aboutsummaryrefslogtreecommitdiffstats
path: root/vm/address.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-02 17:30:27 +0800
committerobscuren <geffobscura@gmail.com>2015-01-02 17:30:27 +0800
commit0fb1bcd32192b8bf05a328b955a08da4cefe0180 (patch)
tree67460b927eb41b2876e8e6b7eb9dece494dbd088 /vm/address.go
parent8da07e91e40c1d1bb43763b7e959ae92e5770af2 (diff)
parenta4dc12f12c7a06f5e28d5b1e760249875ef7a8c5 (diff)
downloaddexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar
dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.gz
dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.bz2
dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.lz
dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.xz
dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.zst
dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.zip
Merge branch 'poc8' into docbranch
Diffstat (limited to 'vm/address.go')
-rw-r--r--vm/address.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/vm/address.go b/vm/address.go
index be8921a3b..611979c94 100644
--- a/vm/address.go
+++ b/vm/address.go
@@ -11,25 +11,25 @@ type Address interface {
Call(in []byte) []byte
}
-type PrecompiledAddress struct {
+type PrecompiledAccount struct {
Gas func(l int) *big.Int
fn func(in []byte) []byte
}
-func (self PrecompiledAddress) Call(in []byte) []byte {
+func (self PrecompiledAccount) Call(in []byte) []byte {
return self.fn(in)
}
-var Precompiled = map[uint64]*PrecompiledAddress{
- 1: &PrecompiledAddress{func(l int) *big.Int {
+var Precompiled = map[string]*PrecompiledAccount{
+ string(ethutil.LeftPadBytes([]byte{1}, 20)): &PrecompiledAccount{func(l int) *big.Int {
return GasEcrecover
}, ecrecoverFunc},
- 2: &PrecompiledAddress{func(l int) *big.Int {
+ string(ethutil.LeftPadBytes([]byte{2}, 20)): &PrecompiledAccount{func(l int) *big.Int {
n := big.NewInt(int64(l+31)/32 + 1)
n.Mul(n, GasSha256)
return n
}, sha256Func},
- 3: &PrecompiledAddress{func(l int) *big.Int {
+ string(ethutil.LeftPadBytes([]byte{3}, 20)): &PrecompiledAccount{func(l int) *big.Int {
n := big.NewInt(int64(l+31)/32 + 1)
n.Mul(n, GasRipemd)
return n