aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/contract.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-10 00:27:54 +0800
committerobscuren <geffobscura@gmail.com>2014-04-10 00:27:54 +0800
commite09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14 (patch)
tree7b1ce2f5cd83e3a345cf26230afd41e48110e015 /ethchain/contract.go
parent4f2e9c2640eaa962d085db329221bfd6f1a1799e (diff)
downloadgo-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar
go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.gz
go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.bz2
go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.lz
go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.xz
go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.zst
go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.zip
Split code for contracts
Diffstat (limited to 'ethchain/contract.go')
-rw-r--r--ethchain/contract.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/ethchain/contract.go b/ethchain/contract.go
index f68dcf367..113d067a4 100644
--- a/ethchain/contract.go
+++ b/ethchain/contract.go
@@ -9,9 +9,10 @@ type Contract struct {
Amount *big.Int
Nonce uint64
//state *ethutil.Trie
- state *State
- address []byte
- script []byte
+ state *State
+ address []byte
+ script []byte
+ initScript []byte
}
func NewContract(address []byte, Amount *big.Int, root []byte) *Contract {
@@ -88,12 +89,17 @@ func MakeContract(tx *Transaction, state *State) *Contract {
value := tx.Value
contract := NewContract(addr, value, []byte(""))
state.trie.Update(string(addr), string(contract.RlpEncode()))
- for i, val := range tx.Data {
- if len(val) > 0 {
- bytNum := ethutil.BigToBytes(big.NewInt(int64(i)), 256)
- contract.state.trie.Update(string(bytNum), string(ethutil.Encode(val)))
+ contract.script = tx.Data
+ contract.initScript = tx.Init
+
+ /*
+ for i, val := range tx.Data {
+ if len(val) > 0 {
+ bytNum := ethutil.BigToBytes(big.NewInt(int64(i)), 256)
+ contract.state.trie.Update(string(bytNum), string(ethutil.Encode(val)))
+ }
}
- }
+ */
state.trie.Update(string(addr), string(contract.RlpEncode()))
return contract