Banker
View concept page here.
type BankerType uint8
const (
BankerTypeReadonly BankerType = iota
BankerTypeOrigSend
BankerTypeRealmSend
BankerTypeRealmIssue
)
type Banker interface {
GetCoins(addr Address) (dst Coins)
SendCoins(from, to Address, coins Coins)
IssueCoin(addr Address, denom string, amount int64)
RemoveCoin(addr Address, denom string, amount int64)
}
GetBanker
Returns Banker of the specified type.
Parameters
BankerType- type of Banker to get:BankerTypeReadonly- read-only access to coin balancesBankerTypeOrigSend- full access to coins sent with the transaction that calls the bankerBankerTypeRealmSend- full access to coins that the realm itself owns, including the ones sent with the transactionBankerTypeRealmIssue- able to issue new coins
Usage
banker := std.GetBanker(std.<BankerType>)
GetCoins
Returns Coins owned by Address.
Parameters
addrAddress to fetch balances for
Usage
coins := banker.GetCoins(addr)
SendCoins
Sends coins from address from to address to. coins needs to be a well-defined
Coins slice.
Parameters
fromAddress to send fromtoAddress to send tocoinsCoins to send
Usage
banker.SendCoins(from, to, coins)
IssueCoin
Issues amount of coin with a denomination denom to address addr.
Parameters
addrAddress to issue coins todenomstring denomination of coin to issueamountint64 amount of coin to issue
Usage
banker.IssueCoin(addr, denom, amount)
RemoveCoin
Removes (burns) amount of coin with a denomination denom from address addr.
Parameters
addrAddress to remove coins fromdenomstring denomination of coin to removeamountint64 amount of coin to remove
Usage
banker.RemoveCoin(addr, denom, amount)