diff --git a/.gas-snapshot b/.gas-snapshot index 3904560b..e292bafe 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -88,25 +88,25 @@ CreateAddressTest:testComputeAddressSelfNonceUint56() (gas: 534925) CreateAddressTest:testComputeAddressSelfNonceUint64() (gas: 535028) CreateAddressTest:testComputeAddressSelfNonceUint8() (gas: 534652) CreateAddressTest:testComputeAddressSelfRevertTooHighNonce() (gas: 8899) -CreateAddressTest:testFuzzComputeAddressNonce0x7f(uint64,address) (runs: 256, μ: 533177, ~: 533249) -CreateAddressTest:testFuzzComputeAddressNonceUint16(uint64,address) (runs: 256, μ: 532595, ~: 532853) -CreateAddressTest:testFuzzComputeAddressNonceUint24(uint64,address) (runs: 256, μ: 532766, ~: 532833) -CreateAddressTest:testFuzzComputeAddressNonceUint32(uint64,address) (runs: 256, μ: 532719, ~: 532840) -CreateAddressTest:testFuzzComputeAddressNonceUint40(uint64,address) (runs: 256, μ: 532846, ~: 532932) -CreateAddressTest:testFuzzComputeAddressNonceUint48(uint64,address) (runs: 256, μ: 532835, ~: 532916) -CreateAddressTest:testFuzzComputeAddressNonceUint56(uint64,address) (runs: 256, μ: 532854, ~: 532941) -CreateAddressTest:testFuzzComputeAddressNonceUint64(uint64,address) (runs: 256, μ: 532934, ~: 533036) -CreateAddressTest:testFuzzComputeAddressNonceUint8(uint64,address) (runs: 256, μ: 532659, ~: 532707) -CreateAddressTest:testFuzzComputeAddressRevertTooHighNonce(uint256,address) (runs: 256, μ: 12839, ~: 13145) +CreateAddressTest:testFuzzComputeAddressNonce0x7f(uint64,address) (runs: 256, μ: 533176, ~: 533249) +CreateAddressTest:testFuzzComputeAddressNonceUint16(uint64,address) (runs: 256, μ: 532588, ~: 532853) +CreateAddressTest:testFuzzComputeAddressNonceUint24(uint64,address) (runs: 256, μ: 532764, ~: 532833) +CreateAddressTest:testFuzzComputeAddressNonceUint32(uint64,address) (runs: 256, μ: 532718, ~: 532840) +CreateAddressTest:testFuzzComputeAddressNonceUint40(uint64,address) (runs: 256, μ: 532844, ~: 532932) +CreateAddressTest:testFuzzComputeAddressNonceUint48(uint64,address) (runs: 256, μ: 532836, ~: 532916) +CreateAddressTest:testFuzzComputeAddressNonceUint56(uint64,address) (runs: 256, μ: 532853, ~: 532941) +CreateAddressTest:testFuzzComputeAddressNonceUint64(uint64,address) (runs: 256, μ: 532938, ~: 533036) +CreateAddressTest:testFuzzComputeAddressNonceUint8(uint64,address) (runs: 256, μ: 532655, ~: 532707) +CreateAddressTest:testFuzzComputeAddressRevertTooHighNonce(uint256,address) (runs: 256, μ: 12834, ~: 13145) CreateAddressTest:testFuzzComputeAddressSelfNonce0x7f(uint64) (runs: 256, μ: 539418, ~: 539495) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint16(uint64) (runs: 256, μ: 538640, ~: 538928) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint24(uint64) (runs: 256, μ: 538910, ~: 538980) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint32(uint64) (runs: 256, μ: 538961, ~: 539076) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint40(uint64) (runs: 256, μ: 538977, ~: 539060) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint48(uint64) (runs: 256, μ: 539056, ~: 539134) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint56(uint64) (runs: 256, μ: 539146, ~: 539200) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint64(uint64) (runs: 256, μ: 539234, ~: 539321) -CreateAddressTest:testFuzzComputeAddressSelfNonceUint8(uint64) (runs: 256, μ: 538720, ~: 538771) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint16(uint64) (runs: 256, μ: 538626, ~: 538928) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint24(uint64) (runs: 256, μ: 538912, ~: 538980) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint32(uint64) (runs: 256, μ: 538968, ~: 539076) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint40(uint64) (runs: 256, μ: 538978, ~: 539060) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint48(uint64) (runs: 256, μ: 539057, ~: 539134) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint56(uint64) (runs: 256, μ: 539150, ~: 539200) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint64(uint64) (runs: 256, μ: 539241, ~: 539321) +CreateAddressTest:testFuzzComputeAddressSelfNonceUint8(uint64) (runs: 256, μ: 538722, ~: 538771) CreateAddressTest:testFuzzComputeAddressSelfRevertTooHighNonce(uint256) (runs: 256, μ: 12702, ~: 13020) ECDSATest:testFuzzRecoverWithInvalidSignature(bytes,string) (runs: 256, μ: 15349, ~: 15353) ECDSATest:testFuzzRecoverWithTooLongSignature(bytes,string) (runs: 256, μ: 13739, ~: 13743) @@ -125,112 +125,112 @@ ECDSATest:testRecoverWithWrongVersion() (gas: 14962) EIP712DomainSeparatorTest:testCachedDomainSeparatorV4() (gas: 10476) EIP712DomainSeparatorTest:testDomainSeparatorV4() (gas: 11731) EIP712DomainSeparatorTest:testEIP712Domain() (gas: 18055) -EIP712DomainSeparatorTest:testFuzzDomainSeparatorV4(uint8) (runs: 256, μ: 11884, ~: 11906) +EIP712DomainSeparatorTest:testFuzzDomainSeparatorV4(uint8) (runs: 256, μ: 11883, ~: 11906) EIP712DomainSeparatorTest:testFuzzEIP712Domain(bytes1,uint8,bytes32,uint256[]) (runs: 256, μ: 21486, ~: 21524) EIP712DomainSeparatorTest:testFuzzHashTypedDataV4(address,address,uint256,uint256,uint64) (runs: 256, μ: 10679, ~: 10679) EIP712DomainSeparatorTest:testHashTypedDataV4() (gas: 13167) ERC1155Invariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3480) -ERC1155Test:testBalanceOfBatchCase1() (gas: 275544) -ERC1155Test:testBalanceOfBatchCase2() (gas: 230136) -ERC1155Test:testBalanceOfBatchCase3() (gas: 37524) -ERC1155Test:testBalanceOfBatchLengthsMismatch() (gas: 25985) -ERC1155Test:testBalanceOfCase1() (gas: 143617) +ERC1155Test:testBalanceOfBatchCase1() (gas: 254221) +ERC1155Test:testBalanceOfBatchCase2() (gas: 208813) +ERC1155Test:testBalanceOfBatchCase3() (gas: 35505) +ERC1155Test:testBalanceOfBatchLengthsMismatch() (gas: 23677) +ERC1155Test:testBalanceOfCase1() (gas: 133965) ERC1155Test:testBalanceOfCase2() (gas: 21807) -ERC1155Test:testBurnAmountExceedsBalance() (gas: 126668) -ERC1155Test:testBurnBatchAmountExceedsBalance() (gas: 195460) -ERC1155Test:testBurnBatchByApprovedOperator() (gas: 249082) -ERC1155Test:testBurnBatchByNotApprovedOperator() (gas: 31510) -ERC1155Test:testBurnBatchFromZeroAddress() (gas: 25716) -ERC1155Test:testBurnBatchLengthsMismatch() (gas: 40950) -ERC1155Test:testBurnBatchNonExistentTokenIds() (gas: 27599) -ERC1155Test:testBurnBatchSuccess() (gas: 214168) -ERC1155Test:testBurnByApprovedOperator() (gas: 195222) -ERC1155Test:testBurnByNotApprovedOperator() (gas: 145479) -ERC1155Test:testBurnFromZeroAddress() (gas: 17311) -ERC1155Test:testBurnNonExistentTokenId() (gas: 20941) -ERC1155Test:testBurnSuccess() (gas: 139522) -ERC1155Test:testExistsAfterBatchBurn() (gas: 130531) -ERC1155Test:testExistsAfterBatchMint() (gas: 142310) -ERC1155Test:testExistsAfterSingleBurn() (gas: 134886) -ERC1155Test:testExistsAfterSingleMint() (gas: 116835) +ERC1155Test:testBurnAmountExceedsBalance() (gas: 113015) +ERC1155Test:testBurnBatchAmountExceedsBalance() (gas: 178268) +ERC1155Test:testBurnBatchByApprovedOperator() (gas: 231889) +ERC1155Test:testBurnBatchByNotApprovedOperator() (gas: 22104) +ERC1155Test:testBurnBatchFromZeroAddress() (gas: 18165) +ERC1155Test:testBurnBatchLengthsMismatch() (gas: 25851) +ERC1155Test:testBurnBatchNonExistentTokenIds() (gas: 20048) +ERC1155Test:testBurnBatchSuccess() (gas: 196976) +ERC1155Test:testBurnByApprovedOperator() (gas: 180807) +ERC1155Test:testBurnByNotApprovedOperator() (gas: 132572) +ERC1155Test:testBurnFromZeroAddress() (gas: 14072) +ERC1155Test:testBurnNonExistentTokenId() (gas: 16940) +ERC1155Test:testBurnSuccess() (gas: 125107) +ERC1155Test:testExistsAfterBatchBurn() (gas: 113338) +ERC1155Test:testExistsAfterBatchMint() (gas: 128370) +ERC1155Test:testExistsAfterSingleBurn() (gas: 120471) +ERC1155Test:testExistsAfterSingleMint() (gas: 107183) ERC1155Test:testExistsBeforeMint() (gas: 10481) -ERC1155Test:testFuzzBurnBatchSuccess(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 131645, ~: 131641) -ERC1155Test:testFuzzBurnSuccess(address,address,uint256) (runs: 256, μ: 137823, ~: 137853) +ERC1155Test:testFuzzBurnBatchSuccess(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 114457, ~: 114450) +ERC1155Test:testFuzzBurnSuccess(address,address,uint256) (runs: 256, μ: 123438, ~: 123438) ERC1155Test:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13962, ~: 13962) ERC1155Test:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 48758, ~: 48744) -ERC1155Test:testFuzzSafeBatchTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 223969, ~: 223933) -ERC1155Test:testFuzzSafeBatchTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 188503, ~: 188473) -ERC1155Test:testFuzzSafeBatchTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 556561, ~: 556561) -ERC1155Test:testFuzzSafeBatchTransferFromWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 556942, ~: 556631) -ERC1155Test:testFuzzSafeMintBatchEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 152109, ~: 152099) -ERC1155Test:testFuzzSafeMintBatchNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 514049, ~: 514049) -ERC1155Test:testFuzzSafeMintBatchNonMinter(address) (runs: 256, μ: 40656, ~: 40656) -ERC1155Test:testFuzzSafeMintBatchWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 514331, ~: 514164) -ERC1155Test:testFuzzSafeMintEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 150180, ~: 150157) -ERC1155Test:testFuzzSafeMintNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 513070, ~: 513070) -ERC1155Test:testFuzzSafeMintNonMinter(address) (runs: 256, μ: 32906, ~: 32906) -ERC1155Test:testFuzzSafeMintWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 514221, ~: 513868) -ERC1155Test:testFuzzSafeTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 202250, ~: 202204) -ERC1155Test:testFuzzSafeTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 166871, ~: 166831) -ERC1155Test:testFuzzSafeTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 597996, ~: 597996) -ERC1155Test:testFuzzSafeTransferFromWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 600056, ~: 599352) +ERC1155Test:testFuzzSafeBatchTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 196061, ~: 196033) +ERC1155Test:testFuzzSafeBatchTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 160607, ~: 160573) +ERC1155Test:testFuzzSafeBatchTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 528671, ~: 528671) +ERC1155Test:testFuzzSafeBatchTransferFromWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 529059, ~: 529363) +ERC1155Test:testFuzzSafeMintBatchEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 138171, ~: 138154) +ERC1155Test:testFuzzSafeMintBatchNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500109, ~: 500109) +ERC1155Test:testFuzzSafeMintBatchNonMinter(address) (runs: 256, μ: 26528, ~: 26528) +ERC1155Test:testFuzzSafeMintBatchWithData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 500395, ~: 500560) +ERC1155Test:testFuzzSafeMintEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 140531, ~: 140501) +ERC1155Test:testFuzzSafeMintNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 503418, ~: 503418) +ERC1155Test:testFuzzSafeMintNonMinter(address) (runs: 256, μ: 26152, ~: 26152) +ERC1155Test:testFuzzSafeMintWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 504565, ~: 504212) +ERC1155Test:testFuzzSafeTransferFromByApprovedOperator(address,address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 187756, ~: 187714) +ERC1155Test:testFuzzSafeTransferFromEOAReceiver(address,address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 152386, ~: 152341) +ERC1155Test:testFuzzSafeTransferFromNoData(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 578680, ~: 578680) +ERC1155Test:testFuzzSafeTransferFromWithData(address,uint256,uint256,uint256,uint256,bytes) (runs: 256, μ: 580732, ~: 580028) ERC1155Test:testFuzzSetApprovalForAllRevoke(address,address) (runs: 256, μ: 31974, ~: 31942) ERC1155Test:testFuzzSetApprovalForAllSuccess(address,address) (runs: 256, μ: 45350, ~: 45350) ERC1155Test:testFuzzSetMinterNonOwner(address,string) (runs: 256, μ: 15509, ~: 15499) ERC1155Test:testFuzzSetMinterSuccess(string) (runs: 256, μ: 33573, ~: 33584) ERC1155Test:testFuzzSetUriNonMinter(address) (runs: 256, μ: 14420, ~: 14420) -ERC1155Test:testFuzzTotalSupplyAfterBatchBurn(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 125216, ~: 125212) -ERC1155Test:testFuzzTotalSupplyAfterBatchMint(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 140227, ~: 140194) -ERC1155Test:testFuzzTotalSupplyAfterSingleBurn(address,uint256,bytes) (runs: 256, μ: 134908, ~: 134880) -ERC1155Test:testFuzzTotalSupplyAfterSingleMint(uint256,uint256,bytes) (runs: 256, μ: 84329, ~: 57821) +ERC1155Test:testFuzzTotalSupplyAfterBatchBurn(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 108029, ~: 108021) +ERC1155Test:testFuzzTotalSupplyAfterBatchMint(address,uint256,uint256,uint256,uint256) (runs: 256, μ: 126286, ~: 126318) +ERC1155Test:testFuzzTotalSupplyAfterSingleBurn(address,uint256,bytes) (runs: 256, μ: 120486, ~: 120461) +ERC1155Test:testFuzzTotalSupplyAfterSingleMint(uint256,uint256,bytes) (runs: 256, μ: 76070, ~: 48157) ERC1155Test:testFuzzTransferOwnershipNonOwner(address,address) (runs: 256, μ: 14071, ~: 14071) -ERC1155Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75750, ~: 75719) +ERC1155Test:testFuzzTransferOwnershipSuccess(address,address) (runs: 256, μ: 75751, ~: 75719) ERC1155Test:testHasOwner() (gas: 12614) -ERC1155Test:testInitialSetup() (gas: 2895245) +ERC1155Test:testInitialSetup() (gas: 2885587) ERC1155Test:testRenounceOwnershipNonOwner() (gas: 10903) ERC1155Test:testRenounceOwnershipSuccess() (gas: 22923) -ERC1155Test:testSafeBatchTransferFromByApprovedOperator() (gas: 337562) -ERC1155Test:testSafeBatchTransferFromByNotApprovedOperator() (gas: 258973) -ERC1155Test:testSafeBatchTransferFromEOAReceiver() (gas: 294784) -ERC1155Test:testSafeBatchTransferFromInsufficientBalance() (gas: 265159) -ERC1155Test:testSafeBatchTransferFromLengthsMismatch() (gas: 62772) -ERC1155Test:testSafeBatchTransferFromNoData() (gas: 664650) -ERC1155Test:testSafeBatchTransferFromReceiverFunctionNotImplemented() (gas: 278349) -ERC1155Test:testSafeBatchTransferFromReceiverInvalidReturnIdentifier() (gas: 640209) -ERC1155Test:testSafeBatchTransferFromReceiverReverts() (gas: 633481) -ERC1155Test:testSafeBatchTransferFromReceiverRevertsOnlySingle() (gas: 664713) -ERC1155Test:testSafeBatchTransferFromToZeroAddress() (gas: 255593) -ERC1155Test:testSafeBatchTransferFromWithData() (gas: 665883) -ERC1155Test:testSafeMintBatchEOAReceiver() (gas: 247602) -ERC1155Test:testSafeMintBatchLengthsMismatch() (gas: 65870) -ERC1155Test:testSafeMintBatchNoData() (gas: 611277) -ERC1155Test:testSafeMintBatchNonMinter() (gas: 39463) -ERC1155Test:testSafeMintBatchOverflow() (gas: 262844) -ERC1155Test:testSafeMintBatchReceiverFunctionNotImplemented() (gas: 225258) -ERC1155Test:testSafeMintBatchReceiverInvalidReturnIdentifier() (gas: 591889) -ERC1155Test:testSafeMintBatchReceiverReverts() (gas: 585137) -ERC1155Test:testSafeMintBatchReceiverRevertsOnlySingle() (gas: 611254) -ERC1155Test:testSafeMintBatchToZeroAddress() (gas: 40391) -ERC1155Test:testSafeMintBatchWithData() (gas: 611847) -ERC1155Test:testSafeMintEOAReceiver() (gas: 147112) -ERC1155Test:testSafeMintNoData() (gas: 509640) -ERC1155Test:testSafeMintNonMinter() (gas: 31671) -ERC1155Test:testSafeMintOverflow() (gas: 90019) -ERC1155Test:testSafeMintReceiverFunctionNotImplemented() (gas: 133570) -ERC1155Test:testSafeMintReceiverInvalidReturnIdentifier() (gas: 499572) -ERC1155Test:testSafeMintReceiverReverts() (gas: 493183) -ERC1155Test:testSafeMintToZeroAddress() (gas: 32592) -ERC1155Test:testSafeMintWithData() (gas: 510881) -ERC1155Test:testSafeTransferFromByApprovedOperator() (gas: 202033) -ERC1155Test:testSafeTransferFromByNotApprovedOperator() (gas: 147847) -ERC1155Test:testSafeTransferFromEOAReceiver() (gas: 165603) -ERC1155Test:testSafeTransferFromInsufficientBalance() (gas: 87532) -ERC1155Test:testSafeTransferFromNoData() (gas: 595595) -ERC1155Test:testSafeTransferFromReceiverFunctionNotImplemented() (gas: 200497) -ERC1155Test:testSafeTransferFromReceiverInvalidReturnIdentifier() (gas: 566556) -ERC1155Test:testSafeTransferFromReceiverReverts() (gas: 560124) -ERC1155Test:testSafeTransferFromToZeroAddress() (gas: 85794) -ERC1155Test:testSafeTransferFromWithData() (gas: 597952) +ERC1155Test:testSafeBatchTransferFromByApprovedOperator() (gas: 309672) +ERC1155Test:testSafeBatchTransferFromByNotApprovedOperator() (gas: 230884) +ERC1155Test:testSafeBatchTransferFromEOAReceiver() (gas: 272472) +ERC1155Test:testSafeBatchTransferFromInsufficientBalance() (gas: 237269) +ERC1155Test:testSafeBatchTransferFromLengthsMismatch() (gas: 34872) +ERC1155Test:testSafeBatchTransferFromNoData() (gas: 636760) +ERC1155Test:testSafeBatchTransferFromReceiverFunctionNotImplemented() (gas: 258037) +ERC1155Test:testSafeBatchTransferFromReceiverInvalidReturnIdentifier() (gas: 612319) +ERC1155Test:testSafeBatchTransferFromReceiverReverts() (gas: 605591) +ERC1155Test:testSafeBatchTransferFromReceiverRevertsOnlySingle() (gas: 636823) +ERC1155Test:testSafeBatchTransferFromToZeroAddress() (gas: 227703) +ERC1155Test:testSafeBatchTransferFromWithData() (gas: 637973) +ERC1155Test:testSafeMintBatchEOAReceiver() (gas: 233662) +ERC1155Test:testSafeMintBatchLengthsMismatch() (gas: 37990) +ERC1155Test:testSafeMintBatchNoData() (gas: 597337) +ERC1155Test:testSafeMintBatchNonMinter() (gas: 25335) +ERC1155Test:testSafeMintBatchOverflow() (gas: 234964) +ERC1155Test:testSafeMintBatchReceiverFunctionNotImplemented() (gas: 213818) +ERC1155Test:testSafeMintBatchReceiverInvalidReturnIdentifier() (gas: 577949) +ERC1155Test:testSafeMintBatchReceiverReverts() (gas: 571197) +ERC1155Test:testSafeMintBatchReceiverRevertsOnlySingle() (gas: 597314) +ERC1155Test:testSafeMintBatchToZeroAddress() (gas: 26451) +ERC1155Test:testSafeMintBatchWithData() (gas: 597897) +ERC1155Test:testSafeMintEOAReceiver() (gas: 137460) +ERC1155Test:testSafeMintNoData() (gas: 499988) +ERC1155Test:testSafeMintNonMinter() (gas: 24917) +ERC1155Test:testSafeMintOverflow() (gas: 81129) +ERC1155Test:testSafeMintReceiverFunctionNotImplemented() (gas: 128918) +ERC1155Test:testSafeMintReceiverInvalidReturnIdentifier() (gas: 489920) +ERC1155Test:testSafeMintReceiverReverts() (gas: 483531) +ERC1155Test:testSafeMintToZeroAddress() (gas: 25988) +ERC1155Test:testSafeMintWithData() (gas: 501221) +ERC1155Test:testSafeTransferFromByApprovedOperator() (gas: 187549) +ERC1155Test:testSafeTransferFromByNotApprovedOperator() (gas: 134808) +ERC1155Test:testSafeTransferFromEOAReceiver() (gas: 151119) +ERC1155Test:testSafeTransferFromInsufficientBalance() (gas: 78636) +ERC1155Test:testSafeTransferFromNoData() (gas: 576279) +ERC1155Test:testSafeTransferFromReceiverFunctionNotImplemented() (gas: 186181) +ERC1155Test:testSafeTransferFromReceiverInvalidReturnIdentifier() (gas: 547240) +ERC1155Test:testSafeTransferFromReceiverReverts() (gas: 540808) +ERC1155Test:testSafeTransferFromToZeroAddress() (gas: 77660) +ERC1155Test:testSafeTransferFromWithData() (gas: 578620) ERC1155Test:testSetApprovalForAllRevoke() (gas: 33920) ERC1155Test:testSetApprovalForAllSuccess() (gas: 47704) ERC1155Test:testSetApprovalForAllToSelf() (gas: 10855) @@ -245,17 +245,17 @@ ERC1155Test:testSupportsInterfaceInvalidInterfaceId() (gas: 8402) ERC1155Test:testSupportsInterfaceInvalidInterfaceIdGasCost() (gas: 9280) ERC1155Test:testSupportsInterfaceSuccess() (gas: 10924) ERC1155Test:testSupportsInterfaceSuccessGasCost() (gas: 9387) -ERC1155Test:testTotalSupplyAfterBatchBurn() (gas: 130500) -ERC1155Test:testTotalSupplyAfterBatchMint() (gas: 142271) -ERC1155Test:testTotalSupplyAfterSingleBurn() (gas: 131689) -ERC1155Test:testTotalSupplyAfterSingleMint() (gas: 116779) +ERC1155Test:testTotalSupplyAfterBatchBurn() (gas: 113307) +ERC1155Test:testTotalSupplyAfterBatchMint() (gas: 128331) +ERC1155Test:testTotalSupplyAfterSingleBurn() (gas: 117274) +ERC1155Test:testTotalSupplyAfterSingleMint() (gas: 107127) ERC1155Test:testTotalSupplyBeforeMint() (gas: 10460) ERC1155Test:testTransferOwnershipNonOwner() (gas: 12455) ERC1155Test:testTransferOwnershipSuccess() (gas: 53866) ERC1155Test:testTransferOwnershipToZeroAddress() (gas: 15610) -ERC1155Test:testUriBaseAndTokenUriNotSet() (gas: 2854107) +ERC1155Test:testUriBaseAndTokenUriNotSet() (gas: 2844448) ERC1155Test:testUriBaseAndTokenUriSet() (gas: 64191) -ERC1155Test:testUriNoBaseURI() (gas: 2903506) +ERC1155Test:testUriNoBaseURI() (gas: 2893847) ERC1155Test:testUriNoTokenUri() (gas: 18839) ERC20Invariants:statefulFuzzOwner() (runs: 256, calls: 3840, reverts: 3482) ERC20Invariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3482) @@ -379,8 +379,8 @@ ERC2981Test:testSupportsInterfaceSuccessGasCost() (gas: 9207) ERC2981Test:testTransferOwnershipNonOwner() (gas: 12383) ERC2981Test:testTransferOwnershipSuccess() (gas: 22202) ERC2981Test:testTransferOwnershipToZeroAddress() (gas: 15473) -ERC4626VaultInvariants:statefulFuzzTotalAssets() (runs: 256, calls: 3840, reverts: 3307) -ERC4626VaultInvariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3307) +ERC4626VaultInvariants:statefulFuzzTotalAssets() (runs: 256, calls: 3840, reverts: 3309) +ERC4626VaultInvariants:statefulFuzzTotalSupply() (runs: 256, calls: 3840, reverts: 3309) ERC4626VaultTest:testCachedDomainSeparator() (gas: 10578) ERC4626VaultTest:testDepositInsufficientAllowance() (gas: 82497) ERC4626VaultTest:testDepositWithNoApproval() (gas: 24432) @@ -417,10 +417,10 @@ ERC4626VaultTest:testWithdrawInsufficientAssets() (gas: 117771) ERC4626VaultTest:testWithdrawWithNoAssets() (gas: 21289) ERC4626VaultTest:test_RT_deposit_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472229, ~: 473225) ERC4626VaultTest:test_RT_deposit_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473932, ~: 474451) -ERC4626VaultTest:test_RT_mint_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472072, ~: 473297) +ERC4626VaultTest:test_RT_mint_redeem((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472073, ~: 473297) ERC4626VaultTest:test_RT_mint_withdraw((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 473928, ~: 474775) ERC4626VaultTest:test_RT_redeem_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472666, ~: 473263) -ERC4626VaultTest:test_RT_redeem_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472746, ~: 473346) +ERC4626VaultTest:test_RT_redeem_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 472747, ~: 473346) ERC4626VaultTest:test_RT_withdraw_deposit((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 474001, ~: 474483) ERC4626VaultTest:test_RT_withdraw_mint((address[4],uint256[4],uint256[4],int256),uint256) (runs: 256, μ: 474181, ~: 474591) ERC4626VaultTest:test_asset((address[4],uint256[4],uint256[4],int256)) (runs: 256, μ: 423343, ~: 426380) @@ -503,7 +503,7 @@ ERC721Test:testRenounceOwnershipSuccess() (gas: 22918) ERC721Test:testSafeMintNonMinter() (gas: 13035) ERC721Test:testSafeMintOverflow() (gas: 15304) ERC721Test:testSafeMintReceiverContract() (gas: 386236) -ERC721Test:testSafeMintReceiverContractFunctionNotImplemented() (gas: 115780) +ERC721Test:testSafeMintReceiverContractFunctionNotImplemented() (gas: 118280) ERC721Test:testSafeMintReceiverContractInvalidReturnIdentifier() (gas: 337293) ERC721Test:testSafeMintReceiverContractRevertsWithMessage() (gas: 334578) ERC721Test:testSafeMintReceiverContractRevertsWithPanic() (gas: 334757) @@ -512,7 +512,7 @@ ERC721Test:testSafeMintSuccess() (gas: 524549) ERC721Test:testSafeMintToZeroAddress() (gas: 38391) ERC721Test:testSafeMintTokenAlreadyMinted() (gas: 362406) ERC721Test:testSafeTransferFromNoData() (gas: 1438774) -ERC721Test:testSafeTransferFromReceiverFunctionNotImplemented() (gas: 180184) +ERC721Test:testSafeTransferFromReceiverFunctionNotImplemented() (gas: 182684) ERC721Test:testSafeTransferFromReceiverInvalidReturnIdentifier() (gas: 401725) ERC721Test:testSafeTransferFromReceiverRevertsWithMessage() (gas: 398990) ERC721Test:testSafeTransferFromReceiverRevertsWithPanic() (gas: 399192) @@ -580,8 +580,8 @@ MathTest:testWadExp() (gas: 34590) MathTest:testWadExpOverflow() (gas: 11169) MathTest:testWadLn() (gas: 31356) MathTest:testWadLnNegativeValues() (gas: 11096) -MerkleProofVerificationTest:testFuzzMultiProofVerifySingleLeaf(bytes32[],uint256) (runs: 256, μ: 261878, ~: 262381) -MerkleProofVerificationTest:testFuzzVerify(bytes32[],uint256) (runs: 256, μ: 176344, ~: 176081) +MerkleProofVerificationTest:testFuzzMultiProofVerifySingleLeaf(bytes32[],uint256) (runs: 256, μ: 261877, ~: 262341) +MerkleProofVerificationTest:testFuzzVerify(bytes32[],uint256) (runs: 256, μ: 176344, ~: 176041) MerkleProofVerificationTest:testFuzzVerifyMultiProofMultipleLeaves(bool,bool,bool) (runs: 256, μ: 45520, ~: 45511) MerkleProofVerificationTest:testInvalidMerkleMultiProof() (gas: 46709) MerkleProofVerificationTest:testInvalidMerkleProof() (gas: 18776) @@ -614,7 +614,7 @@ Ownable2StepInvariants:statefulFuzzPendingOwner() (runs: 256, calls: 3840, rever Ownable2StepTest:testAcceptOwnershipNonPendingOwner() (gas: 47364) Ownable2StepTest:testAcceptOwnershipSuccess() (gas: 40661) Ownable2StepTest:testFuzzAcceptOwnershipNonPendingOwner(address) (runs: 256, μ: 46803, ~: 46803) -Ownable2StepTest:testFuzzAcceptOwnershipSuccess(address,address) (runs: 256, μ: 67719, ~: 67688) +Ownable2StepTest:testFuzzAcceptOwnershipSuccess(address,address) (runs: 256, μ: 67720, ~: 67688) Ownable2StepTest:testFuzzPendingOwnerResetAfterRenounceOwnership(address) (runs: 256, μ: 40131, ~: 40117) Ownable2StepTest:testFuzzRenounceOwnershipNonOwner(address) (runs: 256, μ: 13872, ~: 13872) Ownable2StepTest:testFuzzRenounceOwnershipSuccess(address) (runs: 256, μ: 45431, ~: 45417) @@ -665,13 +665,13 @@ SignatureCheckerTest:testFuzzEOAWithInvalidSignature(bytes,string) (runs: 256, SignatureCheckerTest:testFuzzEOAWithInvalidSigner(string,string) (runs: 256, μ: 20396, ~: 20400) SignatureCheckerTest:testFuzzEOAWithValidSignature(string,string) (runs: 256, μ: 20306, ~: 20310) SignatureCheckerTest:testInitialSetup() (gas: 8292) -TimelockControllerInvariants:statefulFuzzExecutedLessThanOrEqualToScheduled() (runs: 256, calls: 3840, reverts: 1252) -TimelockControllerInvariants:statefulFuzzExecutedProposalCancellation() (runs: 256, calls: 3840, reverts: 1245) -TimelockControllerInvariants:statefulFuzzExecutingCancelledProposal() (runs: 256, calls: 3840, reverts: 1267) -TimelockControllerInvariants:statefulFuzzExecutingNotReadyProposal() (runs: 256, calls: 3840, reverts: 1277) -TimelockControllerInvariants:statefulFuzzOnceProposalExecution() (runs: 256, calls: 3840, reverts: 1254) -TimelockControllerInvariants:statefulFuzzProposalsExecutedMatchCount() (runs: 256, calls: 3840, reverts: 1253) -TimelockControllerInvariants:statefulFuzzSumOfProposals() (runs: 256, calls: 3840, reverts: 1253) +TimelockControllerInvariants:statefulFuzzExecutedLessThanOrEqualToScheduled() (runs: 256, calls: 3840, reverts: 1216) +TimelockControllerInvariants:statefulFuzzExecutedProposalCancellation() (runs: 256, calls: 3840, reverts: 1242) +TimelockControllerInvariants:statefulFuzzExecutingCancelledProposal() (runs: 256, calls: 3840, reverts: 1233) +TimelockControllerInvariants:statefulFuzzExecutingNotReadyProposal() (runs: 256, calls: 3840, reverts: 1273) +TimelockControllerInvariants:statefulFuzzOnceProposalExecution() (runs: 256, calls: 3840, reverts: 1249) +TimelockControllerInvariants:statefulFuzzProposalsExecutedMatchCount() (runs: 256, calls: 3840, reverts: 1217) +TimelockControllerInvariants:statefulFuzzSumOfProposals() (runs: 256, calls: 3840, reverts: 1217) TimelockControllerTest:testAdminCannotBatchExecute() (gas: 750660) TimelockControllerTest:testAdminCannotBatchSchedule() (gas: 748447) TimelockControllerTest:testAdminCannotCancel() (gas: 13375) @@ -709,11 +709,11 @@ TimelockControllerTest:testExecutorCanExecute() (gas: 29504) TimelockControllerTest:testExecutorCannotBatchSchedule() (gas: 1485551) TimelockControllerTest:testExecutorCannotCancel() (gas: 15471) TimelockControllerTest:testExecutorCannotSchedule() (gas: 19169) -TimelockControllerTest:testFuzzBatchValue(uint256) (runs: 256, μ: 4650556, ~: 4650314) +TimelockControllerTest:testFuzzBatchValue(uint256) (runs: 256, μ: 4650558, ~: 4650314) TimelockControllerTest:testFuzzHashOperation(address,uint256,bytes,bytes32,bytes32) (runs: 256, μ: 10604, ~: 10581) TimelockControllerTest:testFuzzHashOperationBatch(address[],uint256[],bytes[],bytes32,bytes32) (runs: 256, μ: 1838979, ~: 1838435) -TimelockControllerTest:testFuzzOperationValue(uint256) (runs: 256, μ: 111629, ~: 111387) -TimelockControllerTest:testHandleERC1155() (gas: 41586201) +TimelockControllerTest:testFuzzOperationValue(uint256) (runs: 256, μ: 111631, ~: 111387) +TimelockControllerTest:testHandleERC1155() (gas: 41553014) TimelockControllerTest:testHandleERC721() (gas: 7157921) TimelockControllerTest:testHashOperation() (gas: 12363) TimelockControllerTest:testHashOperationBatch() (gas: 1525346) diff --git a/src/snekmate/auth/access_control.vy b/src/snekmate/auth/access_control.vy index d91fc022..128cb5aa 100644 --- a/src/snekmate/auth/access_control.vy +++ b/src/snekmate/auth/access_control.vy @@ -100,39 +100,6 @@ hasRole: public(HashMap[bytes32, HashMap[address, bool]]) getRoleAdmin: public(HashMap[bytes32, bytes32]) -# @dev Emitted when `new_admin_role` is set as -# `role`'s admin role, replacing `previous_admin_role`. -# Note that `DEFAULT_ADMIN_ROLE` is the starting -# admin for all roles, despite `RoleAdminChanged` -# not being emitted signaling this. -event RoleAdminChanged: - role: indexed(bytes32) - previous_admin_role: indexed(bytes32) - new_admin_role: indexed(bytes32) - - -# @dev Emitted when `account` is granted `role`. -# Note that `sender` is the account (an admin -# role bearer) that originated the contract call. -event RoleGranted: - role: indexed(bytes32) - account: indexed(address) - sender: indexed(address) - - -# @dev Emitted when `account` is revoked `role`. -# Note that `sender` is the account that originated -# the contract call: -# - if using `revokeRole`, it is the admin role -# bearer, -# - if using `renounceRole`, it is the role bearer -# (i.e. `account`). -event RoleRevoked: - role: indexed(bytes32) - account: indexed(address) - sender: indexed(address) - - @deploy @payable def __init__(): @@ -243,7 +210,7 @@ def _set_role_admin(role: bytes32, admin_role: bytes32): """ previous_admin_role: bytes32 = self.getRoleAdmin[role] self.getRoleAdmin[role] = admin_role - log RoleAdminChanged(role, previous_admin_role, admin_role) + log IAccessControl.RoleAdminChanged(role, previous_admin_role, admin_role) @internal @@ -257,7 +224,7 @@ def _grant_role(role: bytes32, account: address): """ if (not(self.hasRole[role][account])): self.hasRole[role][account] = True - log RoleGranted(role, account, msg.sender) + log IAccessControl.RoleGranted(role, account, msg.sender) @internal @@ -271,4 +238,4 @@ def _revoke_role(role: bytes32, account: address): """ if (self.hasRole[role][account]): self.hasRole[role][account] = False - log RoleRevoked(role, account, msg.sender) + log IAccessControl.RoleRevoked(role, account, msg.sender) diff --git a/src/snekmate/extensions/erc4626.vy b/src/snekmate/extensions/erc4626.vy index 80993b08..9d6e5540 100644 --- a/src/snekmate/extensions/erc4626.vy +++ b/src/snekmate/extensions/erc4626.vy @@ -157,27 +157,6 @@ _DECIMALS_OFFSET: immutable(uint8) _UNDERLYING_DECIMALS: immutable(uint8) -# @dev Emitted when `sender` has exchanged `assets` -# for `shares`, and transferred those `shares` -# to `owner`. -event Deposit: - sender: indexed(address) - owner: indexed(address) - assets: uint256 - shares: uint256 - - -# @dev Emitted when `sender` has exchanged `shares`, -# owned by `owner`, for `assets`, and transferred -# those `assets` to `receiver`. -event Withdraw: - sender: indexed(address) - receiver: indexed(address) - owner: indexed(address) - assets: uint256 - shares: uint256 - - @deploy @payable def __init__(name_: String[25], symbol_: String[5], asset_: IERC20, decimals_offset_: uint8, name_eip712_: String[50], version_eip712_: String[20]): @@ -679,7 +658,7 @@ def _deposit(sender: address, receiver: address, assets: uint256, shares: uint25 # the target address is an EOA), the call reverts. assert extcall _ASSET.transferFrom(sender, self, assets, default_return_value=True), "erc4626: transferFrom operation did not succeed" erc20._mint(receiver, shares) - log Deposit(sender, receiver, assets, shares) + log IERC4626.Deposit(sender, receiver, assets, shares) @internal @@ -718,4 +697,4 @@ def _withdraw(sender: address, receiver: address, owner: address, assets: uint25 # you add the kwarg `skip_contract_check=True`. If the check fails (i.e. # the target address is an EOA), the call reverts. assert extcall _ASSET.transfer(receiver, assets, default_return_value=True), "erc4626: transfer operation did not succeed" - log Withdraw(sender, receiver, owner, assets, shares) + log IERC4626.Withdraw(sender, receiver, owner, assets, shares) diff --git a/src/snekmate/tokens/erc1155.vy b/src/snekmate/tokens/erc1155.vy index 382c9408..fc2941af 100644 --- a/src/snekmate/tokens/erc1155.vy +++ b/src/snekmate/tokens/erc1155.vy @@ -93,7 +93,7 @@ _SUPPORTED_INTERFACES: constant(bytes4[3]) = [ # @dev Stores the upper bound for batch calls. -_BATCH_SIZE: constant(uint16) = 255 +_BATCH_SIZE: constant(uint8) = 128 # @dev Stores the base URI for computing `uri`. @@ -132,47 +132,6 @@ is_minter: public(HashMap[address, bool]) _token_uris: HashMap[uint256, String[432]] -# @dev Emitted when `amount` tokens of token type -# `id` are transferred from `owner` to `to` by -# `operator`. -event TransferSingle: - operator: indexed(address) - owner: indexed(address) - to: indexed(address) - id: uint256 - amount: uint256 - - -# @dev Equivalent to multiple `TransferSingle` events, -# where `operator`, `owner`, and `to` are the same -# for all transfers. -event TransferBatch: - operator: indexed(address) - owner: indexed(address) - to: indexed(address) - ids: DynArray[uint256, _BATCH_SIZE] - amounts: DynArray[uint256, _BATCH_SIZE] - - -# @dev Emitted when `owner` grants or revokes permission -# to `operator` to transfer their tokens, according to -# `approved`. -event ApprovalForAll: - owner: indexed(address) - operator: indexed(address) - approved: bool - - -# @dev Emitted when the Uniform Resource Identifier (URI) -# for token type `id` changes to `value`, if it is a -# non-programmatic URI. Note that if an `URI` event was -# emitted for `id`, the EIP-1155 standard guarantees that -# `value` will equal the value returned by `uri`. -event URI: - value: String[512] - id: indexed(uint256) - - # @dev Emitted when the status of a `minter` # address is changed. event RoleMinterChanged: @@ -524,7 +483,7 @@ def _set_approval_for_all(owner: address, operator: address, approved: bool): """ assert owner != operator, "erc1155: setting approval status for self" self.isApprovedForAll[owner][operator] = approved - log ApprovalForAll(owner, operator, approved) + log IERC1155.ApprovalForAll(owner, operator, approved) @internal @@ -564,7 +523,7 @@ def _safe_transfer_from(owner: address, to: address, id: uint256, amount: uint25 # due to an arithmetic check of the entire token # supply in the functions `_safe_mint` and `_safe_mint_batch`. self.balanceOf[to][id] = unsafe_add(self.balanceOf[to][id], amount) - log TransferSingle(msg.sender, owner, to, id, amount) + log IERC1155.TransferSingle(msg.sender, owner, to, id, amount) self._after_token_transfer(owner, to, self._as_singleton_array(id), self._as_singleton_array(amount), data) @@ -620,7 +579,7 @@ def _safe_batch_transfer_from(owner: address, to: address, ids: DynArray[uint256 # maximum value of `uint16`. idx = unsafe_add(idx, 1) - log TransferBatch(msg.sender, owner, to, ids, amounts) + log IERC1155.TransferBatch(msg.sender, owner, to, ids, amounts) self._after_token_transfer(owner, to, ids, amounts, data) @@ -659,7 +618,7 @@ def _safe_mint(owner: address, id: uint256, amount: uint256, data: Bytes[1_024]) # due to an arithmetic check of the entire token # supply in the function `_before_token_transfer`. self.balanceOf[owner][id] = unsafe_add(self.balanceOf[owner][id], amount) - log TransferSingle(msg.sender, empty(address), owner, id, amount) + log IERC1155.TransferSingle(msg.sender, empty(address), owner, id, amount) self._after_token_transfer(empty(address), owner, self._as_singleton_array(id), self._as_singleton_array(amount), data) @@ -709,7 +668,7 @@ def _safe_mint_batch(owner: address, ids: DynArray[uint256, _BATCH_SIZE], amount # maximum value of `uint16`. idx = unsafe_add(idx, 1) - log TransferBatch(msg.sender, empty(address), owner, ids, amounts) + log IERC1155.TransferBatch(msg.sender, empty(address), owner, ids, amounts) self._after_token_transfer(empty(address), owner, ids, amounts, data) @@ -770,7 +729,7 @@ def _set_uri(id: uint256, token_uri: String[432]): string URI for computing `uri`. """ self._token_uris[id] = token_uri - log URI(self._uri(id), id) + log IERC1155.URI(self._uri(id), id) @internal @@ -792,7 +751,7 @@ def _burn(owner: address, id: uint256, amount: uint256): owner_balance: uint256 = self.balanceOf[owner][id] assert owner_balance >= amount, "erc1155: burn amount exceeds balance" self.balanceOf[owner][id] = unsafe_sub(owner_balance, amount) - log TransferSingle(msg.sender, owner, empty(address), id, amount) + log IERC1155.TransferSingle(msg.sender, owner, empty(address), id, amount) self._after_token_transfer(owner, empty(address), self._as_singleton_array(id), self._as_singleton_array(amount), b"") @@ -828,7 +787,7 @@ def _burn_batch(owner: address, ids: DynArray[uint256, _BATCH_SIZE], amounts: Dy # maximum value of `uint16`. idx = unsafe_add(idx, 1) - log TransferBatch(msg.sender, owner, empty(address), ids, amounts) + log IERC1155.TransferBatch(msg.sender, owner, empty(address), ids, amounts) self._after_token_transfer(owner, empty(address), ids, amounts, b"") diff --git a/src/snekmate/tokens/erc20.vy b/src/snekmate/tokens/erc20.vy index 23364127..d811adce 100644 --- a/src/snekmate/tokens/erc20.vy +++ b/src/snekmate/tokens/erc20.vy @@ -167,24 +167,6 @@ is_minter: public(HashMap[address, bool]) nonces: public(HashMap[address, uint256]) -# @dev Emitted when `amount` tokens are moved -# from one account (`owner`) to another (`to`). -# Note that the parameter `amount` may be zero. -event Transfer: - owner: indexed(address) - to: indexed(address) - amount: uint256 - - -# @dev Emitted when the allowance of a `spender` -# for an `owner` is set by a call to `approve`. -# The parameter `amount` is the new allowance. -event Approval: - owner: indexed(address) - spender: indexed(address) - amount: uint256 - - # @dev Emitted when the status of a `minter` # address is changed. event RoleMinterChanged: @@ -475,7 +457,7 @@ def _transfer(owner: address, to: address, amount: uint256): assert owner_balanceOf >= amount, "erc20: transfer amount exceeds balance" self.balanceOf[owner] = unsafe_sub(owner_balanceOf, amount) self.balanceOf[to] = unsafe_add(self.balanceOf[to], amount) - log Transfer(owner, to, amount) + log IERC20.Transfer(owner, to, amount) self._after_token_transfer(owner, to, amount) @@ -498,7 +480,7 @@ def _mint(owner: address, amount: uint256): self.totalSupply += amount self.balanceOf[owner] = unsafe_add(self.balanceOf[owner], amount) - log Transfer(empty(address), owner, amount) + log IERC20.Transfer(empty(address), owner, amount) self._after_token_transfer(empty(address), owner, amount) @@ -522,7 +504,7 @@ def _burn(owner: address, amount: uint256): assert account_balance >= amount, "erc20: burn amount exceeds balance" self.balanceOf[owner] = unsafe_sub(account_balance, amount) self.totalSupply = unsafe_sub(self.totalSupply, amount) - log Transfer(owner, empty(address), amount) + log IERC20.Transfer(owner, empty(address), amount) self._after_token_transfer(owner, empty(address), amount) @@ -543,7 +525,7 @@ def _approve(owner: address, spender: address, amount: uint256): assert spender != empty(address), "erc20: approve to the zero address" self.allowance[owner][spender] = amount - log Approval(owner, spender, amount) + log IERC20.Approval(owner, spender, amount) @internal diff --git a/src/snekmate/tokens/erc721.vy b/src/snekmate/tokens/erc721.vy index 7d29fddc..16ee3d8b 100644 --- a/src/snekmate/tokens/erc721.vy +++ b/src/snekmate/tokens/erc721.vy @@ -236,44 +236,6 @@ _token_uris: HashMap[uint256, String[432]] _counter: uint256 -# @dev Emitted when `token_id` token is -# transferred from `owner` to `to`. -event Transfer: - owner: indexed(address) - to: indexed(address) - token_id: indexed(uint256) - - -# @dev Emitted when `owner` enables `approved` -# to manage the `token_id` token. -event Approval: - owner: indexed(address) - approved: indexed(address) - token_id: indexed(uint256) - - -# @dev Emitted when `owner` enables or disables -# (`approved`) `operator` to manage all of its -# assets. -event ApprovalForAll: - owner: indexed(address) - operator: indexed(address) - approved: bool - - -# @dev Emitted when the metadata of a token is -# changed. -event MetadataUpdate: - token_id: uint256 - - -# @dev Emitted when the metadata of a range of -# tokens is changed. -event BatchMetadataUpdate: - from_token_id: uint256 - token_id: uint256 - - # @dev Emitted when the status of a `minter` # address is changed. event RoleMinterChanged: @@ -779,7 +741,7 @@ def _approve(to: address, token_id: uint256): @param token_id The 32-byte identifier of the token. """ self._token_approvals[token_id] = to - log Approval(self._owner_of(token_id), to, token_id) + log IERC721.Approval(self._owner_of(token_id), to, token_id) @internal @@ -807,7 +769,7 @@ def _set_approval_for_all(owner: address, operator: address, approved: bool): """ assert owner != operator, "erc721: approve to caller" self.isApprovedForAll[owner][operator] = approved - log ApprovalForAll(owner, operator, approved) + log IERC721.ApprovalForAll(owner, operator, approved) @internal @@ -876,7 +838,7 @@ def _mint(owner: address, token_id: uint256): # this is no longer even theoretically possible. self._balances[owner] = unsafe_add(self._balances[owner], 1) self._owners[token_id] = owner - log Transfer(empty(address), owner, token_id) + log IERC721.Transfer(empty(address), owner, token_id) self._after_token_transfer(empty(address), owner, token_id) @@ -944,7 +906,7 @@ def _transfer(owner: address, to: address, token_id: uint256): self._balances[owner] = unsafe_sub(self._balances[owner], 1) self._balances[to] = unsafe_add(self._balances[to], 1) self._owners[token_id] = to - log Transfer(owner, to, token_id) + log IERC721.Transfer(owner, to, token_id) self._after_token_transfer(owner, to, token_id) @@ -960,7 +922,7 @@ def _set_token_uri(token_id: uint256, token_uri: String[432]): """ assert self._exists(token_id), "erc721: URI set of nonexistent token" self._token_uris[token_id] = token_uri - log MetadataUpdate(token_id) + log IERC4906.MetadataUpdate(token_id) @internal @@ -997,7 +959,7 @@ def _burn(token_id: uint256): # received through minting and transfer. self._balances[owner] = unsafe_sub(self._balances[owner], 1) self._owners[token_id] = empty(address) - log Transfer(owner, empty(address), token_id) + log IERC721.Transfer(owner, empty(address), token_id) self._after_token_transfer(owner, empty(address), token_id) diff --git a/src/snekmate/tokens/mocks/erc1155_mock.vy b/src/snekmate/tokens/mocks/erc1155_mock.vy index 07482836..c595e1fd 100644 --- a/src/snekmate/tokens/mocks/erc1155_mock.vy +++ b/src/snekmate/tokens/mocks/erc1155_mock.vy @@ -114,6 +114,6 @@ def _customMint(owner: address, id: uint256, amount: uint256): # due to an arithmetic check of the entire token # supply in the function `_before_token_transfer`. erc1155.balanceOf[owner][id] = unsafe_add(erc1155.balanceOf[owner][id], amount) - log erc1155.TransferSingle(msg.sender, empty(address), owner, id, amount) + log IERC1155.TransferSingle(msg.sender, empty(address), owner, id, amount) erc1155._after_token_transfer(empty(address), owner, erc1155._as_singleton_array(id), erc1155._as_singleton_array(amount), b"") diff --git a/src/snekmate/utils/eip712_domain_separator.vy b/src/snekmate/utils/eip712_domain_separator.vy index 2f65b4f5..0d900780 100644 --- a/src/snekmate/utils/eip712_domain_separator.vy +++ b/src/snekmate/utils/eip712_domain_separator.vy @@ -54,12 +54,6 @@ _VERSION: immutable(String[20]) _HASHED_VERSION: immutable(bytes32) -# @dev May be emitted to signal that the domain could -# have changed. -event EIP712DomainChanged: - pass - - @deploy @payable def __init__(name_: String[50], version_: String[20]): @@ -90,7 +84,7 @@ def __init__(name_: String[50], version_: String[20]): @external @view -def eip712Domain() -> (bytes1, String[50], String[20], uint256, address, bytes32, DynArray[uint256, 128]): +def eip712Domain() -> (bytes1, String[50], String[20], uint256, address, bytes32, DynArray[uint256, 32]): """ @dev Returns the fields and values that describe the domain separator used by this contract for EIP-712 signatures. @@ -111,7 +105,7 @@ def eip712Domain() -> (bytes1, String[50], String[20], uint256, address, bytes32 @return DynArray The 32-byte array of EIP-712 extensions. """ # Note that `\x0f` equals `01111`. - return (convert(b"\x0f", bytes1), _NAME, _VERSION, chain.id, self, empty(bytes32), empty(DynArray[uint256, 128])) + return (convert(b"\x0f", bytes1), _NAME, _VERSION, chain.id, self, empty(bytes32), empty(DynArray[uint256, 32])) @internal diff --git a/src/snekmate/utils/interfaces/IERC5267.vyi b/src/snekmate/utils/interfaces/IERC5267.vyi index a2f628d0..7c5fc2d9 100644 --- a/src/snekmate/utils/interfaces/IERC5267.vyi +++ b/src/snekmate/utils/interfaces/IERC5267.vyi @@ -33,7 +33,7 @@ event EIP712DomainChanged: @external @view -def eip712Domain() -> (bytes1, String[50], String[20], uint256, address, bytes32, DynArray[uint256, 128]): +def eip712Domain() -> (bytes1, String[50], String[20], uint256, address, bytes32, DynArray[uint256, 32]): """ @dev Returns the fields and values that describe the domain separator used by this contract for EIP-712 signatures. diff --git a/src/snekmate/utils/merkle_proof_verification.vy b/src/snekmate/utils/merkle_proof_verification.vy index 71a6a46f..9470f581 100644 --- a/src/snekmate/utils/merkle_proof_verification.vy +++ b/src/snekmate/utils/merkle_proof_verification.vy @@ -33,6 +33,10 @@ """ +# @dev Stores the 1-byte upper bound for the dynamic arrays. +_DYNARRAY_BOUND: constant(uint8) = max_value(uint8) + + @deploy @payable def __init__(): @@ -46,7 +50,7 @@ def __init__(): @internal @pure -def _verify(proof: DynArray[bytes32, max_value(uint8)], root: bytes32, leaf: bytes32) -> bool: +def _verify(proof: DynArray[bytes32, _DYNARRAY_BOUND], root: bytes32, leaf: bytes32) -> bool: """ @dev Returns `True` if it can be proved that a `leaf` is part of a Merkle tree defined by `root`. @@ -65,8 +69,8 @@ def _verify(proof: DynArray[bytes32, max_value(uint8)], root: bytes32, leaf: byt @internal @pure -def _multi_proof_verify(proof: DynArray[bytes32, max_value(uint8)], proof_flags: DynArray[bool, max_value(uint8)], - root: bytes32, leaves: DynArray[bytes32, max_value(uint8)]) -> bool: +def _multi_proof_verify(proof: DynArray[bytes32, _DYNARRAY_BOUND], proof_flags: DynArray[bool, _DYNARRAY_BOUND], + root: bytes32, leaves: DynArray[bytes32, _DYNARRAY_BOUND]) -> bool: """ @dev Returns `True` if it can be simultaneously proved that `leaves` are part of a Merkle tree defined by `root` @@ -90,7 +94,7 @@ def _multi_proof_verify(proof: DynArray[bytes32, max_value(uint8)], proof_flags: @internal @pure -def _process_proof(proof: DynArray[bytes32, max_value(uint8)], leaf: bytes32) -> bytes32: +def _process_proof(proof: DynArray[bytes32, _DYNARRAY_BOUND], leaf: bytes32) -> bytes32: """ @dev Returns the recovered hash obtained by traversing a Merkle tree from `leaf` using `proof`. @@ -111,8 +115,8 @@ def _process_proof(proof: DynArray[bytes32, max_value(uint8)], leaf: bytes32) -> @internal @pure -def _process_multi_proof(proof: DynArray[bytes32, max_value(uint8)], proof_flags: DynArray[bool, max_value(uint8)], - leaves: DynArray[bytes32, max_value(uint8)]) -> bytes32: +def _process_multi_proof(proof: DynArray[bytes32, _DYNARRAY_BOUND], proof_flags: DynArray[bool, _DYNARRAY_BOUND], + leaves: DynArray[bytes32, _DYNARRAY_BOUND]) -> bytes32: """ @dev Returns the recovered hash obtained by traversing a Merkle tree from `leaves` using `proof` and a @@ -155,7 +159,7 @@ def _process_multi_proof(proof: DynArray[bytes32, max_value(uint8)], proof_flags # are added together or incremented by `1`. assert unsafe_add(leaves_length, len(proof)) == unsafe_add(total_hashes, 1), "merkle_proof_verification: invalid multiproof" - hashes: DynArray[bytes32, max_value(uint8)] = [] + hashes: DynArray[bytes32, _DYNARRAY_BOUND] = [] leaf_pos: uint256 = empty(uint256) hash_pos: uint256 = empty(uint256) proof_pos: uint256 = empty(uint256) diff --git a/src/snekmate/utils/mocks/merkle_proof_verification_mock.vy b/src/snekmate/utils/mocks/merkle_proof_verification_mock.vy index 3c96d127..66980af3 100644 --- a/src/snekmate/utils/mocks/merkle_proof_verification_mock.vy +++ b/src/snekmate/utils/mocks/merkle_proof_verification_mock.vy @@ -27,7 +27,7 @@ def __init__(): @external @pure -def verify(proof: DynArray[bytes32, max_value(uint8)], root: bytes32, leaf: bytes32) -> bool: +def verify(proof: DynArray[bytes32, mp._DYNARRAY_BOUND], root: bytes32, leaf: bytes32) -> bool: """ @dev Returns `True` if it can be proved that a `leaf` is part of a Merkle tree defined by `root`. @@ -46,8 +46,8 @@ def verify(proof: DynArray[bytes32, max_value(uint8)], root: bytes32, leaf: byte @external @pure -def multi_proof_verify(proof: DynArray[bytes32, max_value(uint8)], proof_flags: DynArray[bool, max_value(uint8)], - root: bytes32, leaves: DynArray[bytes32, max_value(uint8)]) -> bool: +def multi_proof_verify(proof: DynArray[bytes32, mp._DYNARRAY_BOUND], proof_flags: DynArray[bool, mp._DYNARRAY_BOUND], + root: bytes32, leaves: DynArray[bytes32, mp._DYNARRAY_BOUND]) -> bool: """ @dev Returns `True` if it can be simultaneously proved that `leaves` are part of a Merkle tree defined by `root`