market

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2018 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

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

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

Oracle errors reserve 1101-1199

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 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 signer of a Msg is not a validator

func NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler creates a new handler for all market type messages.

Types

type Keeper

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

nolint

func NewKeeper

func NewKeeper(
	ok oracle.Keeper,
	tk treasury.Keeper,
	bk bank.Keeper,
) Keeper

NewKeeper crates a new keeper with write and read access

func (Keeper) SwapCoins

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

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 defines the msg of a trader containing terra coin to be swapped with luna coin, or luna coin to be swapped with the terra coin

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