Documentation ¶
Index ¶
- Constants
- func ErrExceedsDailySwapLimit(codespace sdk.CodespaceType, denom string) sdk.Error
- func ErrInsufficientSwapCoins(codespace sdk.CodespaceType, rval sdk.Int) sdk.Error
- func ErrNoEffectivePrice(codespace sdk.CodespaceType, denom string) sdk.Error
- func ErrRecursiveSwap(codespace sdk.CodespaceType, denom string) sdk.Error
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
- func NewHandler(k Keeper) sdk.Handler
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type GenesisState
- type Keeper
- func (k Keeper) GetParams(ctx sdk.Context) Params
- func (k Keeper) SetParams(ctx sdk.Context, params Params)
- func (k Keeper) SwapCoins(ctx sdk.Context, offerCoin sdk.Coin, askDenom string) (sdk.Coin, sdk.Error)
- func (k Keeper) SwapDecCoins(ctx sdk.Context, offerCoin sdk.DecCoin, askDenom string) (sdk.DecCoin, sdk.Error)
- type MsgSwap
- type Params
Constants ¶
const ( // ModuleName is the name of the market module ModuleName = "market" // StoreKey is the string store representation StoreKey = ModuleName // RouterKey is the msg router key for the market module RouterKey = ModuleName // DefaultParamspace is for the paramspace notation DefaultParamspace = ModuleName )
const ( DefaultCodespace sdk.CodespaceType = "market" CodeInsufficientSwap sdk.CodeType = 1 CodeNoEffectivePrice sdk.CodeType = 2 CodeRecursiveSwap sdk.CodeType = 3 CodeExceedsSwapLimit sdk.CodeType = 4 )
market error codes
Variables ¶
This section is empty.
Functions ¶
func ErrExceedsDailySwapLimit ¶ added in v0.1.1
func ErrExceedsDailySwapLimit(codespace sdk.CodespaceType, denom string) sdk.Error
ErrExceedsDailySwapLimit called when the coin swap exceeds the daily swap limit
func ErrInsufficientSwapCoins ¶
ErrInsufficientSwapCoins called when not enough coins are being requested for a swap
func ErrNoEffectivePrice ¶ added in v0.0.5
func ErrNoEffectivePrice(codespace sdk.CodespaceType, denom string) sdk.Error
ErrNoEffectivePrice called when a price for the asset is not registered with the oracle
func ErrRecursiveSwap ¶
func ErrRecursiveSwap(codespace sdk.CodespaceType, denom string) sdk.Error
ErrRecursiveSwap called when Ask and Offer coin denominatioins are equal
func InitGenesis ¶ added in v0.1.1
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
new oracle genesis
func NewHandler ¶
NewHandler creates a new handler for all market type messages.
func RegisterCodec ¶ added in v0.0.5
RegisterCodec concretes types on codec codec
func ValidateGenesis ¶ added in v0.1.1
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the provided oracle genesis state to ensure the expected invariants holds. (i.e. params in correct bounds, no duplicate validators)
Types ¶
type GenesisState ¶ added in v0.1.1
type GenesisState struct {
Params Params `json:"params"` // market params
}
GenesisState - all distribution state that must be provided at genesis
func DefaultGenesisState ¶ added in v0.1.1
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func ExportGenesis ¶ added in v0.1.1
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
ExportGenesis returns a GenesisState for a given context and keeper. The GenesisState will contain the pool, and validator/delegator distribution info's
func NewGenesisState ¶ added in v0.1.1
func NewGenesisState(params Params) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper holds data structures for the market module
func (Keeper) SwapCoins ¶
func (k Keeper) SwapCoins(ctx sdk.Context, offerCoin sdk.Coin, askDenom string) (sdk.Coin, sdk.Error)
SwapCoins returns the amount of asked coins should be returned for a given offerCoin at the effective exchange rate registered with the oracle. Returns an Error if the swap is recursive, or the coins to be traded are unknown by the oracle, or the amount to trade is too small.
func (Keeper) SwapDecCoins ¶ added in v0.0.5
func (k Keeper) SwapDecCoins(ctx sdk.Context, offerCoin sdk.DecCoin, askDenom string) (sdk.DecCoin, sdk.Error)
SwapDecCoins returns the amount of asked DecCoins should be returned for a given offerCoin at the effective exchange rate registered with the oracle. Similar to SwapCoins, but operates over sdk.DecCoins for convinience and accuracy.
type MsgSwap ¶ added in v0.0.7
type MsgSwap struct { Trader sdk.AccAddress `json:"trader"` // Address of the trader OfferCoin sdk.Coin `json:"offer_coin"` // Coin being offered AskDenom string `json:"ask_denom"` // Denom of the coin to swap to }
MsgSwap contains a swap request
func NewMsgSwap ¶ added in v0.0.7
NewMsgSwap creates a MsgSwap instance
func (MsgSwap) GetSignBytes ¶ added in v0.0.7
GetSignBytes Implements Msg
func (MsgSwap) GetSigners ¶ added in v0.0.7
func (msg MsgSwap) GetSigners() []sdk.AccAddress
GetSigners Implements Msg
func (MsgSwap) ValidateBasic ¶ added in v0.0.7
ValidateBasic Implements Msg
type Params ¶ added in v0.1.1
type Params struct {
DailySwapLimit sdk.Dec `json:"daily_swap_limit"` // daily % inflation cap on a currency from swaps
}
Params market parameters
func DefaultParams ¶ added in v0.1.1
func DefaultParams() Params
DefaultParams creates default market module parameters