ERC1155Burnable.spec 924 B

123456789101112131415161718192021222324252627282930
  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 by the holder to act on the holder's
  7. /// behalf.
  8. rule onlyHolderOrApprovedCanReduceBalance {
  9. address holder; uint256 token; uint256 amount;
  10. uint256 balanceBefore = balanceOf(holder, token);
  11. method f; env e; calldataarg args;
  12. f(e, args);
  13. uint256 balanceAfter = balanceOf(holder, token);
  14. assert balanceAfter < balanceBefore => e.msg.sender == holder || isApprovedForAll(holder, e.msg.sender),
  15. "An account balance may only be reduced by the holder or a holder-approved agent";
  16. }
  17. /// This rule should always fail.
  18. rule sanity {
  19. method f; env e; calldataarg args;
  20. f(e, args);
  21. assert false,
  22. "This rule should always fail";
  23. }