types

package
v0.0.0-...-00bf0a9 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PowerFunction     = "power_function"
	SigmoidFunction   = "sigmoid_function"
	SwapperFunction   = "swapper_function"
	AugmentedFunction = "augmented_function"

	HatchState  = "HATCH"
	OpenState   = "OPEN"
	SettleState = "SETTLE"

	DoNotModifyField = "[do-not-modify]"

	AnyNumberOfReserveTokens = -1
)
View Source
const (
	EventTypeCreateWar          = "create_war"
	EventTypeEditWar            = "edit_war"
	EventTypeInitSwapper        = "init_swapper"
	EventTypeBuy                = "buy"
	EventTypeSell               = "sell"
	EventTypeSwap               = "swap"
	EventTypeMakeOutcomePayment = "make_outcome_payment"
	EventTypeWithdrawShare      = "withdraw_share"
	EventTypeOrderCancel        = "order_cancel"
	EventTypeOrderFulfill       = "order_fulfill"
	EventTypeStateChange        = "state_change"

	AttributeKeyWar                    = "war"
	AttributeKeyName                   = "name"
	AttributeKeyDescription            = "description"
	AttributeKeyFunctionType           = "function_type"
	AttributeKeyFunctionParameters     = "function_parameters"
	AttributeKeyReserveTokens          = "reserve_tokens"
	AttributeKeyTxFeePercentage        = "tx_fee_percentage"
	AttributeKeyExitFeePercentage      = "exit_fee_percentage"
	AttributeKeyFeeAddress             = "fee_address"
	AttributeKeyMaxSupply              = "max_supply"
	AttributeKeyOrderQuantityLimits    = "order_quantity_limits"
	AttributeKeySanityRate             = "sanity_rate"
	AttributeKeySanityMarginPercentage = "sanity_margin_percentage"
	AttributeKeyAllowSells             = "allow_sells"
	AttributeKeySigners                = "signers"
	AttributeKeyBatchBlocks            = "batch_blocks"
	AttributeKeyOutcomePayment         = "outcome_payment"
	AttributeKeyState                  = "state"
	AttributeKeyMaxPrices              = "max_prices"
	AttributeKeySwapFromToken          = "from_token"
	AttributeKeySwapToToken            = "to_token"
	AttributeKeyOrderType              = "order_type"
	AttributeKeyAddress                = "address"
	AttributeKeyCancelReason           = "cancel_reason"
	AttributeKeyTokensMinted           = "tokens_minted"
	AttributeKeyTokensBurned           = "tokens_burned"
	AttributeKeyTokensSwapped          = "tokens_swapped"
	AttributeKeyChargedPrices          = "charged_prices"
	AttributeKeyChargedPricesReserve   = "charged_prices_of_which_reserve"
	AttributeKeyChargedPricesFunding   = "charged_prices_of_which_funding"
	AttributeKeyChargedFees            = "charged_fees"
	AttributeKeyReturnedToAddress      = "returned_to_address"
	AttributeKeyNewWarTokenBalance     = "new_war_token_balance"
	AttributeKeyOldState               = "old_state"
	AttributeKeyNewState               = "new_state"

	AttributeValueBuyOrder  = "buy"
	AttributeValueSellOrder = "sell"
	AttributeValueSwapOrder = "swap"
	AttributeValueCategory  = ModuleName
)
View Source
const (
	// ModuleName is the name of this module
	ModuleName = "wars"

	// StoreKey is the default store key for this module
	StoreKey = ModuleName

	// DefaultParamspace is the default param space for this module
	DefaultParamspace = ModuleName

	// WarsMintBurnAccount the root string for the wars mint burn account address
	WarsMintBurnAccount = "wars_mint_burn_account"

	// BatchesIntermediaryAccount the root string for the batches account address
	BatchesIntermediaryAccount = "batches_intermediary_account"

	// WarsReserveAccount the root string for the wars reserve account address
	WarsReserveAccount = "wars_reserve_account"

	// QuerierRoute is the querier route for this module's store.
	QuerierRoute = ModuleName

	// RouterKey is the message route for this module
	RouterKey = ModuleName
)
View Source
const (
	TypeMsgCreateWar          = "create_war"
	TypeMsgEditWar            = "edit_war"
	TypeMsgBuy                = "buy"
	TypeMsgSell               = "sell"
	TypeMsgSwap               = "swap"
	TypeMsgMakeOutcomePayment = "make_outcome_payment"
	TypeMsgWithdrawShare      = "withdraw_share"
)
View Source
const (
	DefaultCodespace = ModuleName
)

Variables

View Source
var (
	RequiredParamsForFunctionType = map[string][]string{
		PowerFunction:     {"m", "n", "c"},
		SigmoidFunction:   {"a", "b", "c"},
		SwapperFunction:   nil,
		AugmentedFunction: {"d0", "p0", "theta", "kappa"},
	}

	NoOfReserveTokensForFunctionType = map[string]int{
		PowerFunction:     AnyNumberOfReserveTokens,
		SigmoidFunction:   AnyNumberOfReserveTokens,
		SwapperFunction:   2,
		AugmentedFunction: AnyNumberOfReserveTokens,
	}

	ExtraParameterRestrictions = map[string]FunctionParamRestrictions{
		PowerFunction:     powerParameterRestrictions,
		SigmoidFunction:   sigmoidParameterRestrictions,
		SwapperFunction:   nil,
		AugmentedFunction: augmentedParameterRestrictions,
	}
)
View Source
var (
	ErrArgumentMustBePositive               = sdkerrors.Register(ModuleName, 301, "argument must be a positive value")
	ErrArgumentMustBeInteger                = sdkerrors.Register(ModuleName, 302, "argument must be an integer value")
	ErrArgumentMustBeBetween                = sdkerrors.Register(ModuleName, 303, "argument must be between")
	ErrArgumentCannotBeEmpty                = sdkerrors.Register(ModuleName, 304, "argument cannot be empty")
	ErrArgumentCannotBeNegative             = sdkerrors.Register(ModuleName, 305, "argument cannot be negative")
	ErrArgumentMissingOrNonFloat            = sdkerrors.Register(ModuleName, 306, "argument is missing or is not a float")
	ErrWarDoesNotExist                      = sdkerrors.Register(ModuleName, 307, "war does not exist")
	ErrWarAlreadyExists                     = sdkerrors.Register(ModuleName, 308, "war already exists")
	ErrWarTokenCannotBeStakingToken         = sdkerrors.Register(ModuleName, 309, "war token cannot be staking token")
	ErrInvalidStateForAction                = sdkerrors.Register(ModuleName, 310, "cannot perform that action at the current state")
	ErrReserveDenomsMismatch                = sdkerrors.Register(ModuleName, 311, "denom do not match reserve")
	ErrOrderQuantityLimitExceeded           = sdkerrors.Register(ModuleName, 312, "order quantity limits exceeded")
	ErrValuesViolateSanityRate              = sdkerrors.Register(ModuleName, 313, "values violate sanity rate")
	ErrWarDoesNotAllowSelling               = sdkerrors.Register(ModuleName, 314, "war does not allow selling at the moment")
	ErrFunctionNotAvailableForFunctionType  = sdkerrors.Register(ModuleName, 315, "function is not available for the function type")
	ErrCannotMakeZeroOutcomePayment         = sdkerrors.Register(ModuleName, 316, "cannot make outcome payment because outcome payment is set to nil")
	ErrNoWarTokensOwned                     = sdkerrors.Register(ModuleName, 317, "no war tokens of this war are owned")
	ErrCannotBurnMoreThanSupply             = sdkerrors.Register(ModuleName, 318, "cannot burn more tokens than the current supply")
	ErrFeesCannotBeOrExceed100Percent       = sdkerrors.Register(ModuleName, 319, "sum of fees is or exceeds 100 percent")
	ErrFromAndToCannotBeTheSameToken        = sdkerrors.Register(ModuleName, 320, "from and to tokens cannot be the same token")
	ErrCannotMintMoreThanMaxSupply          = sdkerrors.Register(ModuleName, 321, "cannot mint more tokens than the max supply")
	ErrMaxPriceExceeded                     = sdkerrors.Register(ModuleName, 322, "max price exceeded")
	ErrInsufficientReserveToBuy             = sdkerrors.Register(ModuleName, 323, "insufficient reserve was supplied to perform buy order")
	ErrIncorrectNumberOfFunctionParameters  = sdkerrors.Register(ModuleName, 324, "incorrect number of function parameters")
	ErrFunctionParameterMissingOrNonFloat   = sdkerrors.Register(ModuleName, 325, "parameter is missing or is not a float")
	ErrFunctionRequiresNonZeroCurrentSupply = sdkerrors.Register(ModuleName, 326, "function requires the current supply to be non zero")
	ErrTokenIsNotAValidReserveToken         = sdkerrors.Register(ModuleName, 327, "token is not a valid reserve token")
	ErrSwapAmountTooSmallToGiveAnyReturn    = sdkerrors.Register(ModuleName, 328, "swap amount too small to give any return")
	ErrSwapAmountCausesReserveDepletion     = sdkerrors.Register(ModuleName, 329, "swap amount too large and causes reserve to be depleted")
	ErrInvalidCoinDenomination              = sdkerrors.Register(ModuleName, 330, "invalid coin denomination")
	ErrMaxSupplyDenomDoesNotMatchTokenDenom = sdkerrors.Register(ModuleName, 331, "max supply denom does not match token denom")
	ErrDidNotEditAnything                   = sdkerrors.Register(ModuleName, 332, "did not edit anything from the war")
	ErrWarTokenCannotAlsoBeReserveToken     = sdkerrors.Register(ModuleName, 333, "token cannot also be a reserve token")
	ErrDuplicateReserveToken                = sdkerrors.Register(ModuleName, 334, "cannot have duplicate tokens in reserve tokens")
	ErrUnrecognizedFunctionType             = sdkerrors.Register(ModuleName, 335, "unrecognized function type")
	ErrIncorrectNumberOfReserveTokens       = sdkerrors.Register(ModuleName, 336, "incorrect number of reserve tokens")
	ErrInvalidFunctionParameter             = sdkerrors.Register(ModuleName, 337, "invalid function parameter")
	ErrArgumentMissingOrNonUInteger         = sdkerrors.Register(ModuleName, 338, "argument is missing or is not an unsigned integer")
	ErrArgumentMissingOrNonBoolean          = sdkerrors.Register(ModuleName, 339, "argument is missing or is not true or false")
	ErrReservedWarToken                     = sdkerrors.Register(ModuleName, 340, "war token is reserved")
)
View Source
var (
	WarsKeyPrefix        = []byte{0x00} // key for wars
	BatchesKeyPrefix     = []byte{0x01} // key for batches
	LastBatchesKeyPrefix = []byte{0x02} // key for last batches
)

Wars and batches are stored as follow:

- Wars: 0x00<war_token_bytes> - Batches: 0x01<war_token_bytes> - Last batches: 0x02<war_token_bytes>

View Source
var (
	KeyReservedWarTokens = []byte("ReservedWarTokens")
)

Parameter store keys

View Source
var ModuleCdc *codec.Codec

ModuleCdc is the codec for the module

Functions

func AccAddressesToString

func AccAddressesToString(addresses []sdk.AccAddress) (result string)

func AdjustFees

func AdjustFees(fees sdk.Coins, maxFees sdk.Coins) sdk.Coins

func CheckCoinDenom

func CheckCoinDenom(denom string) (err error)

func CheckNoOfReserveTokens

func CheckNoOfReserveTokens(resTokens []string, fnType string) error

func CheckReserveTokenNames

func CheckReserveTokenNames(resTokens []string, token string) error

func DivideDecCoinByDec

func DivideDecCoinByDec(dc sdk.DecCoin, scale sdk.Dec) sdk.DecCoin

func DivideDecCoinsByDec

func DivideDecCoinsByDec(dcs sdk.DecCoins, scale sdk.Dec) (scaled sdk.DecCoins)

noinspection GoNilness

func GetBatchKey

func GetBatchKey(token string) []byte

func GetLastBatchKey

func GetLastBatchKey(token string) []byte

func GetRequiredParamsForFunctionType

func GetRequiredParamsForFunctionType(fnType string) (fnParams []string, err error)

func GetWarKey

func GetWarKey(token string) []byte

func Invariant

func Invariant(R, S sdk.Dec, kappa int64) sdk.Dec

value function for a given state (R,S)

func MultiplyDecCoinByDec

func MultiplyDecCoinByDec(dc sdk.DecCoin, scale sdk.Dec) sdk.DecCoin

func MultiplyDecCoinByInt

func MultiplyDecCoinByInt(dc sdk.DecCoin, scale sdk.Int) sdk.DecCoin

func MultiplyDecCoinsByDec

func MultiplyDecCoinsByDec(dcs sdk.DecCoins, scale sdk.Dec) (scaled sdk.DecCoins)

noinspection GoNilness

func MultiplyDecCoinsByInt

func MultiplyDecCoinsByInt(dcs sdk.DecCoins, scale sdk.Int) (scaled sdk.DecCoins)

noinspection GoNilness

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamTable for wars module.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func Reserve

func Reserve(S sdk.Dec, kappa int64, V0 sdk.Dec) sdk.Dec

This is the reverse of Supply(...) function

func RoundFee

func RoundFee(f sdk.DecCoin) sdk.Coin

func RoundReservePrice

func RoundReservePrice(p sdk.DecCoin) sdk.Coin

func RoundReservePrices

func RoundReservePrices(ps sdk.DecCoins) (rounded sdk.Coins)

noinspection GoNilness

func RoundReserveReturn

func RoundReserveReturn(r sdk.DecCoin) sdk.Coin

func RoundReserveReturns

func RoundReserveReturns(rs sdk.DecCoins) (rounded sdk.Coins)

noinspection GoNilness

func SpotPrice

func SpotPrice(R sdk.Dec, kappa int64, V0 sdk.Dec) sdk.Dec

given a value function (parameterized by kappa) and an invariant coeficient V0 return a spot price P as a function of reserve R

func StringsToString

func StringsToString(strs []string) (result string)

func Supply

func Supply(R sdk.Dec, kappa int64, V0 sdk.Dec) sdk.Dec

given a value function (parameterized by kappa) and an invariant coeficient V0 return Supply S as a function of reserve R

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

func ValidateParams

func ValidateParams(params Params) error

validate params

Types

type BaseOrder

type BaseOrder struct {
	Address      sdk.AccAddress `json:"address" yaml:"address"`
	Amount       sdk.Coin       `json:"amount" yaml:"amount"`
	Cancelled    bool           `json:"cancelled" yaml:"cancelled"`
	CancelReason string         `json:"cancel_reason" yaml:"cancel_reason"`
}

func NewBaseOrder

func NewBaseOrder(address sdk.AccAddress, amount sdk.Coin) BaseOrder

func (BaseOrder) IsCancelled

func (bo BaseOrder) IsCancelled() bool

type Batch

type Batch struct {
	Token           string       `json:"token" yaml:"token"`
	BlocksRemaining sdk.Uint     `json:"blocks_remaining" yaml:"blocks_remaining"`
	TotalBuyAmount  sdk.Coin     `json:"total_buy_amount" yaml:"total_buy_amount"`
	TotalSellAmount sdk.Coin     `json:"total_sell_amount" yaml:"total_sell_amount"`
	BuyPrices       sdk.DecCoins `json:"buy_prices" yaml:"buy_prices"`
	SellPrices      sdk.DecCoins `json:"sell_prices" yaml:"sell_prices"`
	Buys            []BuyOrder   `json:"buys" yaml:"buys"`
	Sells           []SellOrder  `json:"sells" yaml:"sells"`
	Swaps           []SwapOrder  `json:"swaps" yaml:"swaps"`
}

func NewBatch

func NewBatch(token string, blocks sdk.Uint) Batch

func (Batch) EqualBuysAndSells

func (b Batch) EqualBuysAndSells() bool

func (Batch) MoreBuysThanSells

func (b Batch) MoreBuysThanSells() bool

func (Batch) MoreSellsThanBuys

func (b Batch) MoreSellsThanBuys() bool

type BuyOrder

type BuyOrder struct {
	BaseOrder
	MaxPrices sdk.Coins `json:"max_prices" yaml:"max_prices"`
}

func NewBuyOrder

func NewBuyOrder(address sdk.AccAddress, amount sdk.Coin, maxPrices sdk.Coins) BuyOrder

type FunctionParam

type FunctionParam struct {
	Param string  `json:"param" yaml:"param"`
	Value sdk.Dec `json:"value" yaml:"value"`
}

func NewFunctionParam

func NewFunctionParam(param string, value sdk.Dec) FunctionParam

type FunctionParamRestrictions

type FunctionParamRestrictions func(paramsMap map[string]sdk.Dec) error

func GetExceptionsForFunctionType

func GetExceptionsForFunctionType(fnType string) (restrictions FunctionParamRestrictions, err error)

type FunctionParams

type FunctionParams []FunctionParam

func (FunctionParams) AsMap

func (fps FunctionParams) AsMap() (paramsMap map[string]sdk.Dec)

func (FunctionParams) String

func (fps FunctionParams) String() (result string)

func (FunctionParams) Validate

func (fps FunctionParams) Validate(functionType string) error

type GenesisState

type GenesisState struct {
	Wars    []War   `json:"wars" yaml:"wars"`
	Batches []Batch `json:"batches" yaml:"batches"`
	Params  Params  `json:"params" yaml:"params"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(wars []War, batches []Batch, params Params) GenesisState

type MsgBuy

type MsgBuy struct {
	Buyer     sdk.AccAddress `json:"buyer" yaml:"buyer"`
	Amount    sdk.Coin       `json:"amount" yaml:"amount"`
	MaxPrices sdk.Coins      `json:"max_prices" yaml:"max_prices"`
}

func NewMsgBuy

func NewMsgBuy(buyer sdk.AccAddress, amount sdk.Coin, maxPrices sdk.Coins) MsgBuy

func (MsgBuy) GetSignBytes

func (msg MsgBuy) GetSignBytes() []byte

func (MsgBuy) GetSigners

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

func (MsgBuy) Route

func (msg MsgBuy) Route() string

func (MsgBuy) Type

func (msg MsgBuy) Type() string

func (MsgBuy) ValidateBasic

func (msg MsgBuy) ValidateBasic() error

type MsgCreateWar

type MsgCreateWar struct {
	Token                  string           `json:"token" yaml:"token"`
	Name                   string           `json:"name" yaml:"name"`
	Description            string           `json:"description" yaml:"description"`
	FunctionType           string           `json:"function_type" yaml:"function_type"`
	FunctionParameters     FunctionParams   `json:"function_parameters" yaml:"function_parameters"`
	Creator                sdk.AccAddress   `json:"creator" yaml:"creator"`
	ReserveTokens          []string         `json:"reserve_tokens" yaml:"reserve_tokens"`
	TxFeePercentage        sdk.Dec          `json:"tx_fee_percentage" yaml:"tx_fee_percentage"`
	ExitFeePercentage      sdk.Dec          `json:"exit_fee_percentage" yaml:"exit_fee_percentage"`
	FeeAddress             sdk.AccAddress   `json:"fee_address" yaml:"fee_address"`
	MaxSupply              sdk.Coin         `json:"max_supply" yaml:"max_supply"`
	OrderQuantityLimits    sdk.Coins        `json:"order_quantity_limits" yaml:"order_quantity_limits"`
	SanityRate             sdk.Dec          `json:"sanity_rate" yaml:"sanity_rate"`
	SanityMarginPercentage sdk.Dec          `json:"sanity_margin_percentage" yaml:"sanity_margin_percentage"`
	AllowSells             bool             `json:"allow_sells" yaml:"allow_sells"`
	Signers                []sdk.AccAddress `json:"signers" yaml:"signers"`
	BatchBlocks            sdk.Uint         `json:"batch_blocks" yaml:"batch_blocks"`
	OutcomePayment         sdk.Coins        `json:"outcome_payment" yaml:"outcome_payment"`
}

func NewMsgCreateWar

func NewMsgCreateWar(token, name, description string, creator sdk.AccAddress,
	functionType string, functionParameters FunctionParams, reserveTokens []string,
	txFeePercentage, exitFeePercentage sdk.Dec, feeAddress sdk.AccAddress, maxSupply sdk.Coin,
	orderQuantityLimits sdk.Coins, sanityRate, sanityMarginPercentage sdk.Dec,
	allowSell bool, signers []sdk.AccAddress, batchBlocks sdk.Uint,
	outcomePayment sdk.Coins) MsgCreateWar

func (MsgCreateWar) GetSignBytes

func (msg MsgCreateWar) GetSignBytes() []byte

func (MsgCreateWar) GetSigners

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

func (MsgCreateWar) Route

func (msg MsgCreateWar) Route() string

func (MsgCreateWar) Type

func (msg MsgCreateWar) Type() string

func (MsgCreateWar) ValidateBasic

func (msg MsgCreateWar) ValidateBasic() error

type MsgEditWar

type MsgEditWar struct {
	Token                  string           `json:"token" yaml:"token"`
	Name                   string           `json:"name" yaml:"name"`
	Description            string           `json:"description" yaml:"description"`
	OrderQuantityLimits    string           `json:"order_quantity_limits" yaml:"order_quantity_limits"`
	SanityRate             string           `json:"sanity_rate" yaml:"sanity_rate"`
	SanityMarginPercentage string           `json:"sanity_margin_percentage" yaml:"sanity_margin_percentage"`
	Editor                 sdk.AccAddress   `json:"editor" yaml:"editor"`
	Signers                []sdk.AccAddress `json:"signers" yaml:"signers"`
}

func NewMsgEditWar

func NewMsgEditWar(token, name, description, orderQuantityLimits, sanityRate,
	sanityMarginPercentage string, editor sdk.AccAddress,
	signers []sdk.AccAddress) MsgEditWar

func (MsgEditWar) GetSignBytes

func (msg MsgEditWar) GetSignBytes() []byte

func (MsgEditWar) GetSigners

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

func (MsgEditWar) Route

func (msg MsgEditWar) Route() string

func (MsgEditWar) Type

func (msg MsgEditWar) Type() string

func (MsgEditWar) ValidateBasic

func (msg MsgEditWar) ValidateBasic() error

type MsgMakeOutcomePayment

type MsgMakeOutcomePayment struct {
	Sender   sdk.AccAddress `json:"sender" yaml:"sender"`
	WarToken string         `json:"war_token" yaml:"war_token"`
}

func NewMsgMakeOutcomePayment

func NewMsgMakeOutcomePayment(sender sdk.AccAddress, warToken string) MsgMakeOutcomePayment

func (MsgMakeOutcomePayment) GetSignBytes

func (msg MsgMakeOutcomePayment) GetSignBytes() []byte

func (MsgMakeOutcomePayment) GetSigners

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

func (MsgMakeOutcomePayment) Route

func (msg MsgMakeOutcomePayment) Route() string

func (MsgMakeOutcomePayment) Type

func (msg MsgMakeOutcomePayment) Type() string

func (MsgMakeOutcomePayment) ValidateBasic

func (msg MsgMakeOutcomePayment) ValidateBasic() error

type MsgSell

type MsgSell struct {
	Seller sdk.AccAddress `json:"seller" yaml:"seller"`
	Amount sdk.Coin       `json:"amount" yaml:"amount"`
}

func NewMsgSell

func NewMsgSell(seller sdk.AccAddress, amount sdk.Coin) MsgSell

func (MsgSell) GetSignBytes

func (msg MsgSell) GetSignBytes() []byte

func (MsgSell) GetSigners

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

func (MsgSell) Route

func (msg MsgSell) Route() string

func (MsgSell) Type

func (msg MsgSell) Type() string

func (MsgSell) ValidateBasic

func (msg MsgSell) ValidateBasic() error

type MsgSwap

type MsgSwap struct {
	Swapper  sdk.AccAddress `json:"swapper" yaml:"swapper"`
	WarToken string         `json:"war_token" yaml:"war_token"`
	From     sdk.Coin       `json:"from" yaml:"from"`
	ToToken  string         `json:"to_token" yaml:"to_token"`
}

func NewMsgSwap

func NewMsgSwap(swapper sdk.AccAddress, warToken string, from sdk.Coin, toToken string) MsgSwap

func (MsgSwap) GetSignBytes

func (msg MsgSwap) GetSignBytes() []byte

func (MsgSwap) GetSigners

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

func (MsgSwap) Route

func (msg MsgSwap) Route() string

func (MsgSwap) Type

func (msg MsgSwap) Type() string

func (MsgSwap) ValidateBasic

func (msg MsgSwap) ValidateBasic() error

type MsgWithdrawShare

type MsgWithdrawShare struct {
	Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"`
	WarToken  string         `json:"war_token" yaml:"war_token"`
}

func NewMsgWithdrawShare

func NewMsgWithdrawShare(recipient sdk.AccAddress, warToken string) MsgWithdrawShare

func (MsgWithdrawShare) GetSignBytes

func (msg MsgWithdrawShare) GetSignBytes() []byte

func (MsgWithdrawShare) GetSigners

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

func (MsgWithdrawShare) Route

func (msg MsgWithdrawShare) Route() string

func (MsgWithdrawShare) Type

func (msg MsgWithdrawShare) Type() string

func (MsgWithdrawShare) ValidateBasic

func (msg MsgWithdrawShare) ValidateBasic() error

type Params

type Params struct {
	ReservedWarTokens []string `json:"reserved_war_tokens" yaml:"reserved_war_tokens"`
}

wars parameters

func DefaultParams

func DefaultParams() Params

default wars module parameters

func NewParams

func NewParams(reservedWarTokens []string) Params

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

Implements params.ParamSet

func (Params) String

func (p Params) String() string

type QueryBuyPrice

type QueryBuyPrice struct {
	AdjustedSupply sdk.Coin  `json:"adjusted_supply" yaml:"asdjusted_supply"`
	Prices         sdk.Coins `json:"prices" yaml:"prices"`
	TxFees         sdk.Coins `json:"tx_fees" yaml:"tx_fees"`
	TotalPrices    sdk.Coins `json:"total_prices" yaml:"total_prices"`
	TotalFees      sdk.Coins `json:"total_fees" yaml:"total_fees"`
}

type QuerySellReturn

type QuerySellReturn struct {
	AdjustedSupply sdk.Coin  `json:"adjusted_supply" yaml:"asdjusted_supply"`
	Returns        sdk.Coins `json:"returns" yaml:"returns"`
	TxFees         sdk.Coins `json:"tx_fees" yaml:"tx_fees"`
	ExitFees       sdk.Coins `json:"exit_fees" yaml:"exit_fees"`
	TotalReturns   sdk.Coins `json:"total_returns" yaml:"total_returns"`
	TotalFees      sdk.Coins `json:"total_fees" yaml:"total_fees"`
}

type QuerySwapReturn

type QuerySwapReturn struct {
	TotalReturns sdk.Coins `json:"total_returns" yaml:"total_returns"`
	TotalFees    sdk.Coins `json:"total_fees" yaml:"total_fees"`
}

type QueryWars

type QueryWars []string

func (QueryWars) String

func (b QueryWars) String() string

type SellOrder

type SellOrder struct {
	BaseOrder
}

func NewSellOrder

func NewSellOrder(address sdk.AccAddress, amount sdk.Coin) SellOrder

type SwapOrder

type SwapOrder struct {
	BaseOrder
	ToToken string `json:"to_token" yaml:"to_token"`
}

func NewSwapOrder

func NewSwapOrder(address sdk.AccAddress, from sdk.Coin, toToken string) SwapOrder

type War

type War struct {
	Token                  string           `json:"token" yaml:"token"`
	Name                   string           `json:"name" yaml:"name"`
	Description            string           `json:"description" yaml:"description"`
	Creator                sdk.AccAddress   `json:"creator" yaml:"creator"`
	FunctionType           string           `json:"function_type" yaml:"function_type"`
	FunctionParameters     FunctionParams   `json:"function_parameters" yaml:"function_parameters"`
	ReserveTokens          []string         `json:"reserve_tokens" yaml:"reserve_tokens"`
	TxFeePercentage        sdk.Dec          `json:"tx_fee_percentage" yaml:"tx_fee_percentage"`
	ExitFeePercentage      sdk.Dec          `json:"exit_fee_percentage" yaml:"exit_fee_percentage"`
	FeeAddress             sdk.AccAddress   `json:"fee_address" yaml:"fee_address"`
	MaxSupply              sdk.Coin         `json:"max_supply" yaml:"max_supply"`
	OrderQuantityLimits    sdk.Coins        `json:"order_quantity_limits" yaml:"order_quantity_limits"`
	SanityRate             sdk.Dec          `json:"sanity_rate" yaml:"sanity_rate"`
	SanityMarginPercentage sdk.Dec          `json:"sanity_margin_percentage" yaml:"sanity_margin_percentage"`
	CurrentSupply          sdk.Coin         `json:"current_supply" yaml:"current_supply"`
	CurrentReserve         sdk.Coins        `json:"current_reserve" yaml:"current_reserve"`
	AllowSells             bool             `json:"allow_sells" yaml:"allow_sells"`
	Signers                []sdk.AccAddress `json:"signers" yaml:"signers"`
	BatchBlocks            sdk.Uint         `json:"batch_blocks" yaml:"batch_blocks"`
	OutcomePayment         sdk.Coins        `json:"outcome_payment" yaml:"outcome_payment"`
	State                  string           `json:"state" yaml:"state"`
}

func NewWar

func NewWar(token, name, description string, creator sdk.AccAddress,
	functionType string, functionParameters FunctionParams, reserveTokens []string,
	txFeePercentage, exitFeePercentage sdk.Dec, feeAddress sdk.AccAddress,
	maxSupply sdk.Coin, orderQuantityLimits sdk.Coins, sanityRate,
	sanityMarginPercentage sdk.Dec, allowSells bool, signers []sdk.AccAddress,
	batchBlocks sdk.Uint, outcomePayment sdk.Coins, state string) War

func (War) AnyOrderQuantityLimitsExceeded

func (war War) AnyOrderQuantityLimitsExceeded(amounts sdk.Coins) bool

func (War) GetCurrentPricesPT

func (war War) GetCurrentPricesPT(reserveBalances sdk.Coins) (sdk.DecCoins, error)

func (War) GetExitFee

func (war War) GetExitFee(reserveAmount sdk.DecCoin) sdk.Coin

func (War) GetExitFees

func (war War) GetExitFees(reserveAmounts sdk.DecCoins) (fees sdk.Coins)

noinspection GoNilness

func (War) GetFee

func (war War) GetFee(reserveAmount sdk.DecCoin, percentage sdk.Dec) sdk.Coin

func (War) GetFees

func (war War) GetFees(reserveAmounts sdk.DecCoins, percentage sdk.Dec) (fees sdk.Coins)

func (War) GetNewReserveDecCoins

func (war War) GetNewReserveDecCoins(amount sdk.Dec) (coins sdk.DecCoins)

noinspection GoNilness

func (War) GetPricesAtSupply

func (war War) GetPricesAtSupply(supply sdk.Int) (result sdk.DecCoins, err error)

func (War) GetPricesToMint

func (war War) GetPricesToMint(mint sdk.Int, reserveBalances sdk.Coins) (sdk.DecCoins, error)

func (War) GetReserveDeltaForLiquidityDelta

func (war War) GetReserveDeltaForLiquidityDelta(mintOrBurn sdk.Int, reserveBalances sdk.Coins) sdk.DecCoins

func (War) GetReturnsForBurn

func (war War) GetReturnsForBurn(burn sdk.Int, reserveBalances sdk.Coins) sdk.DecCoins

func (War) GetReturnsForSwap

func (war War) GetReturnsForSwap(from sdk.Coin, toToken string, reserveBalances sdk.Coins) (returns sdk.Coins, txFee sdk.Coin, err error)

func (War) GetTxFee

func (war War) GetTxFee(reserveAmount sdk.DecCoin) sdk.Coin

func (War) GetTxFees

func (war War) GetTxFees(reserveAmounts sdk.DecCoins) (fees sdk.Coins)

noinspection GoNilness

func (War) ReserveAtSupply

func (war War) ReserveAtSupply(supply sdk.Int) (result sdk.Dec)

func (War) ReserveDenomsEqualTo

func (war War) ReserveDenomsEqualTo(coins sdk.Coins) bool

func (War) ReservesViolateSanityRate

func (war War) ReservesViolateSanityRate(newReserves sdk.Coins) bool

func (War) SignersEqualTo

func (war War) SignersEqualTo(signers []sdk.AccAddress) bool

Jump to

Keyboard shortcuts

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