Skip to content

Latest commit

 

History

History
100 lines (77 loc) · 2.12 KB

banker.md

File metadata and controls

100 lines (77 loc) · 2.12 KB
id
banker

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 balances
    • BankerTypeOrigSend - full access to coins sent with the transaction that calls the banker
    • BankerTypeRealmSend - full access to coins that the realm itself owns, including the ones sent with the transaction
    • BankerTypeRealmIssue - able to issue new coins

Usage

banker := std.GetBanker(std.<BankerType>)

:::info 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 from
  • to Address to send to
  • coins 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 to
  • denom string denomination of coin to issue
  • amount 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 from
  • denom string denomination of coin to remove
  • amount int64 amount of coin to remove

Usage

banker.RemoveCoin(addr, denom, amount)