Elastic Peripheral Base Contracts
DeadlineValidation
Validate if the block timestamp has not reached the deadline yet, use for transactions with a deadline.
Modifier: onlyNotExpired()
onlyNotExpired()
Reverts if the current block's timestamp is greater than the specified deadline
.
Field | Type | Explanation |
---|---|---|
|
| Timestamp to check against current block's timestamp |
_blockTimestamp()
_blockTimestamp()
Returns the current block timestamp. Used for overriding by mock contracts for tests.
ERC721Permit
Nonfungible tokens that support an approve via signature, i.e. permit for ERC721.
ImmutableRouterStorage
Immutable variables that are used by Periphery contracts.
Immutables
Field | Type | Explanation |
---|---|---|
|
| Factory contract address |
|
| Canonical WETH address |
|
| keccak256 hash of the pool's creation code. Used to compute the pool address without reading storage from the Factory |
RouterTokenHelper
A helper contract to handle transfers, wrapping and unwrapping of tokens.
unwrapWeth()
unwrapWeth()
Unwraps the contract's entire WETH balance to ETH, then transfers them to the recipient.
Input Field | Type | Explanation |
---|---|---|
|
| Contract's WETH balance should not be lower than this amount |
|
| Desired recipient of unwrapped ETH |
transferAllTokens()
transferAllTokens()
Transfers the contract's entire token
balance to the recipient
Input Field | Type | Explanation |
---|---|---|
|
| Token to transfer |
|
| Contract's token balance should not be lower than this amount |
|
| Desired recipient of the token |
refundEth()
refundEth()
Transfers all ETH balance to the sender.
_transferTokens()
_transferTokens()
Internal function to help transfer tokens from the sender
to the recipient
. If token
is WETH and the contract has enough ETH balance, then wrap and transfer WETH, otherwise use RouterTokenHelper to handle transfers.
Input Field | Type | Explanation |
---|---|---|
|
| Token to transfer |
|
| Address to pull |
|
| Desired recipient of the token |
|
| Amount to be transferred |
RouterTokenHelperWithFee
Inherits RouteTokenHelper. Contains additional functions to charge a fee for transfers as well.
unwrapWethWithFee()
unwrapWethWithFee()
Unwraps the contract's entire WETH balance to ETH, then transfers them to the recipient
. Charges a fee which is transferred to feeRecipient
Input Field | Type | Explanation |
---|---|---|
|
| Contract's WETH balance should not be lower than this amount |
|
| Desired recipient of unwrapped ETH |
|
| Fee to charge in basis points |
|
| Address to receive the fee charged |
transferAllTokensWithFee()
transferAllTokensWithFee()
Transfers the contract's entire token
balance to the recipient. Charges a fee which is transferred to feeRecipient
.
Input Field | Type | Explanation |
---|---|---|
|
| Token to transfer |
|
| Contract's token balance should not be lower than this amount |
|
| Desired recipient of the token |
|
| Fee to charge in basis points |
|
| Address to receive the fee charged |
Multicall
Enables calling multiple methods in a single call to the contract.
multicall()
multicall()
Uses delegateCall
to sequentially execute functions, then return the result of each execution.
Input
Field | Type | Explanation |
---|---|---|
|
| encoded function data for each of the calls to make to this contract |
Output
Field | Type | Explanation |
---|---|---|
|
| results from each of the calls passed in |
LiquidityHelper
A helper contract to handle liquidity related actions, including mint/add/remove liquidity.
Struct: AddLiquidityParams
Used when minting a new position or adding liquidity to an existing one.
Field | Type | Explanation |
---|---|---|
|
| first token of the pool |
|
| second token of the pool |
|
| the pool's swap fee |
|
| position's lower tick |
|
| position's upper tick |
|
| an array containing 2 values |
|
| token0 amount user wants to add |
|
| token1 amount user wants to add |
|
| minimum token0 amount that should be used |
|
| minimum token1 amount that should be used |
Struct: CallbackData
Data for callback from Pool contract.
Field | Type | Explanation |
---|---|---|
|
| first token of the pool |
|
| second token of the pool |
|
| the pool's swap fee |
|
| address to transfer token0/token1 from |
proAMMMintCallback()
proAMMMintCallback()
Mint callback function implementation called by a Pool.
Input Field | Type | Explanation |
---|---|---|
|
| token0 amount requested by the pool |
|
| token1 amount requested by the pool |
|
| Encoded |
_addLiquidity()
_addLiquidity()
Add liquidity to a pool. token0 and token1 should be in the correct order, i.e token0 < token1.
Input
Type | Explanation |
---|---|
Parameters for addiing liquidity to a pool |
Output
Field | Type | Explanation |
---|---|---|
|
| amount of liquidity added |
|
| amount of token0 required |
|
| amount of token1 required |
|
| latest feeGrowthInsideLast calculated by the pool |
|
| pool address |
_callbackData()
_callbackData()
Function to encode input parameters to CallbackData
Input Field | Type | Explanation |
---|---|---|
|
| first token of the pool |
|
| second token of the pool |
|
| the pool's swap fee |
_getPool()
_getPool()
Function for computing the pool address with the given input parameters.
Input Field | Type | Explanation |
---|---|---|
|
| first token of the pool |
|
| second token of the pool |
|
| the pool's swap fee |
Last updated