mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-27 13:58:05 +00:00
27 lines
591 B
Go
27 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()
|
||
|
}
|