diff --git a/.gas-snapshot b/.gas-snapshot index a31980a..a47495b 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,43 +1,43 @@ -EscrowFactoryTest:testFuzz_DeployCloneForMaker(bytes32,uint56,uint56) (runs: 256, μ: 234214, ~: 237929) -EscrowFactoryTest:testFuzz_DeployCloneForTaker(bytes32,uint56) (runs: 256, μ: 180290, ~: 183214) -EscrowFactoryTest:test_NoDeploymentForNotResolver() (gas: 103500) -EscrowFactoryTest:test_NoInsufficientBalanceDeploymentForMaker() (gas: 185378) +EscrowFactoryTest:testFuzz_DeployCloneForMaker(bytes32,uint56,uint56) (runs: 256, μ: 234430, ~: 238022) +EscrowFactoryTest:testFuzz_DeployCloneForTaker(bytes32,uint56) (runs: 256, μ: 180420, ~: 183244) +EscrowFactoryTest:test_NoDeploymentForNotResolver() (gas: 103566) +EscrowFactoryTest:test_NoInsufficientBalanceDeploymentForMaker() (gas: 185444) EscrowFactoryTest:test_NoInsufficientBalanceDeploymentForTaker() (gas: 27693) -EscrowFactoryTest:test_NoInsufficientBalanceNativeDeploymentForMaker() (gas: 151028) +EscrowFactoryTest:test_NoInsufficientBalanceNativeDeploymentForMaker() (gas: 151094) EscrowFactoryTest:test_NoInsufficientBalanceNativeDeploymentForTaker() (gas: 32357) EscrowFactoryTest:test_NoUnsafeDeploymentForTaker() (gas: 34955) -EscrowTest:test_CancelDst() (gas: 165227) -EscrowTest:test_CancelPublicSrc() (gas: 229725) -EscrowTest:test_CancelResolverSrc() (gas: 230817) -EscrowTest:test_NoAnyoneCancelDuringResolverCancelSrc() (gas: 228089) +EscrowTest:test_CancelDst() (gas: 165239) +EscrowTest:test_CancelPublicSrc() (gas: 229949) +EscrowTest:test_CancelResolverSrc() (gas: 231041) +EscrowTest:test_NoAnyoneCancelDuringResolverCancelSrc() (gas: 228304) EscrowTest:test_NoCancelByAnyoneDst() (gas: 172973) EscrowTest:test_NoCancelDuringPublicWithdrawalDst() (gas: 170754) EscrowTest:test_NoCancelDuringResolverWithdrawalDst() (gas: 168458) -EscrowTest:test_NoCancelDuringWithdrawalSrc() (gas: 225460) +EscrowTest:test_NoCancelDuringWithdrawalSrc() (gas: 225675) EscrowTest:test_NoFailedNativeTokenTransferCancelDst() (gas: 183608) -EscrowTest:test_NoFailedNativeTokenTransferCancelSrc() (gas: 245475) +EscrowTest:test_NoFailedNativeTokenTransferCancelSrc() (gas: 245690) EscrowTest:test_NoFailedNativeTokenTransferWithdrawalDst() (gas: 203498) EscrowTest:test_NoFailedNativeTokenTransferWithdrawalDstNative() (gas: 134571) -EscrowTest:test_NoFailedNativeTokenTransferWithdrawalSrc() (gas: 259717) -EscrowTest:test_NoRescueFundsByAnyoneDst() (gas: 222089) -EscrowTest:test_NoRescueFundsByAnyoneSrc() (gas: 270170) -EscrowTest:test_NoRescueFundsEarlierDst() (gas: 221951) -EscrowTest:test_NoRescueFundsEarlierSrc() (gas: 270464) -EscrowTest:test_NoWithdrawalByAnyone() (gas: 223242) +EscrowTest:test_NoFailedNativeTokenTransferWithdrawalSrc() (gas: 259932) +EscrowTest:test_NoRescueFundsByAnyoneDst() (gas: 222092) +EscrowTest:test_NoRescueFundsByAnyoneSrc() (gas: 270388) +EscrowTest:test_NoRescueFundsEarlierDst() (gas: 221954) +EscrowTest:test_NoRescueFundsEarlierSrc() (gas: 270682) +EscrowTest:test_NoWithdrawalByAnyone() (gas: 223457) EscrowTest:test_NoWithdrawalByNonResolverDst() (gas: 168588) EscrowTest:test_NoWithdrawalDuringFinalityLockDst() (gas: 165648) -EscrowTest:test_NoWithdrawalDuringFinalityLockSrc() (gas: 224115) +EscrowTest:test_NoWithdrawalDuringFinalityLockSrc() (gas: 224330) EscrowTest:test_NoWithdrawalWithWrongSecretDst() (gas: 169493) -EscrowTest:test_NoWithdrawalWithWrongSecretSrc() (gas: 226502) -EscrowTest:test_RescueFundsDst() (gas: 200719) -EscrowTest:test_RescueFundsDstNative() (gas: 229181) -EscrowTest:test_RescueFundsSrc() (gas: 253427) -EscrowTest:test_RescueFundsSrcNative() (gas: 255609) -EscrowTest:test_WithdrawByAnyoneDst() (gas: 187702) -EscrowTest:test_WithdrawByResolverDst() (gas: 186485) -EscrowTest:test_WithdrawByResolverDstNative() (gas: 146512) -EscrowTest:test_WithdrawByResolverPublicDst() (gas: 188070) -EscrowTest:test_WithdrawSrc() (gas: 246147) -IntegrationEscrowFactoryTest:testFuzz_DeployCloneForMakerInt(bytes32,uint56,uint56) (runs: 256, μ: 296592, ~: 299936) -IntegrationEscrowFactoryTest:test_NoInsufficientBalanceDeploymentForMakerInt() (gas: 281536) -TimelocksLibTest:test_getStartTimestamps() (gas: 15326) \ No newline at end of file +EscrowTest:test_NoWithdrawalWithWrongSecretSrc() (gas: 226717) +EscrowTest:test_RescueFundsDst() (gas: 200728) +EscrowTest:test_RescueFundsDstNative() (gas: 229187) +EscrowTest:test_RescueFundsSrc() (gas: 253648) +EscrowTest:test_RescueFundsSrcNative() (gas: 255833) +EscrowTest:test_WithdrawByAnyoneDst() (gas: 187714) +EscrowTest:test_WithdrawByResolverDst() (gas: 186497) +EscrowTest:test_WithdrawByResolverDstNative() (gas: 146521) +EscrowTest:test_WithdrawByResolverPublicDst() (gas: 188082) +EscrowTest:test_WithdrawSrc() (gas: 246371) +IntegrationEscrowFactoryTest:testFuzz_DeployCloneForMakerInt(bytes32,uint56,uint56) (runs: 256, μ: 416624, ~: 419968) +IntegrationEscrowFactoryTest:test_NoInsufficientBalanceDeploymentForMakerInt() (gas: 401360) +TimelocksLibTest:test_getStartTimestamps() (gas: 15344) \ No newline at end of file diff --git a/codecov.yml b/codecov.yml index b52d0c4..d0011cc 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,2 +1,3 @@ ignore: - "test" + - "contracts/mocks" diff --git a/contracts/mocks/ERC20True.sol b/contracts/mocks/ERC20True.sol new file mode 100644 index 0000000..449febe --- /dev/null +++ b/contracts/mocks/ERC20True.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.23; + +contract ERC20True { + function transfer(address, uint256) public pure returns (bool) { + return true; + } + + function transferFrom(address, address, uint256) public pure returns (bool) { + return true; + } + + function approve(address, uint256) public pure returns (bool) { + return true; + } + + function balanceOf(address) public pure returns (uint256) { + return 0; + } + + function allowance(address, address) public pure returns (uint256) { + return 0; + } +} diff --git a/lib/clones-with-immutable-args b/lib/clones-with-immutable-args index bf8cb7d..f5ca191 160000 --- a/lib/clones-with-immutable-args +++ b/lib/clones-with-immutable-args @@ -1 +1 @@ -Subproject commit bf8cb7dc50833038c2a27fc61384cb493cb731ab +Subproject commit f5ca191afea933d50a36d101009b5644dc28bc99 diff --git a/lib/forge-std b/lib/forge-std index 155d547..4513bc2 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 155d547c449afa8715f538d69454b83944117811 +Subproject commit 4513bc2063f23c57bee6558799584b518d387a39 diff --git a/lib/limit-order-protocol b/lib/limit-order-protocol index b9f9869..1a32e05 160000 --- a/lib/limit-order-protocol +++ b/lib/limit-order-protocol @@ -1 +1 @@ -Subproject commit b9f986971faf59f1652b6ab2fa949d73ca6e82f8 +Subproject commit 1a32e059f78ddcf1fe6294baed6cafb73a04b685 diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index 01ef448..7eba10d 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit 01ef448981be9d20ca85f2faf6ebdf591ce409f3 +Subproject commit 7eba10dd1e4899f5ca93e3ec3a0b3dafff9b1f03 diff --git a/lib/solidity-utils b/lib/solidity-utils index ebf7a89..74f8c2a 160000 --- a/lib/solidity-utils +++ b/lib/solidity-utils @@ -1 +1 @@ -Subproject commit ebf7a8990d65eb9bc00ea8ab4f0cbb2358d78e38 +Subproject commit 74f8c2a3c42403a5c85f94ba5d403f1fef51c1bf diff --git a/scripts/coverage.sh b/scripts/coverage.sh index ddf45bd..6347389 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -10,7 +10,7 @@ lcov \ --rc branch_coverage=1 \ --remove coverage/lcov.info \ --output-file coverage/filtered-lcov.info \ - "*test*" + "*test*" "contracts/mocks/*" # Generate summary lcov \ diff --git a/test/utils/BaseSetup.sol b/test/utils/BaseSetup.sol index fa35ed2..4f2041c 100644 --- a/test/utils/BaseSetup.sol +++ b/test/utils/BaseSetup.sol @@ -15,9 +15,10 @@ import { TokenMock } from "solidity-utils/mocks/TokenMock.sol"; import { Escrow } from "contracts/Escrow.sol"; import { EscrowFactory, IEscrowFactory } from "contracts/EscrowFactory.sol"; +import { ERC20True } from "contracts/mocks/ERC20True.sol"; +import { IEscrow } from "contracts/interfaces/IEscrow.sol"; import { PackedAddresses, PackedAddressesMemLib } from "./libraries/PackedAddressesMemLib.sol"; import { Timelocks, TimelocksSettersLib } from "./libraries/TimelocksSettersLib.sol"; -import { IEscrow } from "contracts/interfaces/IEscrow.sol"; import { Utils, VmSafe } from "./Utils.sol"; @@ -153,7 +154,6 @@ contract BaseSetup is Test { vm.startPrank(bob.addr); dai.approve(address(escrowFactory), 1000 ether); - dai.approve(address(limitOrderProtocol), 1000 ether); inch.approve(address(feeBank), 1000 ether); feeBank.deposit(10 ether); vm.stopPrank(); @@ -225,7 +225,7 @@ contract BaseSetup is Test { uint256 srcAmount, uint256 dstAmount, bool fakeOrder - ) internal view returns( + ) internal returns( IOrderMixin.Order memory order, bytes32 orderHash, bytes memory extraData, @@ -273,9 +273,9 @@ contract BaseSetup is Test { (order, extension) = _buildOrder( alice.addr, - bob.addr, + address(0), address(usdc), - address(dai), + address(new ERC20True()), srcAmount, dstAmount, MakerTraits.wrap(0),