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>)
Banker
methods expect qualified denomination of the coins. Read more here.GetCoins
Returns Coins
owned by Address
.
Parameters
addr
Address 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
from
Address to send fromto
Address to send tocoins
Coins to send
Usage
banker.SendCoins(from, to, coins)
IssueCoin
Issues amount
of coin with a denomination denom
to address addr
.
Parameters
addr
Address to issue coins todenom
string denomination of coin to issueamount
int64 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
addr
Address to remove coins fromdenom
string denomination of coin to removeamount
int64 amount of coin to remove
Usage
banker.RemoveCoin(addr, denom, amount)