github.com/bytom/bytom@v1.1.2-0.20221014091027-bbcba3df6075/protocol/bc/issuance.go (about) 1 package bc 2 3 import "io" 4 5 // Issuance is a source of new value on a blockchain. It satisfies the 6 // Entry interface. 7 8 func (Issuance) typ() string { return "issuance1" } 9 func (iss *Issuance) writeForHash(w io.Writer) { 10 mustWriteForHash(w, iss.NonceHash) 11 mustWriteForHash(w, iss.Value) 12 } 13 14 // SetDestination will link the issuance to the output 15 func (iss *Issuance) SetDestination(id *Hash, val *AssetAmount, pos uint64) { 16 iss.WitnessDestination = &ValueDestination{ 17 Ref: id, 18 Value: val, 19 Position: pos, 20 } 21 } 22 23 // NewIssuance creates a new Issuance. 24 func NewIssuance(nonceHash *Hash, value *AssetAmount, ordinal uint64) *Issuance { 25 return &Issuance{ 26 NonceHash: nonceHash, 27 Value: value, 28 Ordinal: ordinal, 29 } 30 }