Platform: Code4rena
Start Date: 20/01/2022
End Date: 26/01/2022
Period: 7 days
Status: Completed
Reporters: liveactionllama, CloudEllie
Pot Size: $50,000 USDC
Participants: 35
Reporters: liveactionllama, CloudEllie
Judge: GalloDaSballo
Id: 77
League: ETH
WatchPug | 1/35 | $33,760.19 | 5 | 2 | 2 | 1 | 0 | - | - | 0 |
gzeon | 2/35 | $1,779.97 | 2 | 0 | 0 | 0 | 0 | - | - | 0 |
0x0x0x | 3/35 | $1,673.77 | 2 | 0 | 0 | 0 | 0 | - | - | 0 |
Meta0xNull | 4/35 | $1,551.19 | 2 | 0 | 0 | 0 | 0 | - | - | 0 |
danb | 5/35 | $1,250.60 | 2 | 0 | 0 | 1 | 0 | - | 0 | 0 |
hyh | 6/35 | $845.00 | 2 | 0 | 0 | 1 | 0 | - | 0 | 0 |
camden | 7/35 | $845.00 | 2 | 0 | 0 | 1 | 0 | - | 0 | 0 |
Dravee | 8/35 | $747.29 | 2 | 0 | 0 | 0 | 0 | - | - | 0 |
pauliax | 9/35 | $527.72 | 2 | 0 | 0 | 0 | 0 | - | - | 0 |
harleythedog | 10/35 | $405.60 | 1 | 0 | 0 | 0 | 0 | - | 0 | 0 |
Auditor per page
ElasticSwap is the first Automated Market Maker (AMM) built explicitly to support elastic supply tokens. Our goal is to provide a familiar AMM experience to users that supports the many newly released rebasing tokens. Previous AMMs, like Uniswap have not provided workable solutions to rebasing token or have even advised protocols from creating them.
For example the Uniswap V2 Docs have this warning:
While positive rebalancing does not break any functionality of Uniswap, those interested in them should be aware that the positive balance found in any pair will be freely available for taking.
While supplying liquidity in a Uniswap V2 pool, liquidity providers are losing out on any rebasing that occurs and leaving it up for grabs for anyone.
We have solved this problem, allowing liquidity providers to receive their expected rebases while still providing liquidity in our pools.
Contract | SLOC | External Contracts Called | Libraries Used |
---|---|---|---|
Exchange.sol | 326 | ERC20.sol | MathLib.sol, OpenZeppelin |
ExchangeFactory.sol | 85 | NA | OpenZeppelin |
MathLib.sol | 709 | NA | NA |
All source code in src/contracts/mocks is explicitly out of scope and is used for testing only
Fee on Transfer Tokens are NOT supported in our current implementation
Exchange - a single instance of our amm that represents a Base Token
and Quote Token
Pair.
Base Token - an arbitrary ERC20 token that may be a token with elastic supply / rebases. (think sOHM, sKLIMA, etc)
Quote Token - an arbitrary ERC20 token that should be a token that does not rebase / has fixed supply.
Decay - the result of the imbalance in tokens that occurs immediately after a rebase occurs in the Base Token
. See our math document below for more information on this important concept.
Our novel AMM approach is made possible by a mathematical model that ensures equality among all liquidity providers in the light of tokens that do not have a fixed supply. The math that allows for this functionality is outlined in this document. Please review the examples in this document to understand the math around how our unique AMM works.
We have developed this protocol using HardHat and there is extensive test coverage that should help Wardens understand functionality and also probe at potential issues.
To run tests please see instructions in the README.md inside of ./elasticswap
x*y=k
. Any ability to execute a swap that doesn't occur along this curve would be obviously problematic and something we would ask Wardens to spend extra time considering