neoneo-go/pkg/core/state/deposit.go

27 lines
591 B
Go
Raw Normal View History

2020-11-19 10:00:46 +00:00
package state
import (
"math/big"
"github.com/nspcc-dev/neo-go/pkg/encoding/bigint"
"github.com/nspcc-dev/neo-go/pkg/io"
)
// Deposit represents GAS deposit from Notary contract.
type Deposit struct {
Amount *big.Int
Till uint32
}
// EncodeBinary implements io.Serializable interface.
func (d *Deposit) EncodeBinary(w *io.BinWriter) {
w.WriteVarBytes(bigint.ToBytes(d.Amount))
w.WriteU32LE(d.Till)
}
// DecodeBinary implements io.Serializable interface.
func (d *Deposit) DecodeBinary(r *io.BinReader) {
d.Amount = bigint.FromBytes(r.ReadVarBytes())
d.Till = r.ReadU32LE()
}