AIP 6: Additional interface methods to the token and policy Source

AuthorNithin Krishna
Discussions-Tohttps://github.com/ampleforth/AIPs/issues/31
StatusImplemented
Created2021-1-26

Summary

The following additions to Ampleforth ERC20 and policy smart contracts are proposed.

  • Elastic token interface methods scaledBalanceOf, scaledTotalSupply, transferAll and transferAllFrom. #180, #187
  • Support for permit EIP-2612 (gasless approvals) #181
  • A convenience function (globalAmpleforthEpochAndAMPLSupply) on the policy contract for multi-chain integration #190 #189
  • Minor gas optimizations #186, #182


Test Cases

Unit tests have been added to test the additions.

scaledBalanceOf, scaledTotalSupply and globalAmpleforthEpochAndAMPLSupply do not modify any smart contract state.

The permit implementation is identical to existing audited implementations on the Aave’s AToken and OpenZeppelin.

transferAll and transferAllFrom are identical to the existing implementations of transfer and transferFrom on the AMPL ERC-20 token.