aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/contract.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/contract.go')
-rw-r--r--ethchain/contract.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/ethchain/contract.go b/ethchain/contract.go
index f7ae01753..f68dcf367 100644
--- a/ethchain/contract.go
+++ b/ethchain/contract.go
@@ -11,6 +11,7 @@ type Contract struct {
//state *ethutil.Trie
state *State
address []byte
+ script []byte
}
func NewContract(address []byte, Amount *big.Int, root []byte) *Contract {
@@ -45,6 +46,14 @@ func (c *Contract) GetMem(num *big.Int) *ethutil.Value {
return c.Addr(nb)
}
+func (c *Contract) GetInstr(pc *big.Int) *ethutil.Value {
+ if int64(len(c.script)-1) < pc.Int64() {
+ return ethutil.NewValue(0)
+ }
+
+ return ethutil.NewValueFromBytes([]byte{c.script[pc.Int64()]})
+}
+
func (c *Contract) SetMem(num *big.Int, val *ethutil.Value) {
addr := ethutil.BigToBytes(num, 256)
c.state.trie.Update(string(addr), string(val.Encode()))