OSDN Git Service

update master (#487)
[bytom/bytom-spv.git] / protocol / bc / issuance.go
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 // (Not to be confused with the deprecated type IssuanceInput.)
9
10 func (Issuance) typ() string { return "issuance1" }
11 func (iss *Issuance) writeForHash(w io.Writer) {
12         mustWriteForHash(w, iss.AnchorId)
13         mustWriteForHash(w, iss.Value)
14         mustWriteForHash(w, iss.ExtHash)
15 }
16
17 func (iss *Issuance) SetDestination(id *Hash, val *AssetAmount, pos uint64) {
18         iss.WitnessDestination = &ValueDestination{
19                 Ref:      id,
20                 Value:    val,
21                 Position: pos,
22         }
23 }
24
25 // NewIssuance creates a new Issuance.
26 func NewIssuance(anchorID *Hash, value *AssetAmount, ordinal uint64) *Issuance {
27         return &Issuance{
28                 AnchorId: anchorID,
29                 Value:    value,
30                 Ordinal:  ordinal,
31         }
32 }