IA0xRouter
Overview
License: Apache 2.0
interface IA0xRouterAuthor: Gabriele Rigo - gab@rigoblock.com Allows Rigoblock smart pools to execute swaps via the 0x AllowanceHolder and Settler contracts.
Errors info
DirectCallNotAllowed
error DirectCallNotAllowed()Thrown when a call is made directly to the adapter instead of via delegatecall.
RecipientNotSmartPool
error RecipientNotSmartPool()Thrown when the swap recipient is not the smart pool.
CounterfeitSettler
error CounterfeitSettler(address target)Thrown when the target is not a genuine 0x Settler instance.
UnsupportedSettlerFunction
Thrown when the Settler calldata has an unsupported function selector.
InvalidSettlerCalldata
Thrown when the Settler calldata is too short to decode.
InsufficientNativeBalance
Thrown when the pool does not hold enough native balance.
OperatorMustEqualTarget
Thrown when operator is not the same address as target.
AllowanceHolder stores the ephemeral allowance under operator. If operator differs from the genuine Settler (target), a malicious operator contract could consume the ephemeral allowance and drain pool tokens to an arbitrary address.
TransferFromRecipientNotSettler
Thrown when a TRANSFER_FROM action's recipient is not the Settler itself.
Allowing an arbitrary recipient would let the pool owner drain funds.
Parameters:
recipient
address
The decoded recipient address that failed the check.
Functions info
exec (0x2213bc0b)
Execute a swap via the 0x AllowanceHolder contract.
The calldata is forwarded unmodified to AllowanceHolder after validation.
Parameters:
operator
address
The address authorized to consume the ephemeral allowance. Must equal target.
token
address
The sell token address.
amount
uint256
The sell token amount.
target
address payable
The 0x Settler contract address that will execute the swap.
data
bytes
The Settler.execute() calldata containing swap instructions.
Return values:
result
bytes
The return data from AllowanceHolder.exec.
Last updated