AeraVaultV1

API Documentation for `AeraVaultV1.sol` contract

AeraVaultV1

Risk-managed treasury vault.

Managed n-asset vault that supports withdrawals in line with a pre-defined validator contract.

Vault owner is the asset owner.

Methods

acceptOwnership

function acceptOwnership() external nonpayable

Accept ownership

bVault

function bVault() external view returns (contract IBVault)

Balancer Vault.

Returns

NameTypeDescription

_0

contract IBVault

undefined

cancelOwnershipTransfer

function cancelOwnershipTransfer() external nonpayable

Cancel current pending ownership transfer

cancelWeightUpdates

function cancelWeightUpdates() external nonpayable

Cancel the active weight update schedule.

Keep calculated weights from the schedule at the time.

claimGuardianFees

function claimGuardianFees() external nonpayable

Claim guardian fee.

This function shouldn't be called too frequently.

claimRewards

function claimRewards(IBMerkleOrchard.Claim[] claims, contract IERC20[] tokens) external nonpayable

Claim Balancer rewards.

It calls claimDistributions() function of Balancer MerkleOrchard. Once this function is called, the tokens will be transferred to the Vault and it can be distributed via sweep function.

Parameters

NameTypeDescription

claims

IBMerkleOrchard.Claim[]

An array of claims provided as a claim struct. See https://docs.balancer.fi/products/merkle-orchard/claiming-tokens#claiming-from-the-contract-directly.

tokens

contract IERC20[]

An array consisting of tokens to be claimed.

deposit

function deposit(IProtocolAPI.TokenValue[] tokenWithAmount) external nonpayable

Deposit tokens into vault.

It calls updateWeights() function which cancels current active weights change schedule.

Parameters

NameTypeDescription

tokenWithAmount

IProtocolAPI.TokenValue[]

Deposit tokens with amount.

depositIfBalanceUnchanged

function depositIfBalanceUnchanged(IProtocolAPI.TokenValue[] tokenWithAmount) external nonpayable

Deposit tokens into vault.

It calls updateWeights() function which cancels current active weights change schedule. It reverts if balances were updated in the current block.

Parameters

NameTypeDescription

tokenWithAmount

IProtocolAPI.TokenValue[]

Deposit token with amount.

description

function description() external view returns (string)

Describes vault purpose and modelling assumptions for differentiating between vaults

string cannot be immutable bytecode but only set in constructor

Returns

NameTypeDescription

_0

string

undefined

disableTrading

function disableTrading() external nonpayable

Disable swap.

enableTradingRiskingArbitrage

function enableTradingRiskingArbitrage() external nonpayable

Enable swap with current weights.

enableTradingWithWeights

function enableTradingWithWeights(IProtocolAPI.TokenValue[] tokenWithWeight) external nonpayable

Enable swap with updating weights.

These are checked by Balancer in internal transactions: If weight length and token length match. If total sum of weights is one. If weight is greater than minimum.

Parameters

NameTypeDescription

tokenWithWeight

IProtocolAPI.TokenValue[]

Tokens with new weights.

finalize

function finalize() external nonpayable

Destroy vault and returns all funds to treasury owner.

finalized

function finalized() external view returns (bool)

Indicates that the Vault has been finalized

Returns

NameTypeDescription

_0

bool

undefined

getHoldings

function getHoldings() external view returns (uint256[] amounts)

Underlying token balances.

Returns

NameTypeDescription

amounts

uint256[]

Token balances in underlying pool

getNormalizedWeights

function getNormalizedWeights() external view returns (uint256[])

Get token weights.

Returns

NameTypeDescription

_0

uint256[]

Normalized weights of tokens on Balancer pool.

getSwapFee

function getSwapFee() external view returns (uint256)

Get swap fee.

Divide by 10**18 for decimal representation

Returns

NameTypeDescription

_0

uint256

Swap fee from underlying Balancer pool.

getTokens

function getTokens() external view returns (contract IERC20[] tokens)

Get IERC20 Tokens Balancer Pool.

Returns

NameTypeDescription

tokens

contract IERC20[]

IERC20 tokens of Balancer pool.

getTokensData

function getTokensData() external view returns (contract IERC20[], uint256[], uint256)

Get Token Data of Balancer Pool.

Returns

NameTypeDescription

_0

contract IERC20[]

IERC20 tokens of Balancer pool.

_1

uint256[]

Balances of tokens of Balancer pool.

_2

uint256

Last updated Blocknumber.

holding

function holding(uint256 index) external view returns (uint256)

Balance of token with given index.

Parameters

NameTypeDescription

index

uint256

undefined

Returns

NameTypeDescription

_0

uint256

Token balance in underlying pool.

initialDeposit

function initialDeposit(IProtocolAPI.TokenValue[] tokenWithAmount) external nonpayable

Initialize Vault with first deposit.

Initial deposit must be performed before calling withdraw() or deposit() functions. It enables trading, so weights and balances should be in line with market spot prices, otherwise there is a significant risk of arbitrage. This is checked by Balancer in internal transactions: If token amount is not zero when join pool.

Parameters

NameTypeDescription

tokenWithAmount

IProtocolAPI.TokenValue[]

Deposit tokens with amount.

initialized

function initialized() external view returns (bool)

Indicates that the Vault has been initialized

Returns

NameTypeDescription

_0

bool

undefined

initiateFinalization

function initiateFinalization() external nonpayable

Initiate vault destruction and return all funds to treasury owner.

isSwapEnabled

function isSwapEnabled() external view returns (bool)

Check if vault trading is enabled.

Returns

NameTypeDescription

_0

bool

If public swap is turned on, returns true, otherwise false.

lastFeeCheckpoint

function lastFeeCheckpoint() external view returns (uint256)

Last timestamp where guardian fee index was locked.

Returns

NameTypeDescription

_0

uint256

undefined

lastSwapFeeCheckpoint

function lastSwapFeeCheckpoint() external view returns (uint256)

Last timestamp where swap fee was updated.

Returns

NameTypeDescription

_0

uint256

undefined

managementFee

function managementFee() external view returns (uint256)

Management fee earned proportion per second.

10**18 is 100%

Returns

NameTypeDescription

_0

uint256

undefined

guardian

function guardian() external view returns (address)

Controls vault parameters.

Returns

NameTypeDescription

_0

address

undefined

guardianFee

function guardiansFee(address, uint256) external view returns (uint256)

Fee earned amount by current guardian and previous guardians.

Parameters

NameTypeDescription

_0

address

undefined

_1

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

guardiansFeeTotal

function guardiansFeeTotal(uint256) external view returns (uint256)

Total guardian fee earned amount

Parameters

NameTypeDescription

_0

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

merkleOrchard

function merkleOrchard() external view returns (contract IBMerkleOrchard)

Balancer Merkle Orchard.

Returns

NameTypeDescription

_0

contract IBMerkleOrchard

undefined

noticePeriod

function noticePeriod() external view returns (uint256)

Notice period for vault termination (in seconds).

Returns

NameTypeDescription

_0

uint256

undefined

noticeTimeoutAt

function noticeTimeoutAt() external view returns (uint256)

Timestamp when notice elapses or 0 if not yet set

Returns

NameTypeDescription

_0

uint256

undefined

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription

_0

address

undefined

pendingOwner

function pendingOwner() external view returns (address)

Pending account to accept ownership of vault.

Returns

NameTypeDescription

_0

address

undefined

pool

function pool() external view returns (contract IBManagedPool)

Balancer Managed Pool.

Returns

NameTypeDescription

_0

contract IBManagedPool

undefined

poolController

function poolController() external view returns (contract IBManagedPoolController)

Balancer Managed Pool Controller.

Returns

NameTypeDescription

_0

contract IBManagedPoolController

undefined

poolId

function poolId() external view returns (bytes32)

Pool ID of Balancer pool on Vault.

Returns

NameTypeDescription

_0

bytes32

undefined

renounceOwnership

function renounceOwnership() external nonpayable

Disable ownership renounceable

setGuardian

function setGuardian(address newGuardian) external nonpayable

Change guardian.

Parameters

NameTypeDescription

newGuardian

address

undefined

setSwapFee

function setSwapFee(uint256 newSwapFee) external nonpayable

Change swap fee.

These are checked by Balancer in internal transactions: If new swap fee is less than maximum. If new swap fee is greater than minimum.

Parameters

NameTypeDescription

newSwapFee

uint256

undefined

sweep

function sweep(address token, uint256 amount) external nonpayable

Withdraw any tokens accidentally sent to vault.

Parameters

NameTypeDescription

token

address

undefined

amount

uint256

undefined

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Offer ownership to another address

It disables immediate transfer of ownership

Parameters

NameTypeDescription

newOwner

address

undefined

updateWeightsGradually

function updateWeightsGradually(IProtocolAPI.TokenValue[] tokenWithWeight, uint256 startTime, uint256 endTime) external nonpayable

Initiate weight move to target in given update window.

These are checked by Balancer in internal transactions: If target weight length and token length match. If total sum of target weights is one. If target weight is greater than minimum.

Parameters

NameTypeDescription

tokenWithWeight

IProtocolAPI.TokenValue[]

Tokens with target weights.

startTime

uint256

Timestamp at which weight movement should start.

endTime

uint256

Timestamp at which the weights should reach target values.

validator

function validator() external view returns (contract IWithdrawalValidator)

Verifies withdraw limits.

Returns

NameTypeDescription

_0

contract IWithdrawalValidator

undefined

withdraw

function withdraw(IProtocolAPI.TokenValue[] tokenWithAmount) external nonpayable

Withdraw tokens up to requested amounts.

It calls updateWeights() function which cancels current active weights change schedule.

Parameters

NameTypeDescription

tokenWithAmount

IProtocolAPI.TokenValue[]

Requested tokens with amount.

withdrawIfBalanceUnchanged

function withdrawIfBalanceUnchanged(IProtocolAPI.TokenValue[] tokenWithAmount) external nonpayable

Withdraw tokens up to requested amounts.

It calls updateWeights() function which cancels current active weights change schedule. It reverts if balances were updated in the current block.

Parameters

NameTypeDescription

tokenWithAmount

IProtocolAPI.TokenValue[]

Requested tokens with amount.

Events

CancelWeightUpdates

event CancelWeightUpdates(uint256[] weights)

Emitted when cancelWeightUpdates is called.

Parameters

NameTypeDescription

weights

uint256[]

Current weights of tokens.

Created

event Created(address indexed factory, string name, string symbol, contract IERC20[] tokens, uint256[] weights, uint256 swapFeePercentage, address indexed guardian, address indexed validator, uint256 noticePeriod, uint256 managementFee, address merkleOrchard, string description)

Emitted when the vault is created.

Parameters

NameTypeDescription

factory indexed

address

Balancer Managed Pool factory address.

name

string

Name of Pool Token.

symbol

string

Symbol of Pool Token.

tokens

contract IERC20[]

Token addresses.

weights

uint256[]

Token weights.

swapFeePercentage

uint256

Pool swap fee.

guardian indexed

address

Vault guardian address.

validator indexed

address

Withdrawal validator contract address.

noticePeriod

uint256

Notice period (in seconds).

managementFee

uint256

Management fee earned proportion per second.

merkleOrchard

address

Merkle Orchard address.

description

string

Vault description.

Deposit

event Deposit(uint256[] requestedAmounts, uint256[] amounts, uint256[] weights)

Emitted when tokens are deposited.

Parameters

NameTypeDescription

requestedAmounts

uint256[]

Requested amounts to deposit.

amounts

uint256[]

Deposited amounts.

weights

uint256[]

Token weights following deposit.

DistributeGuardianFees

event DistributeGuardianFees(address indexed guardian, uint256[] amounts)

Emitted when management fees are withdrawn.

Parameters

NameTypeDescription

guardian indexed

address

Guardian address.

amounts

uint256[]

Withdrawn amounts.

EnabledTradingWithWeights

event EnabledTradingWithWeights(uint256 time, uint256[] weights)

Emitted when enableTradingWithWeights is called.

Parameters

NameTypeDescription

time

uint256

timestamp of updates.

weights

uint256[]

Target weights of tokens.

FinalizationInitiated

event FinalizationInitiated(uint256 noticeTimeoutAt)

Emitted when initiateFinalization is called.

Parameters

NameTypeDescription

noticeTimeoutAt

uint256

Timestamp for notice timeout.

Finalized

event Finalized(address indexed caller, uint256[] amounts)

Emitted when vault is finalized.

Parameters

NameTypeDescription

caller indexed

address

Address of finalizer.

amounts

uint256[]

Returned token amounts.

GuardianChanged

event GuardianChanged(address indexed previousGuardian, address indexed guardian)

Emitted when guardian is changed.

Parameters

NameTypeDescription

previousGuardianindexed

address

Previous guardian address.

guardian indexed

address

New guardian address.

OwnershipTransferCanceled

event OwnershipTransferCanceled(address indexed currentOwner, address indexed canceledOwner)

Emitted when cancelOwnershipTransfer is called.

Parameters

NameTypeDescription

currentOwner indexed

address

Address of current owner.

canceledOwner indexed

address

Address of canceled owner.

OwnershipTransferOffered

event OwnershipTransferOffered(address indexed currentOwner, address indexed pendingOwner)

Emitted when transferOwnership is called.

Parameters

NameTypeDescription

currentOwner indexed

address

Address of current owner.

pendingOwner indexed

address

Address of pending owner.

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription

previousOwner indexed

address

undefined

newOwner indexed

address

undefined

SetSwapEnabled

event SetSwapEnabled(bool swapEnabled)

Emitted when swap is enabled/disabled.

Parameters

NameTypeDescription

swapEnabled

bool

New state of swap.

SetSwapFee

event SetSwapFee(uint256 swapFee)

Emitted when swap fee is updated.

Parameters

NameTypeDescription

swapFee

uint256

New swap fee.

UpdateWeightsGradually

event UpdateWeightsGradually(uint256 startTime, uint256 endTime, uint256[] weights)

Emitted when updateWeightsGradually is called.

Parameters

NameTypeDescription

startTime

uint256

Start timestamp of updates.

endTime

uint256

End timestamp of updates.

weights

uint256[]

Target weights of tokens.

Withdraw

event Withdraw(uint256[] requestedAmounts, uint256[] amounts, uint256[] allowances, uint256[] weights)

Emitted when tokens are withdrawn.

Parameters

NameTypeDescription

requestedAmounts

uint256[]

Requested amounts to withdraw.

amounts

uint256[]

Withdrawn amounts.

allowances

uint256[]

Token withdrawal allowances.

weights

uint256[]

Token weights following withdrawal.

Errors

Aera__AmountExceedAvailable

error Aera__AmountExceedAvailable(address token, uint256 amount, uint256 available)

Parameters

NameTypeDescription

token

address

undefined

amount

uint256

undefined

available

uint256

undefined

Aera__AmountIsBelowMin

error Aera__AmountIsBelowMin(uint256 actual, uint256 min)

Parameters

NameTypeDescription

actual

uint256

undefined

min

uint256

undefined

Aera__BalanceChangedInCurrentBlock

error Aera__BalanceChangedInCurrentBlock()

Aera__CallerIsNotGuardian

error Aera__CallerIsNotGuardian()

Aera__CallerIsNotOwnerOrGuardian

error Aera__CallerIsNotOwnerOrGuardian()

Aera__CannotSetSwapFeeBeforeCooldown

error Aera__CannotSetSwapFeeBeforeCooldown()

Aera__CannotSweepPoolToken

error Aera__CannotSweepPoolToken()

Aera__DescriptionIsEmpty

error Aera__DescriptionIsEmpty()

Aera__DifferentTokensInPosition

error Aera__DifferentTokensInPosition(address actual, address sortedToken, uint256 index)

Parameters

NameTypeDescription

actual

address

undefined

sortedToken

address

undefined

index

uint256

undefined

Aera__FinalizationNotInitiated

error Aera__FinalizationNotInitiated()

Aera__ManagementFeeIsAboveMax

error Aera__ManagementFeeIsAboveMax(uint256 actual, uint256 max)

Parameters

NameTypeDescription

actual

uint256

undefined

max

uint256

undefined

Aera__GuardianIsOwner

error Aera__GuardianIsOwner(address newGuardian)

Parameters

NameTypeDescription

newGuardian

address

undefined

Aera__GuardianIsZeroAddress

error Aera__GuardianIsZeroAddress()

Aera__NoAvailableFeeForCaller

error Aera__NoAvailableFeeForCaller(address caller)

Parameters

NameTypeDescription

caller

address

undefined

Aera__NoPendingOwnershipTransfer

error Aera__NoPendingOwnershipTransfer()

Aera__NotPendingOwner

error Aera__NotPendingOwner()

Aera__NoticePeriodIsAboveMax

error Aera__NoticePeriodIsAboveMax(uint256 actual, uint256 max)

Parameters

NameTypeDescription

actual

uint256

undefined

max

uint256

undefined

Aera__NoticeTimeoutNotElapsed

error Aera__NoticeTimeoutNotElapsed(uint256 noticeTimeoutAt)

Parameters

NameTypeDescription

noticeTimeoutAt

uint256

undefined

Aera__OwnerIsZeroAddress

error Aera__OwnerIsZeroAddress()

Aera__PoolSwapIsAlreadyEnabled

error Aera__PoolSwapIsAlreadyEnabled()

Aera__SwapFeePercentageChangeIsAboveMax

error Aera__SwapFeePercentageChangeIsAboveMax(uint256 actual, uint256 max)

Parameters

NameTypeDescription

actual

uint256

undefined

max

uint256

undefined

Aera__ValidatorIsNotMatched

error Aera__ValidatorIsNotMatched(uint256 numTokens, uint256 numAllowances)

Parameters

NameTypeDescription

numTokens

uint256

undefined

numAllowances

uint256

undefined

Aera__ValidatorIsNotValid

error Aera__ValidatorIsNotValid(address validator)

Parameters

NameTypeDescription

validator

address

undefined

Aera__ValueLengthIsNotSame

error Aera__ValueLengthIsNotSame(uint256 numTokens, uint256 numValues)

ERRORS ///

Parameters

NameTypeDescription

numTokens

uint256

undefined

numValues

uint256

undefined

Aera__VaultIsAlreadyFinalized

error Aera__VaultIsAlreadyFinalized()

Aera__VaultIsAlreadyInitialized

error Aera__VaultIsAlreadyInitialized()

Aera__VaultIsFinalizing

error Aera__VaultIsFinalizing()

Aera__VaultIsNotRenounceable

error Aera__VaultIsNotRenounceable()

Aera__VaultNotInitialized

error Aera__VaultNotInitialized()

Aera__WeightChangeDurationIsBelowMin

error Aera__WeightChangeDurationIsBelowMin(uint256 actual, uint256 min)

Parameters

NameTypeDescription

actual

uint256

undefined

min

uint256

undefined

Aera__WeightChangeEndBeforeStart

error Aera__WeightChangeEndBeforeStart()

Aera__WeightChangeEndTimeIsAboveMax

error Aera__WeightChangeEndTimeIsAboveMax(uint256 actual, uint256 max)

Parameters

NameTypeDescription

actual

uint256

undefined

max

uint256

undefined

Aera__WeightChangeRatioIsAboveMax

error Aera__WeightChangeRatioIsAboveMax(address token, uint256 actual, uint256 max)

Parameters

NameTypeDescription

token

address

undefined

actual

uint256

undefined

max

uint256

undefined

Aera__WeightChangeStartTimeIsAboveMax

error Aera__WeightChangeStartTimeIsAboveMax(uint256 actual, uint256 max)

Parameters

NameTypeDescription

actual

uint256

undefined

max

uint256

undefined

Aera__WeightIsAboveMax

error Aera__WeightIsAboveMax(uint256 actual, uint256 max)

Parameters

NameTypeDescription

actual

uint256

undefined

max

uint256

undefined

Aera__WeightIsBelowMin

error Aera__WeightIsBelowMin(uint256 actual, uint256 min)

Parameters

NameTypeDescription

actual

uint256

undefined

min

uint256

undefined

Last updated