Skip to main content

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

NameTypeDescription
initialOwner_addressThe address of the initial owner
factoryAddressaddressUniswap V3 Factory address
swapRouterAddressaddressUniswap V3 SwapRouter address
quoterAddressaddressUniswap V3 QuoterV2 address
configAddressaddressOrionConfig contract address

setAssetFee

function setAssetFee(address asset, uint24 fee) external

Sets the fee tier for a given asset

Parameters

NameTypeDescription
assetaddressThe address of the asset
feeuint24The fee tier to set

validateExecutionAdapter

function validateExecutionAdapter(address asset) external view

Validates that the given asset is compatible with this adapter

Parameters

NameTypeDescription
assetaddressThe 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

NameTypeDescription
assetaddressThe address of the asset to buy
amountuint256

Return Values

NameTypeDescription
underlyingAmountuint256The 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

NameTypeDescription
assetaddressThe address of the asset to sell
amountuint256

Return Values

NameTypeDescription
receivedAmountuint256

buy

function buy(address asset, uint256 amount) external returns (uint256 spentAmount)

Executes a buy operation by converting underlying assets to asset shares

Parameters

NameTypeDescription
assetaddressThe address of the asset to buy
amountuint256

Return Values

NameTypeDescription
spentAmountuint256