keepers

package
v0.0.0-...-962cb54 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryBancorInfo = "bancor-info"
	QueryParameters = "parameters"
	QueryBancors    = "bancor-list"
)

Variables

View Source
var (
	BancorInfoKey    = []byte{0x10}
	BancorInfoKeyEnd = []byte{0x11}
)

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

creates a querier for asset REST endpoints

Types

type BancorInfo

type BancorInfo struct {
	Owner              sdk.AccAddress `json:"sender"`
	Stock              string         `json:"stock"`
	Money              string         `json:"money"`
	InitPrice          sdk.Dec        `json:"init_price"`
	MaxSupply          sdk.Int        `json:"max_supply"`
	StockPrecision     byte           `json:"stock_precision"`
	MaxPrice           sdk.Dec        `json:"max_price"`
	MaxMoney           sdk.Int        `json:"max_money"` // DEX2
	AR                 int64          `json:"ar"`        // DEX2
	Price              sdk.Dec        `json:"price"`
	StockInPool        sdk.Int        `json:"stock_in_pool"`
	MoneyInPool        sdk.Int        `json:"money_in_pool"`
	EarliestCancelTime int64          `json:"earliest_cancel_time"`
}

func (*BancorInfo) GetSymbol

func (bi *BancorInfo) GetSymbol() string

func (*BancorInfo) IsConsistent

func (bi *BancorInfo) IsConsistent() bool

func (*BancorInfo) UpdateStockInPool

func (bi *BancorInfo) UpdateStockInPool(stockInPool sdk.Int) bool

type BancorInfoDisplay

type BancorInfoDisplay struct {
	Owner              string `json:"owner"`
	Stock              string `json:"stock"`
	Money              string `json:"money"`
	InitPrice          string `json:"init_price"`
	MaxSupply          string `json:"max_supply"`
	StockPrecision     string `json:"stock_precision"`
	MaxPrice           string `json:"max_price"`
	MaxMoney           string `json:"max_money"`
	AR                 string `json:"ar"`
	CurrentPrice       string `json:"current_price"`
	StockInPool        string `json:"stock_in_pool"`
	MoneyInPool        string `json:"money_in_pool"`
	EarliestCancelTime int64  `json:"earliest_cancel_time"`
}

func NewBancorInfoDisplay

func NewBancorInfoDisplay(bi *BancorInfo) BancorInfoDisplay

type BancorInfoKeeper

type BancorInfoKeeper struct {
	// contains filtered or unexported fields
}

func NewBancorInfoKeeper

func NewBancorInfoKeeper(key sdk.StoreKey, cdc *codec.Codec, paramSubspace params.Subspace) *BancorInfoKeeper

func (*BancorInfoKeeper) GetParams

func (keeper *BancorInfoKeeper) GetParams(ctx sdk.Context) (param types.Params)

func (*BancorInfoKeeper) Iterate

func (keeper *BancorInfoKeeper) Iterate(ctx sdk.Context, biProc func(bi *BancorInfo))

func (*BancorInfoKeeper) Load

func (keeper *BancorInfoKeeper) Load(ctx sdk.Context, symbol string) *BancorInfo

key: stock/money pair

func (*BancorInfoKeeper) Remove

func (keeper *BancorInfoKeeper) Remove(ctx sdk.Context, bi *BancorInfo)

func (*BancorInfoKeeper) Save

func (keeper *BancorInfoKeeper) Save(ctx sdk.Context, bi *BancorInfo)

func (*BancorInfoKeeper) SetParams

func (keeper *BancorInfoKeeper) SetParams(ctx sdk.Context, params types.Params)

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func (*Keeper) DeductFee

func (keeper *Keeper) DeductFee(ctx sdk.Context, acc sdk.AccAddress, amt sdk.Coins) sdk.Error

func (*Keeper) DeductInt64CetFee

func (keeper *Keeper) DeductInt64CetFee(ctx sdk.Context, addr sdk.AccAddress, amt int64) sdk.Error

func (*Keeper) FreezeCoins

func (keeper *Keeper) FreezeCoins(ctx sdk.Context, acc sdk.AccAddress, amt sdk.Coins) sdk.Error

func (*Keeper) GetAllBancorInfos

func (keeper *Keeper) GetAllBancorInfos(ctx sdk.Context) (list []*BancorInfo)

func (*Keeper) GetMarketFeeMin

func (keeper *Keeper) GetMarketFeeMin(ctx sdk.Context) int64

func (*Keeper) GetMarketVolume

func (keeper *Keeper) GetMarketVolume(ctx sdk.Context, stock, money string, stockVolume, moneyVolume sdk.Dec) sdk.Dec

func (*Keeper) GetParams

func (keeper *Keeper) GetParams(ctx sdk.Context) (param types.Params)

func (*Keeper) GetRebate

func (keeper *Keeper) GetRebate(ctx sdk.Context, address sdk.AccAddress, total sdk.Int) (acc sdk.AccAddress, rebate, balance sdk.Int, exist bool)

func (*Keeper) GetRebateRatio

func (keeper *Keeper) GetRebateRatio(ctx sdk.Context) int64

func (*Keeper) GetRebateRatioBase

func (keeper *Keeper) GetRebateRatioBase(ctx sdk.Context) int64

func (*Keeper) GetRefereeAddr

func (keeper *Keeper) GetRefereeAddr(ctx sdk.Context, accAddr sdk.AccAddress) sdk.AccAddress

func (Keeper) IsBancorExist

func (keeper Keeper) IsBancorExist(ctx sdk.Context, stock string) bool

func (*Keeper) IsForbiddenByTokenIssuer

func (keeper *Keeper) IsForbiddenByTokenIssuer(ctx sdk.Context, denom string, addr sdk.AccAddress) bool

func (*Keeper) IsMarketExist

func (keeper *Keeper) IsMarketExist(ctx sdk.Context, symbol string) bool

func (*Keeper) IsSubscribed

func (keeper *Keeper) IsSubscribed(topic string) bool

func (*Keeper) IsTokenExists

func (keeper *Keeper) IsTokenExists(ctx sdk.Context, denom string) bool

func (*Keeper) IsTokenIssuer

func (keeper *Keeper) IsTokenIssuer(ctx sdk.Context, denom string, addr sdk.AccAddress) bool

func (*Keeper) Iterate

func (keeper *Keeper) Iterate(ctx sdk.Context, biProc func(bi *BancorInfo))

func (*Keeper) Load

func (keeper *Keeper) Load(ctx sdk.Context, symbol string) *BancorInfo

func (*Keeper) Remove

func (keeper *Keeper) Remove(ctx sdk.Context, bi *BancorInfo)

func (*Keeper) Save

func (keeper *Keeper) Save(ctx sdk.Context, bi *BancorInfo)

func (*Keeper) SendCoins

func (keeper *Keeper) SendCoins(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amt sdk.Coins) sdk.Error

func (*Keeper) SetParams

func (keeper *Keeper) SetParams(ctx sdk.Context, params types.Params)

func (*Keeper) UnFreezeCoins

func (keeper *Keeper) UnFreezeCoins(ctx sdk.Context, acc sdk.AccAddress, amt sdk.Coins) sdk.Error

type QueryBancorInfoParam

type QueryBancorInfoParam struct {
	Symbol string `json:"symbol"`
}

Jump to

Keyboard shortcuts

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