PoolManager
Unichain0x1f98400000000000000000000000000000000004
Solidity v0.8.26+commit.8a97fa7a
Overview
Read Functions
Returns the current allowance given to a spender by an owner
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | The account of the token owner |
| spender | address | The account of the token spender |
| id | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| amount | uint256 | The current allowance granted by `owner` to `spender` |
Returns an account's balance in the token
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | |
| id | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| balance | uint256 | The number of tokens held by the account |
Called by external contracts to access granular pool state
Parameters
| Name | Type | Description |
|---|---|---|
| slot | bytes32 | Key of slot to sload |
Returns
| Name | Type | Description |
|---|---|---|
| — | bytes32 | value The value of the slot as bytes32 |
Called by external contracts to access granular pool state
Parameters
| Name | Type | Description |
|---|---|---|
| startSlot | bytes32 | |
| nSlots | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| — | bytes32[] | value The value of the slot as bytes32 |
Called by external contracts to access granular pool state
Parameters
| Name | Type | Description |
|---|---|---|
| slots | bytes32[] |
Returns
| Name | Type | Description |
|---|---|---|
| — | bytes32[] | value The value of the slot as bytes32 |
Called by external contracts to access transient storage of the contract
Parameters
| Name | Type | Description |
|---|---|---|
| slots | bytes32[] |
Returns
| Name | Type | Description |
|---|---|---|
| — | bytes32[] | value The value of the slot as bytes32 |
Called by external contracts to access transient storage of the contract
Parameters
| Name | Type | Description |
|---|---|---|
| slot | bytes32 | Key of slot to tload |
Returns
| Name | Type | Description |
|---|---|---|
| — | bytes32 | value The value of the slot as bytes32 |
Checks if a spender is approved by an owner as an operator
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | The address of the owner. |
| operator | address |
Returns
| Name | Type | Description |
|---|---|---|
| isOperator | bool | approved The approval status. |
Returns
| Name | Type | Description |
|---|---|---|
| — | address |
Returns the current protocol fee controller address
Returns
| Name | Type | Description |
|---|---|---|
| — | address | address The current protocol fee controller address |
Given a currency address, returns the protocol fees accrued in that currency
Parameters
| Name | Type | Description |
|---|---|---|
| currency | address | The currency to check |
Returns
| Name | Type | Description |
|---|---|---|
| amount | uint256 | amount The amount of protocol fees accrued in the currency |
///////////////////////////////////////////////////////////
Parameters
| Name | Type | Description |
|---|---|---|
| interfaceId | bytes4 |
Returns
| Name | Type | Description |
|---|---|---|
| — | bool |
Write Functions
Sets the allowance of a spender from the `msg.sender` to the value `amount`
Parameters
| Name | Type | Description |
|---|---|---|
| spender | address | The account which will be allowed to spend a given amount of the owners tokens |
| id | uint256 | |
| amount | uint256 | The amount of tokens allowed to be used by `spender` |
Returns
| Name | Type | Description |
|---|---|---|
| — | bool | Returns true for a successful approval, false for unsuccessful |
Called by the user to move value from ERC6909 balance
Parameters
| Name | Type | Description |
|---|---|---|
| from | address | The address to burn the tokens from |
| id | uint256 | The currency address to burn from ERC6909s, as a uint256 |
| amount | uint256 | The amount of currency to burn |
WARNING - Any currency that is cleared, will be non-retrievable, and locked in the contract permanently. A call to clear will zero out a positive balance WITHOUT a corresponding transfer.
Parameters
| Name | Type | Description |
|---|---|---|
| currency | address | |
| amount | uint256 |
Collects the protocol fees for a given recipient and currency, returning the amount collected
Parameters
| Name | Type | Description |
|---|---|---|
| recipient | address | The address to receive the protocol fees |
| currency | address | The currency to withdraw |
| amount | uint256 | The amount of currency to withdraw |
Returns
| Name | Type | Description |
|---|---|---|
| amountCollected | uint256 | amountCollected The amount of currency successfully withdrawn |
Donates the given amount of currency0 and currency1 to the pool
Parameters
| Name | Type | Description |
|---|---|---|
| key | tuple | |
| amount0 | uint256 | |
| amount1 | uint256 | |
| hookData | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| delta | int256 |
Initialize the state for a given pool ID
Parameters
| Name | Type | Description |
|---|---|---|
| key | tuple | The pool key for the pool to initialize |
| sqrtPriceX96 | uint160 | The initial square root price |
Returns
| Name | Type | Description |
|---|---|---|
| tick | int24 | tick The initial tick of the pool |
Called by the user to move value into ERC6909 balance
Parameters
| Name | Type | Description |
|---|---|---|
| to | address | The address to mint the tokens to |
| id | uint256 | The currency address to mint to ERC6909s, as a uint256 |
| amount | uint256 | The amount of currency to mint |
Effect changes to a position in a pool
Parameters
| Name | Type | Description |
|---|---|---|
| key | tuple | |
| params | tuple | the position details and the change to the position's liquidity to effect |
| hookData | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| callerDelta | int256 | delta the deltas of the token balances of the pool, from the liquidity change |
| feesAccrued | int256 | feeDelta the fees generated by the liquidity range |
Sets or removes an operator for the caller.
Parameters
| Name | Type | Description |
|---|---|---|
| operator | address | The address of the operator. |
| approved | bool | The approval status. |
Returns
| Name | Type | Description |
|---|---|---|
| — | bool | bool True, always |
Sets the protocol fee for the given pool
Parameters
| Name | Type | Description |
|---|---|---|
| key | tuple | The key of the pool to set a protocol fee for |
| newProtocolFee | uint24 | The fee to set |
Sets the protocol fee controller
Parameters
| Name | Type | Description |
|---|---|---|
| controller | address | The new protocol fee controller |
Called by the user to pay what is owed
Returns
| Name | Type | Description |
|---|---|---|
| — | uint256 | paid The amount of currency settled |
Called by the user to pay on behalf of another address
Parameters
| Name | Type | Description |
|---|---|---|
| recipient | address | The address to credit for the payment |
Returns
| Name | Type | Description |
|---|---|---|
| — | uint256 | paid The amount of currency settled |
Executes a swap against the state, and returns the amount deltas of the pool
Parameters
| Name | Type | Description |
|---|---|---|
| key | tuple | |
| params | tuple | |
| hookData | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| swapDelta | int256 |
Writes the current ERC20 balance of the specified currency to transient storage This is used to checkpoint balances for the manager and derive deltas for the caller.
Parameters
| Name | Type | Description |
|---|---|---|
| currency | address |
Called by the user to net out some value owed to the user
Parameters
| Name | Type | Description |
|---|---|---|
| currency | address | The currency to withdraw from the pool manager |
| to | address | The address to withdraw to |
| amount | uint256 | The amount of currency to withdraw |
Transfers the amount of token from the `msg.sender` to the recipient
Parameters
| Name | Type | Description |
|---|---|---|
| receiver | address | |
| id | uint256 | |
| amount | uint256 | The number of tokens to send from the sender to the recipient |
Returns
| Name | Type | Description |
|---|---|---|
| — | bool | Returns true for a successful transfer, false for an unsuccessful transfer |
Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`
Parameters
| Name | Type | Description |
|---|---|---|
| sender | address | The account from which the transfer will be initiated |
| receiver | address | |
| id | uint256 | |
| amount | uint256 | The amount of the transfer |
Returns
| Name | Type | Description |
|---|---|---|
| — | bool | Returns true for a successful transfer, false for unsuccessful |
///////////////////////////////////////////////////////////
Parameters
| Name | Type | Description |
|---|---|---|
| newOwner | address |
All interactions on the contract that account deltas require unlocking. A caller that calls `unlock` must implement `IUnlockCallback(msg.sender).unlockCallback(data)`, where they interact with the remaining functions on this contract.
Parameters
| Name | Type | Description |
|---|---|---|
| data | bytes | Any data to pass to the callback, via `IUnlockCallback(msg.sender).unlockCallback(data)` |
Returns
| Name | Type | Description |
|---|---|---|
| result | bytes | The data returned by the call to `IUnlockCallback(msg.sender).unlockCallback(data)` |
Updates the pools lp fees for the a pool that has enabled dynamic lp fees.
Parameters
| Name | Type | Description |
|---|---|---|
| key | tuple | The key of the pool to update dynamic LP fees for |
| newDynamicLPFee | uint24 | The new dynamic pool LP fee |
Events
Event emitted when the approval amount for the spender of a given owner's tokens changes.
| Name | Type | Indexed | Description |
|---|---|---|---|
| owner | address | ✓ | The account that approved spending of its tokens |
| spender | address | ✓ | The account for which the spending allowance was modified |
| id | uint256 | ✓ | |
| amount | uint256 |
Emitted for donations
| Name | Type | Indexed | Description |
|---|---|---|---|
| id | bytes32 | ✓ | The abi encoded hash of the pool key struct for the pool that was donated to |
| sender | address | ✓ | The address that initiated the donate call |
| amount0 | uint256 | The amount donated in currency0 | |
| amount1 | uint256 | The amount donated in currency1 |
Emitted when a new pool is initialized
| Name | Type | Indexed | Description |
|---|---|---|---|
| id | bytes32 | ✓ | The abi encoded hash of the pool key struct for the new pool |
| currency0 | address | ✓ | The first currency of the pool by address sort order |
| currency1 | address | ✓ | The second currency of the pool by address sort order |
| fee | uint24 | The fee collected upon every swap in the pool, denominated in hundredths of a bip | |
| tickSpacing | int24 | The minimum number of ticks between initialized ticks | |
| hooks | address | The hooks contract address for the pool, or address(0) if none | |
| sqrtPriceX96 | uint160 | The price of the pool on initialization | |
| tick | int24 | The initial tick of the pool corresponding to the initialized price |
Emitted when a liquidity position is modified
| Name | Type | Indexed | Description |
|---|---|---|---|
| id | bytes32 | ✓ | The abi encoded hash of the pool key struct for the pool that was modified |
| sender | address | ✓ | The address that modified the pool |
| tickLower | int24 | The lower tick of the position | |
| tickUpper | int24 | The upper tick of the position | |
| liquidityDelta | int256 | The amount of liquidity that was added or removed | |
| salt | bytes32 | The extra data to make positions unique |
///////////////////////////////////////////////////////////
| Name | Type | Indexed | Description |
|---|---|---|---|
| owner | address | ✓ | |
| operator | address | ✓ | |
| approved | bool |
///////////////////////////////////////////////////////////
| Name | Type | Indexed | Description |
|---|---|---|---|
| user | address | ✓ | |
| newOwner | address | ✓ |
Emitted when the protocol fee controller address is updated in setProtocolFeeController.
| Name | Type | Indexed | Description |
|---|---|---|---|
| protocolFeeController | address | ✓ |
Emitted when the protocol fee is updated for a pool.
| Name | Type | Indexed | Description |
|---|---|---|---|
| id | bytes32 | ✓ | |
| protocolFee | uint24 |
Emitted for swaps between currency0 and currency1
| Name | Type | Indexed | Description |
|---|---|---|---|
| id | bytes32 | ✓ | The abi encoded hash of the pool key struct for the pool that was modified |
| sender | address | ✓ | The address that initiated the swap call, and that received the callback |
| amount0 | int128 | The delta of the currency0 balance of the pool | |
| amount1 | int128 | The delta of the currency1 balance of the pool | |
| sqrtPriceX96 | uint160 | The sqrt(price) of the pool after the swap, as a Q64.96 | |
| liquidity | uint128 | The liquidity of the pool after the swap | |
| tick | int24 | The log base 1.0001 of the price of the pool after the swap | |
| fee | uint24 | The swap fee in hundredths of a bip |
Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.
| Name | Type | Indexed | Description |
|---|---|---|---|
| caller | address | ||
| from | address | ✓ | The account from which the tokens were sent, i.e. the balance decreased |
| to | address | ✓ | The account to which the tokens were sent, i.e. the balance increased |
| id | uint256 | ✓ | |
| amount | uint256 |