PoolManager

Unichain

0x1f98400000000000000000000000000000000004

Solidity v0.8.26+commit.8a97fa7a

🤖
Query this contract from your AI
Reference: 0x1f98400000000000000000000000000000000004
Sample prompt: "Tell me the current state of unichain/0x1f98400000000000000000000000000000000004"
No AI wired up yet? → mcp.smarts.md
Unichain is a docs-only chain on Smarts: source code and ABI are indexed, but live on-chain data (state, recent events, admin profile) is not currently available. AI agents can still query get_contract_info and get_contract_source via MCP.

Overview

Read Functions
12
Write Functions
21
Events
10

Read Functions

allowance(owner: address, spender: address, id: uint256) view

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`
balanceOf(owner: address, id: uint256) view

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
extsload(slot: bytes32) view

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
extsload(startSlot: bytes32, nSlots: uint256) view

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
extsload(slots: bytes32[]) view

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
exttload(slots: bytes32[]) view

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
exttload(slot: bytes32) view

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
isOperator(owner: address, operator: address) view

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.
owner() view

Returns

Name Type Description
address
protocolFeeController() view

Returns the current protocol fee controller address

Returns

Name Type Description
address address The current protocol fee controller address
protocolFeesAccrued(currency: address) view

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
supportsInterface(interfaceId: bytes4) view

///////////////////////////////////////////////////////////

Parameters

Name Type Description
interfaceId bytes4

Returns

Name Type Description
bool

Write Functions

approve(spender: address, id: uint256, amount: uint256) nonpayable

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
burn(from: address, id: uint256, amount: uint256) nonpayable

Called by the user to move value from ERC6909 balance

dev: The id is converted to a uint160 to correspond to a currency address If the upper 12 bytes are not 0, they will be 0-ed out

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
clear(currency: address, amount: uint256) nonpayable

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.

dev: This could be used to clear a balance that is considered dust. Additionally, the amount must be the exact positive balance. This is to enforce that the caller is aware of the amount being cleared.

Parameters

Name Type Description
currency address
amount uint256
collectProtocolFees(recipient: address, currency: address, amount: uint256) nonpayable

Collects the protocol fees for a given recipient and currency, returning the amount collected

dev: This will revert if the contract is unlocked

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
donate(key: tuple, amount0: uint256, amount1: uint256, hookData: bytes) nonpayable

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(key: tuple, sqrtPriceX96: uint160) nonpayable

Initialize the state for a given pool ID

dev: A swap fee totaling MAX_SWAP_FEE (100%) makes exact output swaps impossible since the input is entirely consumed by the fee

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
mint(to: address, id: uint256, amount: uint256) nonpayable

Called by the user to move value into ERC6909 balance

dev: The id is converted to a uint160 to correspond to a currency address If the upper 12 bytes are not 0, they will be 0-ed out

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
modifyLiquidity(key: tuple, params: tuple, hookData: bytes) nonpayable

Effect changes to a position in a pool

dev: PoolManager checks that the pool is initialized before calling

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
setOperator(operator: address, approved: bool) nonpayable

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
setProtocolFee(key: tuple, newProtocolFee: uint24) nonpayable

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
setProtocolFeeController(controller: address) nonpayable

Sets the protocol fee controller

Parameters

Name Type Description
controller address The new protocol fee controller
settle() payable

Called by the user to pay what is owed

Returns

Name Type Description
uint256 paid The amount of currency settled
settleFor(recipient: address) payable

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
swap(key: tuple, params: tuple, hookData: bytes) nonpayable

Executes a swap against the state, and returns the amount deltas of the pool

dev: PoolManager checks that the pool is initialized before calling

Parameters

Name Type Description
key tuple
params tuple
hookData bytes

Returns

Name Type Description
swapDelta int256
sync(currency: address) nonpayable

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.

dev: This MUST be called before any ERC20 tokens are sent into the contract, but can be skipped for native tokens because the amount to settle is determined by the sent value. However, if an ERC20 token has been synced and not settled, and the caller instead wants to settle native funds, this function can be called with the native currency to then be able to settle the native currency

Parameters

Name Type Description
currency address
take(currency: address, to: address, amount: uint256) nonpayable

Called by the user to net out some value owed to the user

dev: Can also be used as a mechanism for free flash loans

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
transfer(receiver: address, id: uint256, amount: uint256) nonpayable

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
transferFrom(sender: address, receiver: address, id: uint256, amount: uint256) nonpayable

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
transferOwnership(newOwner: address) nonpayable

///////////////////////////////////////////////////////////

Parameters

Name Type Description
newOwner address
unlock(data: bytes) nonpayable

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.

dev: The only functions callable without an unlocking are `initialize` and `updateDynamicLPFee`

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)`
updateDynamicLPFee(key: tuple, newDynamicLPFee: uint24) nonpayable

Updates the pools lp fees for the a pool that has enabled dynamic lp fees.

dev: A swap fee totaling MAX_SWAP_FEE (100%) makes exact output swaps impossible since the input is entirely consumed by the fee

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

Approval(owner: address, spender: address, id: uint256, amount: uint256)

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
Donate(id: bytes32, sender: address, amount0: uint256, amount1: 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
Initialize(id: bytes32, currency0: address, currency1: address, fee: uint24, tickSpacing: int24, hooks: address, sqrtPriceX96: uint160, tick: int24)

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
ModifyLiquidity(id: bytes32, sender: address, tickLower: int24, tickUpper: int24, liquidityDelta: int256, salt: bytes32)

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
OperatorSet(owner: address, operator: address, approved: bool)

///////////////////////////////////////////////////////////

Name Type Indexed Description
owner address
operator address
approved bool
OwnershipTransferred(user: address, newOwner: address)

///////////////////////////////////////////////////////////

Name Type Indexed Description
user address
newOwner address
ProtocolFeeControllerUpdated(protocolFeeController: address)

Emitted when the protocol fee controller address is updated in setProtocolFeeController.

Name Type Indexed Description
protocolFeeController address
ProtocolFeeUpdated(id: bytes32, protocolFee: uint24)

Emitted when the protocol fee is updated for a pool.

Name Type Indexed Description
id bytes32
protocolFee uint24
Swap(id: bytes32, sender: address, amount0: int128, amount1: int128, sqrtPriceX96: uint160, liquidity: uint128, tick: int24, fee: 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
Transfer(caller: address, from: address, to: address, id: uint256, amount: uint256)

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