tokens

package
v0.0.0-...-e229939 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PayloadTypeCreateNFTType           = "createNType"
	PayloadTypeMintNFT                 = "createNToken"
	PayloadTypeTransferNFT             = "transNToken"
	PayloadTypeUpdateNFT               = "updateNToken"
	PayloadTypeCreateFungibleTokenType = "createFType"
	PayloadTypeMintFungibleToken       = "createFToken"
	PayloadTypeTransferFungibleToken   = "transFToken"
	PayloadTypeSplitFungibleToken      = "splitFToken"
	PayloadTypeBurnFungibleToken       = "burnFToken"
	PayloadTypeJoinFungibleToken       = "joinFToken"
	PayloadTypeLockToken               = "lockToken"
	PayloadTypeUnlockToken             = "unlockToken"
)
View Source
const (
	UnitIDLength   = UnitPartLength + TypePartLength
	UnitPartLength = 32
	TypePartLength = 1
)
View Source
const DefaultSystemID types.SystemID = 0x00000002

Variables

View Source
var (
	FungibleTokenTypeUnitType    = []byte{0x20}
	FungibleTokenUnitType        = []byte{0x21}
	NonFungibleTokenTypeUnitType = []byte{0x22}
	NonFungibleTokenUnitType     = []byte{0x23}
	FeeCreditRecordUnitType      = []byte{0x2f}
)

Functions

func NewFeeCreditRecordID

func NewFeeCreditRecordID(shardPart []byte, unitPart []byte) types.UnitID

func NewFungibleTokenData

func NewFungibleTokenData(typeID types.UnitID, value, blockNumber, counter, timeout uint64) types.UnitData

func NewFungibleTokenID

func NewFungibleTokenID(shardPart []byte, unitPart []byte) types.UnitID

func NewFungibleTokenTypeData

func NewFungibleTokenTypeData(attr *CreateFungibleTokenTypeAttributes) types.UnitData

func NewFungibleTokenTypeID

func NewFungibleTokenTypeID(shardPart []byte, unitPart []byte) types.UnitID

func NewNonFungibleTokenData

func NewNonFungibleTokenData(typeID types.UnitID, attr *MintNonFungibleTokenAttributes, blockNumber, counter uint64) types.UnitData

func NewNonFungibleTokenID

func NewNonFungibleTokenID(shardPart []byte, unitPart []byte) types.UnitID

func NewNonFungibleTokenTypeID

func NewNonFungibleTokenTypeID(shardPart []byte, unitPart []byte) types.UnitID

func NewRandomFungibleTokenID

func NewRandomFungibleTokenID(shardPart []byte) (types.UnitID, error)

func NewRandomFungibleTokenTypeID

func NewRandomFungibleTokenTypeID(shardPart []byte) (types.UnitID, error)

func NewRandomNonFungibleTokenID

func NewRandomNonFungibleTokenID(shardPart []byte) (types.UnitID, error)

func NewRandomNonFungibleTokenTypeID

func NewRandomNonFungibleTokenTypeID(shardPart []byte) (types.UnitID, error)

func NewUnitData

func NewUnitData(unitID types.UnitID) (types.UnitData, error)

Types

type BurnFungibleTokenAttributes

type BurnFungibleTokenAttributes struct {
	TypeID                       types.UnitID // identifies the type of the token to burn;
	Value                        uint64       // the value to burn
	TargetTokenID                types.UnitID // the target token identifier in join step
	TargetTokenCounter           uint64       // the current counter value of the target token
	Counter                      uint64       // the transaction counter of this token
	InvariantPredicateSignatures [][]byte     // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*BurnFungibleTokenAttributes) SetInvariantPredicateSignatures

func (b *BurnFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*BurnFungibleTokenAttributes) SigBytes

func (b *BurnFungibleTokenAttributes) SigBytes() ([]byte, error)

type CreateFungibleTokenTypeAttributes

type CreateFungibleTokenTypeAttributes struct {
	Symbol                             string       // the symbol (short name) of this token type; note that the symbols are not guaranteed to be unique;
	Name                               string       // the long name of this token type;
	Icon                               *Icon        // the icon of this token type;
	ParentTypeID                       types.UnitID // identifies the parent type that this type derives from; 0 indicates there is no parent type;
	DecimalPlaces                      uint32       // the number of decimal places to display for values of tokens of the new type;
	SubTypeCreationPredicate           []byte       // the predicate clause that controls defining new subtypes of this type;
	TokenCreationPredicate             []byte       // the predicate clause that controls creating new tokens of this type
	InvariantPredicate                 []byte       // the invariant predicate clause that all tokens of this type (and of subtypes of this type) inherit into their bearer predicates;
	SubTypeCreationPredicateSignatures [][]byte     // inputs to satisfy the subtype creation predicates of all parents.
	// contains filtered or unexported fields
}

func (*CreateFungibleTokenTypeAttributes) SetSubTypeCreationPredicateSignatures

func (c *CreateFungibleTokenTypeAttributes) SetSubTypeCreationPredicateSignatures(signatures [][]byte)

func (*CreateFungibleTokenTypeAttributes) SigBytes

func (c *CreateFungibleTokenTypeAttributes) SigBytes() ([]byte, error)

type CreateNonFungibleTokenTypeAttributes

type CreateNonFungibleTokenTypeAttributes struct {
	Symbol                             string       // the symbol (short name) of this token type; note that the symbols are not guaranteed to be unique;
	Name                               string       // the long name of this token type;
	Icon                               *Icon        // the icon of this token type;
	ParentTypeID                       types.UnitID // identifies the parent type that this type derives from; 0 indicates there is no parent type;
	SubTypeCreationPredicate           []byte       // the predicate clause that controls defining new subtypes of this type;
	TokenCreationPredicate             []byte       // the predicate clause that controls creating new tokens of this type
	InvariantPredicate                 []byte       // the invariant predicate clause that all tokens of this type (and of subtypes of this type) inherit into their bearer predicates;
	DataUpdatePredicate                []byte       // the clause that all tokens of this type (and of subtypes of this type) inherit into their data update predicates
	SubTypeCreationPredicateSignatures [][]byte     // inputs to satisfy the subtype creation predicates of all parents.
	// contains filtered or unexported fields
}

func (*CreateNonFungibleTokenTypeAttributes) SetSubTypeCreationPredicateSignatures

func (c *CreateNonFungibleTokenTypeAttributes) SetSubTypeCreationPredicateSignatures(signatures [][]byte)

func (*CreateNonFungibleTokenTypeAttributes) SigBytes

func (c *CreateNonFungibleTokenTypeAttributes) SigBytes() ([]byte, error)

type FungibleTokenData

type FungibleTokenData struct {
	TokenType types.UnitID `json:"tokenType"`         // the type of the token
	Value     uint64       `json:"value,string"`      // the value of the token
	T         uint64       `json:"lastUpdate,string"` // the partition round number of the last transaction with this token
	Counter   uint64       `json:"counter,string"`    // the transaction counter for this token
	T1        uint64       `json:"t1,string"`         // the minimum lifetime of this token
	Locked    uint64       `json:"locked,string"`     // locked status of the bill, non-zero value means locked
	// contains filtered or unexported fields
}

func (*FungibleTokenData) Copy

func (f *FungibleTokenData) Copy() types.UnitData

func (*FungibleTokenData) GetCounter

func (f *FungibleTokenData) GetCounter() uint64

func (*FungibleTokenData) IsLocked

func (f *FungibleTokenData) IsLocked() uint64

func (*FungibleTokenData) SummaryValueInput

func (f *FungibleTokenData) SummaryValueInput() uint64

func (*FungibleTokenData) Write

func (f *FungibleTokenData) Write(hasher hash.Hash) error

type FungibleTokenTypeData

type FungibleTokenTypeData struct {
	Symbol                   string       `json:"symbol"`
	Name                     string       `json:"name"`
	Icon                     *Icon        `json:"icon"`
	ParentTypeId             types.UnitID `json:"parentTypeId"`             // identifies the parent type that this type derives from; 0 indicates there is no parent type;
	DecimalPlaces            uint32       `json:"decimalPlaces"`            // is the number of decimal places to display for values of tokens of this type;
	SubTypeCreationPredicate []byte       `json:"subTypeCreationPredicate"` // the predicate clause that controls defining new subtypes of this type;
	TokenCreationPredicate   []byte       `json:"tokenCreationPredicate"`   // the predicate clause that controls creating new tokens of this type
	InvariantPredicate       []byte       `json:"invariantPredicate"`       // the invariant predicate clause that all tokens of this type (and of subtypes of this type) inherit into their bearer predicates;
	// contains filtered or unexported fields
}

func (*FungibleTokenTypeData) Copy

func (*FungibleTokenTypeData) SummaryValueInput

func (f *FungibleTokenTypeData) SummaryValueInput() uint64

func (*FungibleTokenTypeData) Write

func (f *FungibleTokenTypeData) Write(hasher hash.Hash) error

type Icon

type Icon struct {
	Type string `json:"type"` // the MIME content type identifying an image format;
	Data []byte `json:"data"` // the image in the format specified by type;
	// contains filtered or unexported fields
}

func (*Icon) Copy

func (i *Icon) Copy() *Icon

type JoinFungibleTokenAttributes

type JoinFungibleTokenAttributes struct {
	BurnTransactions             []*types.TransactionRecord // the transactions that burned the source tokens;
	Proofs                       []*types.TxProof           // block proofs for burn transactions
	Counter                      uint64                     // the transaction counter of this token
	InvariantPredicateSignatures [][]byte                   // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*JoinFungibleTokenAttributes) SetInvariantPredicateSignatures

func (j *JoinFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*JoinFungibleTokenAttributes) SigBytes

func (j *JoinFungibleTokenAttributes) SigBytes() ([]byte, error)

type LockTokenAttributes

type LockTokenAttributes struct {
	LockStatus                   uint64   // status of the lock, non-zero value means locked
	Counter                      uint64   // the transaction counter of this token
	InvariantPredicateSignatures [][]byte // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*LockTokenAttributes) SigBytes

func (l *LockTokenAttributes) SigBytes() ([]byte, error)

type MintFungibleTokenAttributes

type MintFungibleTokenAttributes struct {
	Bearer                           []byte   // the initial bearer predicate of the new token
	Value                            uint64   // the value of the new token;
	Nonce                            uint64   // optional nonce
	TokenCreationPredicateSignatures [][]byte // inputs to satisfy the token creation predicates of all parent types.
	// contains filtered or unexported fields
}

func (*MintFungibleTokenAttributes) SetBearer

func (m *MintFungibleTokenAttributes) SetBearer(bearer []byte)

func (*MintFungibleTokenAttributes) SetTokenCreationPredicateSignatures

func (m *MintFungibleTokenAttributes) SetTokenCreationPredicateSignatures(signatures [][]byte)

func (*MintFungibleTokenAttributes) SigBytes

func (m *MintFungibleTokenAttributes) SigBytes() ([]byte, error)

type MintNonFungibleTokenAttributes

type MintNonFungibleTokenAttributes struct {
	Bearer                           []byte   // the initial bearer predicate of the new token
	Name                             string   // the name of the new token
	URI                              string   // the optional URI of an external resource associated with the new token
	Data                             []byte   // the optional data associated with the new token
	DataUpdatePredicate              []byte   // the data update predicate of the new token;
	Nonce                            uint64   // optional nonce
	TokenCreationPredicateSignatures [][]byte // inputs to satisfy the token creation predicates of all parent types.
	// contains filtered or unexported fields
}

func (*MintNonFungibleTokenAttributes) SetBearer

func (m *MintNonFungibleTokenAttributes) SetBearer(bearer []byte)

func (*MintNonFungibleTokenAttributes) SetTokenCreationPredicateSignatures

func (m *MintNonFungibleTokenAttributes) SetTokenCreationPredicateSignatures(signatures [][]byte)

func (*MintNonFungibleTokenAttributes) SigBytes

func (m *MintNonFungibleTokenAttributes) SigBytes() ([]byte, error)

type NonFungibleTokenData

type NonFungibleTokenData struct {
	NftType             types.UnitID `json:"nftType"`
	Name                string       `json:"name"`                // the optional long name of the token
	URI                 string       `json:"uri"`                 // uri is the optional URI of an external resource associated with the token
	Data                []byte       `json:"data"`                // data is the optional data associated with the token.
	DataUpdatePredicate []byte       `json:"dataUpdatePredicate"` // the data update predicate;
	T                   uint64       `json:"lastUpdate,string"`   // the round number of the last transaction with this token;
	Counter             uint64       `json:"counter,string"`      // the transaction counter for this token
	Locked              uint64       `json:"locked,string"`       // locked status of the bill, non-zero value means locked
	// contains filtered or unexported fields
}

func (*NonFungibleTokenData) Copy

func (*NonFungibleTokenData) GetCounter

func (n *NonFungibleTokenData) GetCounter() uint64

func (*NonFungibleTokenData) IsLocked

func (n *NonFungibleTokenData) IsLocked() uint64

func (*NonFungibleTokenData) SummaryValueInput

func (n *NonFungibleTokenData) SummaryValueInput() uint64

func (*NonFungibleTokenData) Write

func (n *NonFungibleTokenData) Write(hasher hash.Hash) error

type NonFungibleTokenTypeData

type NonFungibleTokenTypeData struct {
	Symbol                   string       `json:"symbol"`
	Name                     string       `json:"name"`
	Icon                     *Icon        `json:"icon"`
	ParentTypeId             types.UnitID `json:"parentTypeId"`             // identifies the parent type that this type derives from; 0 indicates there is no parent type;
	SubTypeCreationPredicate []byte       `json:"subTypeCreationPredicate"` // the predicate clause that controls defining new subtypes of this type;
	TokenCreationPredicate   []byte       `json:"tokenCreationPredicate"`   // the predicate clause that controls creating new tokens of this type
	InvariantPredicate       []byte       `json:"invariantPredicate"`       // the invariant predicate clause that all tokens of this type (and of subtypes of this type) inherit into their bearer predicates;
	DataUpdatePredicate      []byte       `json:"dataUpdatePredicate"`      // the clause that all tokens of this type (and of subtypes of this type) inherit into their data update predicates
	// contains filtered or unexported fields
}

func (*NonFungibleTokenTypeData) Copy

func (*NonFungibleTokenTypeData) SummaryValueInput

func (n *NonFungibleTokenTypeData) SummaryValueInput() uint64

func (*NonFungibleTokenTypeData) Write

func (n *NonFungibleTokenTypeData) Write(hasher hash.Hash) error

type SplitFungibleTokenAttributes

type SplitFungibleTokenAttributes struct {
	NewBearer                    []byte       // the bearer predicate of the new token;
	TargetValue                  uint64       // the value of the new token
	Nonce                        []byte       // optional nonce
	Counter                      uint64       // the transaction counter of this token
	TypeID                       types.UnitID // identifies the type of the token;
	RemainingValue               uint64       // new value of the source token
	InvariantPredicateSignatures [][]byte     // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*SplitFungibleTokenAttributes) SetInvariantPredicateSignatures

func (s *SplitFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*SplitFungibleTokenAttributes) SigBytes

func (s *SplitFungibleTokenAttributes) SigBytes() ([]byte, error)

type TransferFungibleTokenAttributes

type TransferFungibleTokenAttributes struct {
	NewBearer                    []byte       // the initial bearer predicate of the new token
	Value                        uint64       // the value to transfer
	Nonce                        []byte       // optional nonce
	Counter                      uint64       // the transaction counter of this token
	TypeID                       types.UnitID // identifies the type of the token;
	InvariantPredicateSignatures [][]byte     // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*TransferFungibleTokenAttributes) SetInvariantPredicateSignatures

func (t *TransferFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*TransferFungibleTokenAttributes) SigBytes

func (t *TransferFungibleTokenAttributes) SigBytes() ([]byte, error)

type TransferNonFungibleTokenAttributes

type TransferNonFungibleTokenAttributes struct {
	NewBearer                    []byte       // the new bearer predicate of the token
	Nonce                        []byte       // optional nonce
	Counter                      uint64       // the transaction counter of this token
	NFTTypeID                    types.UnitID // identifies the type of the token;
	InvariantPredicateSignatures [][]byte     // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*TransferNonFungibleTokenAttributes) SetInvariantPredicateSignatures

func (t *TransferNonFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*TransferNonFungibleTokenAttributes) SigBytes

func (t *TransferNonFungibleTokenAttributes) SigBytes() ([]byte, error)

type UnlockTokenAttributes

type UnlockTokenAttributes struct {
	Counter                      uint64   // the transaction counter of this token
	InvariantPredicateSignatures [][]byte // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*UnlockTokenAttributes) SigBytes

func (l *UnlockTokenAttributes) SigBytes() ([]byte, error)

type UpdateNonFungibleTokenAttributes

type UpdateNonFungibleTokenAttributes struct {
	Data                 []byte   // the new data to replace the data currently associated with the token
	Counter              uint64   // the transaction counter of this token
	DataUpdateSignatures [][]byte // inputs to satisfy the token data update predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*UpdateNonFungibleTokenAttributes) SetDataUpdateSignatures

func (u *UpdateNonFungibleTokenAttributes) SetDataUpdateSignatures(signatures [][]byte)

func (*UpdateNonFungibleTokenAttributes) SigBytes

func (u *UpdateNonFungibleTokenAttributes) SigBytes() ([]byte, error)

Jump to

Keyboard shortcuts

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