Skip to main content

Solidity API

LiquidityOrchestrator

Contract that orchestrates liquidity operations

_This contract is responsible for:

  • Executing actual buy and sell orders on investment universe;
  • Processing withdrawal requests from LPs;
  • Handling slippage and market execution differences from adapter price estimates via liquidity buffer._

automationRegistry

address automationRegistry

Chainlink Automation Registry address

config

contract IOrionConfig config

Orion Config contract address

internalStatesOrchestrator

contract IInternalStateOrchestrator internalStatesOrchestrator

Internal States Orchestrator contract address

underlyingAsset

address underlyingAsset

Underlying asset address

executionAdapterOf

mapping(address => contract IExecutionAdapter) executionAdapterOf

Execution adapters mapping for assets

lastProcessedEpoch

uint16 lastProcessedEpoch

Last processed epoch counter from Internal States Orchestrator

executionMinibatchSize

uint8 executionMinibatchSize

Execution minibatch size

currentPhase

enum ILiquidityOrchestrator.LiquidityUpkeepPhase currentPhase

Upkeep phase

currentMinibatchIndex

uint8 currentMinibatchIndex

Current minibatch index

slippageBound

uint256 slippageBound

Slippage bound in basis points

targetBufferRatio

uint256 targetBufferRatio

Target buffer ratio

sellingTokens

address[] sellingTokens

Selling tokens for current epoch

sellingAmounts

uint256[] sellingAmounts

Selling amounts for current epoch

sellingEstimatedUnderlyingAmounts

uint256[] sellingEstimatedUnderlyingAmounts

Selling underlying amounts for current epoch

buyingTokens

address[] buyingTokens

Buying tokens for current epoch

buyingAmounts

uint256[] buyingAmounts

Buying amounts for current epoch

buyingEstimatedUnderlyingAmounts

uint256[] buyingEstimatedUnderlyingAmounts

Buying underlying amounts for current epoch

deltaBufferAmount

int256 deltaBufferAmount

Delta buffer amount for current epoch

onlyAutomationRegistry

modifier onlyAutomationRegistry()

Restricts function to only Chainlink Automation Registry

onlyConfig

modifier onlyConfig()

Restricts function to only Orion Config contract

constructor

constructor(address initialOwner, address config_, address automationRegistry_) public

Constructor

Parameters

NameTypeDescription
initialOwneraddressThe address of the initial owner
config_addressThe address of the OrionConfig contract
automationRegistry_addressThe address of the Chainlink Automation Registry

updateExecutionMinibatchSize

function updateExecutionMinibatchSize(uint8 _executionMinibatchSize) external

Updates the execution minibatch size

Parameters

NameTypeDescription
_executionMinibatchSizeuint8The new execution minibatch size

updateAutomationRegistry

function updateAutomationRegistry(address newAutomationRegistry) external

Updates the Chainlink Automation Registry address

Parameters

NameTypeDescription
newAutomationRegistryaddressThe new automation registry address

setInternalStatesOrchestrator

function setInternalStatesOrchestrator(address _internalStatesOrchestrator) external

Sets the internal states orchestrator address

Can only be called by the contract owner

Parameters

NameTypeDescription
_internalStatesOrchestratoraddressThe address of the internal states orchestrator

setSlippageBound

function setSlippageBound(uint256 _slippageBound) external

Sets the slippage bound

Parameters

NameTypeDescription
_slippageBounduint256The new slippage bound

claimProtocolFees

function claimProtocolFees(uint256 amount) external

Claim protocol fees with specified amount

Called by the Owner to claim a specific amount of protocol fees

Parameters

NameTypeDescription
amountuint256The amount of protocol fees to claim

setExecutionAdapter

function setExecutionAdapter(address asset, contract IExecutionAdapter adapter) external

Register or replace the execution adapter for an asset.

Can only be called by the Orion Config contract.

Parameters

NameTypeDescription
assetaddressThe address of the asset.
adaptercontract IExecutionAdapterThe execution adapter for the asset.

unsetExecutionAdapter

function unsetExecutionAdapter(address asset) external

Unregister the execution adapter for an asset.

Can only be called by the Orion Config contract.

Parameters

NameTypeDescription
assetaddressThe address of the asset.

returnDepositFunds

function returnDepositFunds(address user, uint256 amount) external

Return deposit funds to a user who cancelled their deposit request

Called by vault contracts when users cancel deposit requests

Parameters

NameTypeDescription
useraddressThe user to return funds to
amountuint256The amount to return

transferCuratorFees

function transferCuratorFees(uint256 amount) external

Transfer pending curator fees to a vault owner

Called by vault contracts when vault owners claim their fees

Parameters

NameTypeDescription
amountuint256The amount of fees to transfer

transferRedemptionFunds

function transferRedemptionFunds(address user, uint256 amount) external

Transfer redemption funds to a user after shares are burned

Called by vault contracts when processing redemption requests

Parameters

NameTypeDescription
useraddressThe user to transfer funds to
amountuint256The amount of underlying assets to transfer

checkUpkeep

function checkUpkeep(bytes) external view returns (bool upkeepNeeded, bytes performData)

Checks if the upkeep is needed

Return Values

NameTypeDescription
upkeepNeededboolWhether the upkeep is needed
performDatabytesThe data to perform the upkeep

performUpkeep

function performUpkeep(bytes performData) external

Performs the upkeep

Parameters

NameTypeDescription
performDatabytesThe encoded data containing the action and minibatch index

_handleStart

function _handleStart() internal

Handles the start action

_processMinibatchSell

function _processMinibatchSell(uint8 minibatchIndex) internal

Handles the sell action

Parameters

NameTypeDescription
minibatchIndexuint8The index of the minibatch to process

_processMinibatchBuy

function _processMinibatchBuy(uint8 minibatchIndex) internal

Handles the buy action

Parameters

NameTypeDescription
minibatchIndexuint8The index of the minibatch to process

_executeSell

function _executeSell(address asset, uint256 sharesAmount, uint256 estimatedUnderlyingAmount) internal

Executes a sell order

Parameters

NameTypeDescription
assetaddressThe asset to sell
sharesAmountuint256The amount of shares to sell
estimatedUnderlyingAmountuint256The estimated underlying amount to receive

_executeBuy

function _executeBuy(address asset, uint256 sharesAmount, uint256 estimatedUnderlyingAmount) internal

Executes a buy order

Parameters

NameTypeDescription
assetaddressThe asset to buy
sharesAmountuint256The amount of shares to buy
estimatedUnderlyingAmountuint256The estimated underlying amount to spend

_processFulfillRedeem

function _processFulfillRedeem() internal

Handles the fulfill redeem action