IExecutionAdapter
IExecutionAdapter
Interface for execution adapters that handle asset trading operations
Execution adapters are responsible for converting between the Orion protocol's underlying token and various asset types (ERC-4626 vaults, ERC-20 tokens, etc.). All buy/sell operations use the Orion underlying token as the base currency, regardless of the token standard of the target asset. The underlying token is defined in the OrionConfig contract and serves as the protocol's base asset.
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 sharesAmount) 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 |
| sharesAmount | uint256 | The amount of asset shares to buy |
Return Values
| Name | Type | Description |
|---|---|---|
| underlyingAmount | uint256 | The underlying amount required |
sell
function sell(address asset, uint256 sharesAmount) external returns (uint256 executionUnderlyingAmount)
Executes a sell operation by converting asset shares to underlying assets
Parameters
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the asset to sell |
| sharesAmount | uint256 | The amount of asset shares to sell |
Return Values
| Name | Type | Description |
|---|---|---|
| executionUnderlyingAmount | uint256 | The actual execution underlying amount received |
buy
function buy(address asset, uint256 sharesAmount) external returns (uint256 executionUnderlyingAmount)
Executes a buy operation by converting underlying assets to asset shares
Parameters
| Name | Type | Description |
|---|---|---|
| asset | address | The address of the asset to buy |
| sharesAmount | uint256 | The amount of asset shares to buy |
Return Values
| Name | Type | Description |
|---|---|---|
| executionUnderlyingAmount | uint256 | The actual execution underlying amount spent |