chaincode

package
v0.0.0-...-d669a3f Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 6 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 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

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

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

Mint creates new tokens and adds them to minter's account balance This function triggers a Transfer event

func (*SmartContract) Name

func (*SmartContract) Symbol

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 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

Jump to

Keyboard shortcuts

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