2019-02-25 22:44:14 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import "github.com/CityOfZion/neo-go/pkg/wire/util"
|
|
|
|
|
2019-03-17 18:26:35 +00:00
|
|
|
// Output represents a transaction output in the neo-network
|
2019-02-25 22:44:14 +00:00
|
|
|
type Output struct {
|
|
|
|
// The NEO asset id used in the transaction.
|
|
|
|
AssetID util.Uint256
|
|
|
|
|
|
|
|
// Amount of AssetType send or received.
|
|
|
|
Amount int64
|
|
|
|
|
|
|
|
// The address of the remittee.
|
|
|
|
ScriptHash util.Uint160
|
|
|
|
}
|
|
|
|
|
2019-03-17 18:26:35 +00:00
|
|
|
//NewOutput returns an output object
|
2019-02-25 22:44:14 +00:00
|
|
|
func NewOutput(assetID util.Uint256, Amount int64, ScriptHash util.Uint160) *Output {
|
|
|
|
return &Output{
|
|
|
|
assetID,
|
|
|
|
Amount,
|
|
|
|
ScriptHash,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-17 18:26:35 +00:00
|
|
|
// Encode encodes the Output into a binary writer
|
2019-02-25 22:44:14 +00:00
|
|
|
func (o *Output) Encode(bw *util.BinWriter) {
|
|
|
|
bw.Write(o.AssetID)
|
|
|
|
bw.Write(o.Amount)
|
|
|
|
bw.Write(o.ScriptHash)
|
|
|
|
}
|
|
|
|
|
2019-03-17 18:26:35 +00:00
|
|
|
// Decode decodes a binary reader into an output object
|
2019-02-25 22:44:14 +00:00
|
|
|
func (o *Output) Decode(br *util.BinReader) {
|
|
|
|
br.Read(&o.AssetID)
|
|
|
|
br.Read(&o.Amount)
|
|
|
|
br.Read(&o.ScriptHash)
|
|
|
|
}
|