4 "github.com/vapor/crypto/sha3pool"
5 "github.com/vapor/protocol/bc"
8 // IssuanceInput satisfies the TypedInput interface and represents a issuance.
9 type IssuanceInput struct {
13 AssetDefinition []byte
15 IssuanceProgram []byte
19 // NewIssuanceInput create a new IssuanceInput struct.
20 func NewIssuanceInput(nonce []byte, amount uint64, issuanceProgram []byte, arguments [][]byte, assetDefinition []byte) *TxInput {
23 TypedInput: &IssuanceInput{
26 AssetDefinition: assetDefinition,
28 IssuanceProgram: issuanceProgram,
34 // InputType is the interface function for return the input type.
35 func (ii *IssuanceInput) InputType() uint8 { return IssuanceInputType }
37 // AssetID calculate the assetID of the issuance input.
38 func (ii *IssuanceInput) AssetID() bc.AssetID {
39 defhash := ii.AssetDefinitionHash()
40 return bc.ComputeAssetID(ii.IssuanceProgram, ii.VMVersion, &defhash)
43 // AssetDefinitionHash return the hash of the issuance asset definition.
44 func (ii *IssuanceInput) AssetDefinitionHash() (defhash bc.Hash) {
45 sha := sha3pool.Get256()
46 defer sha3pool.Put256(sha)
47 sha.Write(ii.AssetDefinition)
52 // NonceHash return the hash of the issuance asset definition.
53 func (ii *IssuanceInput) NonceHash() (hash bc.Hash) {
54 sha := sha3pool.Get256()
55 defer sha3pool.Put256(sha)