Sidechain Contracts
Aura Finance is expanding to become a cross-chain protocol. Deploying to chains beyond Ethereum, with the intent to deploy to wherever the balancer is deployed and emitting rewards. As part of this expansion, a new set of contracts had been deployed.

​
- AuraBalProxyOFT.sol : L1 Aura BAL proxy OFT
- AuraBalOFT.sol : L2 Aura BAL OFT
- AuraProxyOFT.sol : L1 Aura proxy OFT
- AuraOFT.sol : L2 Aura OFT
- Create2Factory.sol : A create2 factory to deploy the sidechain contracts to constant addresses
- CrossChainConfig.sol : Abstract contract to handle setting LZ configs
- CrossChainMessages.sol : Shared LZ messaging library
- L1Coordinator.sol : L1 Coordinator handles sending messages to canonical chain
- L2Coordinator.sol : L2 Coordinator handles sending messages to canonical chain
- PausableOFT.sol : OFT extension that allows a
guardian
address to perform an emergency pause - PausableProxyOFT.sol : Proxy OFT extension that allows a
guardian
address to perform an emergency pause - PauseGuardian.sol : Allows to implement pauses triggered by a
guardian
address
​
Sidechain auraBAL
constructor(string _name, string _symbol) public
Constructs the AuraBalOFT contract.
Parameters
Name | Type | Description |
---|---|---|
_name | string | The oft token name |
_symbol | string | The oft token symbol |
function initialize(address _lzEndpoint, address _guardian) external
Initialize the contract.
Parameters
Name | Type | Description |
---|---|---|
_lzEndpoint | address | LayerZero endpoint contract |
_guardian | address | Pause guardian |
Send and receive auraBAL to and from all the sidechains. all auraBAL sat in this bridge will be staked in the auraBAL compounder and rewards distributed to the L2 staking contracts
struct HarvestToken {
address token;
uint256 rewards;
}
address vault
auraBAL compounder vault contract address
uint256 internalTotalSupply
Internally tracking of total auraBAL supply bridged
uint16[] harvestSrcChainIds
Harvest src chain IDs array
mapping(address => uint256) totalClaimable
token address mapped to amount
mapping(address => mapping(uint16 => uint256)) claimable
token address mapped srcChainId mapped to amount claimable
mapping(uint16 => address) rewardReceiver
srcChainId mapped to reward receiver
mapping(address => bool) authorizedHarvesters
Authorized harvesters
mapping(address => address) ofts
Token to OFT
event Harvest(address caller, uint256 totalUnderlyingSum)
Emitted when harvest rewards.
Parameters
Name | Type | Description |
---|---|---|
caller | address | The caller |
totalUnderlyingSum | uint256 | The total amount of auraBal staked on all sidechains. |
constructor(address _lzEndpoint, address _token, address _vault, address _guardian, address _sudo, uint256 _inflowLimit) public
Constructs the AuraBalProxyOFT contract
Parameters
Name | Type | Description |
---|---|---|
_lzEndpoint | address | LayerZero endpoint contract |
_token | address | The proxied token (auraBAL) |
_vault | address | The AuraBal compounder vault |
_guardian | address | The pause guardian address |
_sudo | address | The super user address |
_inflowLimit | uint256 | Initial inflow limit per epoch |
function setAdapterParams(uint16 _srcChainId, bytes32 _selector, bytes _adapterParams) external
Sets the configuration for a given source chain ID and selector.
Parameters
Name | Type | Description |
---|---|---|
_srcChainId | uint16 | The source chain ID. |
_selector | bytes32 | The selector. |
_adapterParams | bytes | The adapter params. |
function setRewardReceiver(uint16 _srcChainId, address _receiver) external
Set reward receiver for src chain
Parameters
Name | Type | Description |
---|---|---|
_srcChainId | uint16 | The source chain ID |
_receiver | address | The receiver address |
function updateAuthorizedHarvesters(address _harvester, bool _authorized) external
Adds or remove an address from the harvesters' whitelist
Parameters
Name | Type | Description |
---|---|---|
_harvester | address | address of the authorized harvester |
_authorized | bool | Whether to add or remove harvester |
function setOFT(address _token, address _oft) external
Set OFT for token
Parameters
Name | Type | Description |
---|---|---|
_token | address | Token contract address |
_oft | address | OFT contract address |
function setHarvestSrcChainIds(uint16[] _srcChainIds) external
Set srcChainIds to loop through for harvest
Parameters
Name | Type | Description |
---|---|---|
_srcChainIds | uint16[] | Source chain IDs |
function circulatingSupply() public view returns (uint256)
returns the circulating amount of tokens on current chain
function harvest(uint256[] _totalUnderlying, uint256 _totalUnderlyingSum) external
_Harvest rewards from the compounder and distribute them to the source chains
Collect the amount of auraBAL that is staked on each source chain (L2). Then
trigger a harvest on the vault which calculates the amount of auraBAL that has
been earned since the last claim and the amount of extra rewards. These rewards
are then lazily distributed to the src chains proportionally.
​
Lazily meaning the claimable values are just added to a claimable mapping for
processing latest via processClaimable_
Parameters
Name | Type | Description |
---|---|---|
_totalUnderlying | uint256[] | Array of totalUnderlying auraBAL staked on the source chain |
_totalUnderlyingSum | uint256 | Sum of values in _totalUnderlying array |
function processClaimable(address _token, uint16 _srcChainId, address _zroPaymentAddress) external payable
Process claimable rewards
Parameters
Name | Type | Description |
---|---|---|
_token | address | The token to process |
_srcChainId | uint16 | The source chain ID |
_zroPaymentAddress | address | The LayerZero ZRO payment address |
function vaultExecute(uint256 _value, bytes _data) external returns (bool, bytes)
Execute a function on the vault
In order to account for the withdrawalPenalty this contract needs To be the owner of the auraBAL vault. Therefore it needs to be able to call vault owner functions. Rather than wrapping each function we can just use an execute pointing at the vault
function rescue(address _token, address _to, uint256 _amount) external
Rescues the specified amount of tokens from the bridge and transfers them to the specified address.
This function is only callable by the sudo address.
Parameters
Name | Type | Description |
---|---|---|
_token | address | The address of the token to be rescued. |
_to | address | The address to which the tokens should be transferred. |
_amount | uint256 | The amount of tokens to be rescued. |
Sidechain AURA
uint16 canonicalChainId
canonical chain ID
event Locked(address caller, uint256 amount)
Emitted when locked cvx on the L1 chain
Parameters
Name | Type | Description |
---|---|---|
caller | address | The msg.sender |
amount | uint256 | The amount of cvx locked. |
constructor(string _name, string _symbol, uint16 _canonicalChainId) public
Constructs the AuraOFT contract.
Parameters
Name | Type | Description |
---|---|---|
_name | string | The oft token name |
_symbol | string | The oft token symbol |
_canonicalChainId | uint16 | The canonical chain id |
function initialize(address _lzEndpoint, address _guardian) external
Initialize the contract.
Parameters
Name | Type | Description |
---|---|---|
_lzEndpoint | address | LayerZero endpoint contract |
_guardian | address | The pause guardian |
function setAdapterParams(uint16 _srcChainId, bytes32 _selector, bytes _adapterParams) external
Sets the configuration for a given source chain ID and selector.
Parameters
Name | Type | Description |
---|---|---|
_srcChainId | uint16 | The source chain ID. |
_selector | bytes32 | The selector. |
_adapterParams | bytes | The adapter params. |
function lock(address _receiver, uint256 _cvxAmount, address _zroPaymentAddress) external payable
Lock CVX on the L1 chain
Parameters
Name | Type | Description |
---|---|---|
_receiver | address | address that will be receiving the refund and vlaura lock |
_cvxAmount | uint256 | Amount of CVX to lock for vlCVX on L1 |
_zroPaymentAddress | address | The LayerZero ZRO payment address |
Send and receive AURA to and from all the Sidechains and receives lock requests from the sidechains
address locker
Aura Locker contract address
constructor(address _lzEndpoint, address _token, address _locker, address _guardian, address _sudo, uint256 _inflowLimit) public
Constructs the AuraProxyOFT contract
Parameters
Name | Type | Description |
---|---|---|
_lzEndpoint | address | LayerZero endpoint contract |
_token | address | The proxied token (auraBAL) |
_locker | address | The Aura Locker contract address |
_guardian | address | The pause guardian address |
_sudo | address | The super user address |
_inflowLimit | uint256 | Initial inflow limit per epoch |
Deploy contracts using CREATE2 opcode.
A factory contract that uses the CREATE2 opcode to deploy contracts with a deterministic address.
event Deployed(bytes32 salt, address deployed)
Event emitted when a contract is successfully deployed.
Parameters
Name | Type | Description |
---|---|---|
salt | bytes32 | A unique value used as part of the computation to determine the contract's address. |
deployed | address | The address where the contract has been deployed. |
mapping(address => bool) deployer
function updateDeployer(address _deployer, bool _authorized) external
Adds or remove an address from the deployers' whitelist
Parameters
Name | Type | Description |
---|---|---|
_deployer | address | address of the authorized deployer |
_authorized | bool | Whether to add or remove deployer |
function deploy(uint256 amount, bytes32 salt, bytes bytecode, bytes[] callbacks) external returns (address)
Deploys a contract using the CREATE2 opcode.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of Ether to be sent with the transaction deploying the contract. |
salt | bytes32 | A unique value used as part of the computation to determine the contract's address. |
bytecode | bytes | The bytecode that will be used to create the contract. |
callbacks | bytes[] | Callbacks to execute after contract is created. |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The address where the contract has been deployed. |
function computeAddress(bytes32 salt, bytes32 codeHash) external view returns (address)
receive() external payable
Fallback function that accepts Ether.
Setter/Getter logic for cross chain layer zero config
mapping(uint16 => mapping(bytes32 => bytes)) getAdapterParams
srcChainId mapped to selector and configuration
event SetAdapterParams(uint16 srcChainId, bytes32 selector, bytes adapterParams)
Emitted a configuration is set for a given source chain id.
Parameters
Name | Type | Description |
---|---|---|
srcChainId | uint16 | The source chain ID. |
selector | bytes32 | The selector. |
adapterParams | bytes | The configuration. |
function setAdapterParams(uint16 _srcChainId, bytes32 _selector, bytes _adapterParams) external virtual
Sets the configuration for a given source chain ID and selector.
Parameters
Name | Type | Description |
---|---|---|
_srcChainId | uint16 | The source chain ID. |
_selector | bytes32 | The selector. |
_adapterParams | bytes | The adapter params. |
Share types for cross chain messages
bytes4 MAGIC_BYTES
_Magic Bytes to pad the custom message with bytes4(keccak256("isCustomMessage(bytes)"))
enum MessageType {
LOCK,
FEES,
FEES_CALLBACK
}
Tracks the amount of fee debt accrued by each sidechain and sends AURA back to each sidechain for rewards
uint256 REWARD_MULTIPLIER_DENOMINATOR
address balToken
BAL token contract
address auraToken
AURA token contract
address auraOFT
AURA OFT token contract
address treasury
AURA treasury address
address booster
Booster contract address
uint256 rewardMultiplier
Reward multiplier
mapping(uint16 => uint256) feeDebtOf
src chain ID mapped to total feeDebt
mapping(uint16 => uint256) settledFeeDebtOf
src chain ID mapped to total settled feeDebt
mapping(uint16 => uint256) distributedFeeDebtOf
src chain ID mapped to total distributed feeDebt
mapping(uint16 => address) bridgeDelegates
src chain ID to bridgeDelegate
mapping(uint16 => address) l2Coordinators
src chain ID to L2Coordinator address
mapping(address => bool) distributors
sender to isDistributor
event BridgeDelegateUpdated(uint16 srcChainId, address bridgeDelegate)
Parameters
Name | Type | Description |
---|---|---|
srcChainId | uint16 | Source chain ID |
bridgeDelegate | address | The bridge delegate contract |
event L2CoordinatorUpated(uint16 srcChainId, address l2Coordinator)
Parameters
Name | Type | Description |
---|---|---|
srcChainId | uint16 | Source chain ID |
l2Coordinator | address | The l2Coordinator contract |
event DisributorUpdated(address distributor, bool active)
Parameters