types

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchangeRate

type ExchangeRate struct {
	FromDenom string    `json:"fromDenom"`
	ToDenom   string    `json:"toDenom"`
	Rate      types.Dec `json:"rate"` // FromDenom = ToDenom * Rate
}

ExchangeRate - struct to hold exchange rate

func NewExchangeRate

func NewExchangeRate(
	from string,
	to string,
	rate types.Dec,
) ExchangeRate

NewExchangeRate - new ExchangeRate

func (ExchangeRate) Convert

func (e ExchangeRate) Convert(sellingCoin types.Coin) (buyingCoin types.Coin)

Convert - convert from one coin to another using this exchange rate

func (ExchangeRate) Obtain

func (e ExchangeRate) Obtain(buyingCoin types.Coin) (sellingCoin types.Coin)

func (ExchangeRate) String added in v0.2.2

func (e ExchangeRate) String() string

func (ExchangeRate) UpdateRate

func (e ExchangeRate) UpdateRate(newRate types.Dec) ExchangeRate

UpdateRate - update rate of this exchange rate

type Reserve

type Reserve struct {
	Address sdk.AccAddress
}

func GetAllReserve

func GetAllReserve() []Reserve

---------------------------------------------------------------

func NewReserve

func NewReserve(addr sdk.AccAddress) Reserve

func (Reserve) GetCoins

func (res Reserve) GetCoins(
	ctx sdk.Context,
	bankKeeper bank.Keeper,
) types.Coins

func (Reserve) IsValid

func (res Reserve) IsValid() bool

func (Reserve) SetCoins

func (res Reserve) SetCoins(
	ctx sdk.Context,
	bankKeeper bank.Keeper,
	newCoins types.Coins,
) sdk.Error

func (Reserve) String

func (res Reserve) String() string

Jump to

Keyboard shortcuts

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