Documentation
¶
Index ¶
- type SmartContract
- func (s *SmartContract) Allowance(ctx contractapi.TransactionContextInterface, owner string, spender string) (int, error)
- func (s *SmartContract) Approve(ctx contractapi.TransactionContextInterface, spender string, value int) error
- func (s *SmartContract) BalanceOf(ctx contractapi.TransactionContextInterface, account string) (int, error)
- func (s *SmartContract) Burn(ctx contractapi.TransactionContextInterface, amount int) error
- func (s *SmartContract) ClientAccountBalance(ctx contractapi.TransactionContextInterface) (int, error)
- func (s *SmartContract) ClientAccountID(ctx contractapi.TransactionContextInterface) (string, error)
- func (s *SmartContract) Initialize(ctx contractapi.TransactionContextInterface, name string, symbol string, ...) (bool, error)
- func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount int) error
- func (s *SmartContract) Name(ctx contractapi.TransactionContextInterface) (string, error)
- func (s *SmartContract) Symbol(ctx contractapi.TransactionContextInterface) (string, error)
- func (s *SmartContract) TotalSupply(ctx contractapi.TransactionContextInterface) (int, error)
- func (s *SmartContract) Transfer(ctx contractapi.TransactionContextInterface, recipient string, amount int) error
- func (s *SmartContract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, value int) error
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 This function triggers an Approval event
func (*SmartContract) BalanceOf ¶
func (s *SmartContract) BalanceOf(ctx contractapi.TransactionContextInterface, account string) (int, error)
BalanceOf returns the balance of the given account
func (*SmartContract) Burn ¶
func (s *SmartContract) Burn(ctx contractapi.TransactionContextInterface, amount int) error
Burn redeems tokens the minter's account balance This function triggers a Transfer event
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 ¶
func (s *SmartContract) ClientAccountID(ctx contractapi.TransactionContextInterface) (string, error)
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) Initialize ¶
func (s *SmartContract) Initialize(ctx contractapi.TransactionContextInterface, name string, symbol string, decimals string) (bool, error)
Set information for a token and intialize contract. param {String} name The name of the token param {String} symbol The symbol of the token param {String} decimals The decimals used for the token operations
func (*SmartContract) Mint ¶
func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount int) error
Mint creates new tokens and adds them to minter's account balance This function triggers a Transfer event
func (*SmartContract) Name ¶
func (s *SmartContract) Name(ctx contractapi.TransactionContextInterface) (string, error)
func (*SmartContract) Symbol ¶
func (s *SmartContract) Symbol(ctx contractapi.TransactionContextInterface) (string, error)
func (*SmartContract) TotalSupply ¶
func (s *SmartContract) TotalSupply(ctx contractapi.TransactionContextInterface) (int, error)
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 This function triggers a Transfer event
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