chaincode

package
v0.0.0-...-d3bc97f Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SmartContract

type SmartContract struct {
	contractapi.Contract
}

SmartContract provides functions for transferring tokens between accounts

func (*SmartContract) Allowance

func (s *SmartContract) Allowance(ctx contractapi.TransactionContextInterface, owner string, spender string) (int, error)

Allowance returns the amount still available for the spender to withdraw from the owner.

func (*SmartContract) Approve

func (s *SmartContract) Approve(ctx contractapi.TransactionContextInterface, spender string, value int) error

Approve allows the spender to withdraw from the calling client's token account. The spender can withdraw multiple times if necessary, up to the value amount.

func (*SmartContract) BalanceOf

func (s *SmartContract) BalanceOf(ctx contractapi.TransactionContextInterface, account string) (int, error)

BalanceOf returns the balance of the given account

func (*SmartContract) ClientAccountBalance

func (s *SmartContract) ClientAccountBalance(ctx contractapi.TransactionContextInterface) (int, error)

ClientAccountBalance returns the balance of the requesting client's account

func (*SmartContract) ClientAccountID

ClientAccountID returns the id of the requesting client's account. In this implementation, the client account ID is the clientId itself. Users can use this function to get their own account id, which they can then give to others as the payment address

func (*SmartContract) Mint

Mint creates new tokens and adds them to minter's account balance

func (*SmartContract) TotalSupply

TotalSupply returns the total token supply

func (*SmartContract) Transfer

func (s *SmartContract) Transfer(ctx contractapi.TransactionContextInterface, recipient string, amount int) error

Transfer transfers tokens from client account to recipient account. recipient account must be a valid clientID as returned by the ClientID() function.

func (*SmartContract) TransferFrom

func (s *SmartContract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, value int) error

TransferFrom transfers the value amount from the "from" address to the "to" address. This function triggers a Transfer event.

Jump to

Keyboard shortcuts

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