Documentation ¶
Index ¶
- Constants
- func GetTokenOwnerString(owner *token.TokenOwner) (string, error)
- type BigQuantity
- type Issuer
- type Manager
- type MemoryLedger
- func (p *MemoryLedger) DeleteState(namespace string, key string) error
- func (p *MemoryLedger) Done()
- func (p *MemoryLedger) GetState(namespace string, key string) ([]byte, error)
- func (p *MemoryLedger) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (ledger.ResultsIterator, error)
- func (p *MemoryLedger) SetState(namespace string, key string, value []byte) error
- type Quantity
- type Transactor
- func (t *Transactor) Done()
- func (t *Transactor) ListTokens() (*token.UnspentTokens, error)
- func (t *Transactor) RequestRedeem(request *token.RedeemRequest) (*token.TokenTransaction, error)
- func (t *Transactor) RequestTokenOperation(tokenIDs []*token.TokenId, op *token.TokenOperation) (*token.TokenTransaction, int, error)
- func (t *Transactor) RequestTransfer(request *token.TransferRequest) (*token.TokenTransaction, error)
- type Verifier
Constants ¶
const (
Precision uint64 = 64
)
Variables ¶
This section is empty.
Functions ¶
func GetTokenOwnerString ¶
func GetTokenOwnerString(owner *token.TokenOwner) (string, error)
GetTokenOwnerString returns a hex encoded string of the token owner. The owner is hashed to reduce the length.
Types ¶
type BigQuantity ¶
func (*BigQuantity) Decimal ¶
func (q *BigQuantity) Decimal() string
func (*BigQuantity) Hex ¶
func (q *BigQuantity) Hex() string
type Issuer ¶
type Issuer struct {
TokenOwnerValidator identity.TokenOwnerValidator
}
An Issuer that can import new tokens
func (*Issuer) RequestIssue ¶
RequestIssue creates an issue request with the token owners, types, and quantities specified in tokensToIssue.
func (*Issuer) RequestTokenOperation ¶
func (i *Issuer) RequestTokenOperation(request *token.TokenOperation) (*token.TokenTransaction, error)
RequestTokenOperation returns a token transaction matching the requested issue operation
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is used to access TMS components.
func (*Manager) GetTxProcessor ¶
func (m *Manager) GetTxProcessor(channel string) (transaction.TMSTxProcessor, error)
GetTxProcessor returns a TMSTxProcessor that is used to process token transactions.
func (*Manager) SetPolicyValidator ¶
func (m *Manager) SetPolicyValidator(channel string, validator identity.IssuingValidator)
SetPolicyValidator sets the policy validator for the specified channel
type MemoryLedger ¶
type MemoryLedger struct {
// contains filtered or unexported fields
}
A MemoryLedger is an in-memory ledger of transactions and unspent outputs. This implementation is only meant for testing.
func NewMemoryLedger ¶
func NewMemoryLedger() *MemoryLedger
NewMemoryLedger creates a new MemoryLedger
func (*MemoryLedger) DeleteState ¶
func (p *MemoryLedger) DeleteState(namespace string, key string) error
DeleteState deletes the given namespace and key
func (*MemoryLedger) Done ¶
func (p *MemoryLedger) Done()
Done releases resources occupied by the MemoryLedger
func (*MemoryLedger) GetState ¶
func (p *MemoryLedger) GetState(namespace string, key string) ([]byte, error)
GetState gets the value for given namespace and Key. For a chaincode, the namespace corresponds to the chaincodeID
func (*MemoryLedger) GetStateRangeScanIterator ¶
func (p *MemoryLedger) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (ledger.ResultsIterator, error)
GetStateRangeScanIterator gets the values for a given namespace that lie in an interval determined by startKey and endKey. this is a mock function.
type Quantity ¶
type Quantity interface { // Add returns this + b without modify this. // If an overflow occurs, it returns an error. Add(b Quantity) (Quantity, error) // Add returns this - b without modify this. // If an overflow occurs, it returns an error. Sub(b Quantity) (Quantity, error) // Cmd compare this with b Cmp(b Quantity) (int, error) // Hex returns the hexadecimal representation of this quantity Hex() string // Decimal returns the decimal representation of this quantity Decimal() string }
Quantity models a token quantity and its basic operations.
func NewZeroQuantity ¶
NewZeroQuantity returns to zero quantity at the passed precision/ The precision is expressed in bits.
type Transactor ¶
type Transactor struct { PublicCredential []byte Ledger ledger.LedgerReader TokenOwnerValidator identity.TokenOwnerValidator }
A Transactor that can transfer tokens.
func (*Transactor) Done ¶
func (t *Transactor) Done()
Done releases any resources held by this transactor
func (*Transactor) ListTokens ¶
func (t *Transactor) ListTokens() (*token.UnspentTokens, error)
ListTokens queries the ledger and returns the unspent tokens owned by the user. It does not allow to query unspent tokens owned by other users.
func (*Transactor) RequestRedeem ¶
func (t *Transactor) RequestRedeem(request *token.RedeemRequest) (*token.TokenTransaction, error)
RequestRedeem creates a TokenTransaction of type redeem request
func (*Transactor) RequestTokenOperation ¶
func (t *Transactor) RequestTokenOperation(tokenIDs []*token.TokenId, op *token.TokenOperation) (*token.TokenTransaction, int, error)
/ RequestTokenOperation returns a token transaction matching the requested transfer operation
func (*Transactor) RequestTransfer ¶
func (t *Transactor) RequestTransfer(request *token.TransferRequest) (*token.TokenTransaction, error)
RequestTransfer creates a TokenTransaction of type transfer request
type Verifier ¶
type Verifier struct { IssuingValidator identity.IssuingValidator TokenOwnerValidator identity.TokenOwnerValidator }
A Verifier validates and commits token transactions.
func (*Verifier) ProcessTx ¶
func (v *Verifier) ProcessTx(txID string, creator identity.PublicInfo, ttx *token.TokenTransaction, simulator ledger.LedgerWriter) error
ProcessTx checks that transactions are correct wrt. the most recent ledger state. ProcessTx checks are ones that shall be done sequentially, since transactions within a block may introduce dependencies.