keeper

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ParamsStoreKeyExchangeParams = []byte("exchangeparams")

	// TODO: Find another way to implement this without using accounts, or find a cleaner way to implement it using accounts.
	FrozenCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("exchangeFrozenCoins")))
)
View Source
var (
	KeyDelimiter = []byte(":")

	KeyNextOrderId = []byte("newOrderId")
)

Functions

func GetGratestDivisor

func GetGratestDivisor(a sdk.Int, b sdk.Int) sdk.Int

func KeyAddressOrders

func KeyAddressOrders(addr sdk.AccAddress) []byte

Key for getting all orders of a seller from the store

func KeyOrder

func KeyOrder(id uint64) []byte

Key for getting a specific order from the store

func ParamKeyTable

func ParamKeyTable() params.KeyTable

Types

type Keeper

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

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramsKeeper params.Keeper,
	paramSpace params.Subspace, bankKeeper types.BankKeeper, codespace sdk.CodespaceType) Keeper

func (Keeper) AddOrder added in v0.6.0

func (keeper Keeper) AddOrder(ctx sdk.Context, order types.Order)

func (Keeper) Cancel added in v0.6.0

func (keeper Keeper) Cancel(ctx sdk.Context, id uint64, addr sdk.AccAddress) (amt sdk.Coin, err sdk.Error)

func (Keeper) GetAddressOrders

func (keeper Keeper) GetAddressOrders(ctx sdk.Context, addr sdk.AccAddress) (idArr []uint64)

func (Keeper) GetFrozenFundByAddr

func (keeper Keeper) GetFrozenFundByAddr(ctx sdk.Context, addr sdk.AccAddress) (fund sdk.Coins, err sdk.Error)

func (Keeper) GetOrder

func (keeper Keeper) GetOrder(ctx sdk.Context, id uint64) (*types.Order, sdk.Error)

Store level

func (Keeper) GetOrdersByAddr

func (keeper Keeper) GetOrdersByAddr(ctx sdk.Context, addr sdk.AccAddress) (orders types.Orders, err sdk.Error)

func (Keeper) GetOrdersFiltered added in v0.5.0

func (keeper Keeper) GetOrdersFiltered(ctx sdk.Context,
	seller sdk.AccAddress, supplyDenom string, targetDenom string, numLatest uint64) []*types.Order

Get Order from store by OrderId seller will filter orders by creator supplyDenom will filter orders by supply token denom targetDenom will filter orders by target token denom numLatest will fetch a specified number of the most recent orders, or 0 for all orders

func (Keeper) HasOrder

func (keeper Keeper) HasOrder(ctx sdk.Context, id uint64) bool

func (Keeper) Make added in v0.6.0

func (keeper Keeper) Make(ctx sdk.Context, seller sdk.AccAddress,
	supply sdk.Coin, target sdk.Coin) (order *types.Order, err sdk.Error)

func (Keeper) PeekCurrentOrderId

func (keeper Keeper) PeekCurrentOrderId(ctx sdk.Context) (id uint64, err sdk.Error)

Peeks the next available id without incrementing it

func (Keeper) SetAddressOrders added in v0.5.0

func (keeper Keeper) SetAddressOrders(ctx sdk.Context, addr sdk.AccAddress, idArr []uint64)

func (Keeper) SetInitialOrderId

func (keeper Keeper) SetInitialOrderId(ctx sdk.Context, id uint64) sdk.Error

Set the initial order ID

func (Keeper) SetOrder added in v0.5.0

func (keeper Keeper) SetOrder(ctx sdk.Context, order types.Order)

func (Keeper) Take added in v0.6.0

func (keeper Keeper) Take(ctx sdk.Context, id uint64, buyer sdk.AccAddress, val sdk.Coin) (supplyTurnover sdk.Coin,
	targetTurnover sdk.Coin, soldOut bool, err sdk.Error)

Jump to

Keyboard shortcuts

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