Aura Finance
English
Search
K

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.

Sidechain Contracts

  • 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

AuraBalOFT

Sidechain auraBAL

constructor

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

initialize

function initialize(address _lzEndpoint, address _guardian) external
Initialize the contract.
Parameters
Name
Type
Description
_lzEndpoint
address
LayerZero endpoint contract
_guardian
address
Pause guardian

AuraBalProxyOFT

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

HarvestToken

struct HarvestToken {
address token;
uint256 rewards;
}

vault

address vault
auraBAL compounder vault contract address

internalTotalSupply

uint256 internalTotalSupply
Internally tracking of total auraBAL supply bridged

harvestSrcChainIds

uint16[] harvestSrcChainIds
Harvest src chain IDs array

totalClaimable

mapping(address => uint256) totalClaimable
token address mapped to amount

claimable

mapping(address => mapping(uint16 => uint256)) claimable
token address mapped srcChainId mapped to amount claimable

rewardReceiver

mapping(uint16 => address) rewardReceiver
srcChainId mapped to reward receiver

authorizedHarvesters

mapping(address => bool) authorizedHarvesters
Authorized harvesters

ofts

mapping(address => address) ofts
Token to OFT

Harvest

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

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

setAdapterParams

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.

setRewardReceiver

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

updateAuthorizedHarvesters

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

setOFT

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

setHarvestSrcChainIds

function setHarvestSrcChainIds(uint16[] _srcChainIds) external
Set srcChainIds to loop through for harvest
Parameters
Name
Type
Description
_srcChainIds
uint16[]
Source chain IDs

circulatingSupply

function circulatingSupply() public view returns (uint256)
returns the circulating amount of tokens on current chain

harvest

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

processClaimable

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

vaultExecute

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

rescue

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.

AuraOFT

Sidechain AURA

canonicalChainId

uint16 canonicalChainId
canonical chain ID

Locked

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

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

initialize

function initialize(address _lzEndpoint, address _guardian) external
Initialize the contract.
Parameters
Name
Type
Description
_lzEndpoint
address
LayerZero endpoint contract
_guardian
address
The pause guardian

setAdapterParams

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.

lock

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

AuraProxyOFT

Send and receive AURA to and from all the Sidechains and receives lock requests from the sidechains

locker

address locker
Aura Locker contract address

constructor

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

Create2Factory

Deploy contracts using CREATE2 opcode.
A factory contract that uses the CREATE2 opcode to deploy contracts with a deterministic address.

Deployed

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.

deployer

mapping(address => bool) deployer

updateDeployer

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

deploy

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.

computeAddress

function computeAddress(bytes32 salt, bytes32 codeHash) external view returns (address)

receive

receive() external payable
Fallback function that accepts Ether.

CrossChainConfig

Setter/Getter logic for cross chain layer zero config

getAdapterParams

mapping(uint16 => mapping(bytes32 => bytes)) getAdapterParams
srcChainId mapped to selector and configuration

SetAdapterParams

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.

setAdapterParams

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.

CrossChainMessages

Share types for cross chain messages

MAGIC_BYTES

bytes4 MAGIC_BYTES
_Magic Bytes to pad the custom message with bytes4(keccak256("isCustomMessage(bytes)"))

MessageType

enum MessageType {
LOCK,
FEES,
FEES_CALLBACK
}

L1Coordinator

Tracks the amount of fee debt accrued by each sidechain and sends AURA back to each sidechain for rewards

REWARD_MULTIPLIER_DENOMINATOR

uint256 REWARD_MULTIPLIER_DENOMINATOR

balToken

address balToken
BAL token contract

auraToken

address auraToken
AURA token contract

auraOFT

address auraOFT
AURA OFT token contract

treasury

address treasury
AURA treasury address

booster

address booster
Booster contract address

rewardMultiplier

uint256 rewardMultiplier
Reward multiplier

feeDebtOf

mapping(uint16 => uint256) feeDebtOf
src chain ID mapped to total feeDebt

settledFeeDebtOf

mapping(uint16 => uint256) settledFeeDebtOf
src chain ID mapped to total settled feeDebt

distributedFeeDebtOf

mapping(uint16 => uint256) distributedFeeDebtOf
src chain ID mapped to total distributed feeDebt

bridgeDelegates

mapping(uint16 => address) bridgeDelegates
src chain ID to bridgeDelegate

l2Coordinators

mapping(uint16 => address) l2Coordinators
src chain ID to L2Coordinator address

distributors

mapping(address => bool) distributors
sender to isDistributor

BridgeDelegateUpdated

event BridgeDelegateUpdated(uint16 srcChainId, address bridgeDelegate)
Parameters
Name
Type
Description
srcChainId
uint16
Source chain ID
bridgeDelegate
address
The bridge delegate contract

L2CoordinatorUpated

event L2CoordinatorUpated(uint16 srcChainId, address l2Coordinator)
Parameters
Name
Type
Description
srcChainId
uint16
Source chain ID
l2Coordinator
address
The l2Coordinator contract

DisributorUpdated

event DisributorUpdated(address distributor, bool active)
Parameters