aboutsummaryrefslogblamecommitdiffstats
path: root/ethpipe/object.go
blob: f0032992cac8ea4c8c0663b6d36f2d8644b6ca9e (plain) (tree)
1
2
3
4
5
6
7
8






                                             
                    


                             
                                                              






                                                                           
                                                                      


                                         
                                                         

                                                              
package ethpipe

import (
    "github.com/ethereum/eth-go/ethstate"
    "github.com/ethereum/eth-go/ethutil"
)

type Object struct {
    *ethstate.StateObject
}

func (self *Object) StorageString(str string) *ethutil.Value {
    if ethutil.IsHex(str) {
        return self.Storage(ethutil.Hex2Bytes(str[2:]))
    } else {
        return self.Storage(ethutil.RightPadBytes([]byte(str), 32))
    }
}

func (self *Object) StorageValue(addr *ethutil.Value) *ethutil.Value {
    return self.Storage(addr.Bytes())
}

func (self *Object) Storage(addr []byte) *ethutil.Value {
    return self.StateObject.GetStorage(ethutil.BigD(addr))
}