AuraAdapter
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 assetsSTAKE
: Stake assets
Structs
GeneralExtraData
Members
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target gauge deposit pool |
OperateExtraData
Used to indicate the appropriate action of a Operate Operation.
Members
Name | Type | Description |
---|---|---|
operateOperation | OperateOperation | The action to conduct |
pool | IBaseRewardPool4626 | The target gauge deposit pool |
State Variables
MAX_UINT256
Defines the maximum possible amount to be used when staking.
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.
Parameters
Name | Type | Description |
---|---|---|
<none> | bytes | ABI 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.
Parameters
Name | Type | Description |
---|---|---|
out | IAdapter.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. |
extraData | bytes | ABI 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.
Parameters
Name | Type | Description |
---|---|---|
<none> | IAdapter.TokenAmount[] | Array of TokenAmount structs defining the token compositions to send. Not used in this context. |
expectedIn | IAdapter.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) |
extraData | bytes | ABI 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.
Parameters
Name | Type | Description |
---|---|---|
<none> | IAdapter.TokenAmount[] | Array of TokenAmount structs defining the token compositions to send. Not used in this context. |
expectedIn | IAdapter.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) |
extraData | bytes | ABI 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.
Parameters
Name | Type | Description |
---|---|---|
out | IAdapter.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). |
expectedIn | IAdapter.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) |
extraData | bytes | ABI 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.
_withdrawAndUnwrapAsset
Withdraws a given amount of the LP token from a target pool.
Called by _withdraw function.
Parameters
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target deposit gauge pool |
amount | uint256 | The amount of LP token to withdraw |
claim | bool | Flag to indicate whether to claim rewards |
_withdrawAllAndUnwrapAsset
Withdraws all LP tokens from a target pool.
Called by _withdraw function.
Parameters
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target deposit gauge pool |
claim | bool | Flag 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.
Parameters
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target deposit gauge pool |
out | IAdapter.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.
Parameters
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target deposit gauge pool |
expectedIn | IAdapter.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.
Parameters
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target deposit gauge pool |
amount | uint256 | The 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.
Parameters
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target deposit gauge pool |
_unstake
Internal function that interacts with the target deposit gauge pool by invoking its withdraw
method.
Called by _unstakeOperation function.
Parameters
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target deposit gauge pool |
amount | uint256 | The amount of LP token to unstake |
claim | bool | Flag 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.
Parameters
Name | Type | Description |
---|---|---|
pool | IBaseRewardPool4626 | The target deposit gauge pool |
claim | bool | Flag to indicate whether to claim rewards |