standard

package
v0.0.0-...-ff6bfbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2019 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package standard implements standard txvm contracts for Sequence transactions.

Index

Constants

This section is empty.

Variables

View Source
var (

	// PayToMultisigProg1 is the txvm bytecode of the first
	// version of the standard pay-to-multisig contract.
	PayToMultisigProg1 = asm.MustAssemble(payToMultisigProgSrc1)

	// PayToMultisigSeed1 is the seed of the standard pay-to-multisig-program contract.
	PayToMultisigSeed1 = txvm.ContractSeed(PayToMultisigProg1)
)
View Source
var (

	// PayToMultisigProg2 is the txvm bytecode of the standard
	// pay-to-multisig contract.
	PayToMultisigProg2 = asm.MustAssemble(payToMultisigProgSrc2)

	// PayToMultisigSeed2 is the seed of the standard pay-to-multisig-program contract.
	PayToMultisigSeed2 = txvm.ContractSeed(PayToMultisigProg2)
)
View Source
var (
	// RetireContract is the assembled txvm bytecode of the
	// standard retirement contract.
	RetireContract = asm.MustAssemble(retireSrc)

	// RetireContractSeed is the seed of the standard retirement
	// contract.
	RetireContractSeed = txvm.ContractSeed(RetireContract)
)
View Source
var (

	// AssetContractSeed is the seed of the standard asset-issuance contract.
	AssetContractSeed = map[int][32]byte{
		1: txvm.ContractSeed(assetProg[1]),
		2: txvm.ContractSeed(assetProg[2]),
	}
)

Functions

func AssetID

func AssetID(version, quorum int, pubkeys []ed25519.PublicKey, tag []byte) [32]byte

AssetID computes the ID of an asset using the standard asset-issuance contract with the given parameters.

func IssueWithAnchorContract

func IssueWithAnchorContract(version, quorum int, pubkeys []ed25519.PublicKey, tag []byte, amount int64, refdata []byte) []byte

IssueWithAnchorContract produces the txvm bytecode of an issuance contract which invokes the standard asset-issuance contract to issue the requested number of units.

The caller must ensure that a zero-value is on top of the txvm current-contract stack at the point where this code is called. If no such value is available, IssueWithoutAnchor may be used.

func IssueWithoutAnchorContract

func IssueWithoutAnchorContract(version, quorum int, pubkeys []ed25519.PublicKey, tag []byte, amount int64, refdata []byte, blockID []byte, expMS uint64, nonce []byte) []byte

IssueWithoutAnchorContract produces the txvm bytecode of an issuance contract which invokes the standard asset-issuance contract to issue the requested number of units.

It may be used when no value object is on top of the current contract stack. This requires a new nonce for use as an issuance anchor.

When possible, callers should prefer IssueWithAnchor after arranging to place a zero-value on top of the stack.

func Snapshot

func Snapshot(b *txvmutil.Builder,
	quorum int,
	pubkeys []ed25519.PublicKey,
	amount int64,
	assetID bc.Hash,
	anchor []byte,
	seed []byte,
)

Snapshot adds to b the snapshot of a pay-to-multisig-program contract as it appears in the UTXO set.

func SpendMultisig

func SpendMultisig(
	b *txvmutil.Builder,
	quorum int,
	pubkeys []ed25519.PublicKey,
	amount int64,
	assetID bc.Hash,
	anchor []byte,
	seed []byte,
)

SpendMultisig writes txvm bytecode to b, spending a value previously locked with the standard pay-to-multisig-program contract.

func VerifyTxID

func VerifyTxID(txid [32]byte) []byte

VerifyTxID returns a program that verifies the txid matches the given value.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL