Skip to content

Commit

Permalink
Add testSetApprovalForAllAndIsApprovedForAll erc1155
Browse files Browse the repository at this point in the history
  • Loading branch information
ninokeldishvili committed Nov 5, 2024
1 parent 9b23a02 commit 77f8be3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/src/concrete/receipt/Receipt.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,22 @@ contract ReceiptTest is ReceiptFactoryTest {
assertEq(balances[0], amountOne);
assertEq(balances[1], amountTwo);
}

function testSetApprovalForAllAndIsApprovedForAll(uint256 fuzzedKeyAlice, uint256 fuzzedKeyBob) public {
// Ensure the fuzzed key is within the valid range for secp256
address alice = vm.addr((fuzzedKeyAlice % (SECP256K1_ORDER - 1)) + 1);
address bob = vm.addr((fuzzedKeyBob % (SECP256K1_ORDER - 1)) + 1);
vm.assume(alice != bob);

TestReceipt receipt = createReceipt(alice);

vm.startPrank(alice);
// Alice approves operator
receipt.setApprovalForAll(bob, true);
assertTrue(receipt.isApprovedForAll(alice, bob));

// Alice revokes approval
receipt.setApprovalForAll(bob, false);
assertFalse(receipt.isApprovedForAll(alice, bob));
}
}

0 comments on commit 77f8be3

Please sign in to comment.