ERC1155Burnable.spec 905 B

1234567891011121314151617181920212223242526272829
  1. methods {
  2. balanceOf(address, uint256) returns uint256 envfree
  3. isApprovedForAll(address,address) returns bool envfree
  4. }
  5. /// If a method call reduces account balances, the caller must be either the
  6. /// holder of the account or approved to act on the holder's behalf.
  7. rule onlyHolderOrApprovedCanReduceBalance {
  8. address holder; uint256 token; uint256 amount;
  9. uint256 balanceBefore = balanceOf(holder, token);
  10. method f; env e; calldataarg args;
  11. f(e, args);
  12. uint256 balanceAfter = balanceOf(holder, token);
  13. assert balanceAfter < balanceBefore => e.msg.sender == holder || isApprovedForAll(holder, e.msg.sender),
  14. "An account balance may only be reduced by the holder or a holder-approved agent";
  15. }
  16. /// This rule should always fail.
  17. rule sanity {
  18. method f; env e; calldataarg args;
  19. f(e, args);
  20. assert false,
  21. "This rule should always fail";
  22. }