Documentation ¶
Index ¶
- func CalcAmountAsToken0(amount0, amount1 sdk.Int, price1To0 types.Price) sdk.Dec
- func CalcFee(upperTickIndex, lowerTickIndex int64) int64
- func CalcGreatestMatchingRatio(targetAmount0 sdk.Int, targetAmount1 sdk.Int, amount0 sdk.Int, amount1 sdk.Int) (resultAmount0, resultAmount1 sdk.Int)
- func CalcMultihopPriceUpperbound(currentPrice sdk.Dec, remainingSteps []MultihopStep) sdk.Dec
- func CalcResidualValue(amount0, amount1 sdk.Int, priceLower1To0 *types.Price, fee int64) (sdk.Dec, error)
- func CreatePairID(token0, token1 string) (pairID *types.PairID)
- func CreatePairIDFromUnsorted(tokenA, tokenB string) (*types.PairID, error)
- func GetInOutTokens(tokenIn, tokenA, tokenB string) (_, tokenOut string)
- func NewLimitOrderExpiration(tranche types.LimitOrderTranche) types.LimitOrderExpiration
- func NewLimitOrderTranche(sdkCtx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, ...) (types.LimitOrderTranche, error)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewTrancheKey(sdkCtx sdk.Context) string
- func NormalizeAllTickIndexes(baseToken, token0 string, tickIndexes []int64) []int64
- func NormalizeTickIndex(baseToken, token0 string, tickIndex int64) int64
- func SortAmounts(tokenA, token0 string, amountsA, amountsB []sdk.Int) ([]sdk.Int, []sdk.Int)
- func SortTokens(tokenA, tokenB string) (string, string, error)
- type Keeper
- func (k Keeper) BurnShares(ctx sdk.Context, addr sdk.AccAddress, amount sdk.Int, sharesID string) error
- func (k Keeper) CancelLimitOrderCore(goCtx context.Context, trancheKey string, callerAddr sdk.AccAddress) error
- func (k Keeper) DepositCore(goCtx context.Context, token0 string, token1 string, callerAddr sdk.AccAddress, ...) (amounts0Deposit, amounts1Deposit []sdk.Int, sharesIssued sdk.Coins, err error)
- func (k Keeper) FindLimitOrderTranche(ctx sdk.Context, pairID *types.PairID, tickIndex int64, token string, ...) (val types.LimitOrderTranche, fromFilled, found bool)
- func (k Keeper) GetAllInactiveLimitOrderTranche(ctx sdk.Context) (list []types.LimitOrderTranche)
- func (k Keeper) GetAllLimitOrderExpiration(ctx sdk.Context) (list []types.LimitOrderExpiration)
- func (k Keeper) GetAllLimitOrderTrancheAtIndex(sdkCtx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64) (trancheList []types.LimitOrderTranche)
- func (k Keeper) GetAllLimitOrderTrancheUser(ctx sdk.Context) (list []types.LimitOrderTrancheUser)
- func (k Keeper) GetAllLimitOrderTrancheUserForAddress(ctx sdk.Context, address sdk.AccAddress) (list []types.LimitOrderTrancheUser)
- func (k Keeper) GetAllTickLiquidity(ctx sdk.Context) (list []types.TickLiquidity)
- func (k Keeper) GetCurrPrice0To1(ctx sdk.Context, pairID *types.PairID) (price types.Price, found bool)
- func (k Keeper) GetCurrPrice1To0(ctx sdk.Context, pairID *types.PairID) (price types.Price, found bool)
- func (k Keeper) GetCurrTick0To1(ctx sdk.Context, pairID *types.PairID) (tickIdx int64, found bool)
- func (k Keeper) GetCurrTick1To0(ctx sdk.Context, pairID *types.PairID) (tickIdx int64, found bool)
- func (k Keeper) GetFillTranche(sdkCtx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64) (*types.LimitOrderTranche, bool)
- func (k Keeper) GetInactiveLimitOrderTranche(ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, ...) (val types.LimitOrderTranche, found bool)
- func (k Keeper) GetLimitOrderExpiration(ctx sdk.Context, goodTilDate time.Time, trancheRef []byte) (val types.LimitOrderExpiration, found bool)
- func (k Keeper) GetLimitOrderTranche(ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, ...) (tranche *types.LimitOrderTranche, found bool)
- func (k Keeper) GetLimitOrderTrancheByKey(ctx sdk.Context, key []byte) (tranche *types.LimitOrderTranche, found bool)
- func (k Keeper) GetLimitOrderTrancheUser(ctx sdk.Context, address string, trancheKey string) (val types.LimitOrderTrancheUser, found bool)
- func (k Keeper) GetOrInitLimitOrderTrancheUser(ctx sdk.Context, pairID *types.PairID, tickIndex int64, tokenIn string, ...) types.LimitOrderTrancheUser
- func (k Keeper) GetOrInitPlaceTranche(ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, ...) (placeTranche types.LimitOrderTranche, err error)
- func (k Keeper) GetOrInitPool(ctx sdk.Context, pairID *types.PairID, centerTickIndex int64, fee uint64) (Pool, error)
- func (k Keeper) GetOrInitPoolReserves(ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, ...) (*types.PoolReserves, error)
- func (k Keeper) GetParams(_ sdk.Context) types.Params
- func (k Keeper) GetPlaceTranche(sdkCtx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64) (types.LimitOrderTranche, bool)
- func (k Keeper) GetPoolReserves(ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, ...) (pool *types.PoolReserves, found bool)
- func (k Keeper) GetUserPositions(goCtx context.Context, req *types.QueryGetUserPositionsRequest) (*types.QueryGetUserPositionsResponse, error)
- func (k Keeper) HopsToRouteData(ctx sdk.Context, hops []string, exitLimitPrice sdk.Dec) ([]MultihopStep, error)
- func (k Keeper) InactiveLimitOrderTranche(c context.Context, req *types.QueryGetInactiveLimitOrderTrancheRequest) (*types.QueryGetInactiveLimitOrderTrancheResponse, error)
- func (k Keeper) InactiveLimitOrderTrancheAll(c context.Context, req *types.QueryAllInactiveLimitOrderTrancheRequest) (*types.QueryAllInactiveLimitOrderTrancheResponse, error)
- func (k Keeper) IsBehindEnemyLines(ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64) bool
- func (k Keeper) LimitOrderTranche(c context.Context, req *types.QueryGetLimitOrderTrancheRequest) (*types.QueryGetLimitOrderTrancheResponse, error)
- func (k Keeper) LimitOrderTrancheAll(c context.Context, req *types.QueryAllLimitOrderTrancheRequest) (*types.QueryAllLimitOrderTrancheResponse, error)
- func (k Keeper) LimitOrderTrancheUser(c context.Context, req *types.QueryGetLimitOrderTrancheUserRequest) (*types.QueryGetLimitOrderTrancheUserResponse, error)
- func (k Keeper) LimitOrderTrancheUserAll(c context.Context, req *types.QueryAllLimitOrderTrancheUserRequest) (*types.QueryAllLimitOrderTrancheUserResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintShares(ctx sdk.Context, addr sdk.AccAddress, shareCoin sdk.Coin) error
- func (k Keeper) MultiHopSwapCore(goCtx context.Context, amountIn sdk.Int, routes []*types.MultiHopRoute, ...) (coinOut sdk.Coin, err error)
- func (k Keeper) MultihopStep(bctx types.BranchableCache, step MultihopStep, inCoin sdk.Coin, ...) (sdk.Coin, types.BranchableCache, error)
- func (k Keeper) NewTickIterator(ctx sdk.Context, pairID *types.PairID, tokenIn string) TickIterator
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) PlaceLimitOrderCore(goCtx context.Context, tokenIn string, tokenOut string, amountIn sdk.Int, ...) (trancheKeyP *string, err error)
- func (k Keeper) PoolReserves(goCtx context.Context, req *types.QueryGetPoolReservesRequest) (*types.QueryGetPoolReservesResponse, error)
- func (k Keeper) PoolReservesAll(goCtx context.Context, req *types.QueryAllPoolReservesRequest) (*types.QueryAllPoolReservesResponse, error)
- func (k Keeper) PurgeExpiredLimitOrders(ctx sdk.Context, curTime time.Time)
- func (k Keeper) RemoveInactiveLimitOrderTranche(ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, ...)
- func (k Keeper) RemoveLimitOrderExpiration(ctx sdk.Context, goodTilDate time.Time, trancheRef []byte)
- func (k Keeper) RemoveLimitOrderExpirationByKey(ctx sdk.Context, key []byte)
- func (k Keeper) RemoveLimitOrderTranche(ctx sdk.Context, tranche types.LimitOrderTranche)
- func (k Keeper) RemoveLimitOrderTrancheUser(ctx sdk.Context, trancheUser types.LimitOrderTrancheUser)
- func (k Keeper) RemoveLimitOrderTrancheUserByKey(ctx sdk.Context, trancheKey string, address string)
- func (k Keeper) RemovePoolReserves(ctx sdk.Context, pool types.PoolReserves)
- func (k Keeper) RunMultihopRoute(ctx sdk.Context, route types.MultiHopRoute, initialInCoin sdk.Coin, ...) (sdk.Coin, func(), error)
- func (k Keeper) SaveInactiveTranche(sdkCtx sdk.Context, tranche types.LimitOrderTranche)
- func (k Keeper) SaveLiquidity(sdkCtx sdk.Context, liquidityI Liquidity)
- func (k Keeper) SavePool(ctx sdk.Context, pool Pool)
- func (k Keeper) SaveTranche(ctx sdk.Context, tranche types.LimitOrderTranche)
- func (k Keeper) SaveTrancheUser(ctx sdk.Context, trancheUser types.LimitOrderTrancheUser)
- func (k Keeper) SetInactiveLimitOrderTranche(ctx sdk.Context, inactiveLimitOrderTranche types.LimitOrderTranche)
- func (k Keeper) SetLimitOrderExpiration(ctx sdk.Context, goodTilRecord types.LimitOrderExpiration)
- func (k Keeper) SetLimitOrderTranche(ctx sdk.Context, tranche types.LimitOrderTranche)
- func (k Keeper) SetLimitOrderTrancheUser(ctx sdk.Context, limitOrderTrancheUser types.LimitOrderTrancheUser)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPoolReserves(ctx sdk.Context, pool types.PoolReserves)
- func (k Keeper) Swap(ctx sdk.Context, pairID *types.PairID, tokenIn string, tokenOut string, ...) (totalInCoin, totalOutCoin sdk.Coin, err error)
- func (k Keeper) SwapCore(goCtx context.Context, tokenIn string, tokenOut string, maxAmountIn sdk.Int, ...) (coinOut sdk.Coin, err error)
- func (k Keeper) SwapExactAmountIn(ctx sdk.Context, pairID *types.PairID, tokenIn string, tokenOut string, ...) (totalIn, totalOut sdk.Coin, err error)
- func (k Keeper) SwapWithCache(ctx sdk.Context, pairID *types.PairID, tokenIn string, tokenOut string, ...) (totalIn, totalOut sdk.Coin, err error)
- func (k Keeper) TickLiquidityAll(c context.Context, req *types.QueryAllTickLiquidityRequest) (*types.QueryAllTickLiquidityResponse, error)
- func (k Keeper) UserDepositsAll(goCtx context.Context, req *types.QueryAllUserDepositsRequest) (*types.QueryAllUserDepositsResponse, error)
- func (k Keeper) UserLimitOrdersAll(goCtx context.Context, req *types.QueryAllUserLimitOrdersRequest) (*types.QueryAllUserLimitOrdersResponse, error)
- func (k Keeper) WithdrawCore(goCtx context.Context, token0 string, token1 string, callerAddr sdk.AccAddress, ...) error
- func (k Keeper) WithdrawFilledLimitOrderCore(goCtx context.Context, trancheKey string, callerAddr sdk.AccAddress) error
- type Liquidity
- type LiquidityIterator
- type MultihopStep
- type Pool
- func (p *Pool) CalcResidualSharesMinted(residualAmount0 sdk.Int, residualAmount1 sdk.Int) (sharesMinted sdk.Coin, err error)
- func (p *Pool) CalcSharesMinted(amount0 sdk.Int, amount1 sdk.Int, existingShares sdk.Int) (sharesMinted sdk.Coin)
- func (p *Pool) Deposit(maxAmount0, maxAmount1, existingShares sdk.Int, autoswap bool) (inAmount0, inAmount1 sdk.Int, outShares sdk.Coin)
- func (p *Pool) GetDepositDenom() string
- func (p *Pool) GetLowerReserve0() sdk.Int
- func (p *Pool) GetUpperReserve1() sdk.Int
- func (p *Pool) MustCalcPrice1To0Center() *types.Price
- func (p *Pool) RedeemValue(sharesToRemove, totalShares sdk.Int) (outAmount0, outAmount1 sdk.Int)
- func (p *Pool) Swap0To1(maxAmount0 sdk.Int, maxAmountOut1 sdk.Int) (inAmount0, outAmount1 sdk.Int)
- func (p *Pool) Swap1To0(maxAmount1 sdk.Int, maxAmountOut0 sdk.Int) (inAmount1, outAmount0 sdk.Int)
- func (p *Pool) Withdraw(sharesToRemove, totalShares sdk.Int) (outAmount0, outAmount1 sdk.Int)
- type PoolLiquidity
- type StepResult
- type TickIterator
- type UserProfile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcAmountAsToken0 ¶
func CalcGreatestMatchingRatio ¶
func CalcGreatestMatchingRatio( targetAmount0 sdk.Int, targetAmount1 sdk.Int, amount0 sdk.Int, amount1 sdk.Int, ) (resultAmount0, resultAmount1 sdk.Int)
Balance trueAmount1 to the pool ratio
func CalcMultihopPriceUpperbound ¶
func CalcMultihopPriceUpperbound(currentPrice sdk.Dec, remainingSteps []MultihopStep) sdk.Dec
func CalcResidualValue ¶
func CreatePairID ¶
func GetInOutTokens ¶
func NewLimitOrderExpiration ¶
func NewLimitOrderExpiration(tranche types.LimitOrderTranche) types.LimitOrderExpiration
func NewLimitOrderTranche ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func NewTrancheKey ¶
func NormalizeAllTickIndexes ¶
func NormalizeTickIndex ¶
func SortAmounts ¶
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey sdk.StoreKey, ps paramtypes.Subspace, bankKeeper types.BankKeeper, ) *Keeper
func (Keeper) BurnShares ¶
func (Keeper) CancelLimitOrderCore ¶
func (k Keeper) CancelLimitOrderCore( goCtx context.Context, trancheKey string, callerAddr sdk.AccAddress, ) error
Handles MsgCancelLimitOrder, removing a specified number of shares from a limit order and returning the respective amount in terms of the reserve to the user.
func (Keeper) DepositCore ¶
func (k Keeper) DepositCore( goCtx context.Context, token0 string, token1 string, callerAddr sdk.AccAddress, receiverAddr sdk.AccAddress, amounts0 []sdk.Int, amounts1 []sdk.Int, tickIndices []int64, fees []uint64, options []*types.DepositOptions, ) (amounts0Deposit, amounts1Deposit []sdk.Int, sharesIssued sdk.Coins, err error)
Handles core logic for MsgDeposit, checking and initializing data structures (tick, pair), calculating shares based on amount deposited, and sending funds to moduleAddress.
func (Keeper) FindLimitOrderTranche ¶
func (Keeper) GetAllInactiveLimitOrderTranche ¶
func (k Keeper) GetAllInactiveLimitOrderTranche(ctx sdk.Context) (list []types.LimitOrderTranche)
GetAllInactiveLimitOrderTranche returns all inactiveLimitOrderTranche
func (Keeper) GetAllLimitOrderExpiration ¶
func (k Keeper) GetAllLimitOrderExpiration(ctx sdk.Context) (list []types.LimitOrderExpiration)
GetAllLimitOrderExpiration returns all goodTilRecord
func (Keeper) GetAllLimitOrderTrancheAtIndex ¶
func (Keeper) GetAllLimitOrderTrancheUser ¶
func (k Keeper) GetAllLimitOrderTrancheUser(ctx sdk.Context) (list []types.LimitOrderTrancheUser)
GetAllLimitOrderTrancheUser returns all LimitOrderTrancheUser
func (Keeper) GetAllLimitOrderTrancheUserForAddress ¶
func (k Keeper) GetAllLimitOrderTrancheUserForAddress( ctx sdk.Context, address sdk.AccAddress, ) (list []types.LimitOrderTrancheUser)
func (Keeper) GetAllTickLiquidity ¶
func (k Keeper) GetAllTickLiquidity(ctx sdk.Context) (list []types.TickLiquidity)
GetAllTickLiquidity returns all tickLiquidity
func (Keeper) GetCurrPrice0To1 ¶
func (Keeper) GetCurrPrice1To0 ¶
func (Keeper) GetCurrTick0To1 ¶
func (Keeper) GetCurrTick1To0 ¶
func (Keeper) GetFillTranche ¶
func (Keeper) GetInactiveLimitOrderTranche ¶
func (k Keeper) GetInactiveLimitOrderTranche( ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, trancheKey string, ) (val types.LimitOrderTranche, found bool)
GetInactiveLimitOrderTranche returns a inactiveLimitOrderTranche from its index
func (Keeper) GetLimitOrderExpiration ¶
func (k Keeper) GetLimitOrderExpiration( ctx sdk.Context, goodTilDate time.Time, trancheRef []byte, ) (val types.LimitOrderExpiration, found bool)
GetLimitOrderExpiration returns a goodTilRecord from its index
func (Keeper) GetLimitOrderTranche ¶
func (Keeper) GetLimitOrderTrancheByKey ¶
func (Keeper) GetLimitOrderTrancheUser ¶
func (k Keeper) GetLimitOrderTrancheUser( ctx sdk.Context, address string, trancheKey string, ) (val types.LimitOrderTrancheUser, found bool)
GetLimitOrderTrancheUser returns a LimitOrderTrancheUser from its index
func (Keeper) GetOrInitLimitOrderTrancheUser ¶
func (Keeper) GetOrInitPlaceTranche ¶
func (Keeper) GetOrInitPool ¶
func (Keeper) GetOrInitPoolReserves ¶
func (Keeper) GetPlaceTranche ¶
func (Keeper) GetPoolReserves ¶
func (Keeper) GetUserPositions ¶
func (k Keeper) GetUserPositions( goCtx context.Context, req *types.QueryGetUserPositionsRequest, ) (*types.QueryGetUserPositionsResponse, error)
func (Keeper) HopsToRouteData ¶
func (Keeper) InactiveLimitOrderTranche ¶
func (k Keeper) InactiveLimitOrderTranche( c context.Context, req *types.QueryGetInactiveLimitOrderTrancheRequest, ) (*types.QueryGetInactiveLimitOrderTrancheResponse, error)
func (Keeper) InactiveLimitOrderTrancheAll ¶
func (k Keeper) InactiveLimitOrderTrancheAll( c context.Context, req *types.QueryAllInactiveLimitOrderTrancheRequest, ) (*types.QueryAllInactiveLimitOrderTrancheResponse, error)
func (Keeper) IsBehindEnemyLines ¶
func (Keeper) LimitOrderTranche ¶
func (k Keeper) LimitOrderTranche( c context.Context, req *types.QueryGetLimitOrderTrancheRequest, ) (*types.QueryGetLimitOrderTrancheResponse, error)
Returns a specific limit order tranche either from the tickLiquidity index or from the FillLimitOrderTranche index
func (Keeper) LimitOrderTrancheAll ¶
func (k Keeper) LimitOrderTrancheAll( c context.Context, req *types.QueryAllLimitOrderTrancheRequest, ) (*types.QueryAllLimitOrderTrancheResponse, error)
Returns all ACTIVE limit order tranches for a given pairID/tokenIn combination Does NOT return inactiveLimitOrderTranches
func (Keeper) LimitOrderTrancheUser ¶
func (k Keeper) LimitOrderTrancheUser(c context.Context, req *types.QueryGetLimitOrderTrancheUserRequest, ) (*types.QueryGetLimitOrderTrancheUserResponse, error)
func (Keeper) LimitOrderTrancheUserAll ¶
func (k Keeper) LimitOrderTrancheUserAll( c context.Context, req *types.QueryAllLimitOrderTrancheUserRequest, ) (*types.QueryAllLimitOrderTrancheUserResponse, error)
func (Keeper) MintShares ¶
func (Keeper) MultiHopSwapCore ¶
func (Keeper) MultihopStep ¶
func (k Keeper) MultihopStep( bctx types.BranchableCache, step MultihopStep, inCoin sdk.Coin, exitLimitPrice sdk.Dec, currentPrice sdk.Dec, remainingSteps []MultihopStep, stepCache map[multihopCacheKey]StepResult, ) (sdk.Coin, types.BranchableCache, error)
func (Keeper) NewTickIterator ¶
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) PlaceLimitOrderCore ¶
func (k Keeper) PlaceLimitOrderCore( goCtx context.Context, tokenIn string, tokenOut string, amountIn sdk.Int, tickIndex int64, orderType types.LimitOrderType, goodTil *time.Time, callerAddr sdk.AccAddress, receiverAddr sdk.AccAddress, ) (trancheKeyP *string, err error)
Handles MsgPlaceLimitOrder, initializing (tick, pair) data structures if needed, calculating and storing information for a new limit order at a specific tick.
func (Keeper) PoolReserves ¶
func (k Keeper) PoolReserves( goCtx context.Context, req *types.QueryGetPoolReservesRequest, ) (*types.QueryGetPoolReservesResponse, error)
func (Keeper) PoolReservesAll ¶
func (k Keeper) PoolReservesAll( goCtx context.Context, req *types.QueryAllPoolReservesRequest, ) (*types.QueryAllPoolReservesResponse, error)
func (Keeper) PurgeExpiredLimitOrders ¶
func (Keeper) RemoveInactiveLimitOrderTranche ¶
func (k Keeper) RemoveInactiveLimitOrderTranche( ctx sdk.Context, pairID *types.PairID, tokenIn string, tickIndex int64, trancheKey string, )
RemoveInactiveLimitOrderTranche removes a inactiveLimitOrderTranche from the store
func (Keeper) RemoveLimitOrderExpiration ¶
func (k Keeper) RemoveLimitOrderExpiration( ctx sdk.Context, goodTilDate time.Time, trancheRef []byte, )
RemoveLimitOrderExpiration removes a goodTilRecord from the store
func (Keeper) RemoveLimitOrderExpirationByKey ¶
func (Keeper) RemoveLimitOrderTranche ¶
func (k Keeper) RemoveLimitOrderTranche(ctx sdk.Context, tranche types.LimitOrderTranche)
func (Keeper) RemoveLimitOrderTrancheUser ¶
func (k Keeper) RemoveLimitOrderTrancheUser(ctx sdk.Context, trancheUser types.LimitOrderTrancheUser)
func (Keeper) RemoveLimitOrderTrancheUserByKey ¶
func (k Keeper) RemoveLimitOrderTrancheUserByKey( ctx sdk.Context, trancheKey string, address string, )
RemoveLimitOrderTrancheUserByKey removes a LimitOrderTrancheUser from the store
func (Keeper) RemovePoolReserves ¶
func (k Keeper) RemovePoolReserves(ctx sdk.Context, pool types.PoolReserves)
RemoveTickLiquidity removes a tickLiquidity from the store
func (Keeper) RunMultihopRoute ¶
func (Keeper) SaveInactiveTranche ¶
func (k Keeper) SaveInactiveTranche(sdkCtx sdk.Context, tranche types.LimitOrderTranche)
func (Keeper) SaveLiquidity ¶
func (Keeper) SaveTranche ¶
func (k Keeper) SaveTranche(ctx sdk.Context, tranche types.LimitOrderTranche)
func (Keeper) SaveTrancheUser ¶
func (k Keeper) SaveTrancheUser(ctx sdk.Context, trancheUser types.LimitOrderTrancheUser)
func (Keeper) SetInactiveLimitOrderTranche ¶
func (k Keeper) SetInactiveLimitOrderTranche(ctx sdk.Context, inactiveLimitOrderTranche types.LimitOrderTranche)
SetInactiveLimitOrderTranche set a specific inactiveLimitOrderTranche in the store from its index
func (Keeper) SetLimitOrderExpiration ¶
func (k Keeper) SetLimitOrderExpiration(ctx sdk.Context, goodTilRecord types.LimitOrderExpiration)
SetLimitOrderExpiration set a specific goodTilRecord in the store from its index
func (Keeper) SetLimitOrderTranche ¶
func (k Keeper) SetLimitOrderTranche(ctx sdk.Context, tranche types.LimitOrderTranche)
func (Keeper) SetLimitOrderTrancheUser ¶
func (k Keeper) SetLimitOrderTrancheUser(ctx sdk.Context, limitOrderTrancheUser types.LimitOrderTrancheUser)
SetLimitOrderTrancheUser set a specific LimitOrderTrancheUser in the store from its index
func (Keeper) SetPoolReserves ¶
func (k Keeper) SetPoolReserves(ctx sdk.Context, pool types.PoolReserves)
func (Keeper) SwapCore ¶
func (k Keeper) SwapCore(goCtx context.Context, tokenIn string, tokenOut string, maxAmountIn sdk.Int, maxAmountOut sdk.Int, callerAddr sdk.AccAddress, receiverAddr sdk.AccAddress, ) (coinOut sdk.Coin, err error)
Handles core logic for the asset 0 to asset1 direction of MsgSwap; faciliates swapping amount0 for some amount of amount1, given a specified pair (token0, token1).
func (Keeper) SwapExactAmountIn ¶
func (Keeper) SwapWithCache ¶
func (Keeper) TickLiquidityAll ¶
func (k Keeper) TickLiquidityAll( c context.Context, req *types.QueryAllTickLiquidityRequest, ) (*types.QueryAllTickLiquidityResponse, error)
func (Keeper) UserDepositsAll ¶
func (k Keeper) UserDepositsAll( goCtx context.Context, req *types.QueryAllUserDepositsRequest, ) (*types.QueryAllUserDepositsResponse, error)
func (Keeper) UserLimitOrdersAll ¶
func (k Keeper) UserLimitOrdersAll( goCtx context.Context, req *types.QueryAllUserLimitOrdersRequest, ) (*types.QueryAllUserLimitOrdersResponse, error)
func (Keeper) WithdrawCore ¶
func (k Keeper) WithdrawCore( goCtx context.Context, token0 string, token1 string, callerAddr sdk.AccAddress, receiverAddr sdk.AccAddress, sharesToRemoveList []sdk.Int, tickIndices []int64, fees []uint64, ) error
Handles core logic for MsgWithdrawal; calculating and withdrawing reserve0,reserve1 from a specified tick given a specfied number of shares to remove. Calculates the amount of reserve0, reserve1 to withdraw based on the percentage of the desired number of shares to remove compared to the total number of shares at the given tick.
func (Keeper) WithdrawFilledLimitOrderCore ¶
func (k Keeper) WithdrawFilledLimitOrderCore( goCtx context.Context, trancheKey string, callerAddr sdk.AccAddress, ) error
Handles MsgWithdrawFilledLimitOrder, calculates and sends filled liqudity from module to user for a limit order based on amount wished to receive.
type Liquidity ¶
type Liquidity interface { Swap(maxAmountIn sdk.Int, maxAmountOut sdk.Int) (inAmount, outAmount sdk.Int) Price() *types.Price }
type LiquidityIterator ¶
type LiquidityIterator struct {
// contains filtered or unexported fields
}
func NewLiquidityIterator ¶
func NewLiquidityIterator( keeper Keeper, ctx sdk.Context, tradingPair types.DirectionalTradingPair, ) *LiquidityIterator
func (*LiquidityIterator) Close ¶
func (s *LiquidityIterator) Close()
func (*LiquidityIterator) Next ¶
func (s *LiquidityIterator) Next() Liquidity
type MultihopStep ¶
type MultihopStep struct { BestPrice types.Price TradingPair types.DirectionalTradingPair }
type Pool ¶
type Pool struct { CenterTickIndex int64 Fee uint64 LowerTick0 *types.PoolReserves UpperTick1 *types.PoolReserves Price1To0Lower *types.Price Price0To1Upper *types.Price }
func NewPool ¶
func NewPool( centerTickIndex int64, lowerTick0 *types.PoolReserves, upperTick1 *types.PoolReserves, ) Pool
TODO: Accept a PairID here so that GetDepositDenom() can reference it directly
func (*Pool) CalcResidualSharesMinted ¶
func (*Pool) CalcSharesMinted ¶
func (*Pool) Deposit ¶
func (p *Pool) Deposit( maxAmount0, maxAmount1, existingShares sdk.Int, autoswap bool, ) (inAmount0, inAmount1 sdk.Int, outShares sdk.Coin)
Mutates the Pool object and returns relevant change variables. Deposit is not committed until pool.save() is called or the underlying ticks are saved; this method does not use any keeper methods.
func (*Pool) GetDepositDenom ¶
func (*Pool) GetLowerReserve0 ¶
func (*Pool) GetUpperReserve1 ¶
func (*Pool) MustCalcPrice1To0Center ¶
func (*Pool) RedeemValue ¶
type PoolLiquidity ¶
type PoolLiquidity struct {
// contains filtered or unexported fields
}
func (*PoolLiquidity) Price ¶
func (pl *PoolLiquidity) Price() *types.Price
type StepResult ¶
type StepResult struct { Ctx types.BranchableCache CoinOut sdk.Coin Err error }
type TickIterator ¶
type TickIterator struct {
// contains filtered or unexported fields
}
func (TickIterator) Close ¶
func (ti TickIterator) Close() error
func (TickIterator) Next ¶
func (ti TickIterator) Next()
func (TickIterator) Valid ¶
func (ti TickIterator) Valid() bool
func (TickIterator) Value ¶
func (ti TickIterator) Value() (tick types.TickLiquidity)
type UserProfile ¶
type UserProfile struct {
Address sdk.AccAddress
}
func NewUserProfile ¶
func NewUserProfile(address sdk.AccAddress) UserProfile
func (UserProfile) GetAllDeposits ¶
func (u UserProfile) GetAllDeposits(ctx sdk.Context, k Keeper) []types.DepositRecord
func (UserProfile) GetAllLimitOrders ¶
func (u UserProfile) GetAllLimitOrders(ctx sdk.Context, k Keeper) []types.LimitOrderTrancheUser
func (UserProfile) GetAllPositions ¶
func (u UserProfile) GetAllPositions(ctx sdk.Context, k Keeper) types.UserPositions
Source Files ¶
- core.go
- core_helper.go
- grpc_query.go
- grpc_query_inactive_limit_order_tranche.go
- grpc_query_limit_order_tranche.go
- grpc_query_limit_order_tranche_user.go
- grpc_query_params.go
- grpc_query_pool_reserves.go
- grpc_query_tick_liquidity.go
- grpc_query_user_deposits.go
- grpc_query_user_limit_orders.go
- grpc_query_user_positions.go
- inactive_limit_order_tranche.go
- keeper.go
- limit_order_expiration.go
- limit_order_tranche.go
- limit_order_tranche_user.go
- liquidity.go
- msg_server.go
- multihop_swap.go
- pair_helper.go
- params.go
- pool.go
- pool_liquidity.go
- pool_reserves.go
- tick_iterator.go
- tick_liquidity.go
- user_profile.go