UniswapV3ExecutionAdapter
UniswapV3ExecutionAdapter
Execution adapter for Uniswap V3 pools
amountOutMinimum is set to 0 at the Uniswap level because slippage protection is enforced by the LiquidityOrchestrator. This avoids duplicating slippage checks.
UNISWAP_V3_FACTORY
contract IUniswapV3Factory UNISWAP_V3_FACTORY
Uniswap V3 Factory contract
SWAP_ROUTER
contract ISwapRouter SWAP_ROUTER
Uniswap V3 SwapRouter contract
QUOTER
contract IQuoterV2 QUOTER
Uniswap V3 QuoterV2 contract
CONFIG
contract IOrionConfig CONFIG
Orion Config contract
UNDERLYING_ASSET
address UNDERLYING_ASSET
Protocol underlying asset
LIQUIDITY_ORCHESTRATOR
contract ILiquidityOrchestrator LIQUIDITY_ORCHESTRATOR
Liquidity orchestrator contract
assetFee
mapping(address => uint24) assetFee
asset => Uniswap V3 pool fee tier
onlyOwnerOrGuardian
modifier onlyOwnerOrGuardian()
Restricts function to only owner or guardian
constructor
constructor(address initialOwner_, address factoryAddress, address swapRouterAddress, address quoterAddress, address configAddress) public
Constructor
Parameters
| Name | Type | Description |
|---|---|---|
| initialOwner_ | address | The address of the initial owner |
| factoryAddress | address | Uniswap V3 Factory address |
| swapRouterAddress | address | Uniswap V3 SwapRouter address |
| quoterAddress | address | Uniswap V3 QuoterV2 address |
| configAddress | address | OrionConfig contract address |
setAssetFee
function setAssetFee(address asset, uint24 fee) external
Sets the fee tier for a given asset
Parameters
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the asset |
| fee | uint24 | The fee tier to set |
validateExecutionAdapter
function validateExecutionAdapter(address asset) external view
Validates that the given asset is compatible with this adapter
Parameters
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the asset to validate |
previewBuy
function previewBuy(address asset, uint256 amount) external returns (uint256 underlyingAmount)
Previews the underlying amount required to buy a given amount of an asset
Particularly useful in keeping execution adapters composable with each other, making refunding unnecessary when higher-level adapters use the previewed amount for downstream buy() calls.
Parameters
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the asset to buy |
| amount | uint256 |
Return Values
| Name | Type | Description |
|---|---|---|
| underlyingAmount | uint256 | The underlying amount required |
sell
function sell(address asset, uint256 amount) external returns (uint256 receivedAmount)
Executes a sell operation by converting asset shares to underlying assets
Parameters
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the asset to sell |
| amount | uint256 |
Return Values
| Name | Type | Description |
|---|---|---|
| receivedAmount | uint256 |
buy
function buy(address asset, uint256 amount) external returns (uint256 spentAmount)
Executes a buy operation by converting underlying assets to asset shares
Parameters
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the asset to buy |
| amount | uint256 |
Return Values
| Name | Type | Description |
|---|---|---|
| spentAmount | uint256 |