This repository contains the Autonolas tokenomics part of the autonolas-v1 protocol.
Autonolas Tokenomics
Introduction
This repository contains the tokenomics part of Autonolas onchain-protocol contracts.
A graphical overview is available here.
For reference purposes only, an older version of the general Autonolas architecture is available here.
An overview of the Autonolas tokenomics model is provided here. A description of the tokenomics contracts related to Olas staking is provided here.
Details on tokenomics model and Olas Staking can be found here and here.
The Depository and Treasury contracts are inspired by OlympusDAO concepts. The Tokenomics contract implements the brunt of the reward logic for component and agent owners, the logic that regulates the discount factor for bonds, and Olas staking emissions. The Tokenomics contract is deployed via the proxy contract, such that it is possible to update the current Tokenomics implementation.
- Core contracts:
- Staking related contracts:
- Auxiliary contracts:
Development
Prerequisites
- This repository follows the standard
Hardhatdevelopment process. - The code is written on Solidity starting from version
0.8.18. - The standard versions of Node.js along with Yarn are required to proceed further (confirmed to work with Yarn
1.22.19and npm10.1.0and nodev18.6.0); Foundryis required to run the foundry tests.
Install the dependencies
The project has submodules to get the dependencies. Make sure you rungit clone --recursive or init the submodules yourself.
The dependency list is managed by the package.json file, and the setup parameters are stored in the hardhat.config.js file.
Simply run the following command to install the project:
yarn install
Core components
The contracts, deploy scripts, regular scripts and tests are located in the following folders respectively:contracts
scripts
test
Compile the code and run
Hardhat
Compile the code with Hardhat:yarn compile
Run tests with Hardhat:
yarn test
Run coverage with Hardhat:
yarn coverage
Forge
Compile the code with Forge:forge build
Run unit tests with Forge (no fork required):
forge test --mc Depository -vvv
forge test --mc Dispenser -vvv
forge test --mc Treasury -vvv
Oracle unit tests
forge test --mc UniswapPriceOracleConstructorTest -vvv
forge test --mc UniswapPriceOracleGetPriceTest -vvv
forge test --mc UniswapPriceOracleUpdatePriceTest -vvv
forge test --mc UniswapPriceOracleGetTWAPTest -vvv
forge test --mc BalancerPriceOracleConstructorTest -vvv
forge test --mc BalancerPriceOracleGetPriceTest -vvv
forge test --mc BalancerPriceOracleUpdatePriceTest -vvv
forge test --mc BalancerPriceOracleGetTWAPTest -vvv
LPSwapCelo unit tests
forge test --mc LPSwapCeloConstructorTest -vvv
forge test --mc LPSwapCeloSwapTest -vvv
forge test --mc LPSwapCeloSlippageTest -vvv
Run fork tests with Forge (require RPC node URL for the target chain):
# Fork tests (ETH mainnet)
forge test -f $FORKETHNODE_URL --mc LiquidityManagerETH -vvv
forge test -f $FORKETHNODE_URL --mc UniswapPriceOracleETH -vvv
forge test -f $FORKETHNODE_URL --mc BuyBackBurnerUniswapETH -vvv
Fork tests (Base)
forge test -f $FORKBASENODE_URL --mc LiquidityManagerBase -vvv
forge test -f $FORKBASENODE_URL --mc BalancerPriceOracleBase -vvv
forge test -f $FORKBASENODE_URL --mc BuyBackBurnerBalancerBase -vvv
Fork tests (Polygon)
forge test -f $FORKPOLYGONNODE_URL --mc BuyBackBurnerBalancerPolygon -vvv
Fork tests (Arbitrum)
forge test -f $FORKARBITRUMNODE_URL --mc BuyBackBurnerBalancerArbitrum -vvv
Fork tests (Optimism)
forge test -f $FORKOPTIMISMNODE_URL --mc BuyBackBurnerTransferV3Optimism -vvv
Fork tests (Celo)
forge test -f https://forno.celo.org --mc LPSwapCeloForkTest -vvv
Audits
- The audit is provided as development matures. The latest audit reports can be found here: audits.
- A list of known vulnerabilities can be found here: Vulnerabilities list tokenomics.
Static audit
The static audit checks all the deployed contracts on-chain info correctness and can be run using the following script:node scripts/auditchains/auditcontracts_setup.js
Linters
Github workflows
The PR process is managed by github workflows, where the code undergoes several steps in order to be verified. Those include:- code installation;
- running linters;
- running tests.
Deployment
The deployment of contracts to the test- and main-net is split into step-by-step series of scripts for more control and checkpoint convenience. The description of deployment procedure can be found here: deployment.The finalized contract ABIs for deployment and their number of optimization passes are located here: ABIs.
For testing purposes, the hardhat node deployment script is located here.
Deployed Protocol
The list of contract addresses for different chains and their full contract configuration can be found here.In order to test the protocol setup on all the deployed chains, the audit script is implemented. Make sure to export required API keys for corresponding chains (see the script for more information). The audit script can be run as follows:
node scripts/auditchains/auditcontracts_setup.js
LP Token Guide
It is advised to check the following list of instructions before enabling OLAS-based LP tokens.LP Token List
OLAS-based LP tokens eligible for bonding come from various chains. At a minimum, after OLAS has been bridged to a specific chain, theOLAS-XCHAIN_TOKEN LP token is created to provide the liquidity on that chain.
In order to participate in bonding with LPs from different chains, the LP owner needs to transfer LP tokens to the ETH mainnet and deposit via a Depository contract directly, or by using the Bonding UI.
For more information about bonding enabled LP tokens and bridging see here.