Nexera-FiAdapters & DeFi ProtocolsAura

AuraAdapter

Git Source

Extends: BaseAdapter

The AuraAdapter is designed to interact with the Aura Finance Protocol.

This adapter enables users to harness the power of Aura Finance capabilities and integrate them into their financial strategies.

Enums

OperateOperation

Defines the actions available with respect to Operate Operations:

  • UNSTAKE: Unstake assets
  • STAKE: Stake assets
enum OperateOperation{ UNSTAKE, STAKE }

Structs

GeneralExtraData

struct GeneralExtraData {
    IBaseRewardPool4626 pool;
}

Members

NameTypeDescription
poolIBaseRewardPool4626The target gauge deposit pool

OperateExtraData

Used to indicate the appropriate action of a Operate Operation.

struct OperateExtraData {
    OperateOperation operateOperation;
    IBaseRewardPool4626 pool;
}

Members

NameTypeDescription
operateOperationOperateOperationThe action to conduct
poolIBaseRewardPool4626The target gauge deposit pool

State Variables

MAX_UINT256

Defines the maximum possible amount to be used when staking.

uint256 constant MAX_UINT256 = type(uint256).max;

Functions

initialize

The initialize function has an empty body and serves as a structural requirement to comply with the BaseAdapter. It doesn't execute any specific actions.

function initialize(bytes calldata) external override;

Parameters

NameTypeDescription
<none>bytesABI encoded data (Not used in this context)

_deposit

Internal function for handling Deposit Operations.

This function is responsible for depositing and automatically staking Balancer LP tokens (BPT), via invoking the deposit method of the target Pool.

Called by executeAction function.

function _deposit(
    IAdapter.TokenAmount[] calldata out,
    IAdapter.TokenAmount[] calldata,
    bytes calldata extraData
) internal override;

Parameters

NameTypeDescription
outIAdapter.TokenAmount[]Array of TokenAmount structs defining the token compositions to send
<none>IAdapter.TokenAmount[]Array of TokenAmount structs defining the expected token compositions to receive. Not used in this context.
extraDatabytesABI encoded data of type GeneralExtraData. It holds the address of the target gauge deposit pool.

_withdraw

Internal function for handling Withdraw Operations.

This function is used to withdraw the repsective Balancer LP (BPT) token and decide whether to claim reward tokens from the target pool.

Called by executeAction function.

function _withdraw(
    IAdapter.TokenAmount[] calldata,
    IAdapter.TokenAmount[] calldata expectedIn,
    bytes calldata extraData
) internal override;

Parameters

NameTypeDescription
<none>IAdapter.TokenAmount[]Array of TokenAmount structs defining the token compositions to send. Not used in this context.
expectedInIAdapter.TokenAmount[]Array of TokenAmount structs defining the expected token compositions to receive. In this array : - expectedIn[0] should include the address and the amount for the BPT token (amount==0 means withdraw all). - expectedIn[1] should include the address and amount for the reward token (The amount field must be different from 0 to claim). - Remaining array members should include the extra reward tokens' compositions (The amount field must be 0 if the function doesn't claim)
extraDatabytesABI encoded data of type GeneralExtraData. It holds the address of the target gauge deposit pool.

_collect

Internal function for handling Collect Operations.

This function is used to claim the reward tokens from the target pool, via invoking the getReward method of the pool.

Called by executeAction function.

function _collect(
    IAdapter.TokenAmount[] calldata,
    IAdapter.TokenAmount[] calldata expectedIn,
    bytes calldata extraData
) internal override;

Parameters

NameTypeDescription
<none>IAdapter.TokenAmount[]Array of TokenAmount structs defining the token compositions to send. Not used in this context.
expectedInIAdapter.TokenAmount[]Array of TokenAmount structs defining the expected token compositions to receive. In this array : - expectedIn[0] should include the address of the pool's reward token (The amount field is not used in this context). - Remaining array members should include the extra reward tokens' compositions (The amount field is not used in this context)
extraDatabytesABI encoded data of type GeneralExtraData. It holds the address of the target gauge deposit pool.

_operate

Internal function for handling Operate Operations.

This function is used to stake or unstake Balancer LP (BPT) tokens and decide whether to claim reward tokens from the target pool.

Called by executeAction function.

function _operate(
    IAdapter.TokenAmount[] calldata out,
    IAdapter.TokenAmount[] calldata expectedIn,
    bytes calldata extraData
) internal override;

Parameters

NameTypeDescription
outIAdapter.TokenAmount[]Array of TokenAmount structs defining the token compositions to send. It should contain only the address and amount for the token to be staked (MAX_UINT256 is used to stake all).
expectedInIAdapter.TokenAmount[]Array of TokenAmount structs defining the expected token compositions to receive. In this array : - expectedIn[0] should include the address and the amount for the token to be unstaked (amount==MAX_UINT256 means unstake all). - expectedIn[1] should include the address and amount for the reward token (The amount field must be different from 0 to claim). -Remaining array members should include the extra reward tokens compositions (The amount field must be 0 if the function doesn't claim)
extraDatabytesABI encoded data of type OperateExtraData. It holds the address of the target gauge deposit pool & the operate action (STAKE, or UNSTAKE).

_swap

This function always raises the OPERATION_NOT_SUPPORTED error, as Swap is not an action supported within the Aura deposit gauge pools.

Called by executeAction function.

function _swap(
    IAdapter.TokenAmount[] calldata /*out*/,
    IAdapter.TokenAmount[] calldata /*expectedIn*/,
    bytes calldata /*extraData*/
) internal virtual override;

_withdrawAndUnwrapAsset

Withdraws a given amount of the LP token from a target pool.

Called by _withdraw function.

function _withdrawAndUnwrapAsset(IBaseRewardPool4626 pool, uint256 amount, bool claim) internal;

Parameters

NameTypeDescription
poolIBaseRewardPool4626The target deposit gauge pool
amountuint256The amount of LP token to withdraw
claimboolFlag to indicate whether to claim rewards

_withdrawAllAndUnwrapAsset

Withdraws all LP tokens from a target pool.

Called by _withdraw function.

function _withdrawAllAndUnwrapAsset(IBaseRewardPool4626 pool, bool claim) internal;

Parameters

NameTypeDescription
poolIBaseRewardPool4626The target deposit gauge pool
claimboolFlag to indicate whether to claim rewards

_stakeOperation

Internal function for managing staking operations.

It checks the correctness of the provided data and initiates the appropriate staking action based on the specified parameters.

The decision between the appropriate staking action is determined by the amount field of the out parameter.

Called by _operate function.

function _stakeOperation(IBaseRewardPool4626 pool, IAdapter.TokenAmount[] calldata out) internal;

Parameters

NameTypeDescription
poolIBaseRewardPool4626The target deposit gauge pool
outIAdapter.TokenAmount[]Array of TokenAmount structs defining the token compositions to send. - If the amount field equals MAX_UINT256, the _stakeAll function is triggered.- If the amount field equals any other value (excluding zero) the _stake function is triggered.

_unstakeOperation

Internal function for managing unstaking operations.

It checks the correctness of the provided data and initiates the appropriate unstaking action based on the specified parameters.

The decision between the appropriate unstaking action is determined by the amount field of the expectedIn parameter.

Called by _operate function.

function _unstakeOperation(IBaseRewardPool4626 pool, IAdapter.TokenAmount[] calldata expectedIn) internal;

Parameters

NameTypeDescription
poolIBaseRewardPool4626The target deposit gauge pool
expectedInIAdapter.TokenAmount[]Array of TokenAmount structs defining the token compositions to receive.- If the amount field equals zero, the _unstakeAll function is triggered.- If the amount field equals any other value the _unstake function is triggered.Note: If expectedIn.length > 1 and expectedIn[1].token matches the reward token of the pool with a non-zero amount, then _unstake or _unstakeAll is triggered with input parameter claim set to true, signifying the intent to claim rewards alongside the unstaking action.

_stake

Internal function that interacts with the target deposit gauge pool by invoking its stake method.

It facilitates this action by first safe increasing the allowance of the pool for the staking token by amount.

Called by _stakeOperation function.

function _stake(IBaseRewardPool4626 pool, uint256 amount) internal;

Parameters

NameTypeDescription
poolIBaseRewardPool4626The target deposit gauge pool
amountuint256The amount of LP token to stake

_stakeAll

Internal function that interacts with the target deposit gauge pool by invoking its stakeAll method.

It facilitates this action by first safe increasing the allowance of the pool for the staking token to MAX_UINT256 amount.

Called by _stakeOperation function.

function _stakeAll(IBaseRewardPool4626 pool) internal;

Parameters

NameTypeDescription
poolIBaseRewardPool4626The target deposit gauge pool

_unstake

Internal function that interacts with the target deposit gauge pool by invoking its withdraw method.

Called by _unstakeOperation function.

function _unstake(IBaseRewardPool4626 pool, uint256 amount, bool claim) internal;

Parameters

NameTypeDescription
poolIBaseRewardPool4626The target deposit gauge pool
amountuint256The amount of LP token to unstake
claimboolFlag to indicate whether to claim rewards

_unstakeAll

Internal function that interacts with the target deposit gauge pool by invoking its withdrawAll method.

Called by _unstakeOperation function.

function _unstakeAll(IBaseRewardPool4626 pool, bool claim) internal;

Parameters

NameTypeDescription
poolIBaseRewardPool4626The target deposit gauge pool
claimboolFlag to indicate whether to claim rewards

On this page