statereg.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package natspec
  2. import (
  3. "github.com/ethereum/go-ethereum/xeth"
  4. )
  5. type StateReg struct {
  6. xeth *xeth.XEth
  7. caURL, caNatSpec string //contract addresses
  8. }
  9. func NewStateReg(_xeth *xeth.XEth) (self *StateReg) {
  10. self.xeth = _xeth
  11. self.testCreateContracts()
  12. return
  13. }
  14. const codeURLhint = "0x33600081905550609c8060136000396000f30060003560e060020a900480632f926732" +
  15. "14601f578063f39ec1f714603157005b602b6004356024356044565b60006000f35b603a" +
  16. "600435607f565b8060005260206000f35b600054600160a060020a031633600160a06002" +
  17. "0a031614606257607b565b8060016000848152602001908152602001600020819055505b" +
  18. "5050565b60006001600083815260200190815260200160002054905091905056"
  19. const codeNatSpec = "0x33600081905550609c8060136000396000f30060003560e060020a900480632f926732" +
  20. "14601f578063f39ec1f714603157005b602b6004356024356044565b60006000f35b603a" +
  21. "600435607f565b8060005260206000f35b600054600160a060020a031633600160a06002" +
  22. "0a031614606257607b565b8060016000848152602001908152602001600020819055505b" +
  23. "5050565b60006001600083815260200190815260200160002054905091905056"
  24. func (self *StateReg) testCreateContracts() {
  25. var err error
  26. self.caURL, err = self.xeth.Transact(self.xeth.Coinbase(), "", "100000", "", self.xeth.DefaultGas().String(), codeURLhint)
  27. if err != nil {
  28. panic(err)
  29. }
  30. self.caNatSpec, err = self.xeth.Transact(self.xeth.Coinbase(), "", "100000", "", self.xeth.DefaultGas().String(), codeNatSpec)
  31. if err != nil {
  32. panic(err)
  33. }
  34. }