mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
20437a91fb
* add message types for swaps * add tx client commands * add test coverage for swap message deadlines * start handler swap tests, export handler result message event into private method, add stubbed keeper methods * add initial swap implementation to get handler tests passing; adds event specific for trades * add handler acceptance test for slippage in exact input and exact output swaps * implement slippage limit for swap keeper methods * add tests to ensure a user can only swap spendable coins * test pool not found, panic on invalid pool, and panic when module account does not have enough funds * validate that the exact output when using for exact swaps is less than the pool liquidity * nit: long line * add validation that swap output is greater than zero * add rest txs for swap messages * nit: lints * dry up swap keeper methods * from pr feedback - spelling and increase clairty around the output amount of a swap rounding to zero
100 lines
4.5 KiB
Go
100 lines
4.5 KiB
Go
// Code generated by aliasgen tool (github.com/rhuairahrighairidh/aliasgen) DO NOT EDIT.
|
|
|
|
package swap
|
|
|
|
import (
|
|
"github.com/kava-labs/kava/x/swap/keeper"
|
|
"github.com/kava-labs/kava/x/swap/types"
|
|
)
|
|
|
|
const (
|
|
AttributeKeyDepositor = types.AttributeKeyDepositor
|
|
AttributeKeyExactDirection = types.AttributeKeyExactDirection
|
|
AttributeKeyFeePaid = types.AttributeKeyFeePaid
|
|
AttributeKeyOwner = types.AttributeKeyOwner
|
|
AttributeKeyPoolID = types.AttributeKeyPoolID
|
|
AttributeKeyRequester = types.AttributeKeyRequester
|
|
AttributeKeyShares = types.AttributeKeyShares
|
|
AttributeKeySwapInput = types.AttributeKeySwapInput
|
|
AttributeKeySwapOutput = types.AttributeKeySwapOutput
|
|
AttributeValueCategory = types.AttributeValueCategory
|
|
DefaultParamspace = types.DefaultParamspace
|
|
EventTypeSwapDeposit = types.EventTypeSwapDeposit
|
|
EventTypeSwapTrade = types.EventTypeSwapTrade
|
|
EventTypeSwapWithdraw = types.EventTypeSwapWithdraw
|
|
ModuleAccountName = types.ModuleAccountName
|
|
ModuleName = types.ModuleName
|
|
QuerierRoute = types.QuerierRoute
|
|
QueryGetParams = types.QueryGetParams
|
|
RouterKey = types.RouterKey
|
|
StoreKey = types.StoreKey
|
|
)
|
|
|
|
var (
|
|
// function aliases
|
|
NewKeeper = keeper.NewKeeper
|
|
NewQuerier = keeper.NewQuerier
|
|
DefaultGenesisState = types.DefaultGenesisState
|
|
DefaultParams = types.DefaultParams
|
|
DepositorPoolSharesKey = types.DepositorPoolSharesKey
|
|
NewAllowedPool = types.NewAllowedPool
|
|
NewAllowedPools = types.NewAllowedPools
|
|
NewBasePool = types.NewBasePool
|
|
NewBasePoolWithExistingShares = types.NewBasePoolWithExistingShares
|
|
NewDenominatedPool = types.NewDenominatedPool
|
|
NewDenominatedPoolWithExistingShares = types.NewDenominatedPoolWithExistingShares
|
|
NewGenesisState = types.NewGenesisState
|
|
NewMsgDeposit = types.NewMsgDeposit
|
|
NewMsgSwapExactForTokens = types.NewMsgSwapExactForTokens
|
|
NewMsgSwapForExactTokens = types.NewMsgSwapForExactTokens
|
|
NewMsgWithdraw = types.NewMsgWithdraw
|
|
NewParams = types.NewParams
|
|
NewPoolRecord = types.NewPoolRecord
|
|
NewShareRecord = types.NewShareRecord
|
|
ParamKeyTable = types.ParamKeyTable
|
|
PoolID = types.PoolID
|
|
PoolIDFromCoins = types.PoolIDFromCoins
|
|
PoolKey = types.PoolKey
|
|
RegisterCodec = types.RegisterCodec
|
|
|
|
// variable aliases
|
|
DefaultAllowedPools = types.DefaultAllowedPools
|
|
DefaultSwapFee = types.DefaultSwapFee
|
|
DepositorPoolSharesPrefix = types.DepositorPoolSharesPrefix
|
|
ErrDeadlineExceeded = types.ErrDeadlineExceeded
|
|
ErrDepositNotFound = types.ErrDepositNotFound
|
|
ErrInsufficientLiquidity = types.ErrInsufficientLiquidity
|
|
ErrInvalidCoin = types.ErrInvalidCoin
|
|
ErrInvalidDeadline = types.ErrInvalidDeadline
|
|
ErrInvalidPool = types.ErrInvalidPool
|
|
ErrInvalidShares = types.ErrInvalidShares
|
|
ErrInvalidSlippage = types.ErrInvalidSlippage
|
|
ErrNotAllowed = types.ErrNotAllowed
|
|
ErrNotImplemented = types.ErrNotImplemented
|
|
ErrSlippageExceeded = types.ErrSlippageExceeded
|
|
KeyAllowedPools = types.KeyAllowedPools
|
|
KeySwapFee = types.KeySwapFee
|
|
MaxSwapFee = types.MaxSwapFee
|
|
ModuleCdc = types.ModuleCdc
|
|
PoolKeyPrefix = types.PoolKeyPrefix
|
|
)
|
|
|
|
type (
|
|
Keeper = keeper.Keeper
|
|
AccountKeeper = types.AccountKeeper
|
|
AllowedPool = types.AllowedPool
|
|
AllowedPools = types.AllowedPools
|
|
BasePool = types.BasePool
|
|
DenominatedPool = types.DenominatedPool
|
|
GenesisState = types.GenesisState
|
|
MsgDeposit = types.MsgDeposit
|
|
MsgSwapExactForTokens = types.MsgSwapExactForTokens
|
|
MsgSwapForExactTokens = types.MsgSwapForExactTokens
|
|
MsgWithDeadline = types.MsgWithDeadline
|
|
MsgWithdraw = types.MsgWithdraw
|
|
Params = types.Params
|
|
PoolRecord = types.PoolRecord
|
|
ShareRecord = types.ShareRecord
|
|
SupplyKeeper = types.SupplyKeeper
|
|
)
|