ERC1155Burnable.spec 837 B

12345678910111213141516171819202122232425262728
  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 should be either the
  6. /// owner of the account or approved by the owner to act on its behalf.
  7. rule onlyApprovedCanReduceBalance {
  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); // TODO add assert message
  14. }
  15. /// This rule should always fail.
  16. rule sanity {
  17. method f; env e; calldataarg args;
  18. f(e, args);
  19. assert false,
  20. "This rule should always fail";
  21. }