ERC20FlashMint.spec 928 B

12345678910111213141516171819202122232425262728
  1. import "erc20.spec"
  2. methods {
  3. maxFlashLoan(address) returns(uint256) envfree
  4. _burn(address account, uint256 amount) returns(bool) => specBurn(account, amount)
  5. }
  6. ghost mapping(address => uint256) trackedBurnAmount;
  7. function specBurn(address account, uint256 amount) returns bool { // retuns needed to overcome current CVL limitations: "could not type expression "specBurn(account,amount)", message: A summary must return a simple type, but specBurn(account,amount) returns 'void'"
  8. trackedBurnAmount[account] = amount;
  9. return true;
  10. }
  11. // STATUS - verified
  12. // fee + flashLoan amount is burned
  13. rule letsWatchItBurns(env e){
  14. address receiver; address token; uint256 amount; bytes data;
  15. uint256 feeBefore = flashFee(e, token, amount);
  16. flashLoan(e, receiver, token, amount, data);
  17. uint256 burned = trackedBurnAmount[receiver];
  18. assert to_mathint(amount + feeBefore) == burned, "cheater";
  19. }