Skip to content

Commit

Permalink
Merge pull request #14 from 1inch/SC-1057-Integrate-ERC20True-token
Browse files Browse the repository at this point in the history
[SC-1057] Integrate ERC20True token
  • Loading branch information
ZumZoom authored Feb 8, 2024
2 parents 8d77e82 + 1e4811e commit 8137d17
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 42 deletions.
62 changes: 31 additions & 31 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -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)
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)
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ignore:
- "test"
- "contracts/mocks"
25 changes: 25 additions & 0 deletions contracts/mocks/ERC20True.sol
Original file line number Diff line number Diff line change
@@ -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;
}
}
2 changes: 1 addition & 1 deletion lib/clones-with-immutable-args
2 changes: 1 addition & 1 deletion lib/forge-std
2 changes: 1 addition & 1 deletion lib/openzeppelin-contracts
2 changes: 1 addition & 1 deletion lib/solidity-utils
2 changes: 1 addition & 1 deletion scripts/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 5 additions & 5 deletions test/utils/BaseSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 8137d17

Please sign in to comment.