A project to collect and test properties of Ampleforth's AMPL token.
This repo offers an executable, property-based test suite for Ampleforth's AMPL token.
For more info, see the accompanying post Property-based Testing Ampleforth.
Note
Any contributions to add more properties to the project are highly welcome!
The project currently tests the following properties:
Rebase Properties:
- The gon-AMPL conversion rate is the (fixed) scaled total supply divided by the (elastic) total supply
- The rebase operation is non-dilutive, i.e. does not change the wallet wealth distribution
Total Supply Properties:
- The total supply never exceeds the defined max supply
- The total supply is never zero
- The sum of all balances never exceeds the total supply
- Note that rebase tokens can not guarantee that the sum of all balances equals the total supply
- For more info, see here
Transfer Properties:
- A transfer of x AMPLs from user A to user B results in A's external balance being decreased by precisely x AMPLs and B's external balance being increased by precisely x AMPLs
- A transfer of zero AMPL is always possible
- Calling the
tranferAllFrom
function reverts when the balance of the owner is non-zero and the allowance of the spender is zero
The project uses the Foundry toolchain. You can find installation instructions here.
Clone repo:
$ git clone https://github.com/pmerkleplant/ampleforth-property-tests
Install dependencies:
$ cd ampleforth-property-tests
$ forge install
Run test suite:
$ forge test
Run test suite with full stack trace:
$ forge test -vvvv
- Via the
transferAllFrom
function its possible to steal a non-zero amount of gons iff the derived AMPL amount rounds down to zero.