MCPcopy Create free account
hub / github.com/chain/txvm / issue

Function issue

protocol/txbuilder/standard/issue.go:129–159  ·  view source on GitHub ↗
(withAnchor bool, version, quorum int, pubkeys []ed25519.PublicKey, tag []byte, amount int64, refdata []byte, blockID []byte, expMS uint64, nonce []byte)

Source from the content-addressed store, hash-verified

127}
128
129func issue(withAnchor bool, version, quorum int, pubkeys []ed25519.PublicKey, tag []byte, amount int64, refdata []byte, blockID []byte, expMS uint64, nonce []byte) []byte {
130 var b txvmutil.Builder
131 if withAnchor {
132 b.Op(op.Get) // get
133 }
134 b.PushdataBytes(refdata).Op(op.Put) // x'<refdata>' put
135 b.Tuple(func(tup *txvmutil.TupleBuilder) { // {pk_0,...,pk_n} put
136 for _, pk := range pubkeys {
137 tup.PushdataBytes(pk)
138 }
139 })
140 b.Op(op.Put)
141 b.PushdataInt64(int64(quorum)).Op(op.Put) // <quorum> put
142 b.PushdataBytes(tag).Op(op.Put) // <tag> put
143 b.PushdataInt64(amount).Op(op.Put) // <amount> put
144 switch {
145 case withAnchor:
146 b.Op(op.Put) // put
147 b.PushdataInt64(0).Op(op.Put) // 0 put
148 case version == 1:
149 b.PushdataBytes(blockID).Op(op.Put) // <blockID> put
150 b.PushdataUint64(expMS).Op(op.Put) // <expMS> put
151 case version == 2:
152 b.PushdataBytes(blockID).Op(op.Put) // <blockID> put
153 b.PushdataBytes(nonce).Op(op.Put) // <nonce> put
154 b.PushdataUint64(expMS).Op(op.Put) // <expMS> put
155 }
156 b.PushdataBytes(assetProg[version]) // [<asset program>]
157 b.Op(op.Contract).Op(op.Call) // contract call
158 return b.Build()
159}
160
161// AssetID computes the ID of an asset using the standard
162// asset-issuance contract with the given parameters.

Callers 2

IssueWithAnchorContractFunction · 0.85

Calls 6

OpMethod · 0.95
PushdataBytesMethod · 0.95
TupleMethod · 0.95
PushdataInt64Method · 0.95
PushdataUint64Method · 0.95
BuildMethod · 0.95

Tested by

no test coverage detected