market

package
v0.0.5 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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = "market"

	CodeInsufficientSwap sdk.CodeType = 1
	CodeUnknownDenom     sdk.CodeType = 2
	CodeNoEffectivePrice sdk.CodeType = 3
	CodeRecursiveSwap    sdk.CodeType = 4
)

market errors

View Source
const RouterKey = "market"

RouterKey is they name of the market module

View Source
const StoreKey = "market"

StoreKey is string representation of the store key for market

Variables

This section is empty.

Functions

func ErrInsufficientSwapCoins

func ErrInsufficientSwapCoins(codespace sdk.CodespaceType, rval sdk.Int) sdk.Error

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 ErrUnknownDenomination

func ErrUnknownDenomination(codespace sdk.CodespaceType, denom string) sdk.Error

ErrUnknownDenomination called when the denom is not whitelisted by the oracle

func NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler creates a new handler for all market type messages.

func RegisterCodec added in v0.0.5

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

Types

type Keeper

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

nolint

func NewKeeper

func NewKeeper(ok oracle.Keeper, bk bank.Keeper, dk distribution.Keeper) Keeper

func (Keeper) SwapCoins

func (k Keeper) SwapCoins(ctx sdk.Context, offerCoin sdk.Coin, askDenom string) (sdk.Coin, sdk.Error)

func (Keeper) SwapDecCoins added in v0.0.5

func (k Keeper) SwapDecCoins(ctx sdk.Context, offerCoin sdk.DecCoin, askDenom string) (sdk.DecCoin, sdk.Error)

type SwapHistory added in v0.0.5

type SwapHistory []SwapMsg

func (SwapHistory) String added in v0.0.5

func (swaps SwapHistory) String() (out string)

String implements fmt.Stringer interface

type SwapMsg

type SwapMsg struct {
	Trader    sdk.AccAddress // Address of the trader
	OfferCoin sdk.Coin       // Coin being offered
	AskDenom  string         // Denom of the coin to swap to
}

SwapMsg contains a swap request

func NewSwapMsg

func NewSwapMsg(traderAddress sdk.AccAddress, offerCoin sdk.Coin, askCoin string) SwapMsg

NewSwapMsg creates a SwapMsg instance

func (SwapMsg) GetSignBytes

func (msg SwapMsg) GetSignBytes() []byte

GetSignBytes Implements Msg

func (SwapMsg) GetSigners

func (msg SwapMsg) GetSigners() []sdk.AccAddress

GetSigners Implements Msg

func (SwapMsg) Route

func (msg SwapMsg) Route() string

Route Implements Msg

func (SwapMsg) String

func (msg SwapMsg) String() string

String Implements Msg

func (SwapMsg) Type

func (msg SwapMsg) Type() string

Type implements sdk.Msg

func (SwapMsg) ValidateBasic

func (msg SwapMsg) ValidateBasic() sdk.Error

ValidateBasic Implements Msg

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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