Algorithmic market operations (or AMOs), also referred to as direct deposit modules, are operations performed by contracts to mint or burn stablecoins without collateral immediately backing these stablecoins. Stablecoins minted by AMOs are still controlled by the protocol, and if other people start controlling these stablecoins, then this new supply should be properly backed in one way or another.
AMOs are conceived not to affect the peg of the stablecoin.
Angle is a decentralized stablecoin protocol, designed to be both over-collateralized and capital-efficient. For more information about the protocol, you can refer to Angle Documentation.
The protocol is made of different modules, each with their own set of smart contracts. This repo contains the smart contracts for the Algorithmic Market Operations (AMOs) of the protocol that allow the protocol to mint stablecoins in some specific places in DeFi.
The first AMO deployed is on the Curve pool agEUR-EUROC. LP tokens from this AMO are staked on both Stake DAO and Convex.
Documentation to understand Angle Protocol's AMOs is available here.
For a broader overview of the protocol and its different modules, you can also check this overview page of our developers documentation.
Other Angle-related smart contracts can be found in the following repositories:
Otherwise, for more info about the protocol, check out this portal of resources.
To install all the packages needed to run the tests, run:
yarn
Create a .env
file from the template file .env.example
.
If you don't define URI and mnemonics, default mnemonic will be used with a brand new local hardhat node.
Tests and scripts on this repo are written use either Hardhat or Foundry development toolbox.
To setup Foundry on this repo, simply run:
yarn foundry:setup
With Hardhat:
yarn compile
With Foundry:
forge build
yarn test
Defaults with hardhat
network, but another network can be specified with --network NETWORK_NAME
.
A single test file or a glob pattern can be appended to launch a reduced set of tests:
yarn test tests/vaultManager/*
yarn test
A single test file or a glob pattern can be appended to launch a reduced set of tests:
forge test --match-contract MarketplaceTest --match-test testTransferOrder -vvv
Some scripts require to fork mainnet. To do so, you must first ensure that the ETH_NODE_URI_FORK
in .env
is pointing to an archival node (note: Alchemy provides this functionnality for free but Infura doesn't).
Then, uncomment blockNumber
in the hardhat
network definition inside hardhat.config.ts
to boost node speed.
Then run:
FORK=true yarn hardhat run PATH_TO_SCRIPT
We try to keep our contract's code coverage above 99% (on Foundry and on Hardhat). All contract code additions should be covered by tests (locally and in mainnet-fork) before being merged and deployed on mainnet.
To run code coverage with Hardhat tests:
yarn coverage
A subgroup of tests can be run by specifying --testfiles "path/to/tests/*.ts"
.
If coverage runs out of memory, you can export this in your env and retry:
export NODE_OPTIONS=--max_old_space_size=4096
With Foundry, run:
yarn coverage:foundry
If you have issues running tests or scripts, you can try to regenerate contracts typescript bindings by running
yarn generate-types-from-abis
You can also delete node_modules
, cache
, and then re-install dependancies with yarn install --frozen-lockfile
.
At Angle, we consider the security of our systems a top priority. But even putting top priority status and maximum effort, there is still possibility that vulnerabilities exist.
We have therefore setup a bug bounty program with the help of Immunefi. The Angle Protocol bug bounty program is focused around our smart contracts with a primary interest in the prevention of:
- Thefts and freezing of principal of any amount
- Thefts and freezing of unclaimed yield of any amount
- Theft of governance funds
- Governance activity disruption
For more details, please refer to the official page of the bounty on Immunefi.
Level | |
---|---|
Critical | up to USD $500,000 |
High | USD $20,000 |
Medium | USD $2,500 |
All bug reports must include a Proof of Concept demonstrating how the vulnerability can be exploited to be eligible for a reward. This may be a smart contract itself or a transaction.