neo-go/pkg/core/state/deposit.go
2020-11-25 18:37:29 +03:00

26 lines
591 B
Go

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()
}