Moved address
This commit is contained in:
parent
f5737b929a
commit
a4a4ffbeff
@ -41,34 +41,3 @@ func (c *Contract) SetAddr(addr []byte, value interface{}) {
|
||||
func (c *Contract) State() *ethutil.Trie {
|
||||
return c.state
|
||||
}
|
||||
|
||||
type Address struct {
|
||||
Amount *big.Int
|
||||
Nonce uint64
|
||||
}
|
||||
|
||||
func NewAddress(amount *big.Int) *Address {
|
||||
return &Address{Amount: amount, Nonce: 0}
|
||||
}
|
||||
|
||||
func NewAddressFromData(data []byte) *Address {
|
||||
address := &Address{}
|
||||
address.RlpDecode(data)
|
||||
|
||||
return address
|
||||
}
|
||||
|
||||
func (a *Address) AddFee(fee *big.Int) {
|
||||
a.Amount.Add(a.Amount, fee)
|
||||
}
|
||||
|
||||
func (a *Address) RlpEncode() []byte {
|
||||
return ethutil.Encode([]interface{}{a.Amount, a.Nonce})
|
||||
}
|
||||
|
||||
func (a *Address) RlpDecode(data []byte) {
|
||||
decoder := ethutil.NewValueFromBytes(data)
|
||||
|
||||
a.Amount = decoder.Get(0).BigInt()
|
||||
a.Nonce = decoder.Get(1).Uint()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user