Swap

#28

Token swap functionality

Part of Economy & Balances: TAO token management, transfers, and transaction fees

Filter by:
add_liquidity call v290 → v393 #1

Adds liquidity to a subnet's pool within a specified price range.

Emits: LiquidityAdded Modifies: Positions, LastPositionId +3
●●●○○○ Moderate usage
StakingLiquidityAlpha
AlphaSqrtPrice storage v290 → v393

Current sqrt price of Alpha per subnet.

SubnetsLiquidityAlpha
CurrentLiquidity storage v290 → v393

Active liquidity at current price per subnet.

Modified by: add_liquidity, modify_position +1
●●●○○○ Low usage
SubnetsLiquidity
CurrentTick storage v290 → v393

Current price tick per subnet.

SubnetsLiquidity
disable_lp call v350 → v393 #5

Disables user liquidity in all subnets.

Emits: UserLiquidityToggled Modifies: EnabledUserLiquidity
AdminLiquidity
EnabledUserLiquidity storage v290 → v393

Whether user liquidity is enabled per subnet.

Modified by: disable_lp, toggle_user_liquidity
SubnetsLiquidity
FeeGlobalAlpha storage v290 → v393

Accumulated Alpha fees for distribution per subnet.

Modified by: remove_liquidity
SubnetsLiquidityAlpha
FeeGlobalTao storage v290 → v393

Accumulated TAO fees for distribution per subnet.

Modified by: remove_liquidity
SubnetsLiquidity
FeeRate storage v290 → v393

Swap fee rate per subnet, normalized between 0 and u16::MAX.

Modified by: set_fee_rate
SubnetsLiquidity
FeeRateSet event v290 → v393 #0

Emitted when the swap fee rate is updated for a subnet's liquidity pool.

Emitted by: set_fee_rate Modifies: FeeRate
SubnetsAdminLiquidity
FeeRateTooHigh error v290 → v393 #0

The specified fee rate exceeds the maximum allowed.

Thrown by: set_fee_rate
InsufficientBalance error v290 → v393 #4

You don't have enough TAO or Alpha for this operation.

Thrown by: add_liquidity
InsufficientInputAmount error v290 → v393 #1

The provided amount is too small for the swap.

InsufficientLiquidity error v290 → v393 #2

Not enough liquidity in the pool for this operation.

Thrown by: remove_liquidity, modify_position
InvalidLiquidityValue error v290 → v393 #9

The liquidity value is invalid (likely too small).

Thrown by: add_liquidity, modify_position
InvalidTickRange error v290 → v393 #6

The tick range is invalid for adding liquidity.

Thrown by: add_liquidity, modify_position
LastPositionId storage v290 → v393

Counter for unique position IDs.

Modified by: add_liquidity
SystemLiquidity
LiquidityAdded event v290 → v393 #2

Emitted when a user adds liquidity to a subnet's pool.

Emitted by: add_liquidity Modifies: CurrentLiquidity, LastPositionId +3
●●○○○○ Moderate usage
StakingLiquidityAlpha
LiquidityModified event v290 → v393 #4

Emitted when a user modifies an existing liquidity position.

Emitted by: modify_position Modifies: CurrentLiquidity, Positions +2
StakingLiquidityAlpha
LiquidityNotFound error v290 → v393 #5

The specified liquidity position doesn't exist.

Thrown by: remove_liquidity, modify_position
LiquidityRemoved event v290 → v393 #3

Emitted when a user removes an entire liquidity position.

Emitted by: remove_liquidity Modifies: CurrentLiquidity, FeeGlobalAlpha +6
●●○○○○ Moderate usage
StakingLiquidityAlpha
MaxFeeRate constant v290 → v393

Maximum allowed fee rate for swaps.

MaxPositions constant v290 → v393

Maximum positions per user.

MaxPositionsExceeded error v290 → v393 #7

You've reached the maximum number of positions allowed.

Thrown by: add_liquidity
MechanismDoesNotExist error v320 → v393 #11

The specified subnet doesn't exist.

Thrown by: set_fee_rate, toggle_user_liquidity +4
MinimumLiquidity constant v290 → v393

Minimum liquidity safe for rounding.

MinimumReserve constant v290 → v393

Minimum TAO/Alpha reserve required in pools.

modify_position call v290 → v393 #3

Adds or removes liquidity from an existing position and claims fees.

Emits: LiquidityModified Modifies: Positions, Ticks +2
StakingLiquidityAlpha
Positions storage v290 → v393

User liquidity positions with tick ranges.

Modified by: add_liquidity, modify_position +1
●●●○○○ Low usage
StakingLiquidity
PriceLimitExceeded error v290 → v393 #3

Your transaction was rejected because the current Alpha exchange rate is worse than the limit_price you specified. This is your slippage protection working as intended — the price moved against you between when you submitted and when the chain tried to execute.

ProtocolId constant v290 → v393

PalletId used to derive the protocol account address.

remove_liquidity call v290 → v393 #2

Removes an entire liquidity position and claims accrued fees.

Emits: LiquidityRemoved Modifies: Positions, Ticks +6
●●○○○○ Low usage
StakingLiquidityAlpha
ReservesTooLow error v290 → v393 #10

Pool reserves are too low for this operation.

ScrapReservoirAlpha storage v334 → v393

Alpha reservoir for fee scraps per subnet.

Modified by: remove_liquidity
SubnetsLiquidityAlpha
ScrapReservoirTao storage v334 → v393

TAO reservoir for fee scraps per subnet.

Modified by: remove_liquidity
SubnetsLiquidity
set_fee_rate call v290 → v393 #0

Sets the swap fee rate for a specific subnet's liquidity pool.

Emits: FeeRateSet Modifies: FeeRate
AdminLiquidity
SubtokenDisabled error v315 → v393 #13

The subnet doesn't have subtoken (Alpha) enabled.

Thrown by: toggle_user_liquidity, add_liquidity
SwapV3Initialized storage v290 → v393

Whether V3 swap is initialized for a subnet.

SubnetsLiquidity
TickIndexBitmapWords storage v290 → v393

Bitmap tracking initialized ticks.

Modified by: add_liquidity, modify_position +1
●●●○○○ Low usage
SubnetsLiquidity
Ticks storage v290 → v393

Tick data for concentrated liquidity price points.

Modified by: add_liquidity, modify_position +1
●●●○○○ Low usage
SubnetsLiquidity
toggle_user_liquidity call v290 → v393 #4

Enables or disables user liquidity operations for a subnet.

Emits: UserLiquidityToggled Modifies: EnabledUserLiquidity
SubnetsAdminLiquidity
TooManySwapSteps error v290 → v393 #8

The swap requires too many tick crossings.

UserLiquidityDisabled error v290 → v393 #12

User liquidity operations are not enabled for this subnet.

Thrown by: add_liquidity
UserLiquidityToggled event v290 → v393 #1

Emitted when user liquidity is enabled or disabled for a subnet.

Emitted by: toggle_user_liquidity, disable_lp Modifies: EnabledUserLiquidity
SubnetsAdminLiquidity

Related Pallets