Documentation ¶
Index ¶
- func GetMinAndMaxTicksFromExponentAtPriceOne(exponentAtPriceOne sdk.Int) (minTick, maxTick int64)
- func NewMsgCreatorServerImpl(keeper *Keeper) clmodel.MsgCreatorServer
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- func ParseFullPositionFromBytes(key, value []byte) (types.FullPositionByOwnerResult, error)
- func ParsePositionFromBz(bz []byte) (position model.Position, err error)
- type Keeper
- func (k Keeper) CalcInAmtGivenOut(ctx sdk.Context, poolI poolmanagertypes.PoolI, tokenOut sdk.Coin, ...) (tokenIn sdk.Coin, err error)
- func (k Keeper) CalcOutAmtGivenIn(ctx sdk.Context, poolI poolmanagertypes.PoolI, tokenIn sdk.Coin, ...) (tokenOut sdk.Coin, err error)
- func (k Keeper) CreatePosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, ...) (sdk.Int, sdk.Int, sdk.Dec, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllPools(ctx sdk.Context) ([]types.ConcentratedPoolExtension, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPerTickLiquidityDepthFromRange(ctx sdk.Context, poolId uint64, lowerTick, upperTick int64) ([]types.LiquidityDepth, error)
- func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (poolmanagertypes.PoolI, error)
- func (k Keeper) GetPosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, ...) (*model.Position, error)
- func (k Keeper) GetUserPositions(ctx sdk.Context, addr sdk.AccAddress) ([]types.FullPositionByOwnerResult, error)
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) InitializePool(ctx sdk.Context, poolI poolmanagertypes.PoolI, creatorAddress sdk.AccAddress) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k *Keeper) SetPoolManagerKeeper(poolmanagerKeeper types.PoolManagerKeeper)
- func (k Keeper) SetTickInfo(ctx sdk.Context, poolId uint64, tickIndex int64, tickInfo model.TickInfo)
- func (k Keeper) SwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, poolI poolmanagertypes.PoolI, ...) (tokenOutAmount sdk.Int, err error)
- func (k Keeper) SwapExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, poolI poolmanagertypes.PoolI, ...) (tokenInAmount sdk.Int, err error)
- func (k *Keeper) SwapInAmtGivenOut(ctx sdk.Context, desiredTokenOut sdk.Coin, tokenInDenom string, ...) (calcTokenIn, calcTokenOut sdk.Coin, currentTick sdk.Int, ...)
- func (k Keeper) SwapOutAmtGivenIn(ctx sdk.Context, tokenIn sdk.Coin, tokenOutDenom string, swapFee sdk.Dec, ...) (calcTokenIn, calcTokenOut sdk.Coin, currentTick sdk.Int, ...)
- func (k Keeper) WithdrawPosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, ...) (amtDenom0, amtDenom1 sdk.Int, err error)
- type Querier
- func (q Querier) LiquidityDepthsForRange(goCtx context.Context, req *types.QueryLiquidityDepthsForRangeRequest) (*types.QueryLiquidityDepthsForRangeResponse, error)
- func (q Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (q Querier) Pool(ctx context.Context, req *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
- func (q Querier) Pools(ctx context.Context, req *types.QueryPoolsRequest) (*types.QueryPoolsResponse, error)
- func (q Querier) UserPositions(ctx context.Context, req *types.QueryUserPositionsRequest) (*types.QueryUserPositionsResponse, error)
- type SwapState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMinAndMaxTicksFromExponentAtPriceOne ¶
GetMinAndMaxTicksFromExponentAtPriceOne determines min and max ticks allowed for a given exponentAtPriceOne value This allows for a min spot price of 0.000000000000000001 and a max spot price of 100000000000000000000000000000000000000 for every exponentAtPriceOne value
func NewMsgCreatorServerImpl ¶
func NewMsgCreatorServerImpl(keeper *Keeper) clmodel.MsgCreatorServer
func NewMsgServerImpl ¶
func ParseFullPositionFromBytes ¶
func ParseFullPositionFromBytes(key, value []byte) (types.FullPositionByOwnerResult, error)
ParseFullPositionFromBytes parses a full position from key and value bytes. Returns a struct containing the pool id, lower tick, upper tick, frozen until, and liquidity associated with the position. Returns an error if the key or value is not found. Returns an error if fails to parse either.
func ParsePositionFromBz ¶
ParsePositionFromBz parses a position from a byte array. Returns a struct containing the liquidity associated with the position. Returns an error if the byte array is empty. Returns an error if fails to parse.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, storeKey sdk.StoreKey, bankKeeper types.BankKeeper, paramSpace paramtypes.Subspace) *Keeper
func (Keeper) CalcInAmtGivenOut ¶
func (Keeper) CalcOutAmtGivenIn ¶
func (Keeper) CreatePosition ¶
func (k Keeper) CreatePosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, amount0Desired, amount1Desired, amount0Min, amount1Min sdk.Int, lowerTick, upperTick int64, frozenUntil time.Time) (sdk.Int, sdk.Int, sdk.Dec, error)
CreatePosition creates a concentrated liquidity position in range between lowerTick and upperTick in a given `PoolId with the desired amount of each token. Since LPs are only allowed to provide liquidity proportional to the existing reserves, the actual amount of tokens used might differ from requested. As a result, LPs may also provide the minimum amount of each token to be used so that the system fails to create position if the desired amounts cannot be satisfied. On success, returns an actual amount of each token used and liquidity created. Returns error if: - the provided ticks are out of range / invalid - the pool provided does not exist - the liquidity delta is zero - the amount0 or amount1 returned from the position update is less than the given minimums - the pool or user does not have enough tokens to satisfy the requested amount
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the concentrated-liquidity module's exported genesis state.
func (Keeper) GetAllPools ¶
func (Keeper) GetParams ¶
GetParams returns the total set of concentrated-liquidity module's parameters.
func (Keeper) GetPerTickLiquidityDepthFromRange ¶
func (k Keeper) GetPerTickLiquidityDepthFromRange(ctx sdk.Context, poolId uint64, lowerTick, upperTick int64) ([]types.LiquidityDepth, error)
GetPerTickLiquidityDepthFromRange uses the given lower tick and upper tick, iterates over ticks, creates and returns LiquidityDepth array. LiquidityNet from the tick is used to indicate liquidity depths.
func (Keeper) GetPosition ¶
func (k Keeper) GetPosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, lowerTick, upperTick int64, frozenUntil time.Time) (*model.Position, error)
GetPosition checks if a position exists at the provided upper and lower ticks and frozenUntil time for the given owner. Returns position if found.
func (Keeper) GetUserPositions ¶
func (k Keeper) GetUserPositions(ctx sdk.Context, addr sdk.AccAddress) ([]types.FullPositionByOwnerResult, error)
GetUserPositions gets all the existing user positions across many pools.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
InitGenesis initializes the concentrated-liquidity module with the provided genesis state.
func (Keeper) InitializePool ¶
func (k Keeper) InitializePool(ctx sdk.Context, poolI poolmanagertypes.PoolI, creatorAddress sdk.AccAddress) error
InitializePool initializes a concentrated liquidity pool and sets it in state.
func (Keeper) SetParams ¶
SetParams sets the concentrated-liquidity module's parameters with the provided parameters.
func (*Keeper) SetPoolManagerKeeper ¶
func (k *Keeper) SetPoolManagerKeeper(poolmanagerKeeper types.PoolManagerKeeper)
Set the poolmanager keeper.
func (Keeper) SetTickInfo ¶
func (Keeper) SwapExactAmountIn ¶
func (Keeper) SwapExactAmountOut ¶
func (*Keeper) SwapInAmtGivenOut ¶
func (Keeper) SwapOutAmtGivenIn ¶
func (k Keeper) SwapOutAmtGivenIn( ctx sdk.Context, tokenIn sdk.Coin, tokenOutDenom string, swapFee sdk.Dec, priceLimit sdk.Dec, poolId uint64, ) (calcTokenIn, calcTokenOut sdk.Coin, currentTick sdk.Int, liquidity, sqrtPrice sdk.Dec, err error)
SwapOutAmtGivenIn is the internal mutative method for CalcOutAmtGivenIn. Utilizing CalcOutAmtGivenIn's output, this function applies the new tick, liquidity, and sqrtPrice to the respective pool
func (Keeper) WithdrawPosition ¶
func (k Keeper) WithdrawPosition(ctx sdk.Context, poolId uint64, owner sdk.AccAddress, lowerTick, upperTick int64, frozenUntil time.Time, requestedLiquidityAmountToWithdraw sdk.Dec) (amtDenom0, amtDenom1 sdk.Int, err error)
WithdrawPosition attempts to withdraw liquidityAmount from a position with the given pool id in the given tick range. On success, returns a positive amount of each token withdrawn. Returns error if - there is no position in the given tick ranges - if tick ranges are invalid - if attempts to withdraw an amount higher than originally provided in createPosition for a given range.
type Querier ¶
type Querier struct {
Keeper
}
Querier defines a wrapper around the x/concentrated-liquidity keeper providing gRPC method handlers.
func NewQuerier ¶
func (Querier) LiquidityDepthsForRange ¶
func (q Querier) LiquidityDepthsForRange(goCtx context.Context, req *types.QueryLiquidityDepthsForRangeRequest) (*types.QueryLiquidityDepthsForRangeResponse, error)
LiquidityDepthsForRange returns liquidity depths for the given range.
func (Querier) Params ¶
func (q Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params returns module params
func (Querier) Pool ¶
func (q Querier) Pool( ctx context.Context, req *types.QueryPoolRequest, ) (*types.QueryPoolResponse, error)
Pool checks if a pool exists and returns the desired pool.
func (Querier) Pools ¶
func (q Querier) Pools( ctx context.Context, req *types.QueryPoolsRequest, ) (*types.QueryPoolsResponse, error)
Pools returns all concentrated pools in existence.
func (Querier) UserPositions ¶
func (q Querier) UserPositions(ctx context.Context, req *types.QueryUserPositionsRequest) (*types.QueryUserPositionsResponse, error)
UserPositions returns positions of a specified address
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
client
|
|
internal
|
|
Package types is a reverse proxy.
|
Package types is a reverse proxy. |