diff options
author | obscuren <geffobscura@gmail.com> | 2014-03-22 01:22:47 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-03-22 01:22:47 +0800 |
commit | 01c1bce9c5dfa2b2bcdf934afec3f206823f895f (patch) | |
tree | 03c6e06ced15c61e2997b3d7d42fa11b2426d7c5 /ethchain/contract.go | |
parent | 9a9e252cabdc6283d7f4e523860f0e4addf62152 (diff) | |
download | go-tangerine-01c1bce9c5dfa2b2bcdf934afec3f206823f895f.tar go-tangerine-01c1bce9c5dfa2b2bcdf934afec3f206823f895f.tar.gz go-tangerine-01c1bce9c5dfa2b2bcdf934afec3f206823f895f.tar.bz2 go-tangerine-01c1bce9c5dfa2b2bcdf934afec3f206823f895f.tar.lz go-tangerine-01c1bce9c5dfa2b2bcdf934afec3f206823f895f.tar.xz go-tangerine-01c1bce9c5dfa2b2bcdf934afec3f206823f895f.tar.zst go-tangerine-01c1bce9c5dfa2b2bcdf934afec3f206823f895f.zip |
Removed regular ints from the virtual machine and closures
Diffstat (limited to 'ethchain/contract.go')
-rw-r--r-- | ethchain/contract.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ethchain/contract.go b/ethchain/contract.go index 93d2b68ba..f7ae01753 100644 --- a/ethchain/contract.go +++ b/ethchain/contract.go @@ -39,12 +39,17 @@ func (c *Contract) State() *State { return c.state } -func (c *Contract) GetMem(num int64) *ethutil.Value { - nb := ethutil.BigToBytes(big.NewInt(num), 256) +func (c *Contract) GetMem(num *big.Int) *ethutil.Value { + nb := ethutil.BigToBytes(num, 256) return c.Addr(nb) } +func (c *Contract) SetMem(num *big.Int, val *ethutil.Value) { + addr := ethutil.BigToBytes(num, 256) + c.state.trie.Update(string(addr), string(val.Encode())) +} + // Return the gas back to the origin. Used by the Virtual machine or Closures func (c *Contract) ReturnGas(val *big.Int, state *State) { c.Amount.Add(c.Amount, val) |