For the complete documentation index, see llms.txt. This page is also available as Markdown.

ITurbineLiquidityRouter

Git Source

Functions

addLiquidity

Adds liquidity to the pair represented by the given hook.

function addLiquidity(
    address to,
    uint256 amount0,
    uint256 amount1,
    address poolToken0,
    address poolToken1,
    uint24 poolFee,
    uint256 liquidity,
    BatchSignatureTransferParams memory batchSignatureTransferParams
) external payable returns (uint256);

Parameters

Name
Type
Description

to

address

The address receiving the minted liquidity.

amount0

uint256

The amount of token0 to add as liquidity.

amount1

uint256

The amount of token1 to add as liquidity.

poolToken0

address

The address of the first token in the pool.

poolToken1

address

The address of the second token in the pool.

poolFee

uint24

The fee of the pool.

liquidity

uint256

The liquidity amount to mint for the caller.

batchSignatureTransferParams

BatchSignatureTransferParams

The Permit2 batch SignatureTransfer permit and signature for token0 and token1.

Returns

Name
Type
Description

<none>

uint256

liquidity The minted liquidity amount for the caller.

removeLiquidity

Burns liquidity to the pair represented by the given hook.

Parameters

Name
Type
Description

to

address

The address receiving the burnt liquidity.

liquidity

uint256

The burnt liquidity amount from the caller.

poolToken0

address

The address of the first token in the pool.

poolToken1

address

The address of the second token in the pool.

poolFee

uint24

The fee of the pool.

signatureTransferParams

SignatureTransferParams

The Permit2 SignatureTransfer permit and signature for the LP token.

Returns

Name
Type
Description

<none>

uint256

amount0 The amount of token0 received from burning liquidity.

<none>

uint256

amount1 The amount of token1 received from burning liquidity.

submitRemoveLiquidityIntent

Submits a new remove-liquidity intent for later execution.

The caller must be intent.owner. The provided Permit2 authorization must match the LP token and cover at least intent.lpTokenAmount.

The signature stored onchain can only be used by the spender address (this router) because the msg.sender is included in the PermitTransferFrom.hash() see https://github.com/Uniswap/permit2/blob/cc56ad0f3439c502c246fc5cfcc3db92bb8b7219/src/libraries/PermitHash.sol#L62

Parameters

Name
Type
Description

intent

RemoveLiquidityIntent

The remove-liquidity instruction containing pool and LP token amount details.

signatureTransferParams

SignatureTransferParams

Permit2 SignatureTransfer parameters and signature authorizing LP token transfer.

Returns

Name
Type
Description

<none>

RemoveLiquidityIntentHash

The intent hash used to reference this submission.

MIN_INTENT_EXPIRY

Returns the minimum expiry for the TurbineLiquidityRouter

Returns

Name
Type
Description

<none>

uint256

The minimum expiry in seconds

getTurbineSettler

Returns the address of the TurbineSettler

Returns

Name
Type
Description

<none>

address

The address of the TurbineSettler

getTurbineHook

Returns the address of the TurbineHook

Return type is address to avoid unnecessary imports

Returns

Name
Type
Description

<none>

address

The address of the TurbineHook

executePendingIntents

Executes the provided intent hashes and deletes the executed intents.

Parameters

Name
Type
Description

hashes

RemoveLiquidityIntentHash[]

Array of intent hashes to execute.

getRemoveLiquidityIntents

Returns remove-liquidity intent data for the given hashes. Skips deleted/unknown intents (owner == address(0)).

Parameters

Name
Type
Description

hashes

RemoveLiquidityIntentHash[]

Array of intent hashes to query.

Returns

Name
Type
Description

result

RemoveLiquidityData[]

Array of RemoveLiquidityData for valid intents only.

swapExactTokens

Swaps an exact amount of a token for an exact amount of another token.

This function is only callable by the turbineSettler address and the output tokens are transferred to the turbineSettler

  • This function assumes that amountIn is already transferred to this contract.

  • This function transfers tokens to the poolManager via poolManager.unlock(...).

  • The poolManager will perform the swap and return the output amount via the callback (unlockCallback).

Parameters

Name
Type
Description

amountIn

uint256

The exact amount of input tokens to be sent for the swap.

amountOut

uint256

The exact amount of tokens expected to be received from the swap.

poolToken0

address

The address of the first token in the pool.

poolToken1

address

The address of the second token in the pool.

poolFee

uint24

The fee of the pool.

zeroForOne

bool

The direction of the swap.

deadline

uint256

A timestamp by which the call be finished to be valid.

Events

SettlerSet

RemoveLiquidityIntentSubmitted

RemoveLiquidityIntentDeleted

Errors

InvalidOutputReceived

OutOfGas

ZeroLiquidity

InsufficientInitialLiquidity

InsufficientLiquidityBurnt

SwapExpired

NotTurbineSettler

NotPoolManager

NotSettlerOrPoolManager

InvalidIntentOwner

InsufficientLpTokenBalance

DuplicateIntent

InvalidLpTokenAmount

InvalidPermitToken

InvalidPermitAmount

PermitDeadlineTooShort

PermitDeadlineTooLong

NonceAlreadyUsed

Last updated

Was this helpful?