From d2f227ecd48fee4aa1a58e355a8546a1c37b3d59 Mon Sep 17 00:00:00 2001 From: Sara Reynolds Date: Fri, 13 Jan 2023 11:28:54 -0700 Subject: [PATCH] rename --- .../{Permit2_ERC721.sol => Permit2ERC721.sol} | 0 test/AllowanceTransferInvariants.t.sol | 2 +- ...t.sol => AllowanceTransferTestERC20.t.sol} | 4 +- test/SignatureTransfer.t.sol | 4 +- test/mocks/MockPermit2ERC721.sol | 44 +++++++++++++++++++ test/mocks/MockPermit2_ERC721.sol | 44 ------------------- ...C20.t.sol => AllowanceUnitTestERC20.t.sol} | 4 +- ...21.t.sol => AllowanceUnitTestERC721.t.sol} | 10 ++--- ...C721.t.sol => NonceBitmapTestERC721.t.sol} | 10 ++--- ...vider_ERC20.sol => TokenProviderERC20.sol} | 2 +- ...der_ERC721.sol => TokenProviderERC721.sol} | 2 +- 11 files changed, 63 insertions(+), 63 deletions(-) rename src/ERC721/{Permit2_ERC721.sol => Permit2ERC721.sol} (100%) rename test/{AllowanceTransferTest_ERC20.t.sol => AllowanceTransferTestERC20.t.sol} (97%) create mode 100644 test/mocks/MockPermit2ERC721.sol delete mode 100644 test/mocks/MockPermit2_ERC721.sol rename test/shared/{AllowanceUnitTest_ERC20.t.sol => AllowanceUnitTestERC20.t.sol} (81%) rename test/shared/{AllowanceUnitTest_ERC721.t.sol => AllowanceUnitTestERC721.t.sol} (61%) rename test/shared/{NonceBitmapTest_ERC721.t.sol => NonceBitmapTestERC721.t.sol} (53%) rename test/utils/{TokenProvider_ERC20.sol => TokenProviderERC20.sol} (98%) rename test/utils/{TokenProvider_ERC721.sol => TokenProviderERC721.sol} (98%) diff --git a/src/ERC721/Permit2_ERC721.sol b/src/ERC721/Permit2ERC721.sol similarity index 100% rename from src/ERC721/Permit2_ERC721.sol rename to src/ERC721/Permit2ERC721.sol diff --git a/test/AllowanceTransferInvariants.t.sol b/test/AllowanceTransferInvariants.t.sol index 7b4527e9..d44049ad 100644 --- a/test/AllowanceTransferInvariants.t.sol +++ b/test/AllowanceTransferInvariants.t.sol @@ -1,7 +1,7 @@ pragma solidity 0.8.17; import "forge-std/Test.sol"; -import {TokenProvider_ERC20} from "./utils/TokenProvider_ERC20.sol"; +import {TokenProviderERC20} from "./utils/TokenProviderERC20.sol"; import {Permit2} from "../src/ERC20/Permit2.sol"; import {IAllowanceTransfer} from "../src/ERC20/interfaces/IAllowanceTransfer.sol"; import {SignatureVerification} from "../src/shared/SignatureVerification.sol"; diff --git a/test/AllowanceTransferTest_ERC20.t.sol b/test/AllowanceTransferTestERC20.t.sol similarity index 97% rename from test/AllowanceTransferTest_ERC20.t.sol rename to test/AllowanceTransferTestERC20.t.sol index 05edeebd..ad21a0ad 100644 --- a/test/AllowanceTransferTest_ERC20.t.sol +++ b/test/AllowanceTransferTestERC20.t.sol @@ -4,14 +4,14 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; import {BaseAllowanceTransferTest} from "./BaseAllowanceTransferTest.t.sol"; import {Permit2} from "../src/ERC20/Permit2.sol"; -import {TokenProvider_ERC20} from "./utils/TokenProvider_ERC20.sol"; +import {TokenProviderERC20} from "./utils/TokenProviderERC20.sol"; import {PermitHash} from "../src/ERC20/libraries/PermitHash.sol"; import {PermitAbstraction} from "./utils/PermitAbstraction.sol"; import {PermitSignature} from "./utils/PermitSignature.sol"; import {IAllowanceTransfer} from "../src/ERC20/interfaces/IAllowanceTransfer.sol"; import {MockERC20} from "./mocks/MockERC20.sol"; -contract AllowanceTransferTest_ERC20 is TokenProvider_ERC20, BaseAllowanceTransferTest { +contract AllowanceTransferTestERC20 is TokenProviderERC20, BaseAllowanceTransferTest { function setUp() public override { permit2 = address(new Permit2()); DOMAIN_SEPARATOR = Permit2(permit2).DOMAIN_SEPARATOR(); diff --git a/test/SignatureTransfer.t.sol b/test/SignatureTransfer.t.sol index 332bc2a6..fbe51ddc 100644 --- a/test/SignatureTransfer.t.sol +++ b/test/SignatureTransfer.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; import {SafeERC20, IERC20, IERC20Permit} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; import {SignatureVerification} from "../src/shared/SignatureVerification.sol"; -import {TokenProvider_ERC20} from "./utils/TokenProvider_ERC20.sol"; +import {TokenProviderERC20} from "./utils/TokenProviderERC20.sol"; import {PermitSignature} from "./utils/PermitSignature.sol"; import {AddressBuilder} from "./utils/AddressBuilder.sol"; import {AmountBuilder} from "./utils/AmountBuilder.sol"; @@ -15,7 +15,7 @@ import {GasSnapshot} from "forge-gas-snapshot/GasSnapshot.sol"; import {ISignatureTransfer} from "../src/ERC20/interfaces/ISignatureTransfer.sol"; import {InvalidNonce, SignatureExpired} from "../src/shared/PermitErrors.sol"; -contract SignatureTransferTest is Test, PermitSignature, TokenProvider_ERC20, GasSnapshot { +contract SignatureTransferTest is Test, PermitSignature, TokenProviderERC20, GasSnapshot { using AddressBuilder for address[]; using AmountBuilder for uint256[]; diff --git a/test/mocks/MockPermit2ERC721.sol b/test/mocks/MockPermit2ERC721.sol new file mode 100644 index 00000000..d88276dc --- /dev/null +++ b/test/mocks/MockPermit2ERC721.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.17; + +import {Permit2ERC721} from "../../src/ERC721/Permit2ERC721.sol"; +import {IAllowanceTransferERC721} from "../../src/ERC721/interfaces/IAllowanceTransferERC721.sol"; +import {SignatureTransferERC721} from "../../src/ERC721/SignatureTransferERC721.sol"; +import {AllowanceERC721} from "../../src/ERC721/libraries/AllowanceERC721.sol"; +import {IMockPermit2} from "../mocks/IMockPermit2.sol"; + +contract MockPermit2ERC721 is IMockPermit2, Permit2ERC721 { + function doStore(address from, address token, address spender, uint256 word) public override { + IAllowanceTransferERC721.PackedAllowance storage allowed = allowance[from][token][spender]; + assembly { + sstore(allowed.slot, word) + } + } + + function getStore(address from, address token, address spender) public view override returns (uint256 word) { + IAllowanceTransferERC721.PackedAllowance storage allowed = allowance[from][token][spender]; + assembly { + word := sload(allowed.slot) + } + } + + function mockUpdateSome(address from, address token, address spender, uint160 data, uint48 expiration) + public + override + { + IAllowanceTransferERC721.PackedAllowance storage allowed = allowance[from][token][spender]; + AllowanceERC721.updateTokenIdAndExpiration(allowed, data, expiration); + } + + function mockUpdateAll(address from, address token, address spender, uint160 data, uint48 expiration, uint48 nonce) + public + override + { + IAllowanceTransferERC721.PackedAllowance storage allowed = allowance[from][token][spender]; + AllowanceERC721.updateAll(allowed, data, expiration, nonce); + } + + function useUnorderedNonce(address from, uint256 nonce) public override { + _useUnorderedNonce(from, nonce); + } +} diff --git a/test/mocks/MockPermit2_ERC721.sol b/test/mocks/MockPermit2_ERC721.sol deleted file mode 100644 index 27d38185..00000000 --- a/test/mocks/MockPermit2_ERC721.sol +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.17; - -import {Permit2_ERC721} from "../../src/ERC721/Permit2_ERC721.sol"; -import {IAllowanceTransfer_ERC721} from "../../src/ERC721/interfaces/IAllowanceTransfer_ERC721.sol"; -import {SignatureTransfer_ERC721} from "../../src/ERC721/SignatureTransfer_ERC721.sol"; -import {Allowance_ERC721} from "../../src/ERC721/libraries/Allowance_ERC721.sol"; -import {IMockPermit2} from "../mocks/IMockPermit2.sol"; - -contract MockPermit2_ERC721 is IMockPermit2, Permit2_ERC721 { - function doStore(address from, address token, address spender, uint256 word) public override { - IAllowanceTransfer_ERC721.PackedAllowance storage allowed = allowance[from][token][spender]; - assembly { - sstore(allowed.slot, word) - } - } - - function getStore(address from, address token, address spender) public view override returns (uint256 word) { - IAllowanceTransfer_ERC721.PackedAllowance storage allowed = allowance[from][token][spender]; - assembly { - word := sload(allowed.slot) - } - } - - function mockUpdateSome(address from, address token, address spender, uint160 data, uint48 expiration) - public - override - { - IAllowanceTransfer_ERC721.PackedAllowance storage allowed = allowance[from][token][spender]; - Allowance_ERC721.updateTokenIdAndExpiration(allowed, data, expiration); - } - - function mockUpdateAll(address from, address token, address spender, uint160 data, uint48 expiration, uint48 nonce) - public - override - { - IAllowanceTransfer_ERC721.PackedAllowance storage allowed = allowance[from][token][spender]; - Allowance_ERC721.updateAll(allowed, data, expiration, nonce); - } - - function useUnorderedNonce(address from, uint256 nonce) public override { - _useUnorderedNonce(from, nonce); - } -} diff --git a/test/shared/AllowanceUnitTest_ERC20.t.sol b/test/shared/AllowanceUnitTestERC20.t.sol similarity index 81% rename from test/shared/AllowanceUnitTest_ERC20.t.sol rename to test/shared/AllowanceUnitTestERC20.t.sol index 7631de06..b5046e2c 100644 --- a/test/shared/AllowanceUnitTest_ERC20.t.sol +++ b/test/shared/AllowanceUnitTestERC20.t.sol @@ -4,9 +4,9 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; import "../mocks/MockPermit2.sol"; import {BaseAllowanceUnitTest} from "./BaseAllowanceUnitTest.sol"; -import {TokenProvider_ERC20} from "../utils/TokenProvider_ERC20.sol"; +import {TokenProviderERC20} from "../utils/TokenProviderERC20.sol"; -contract AllowanceUnitTest_ERC20 is TokenProvider_ERC20, BaseAllowanceUnitTest { +contract AllowanceUnitTest_ERC20 is TokenProviderERC20, BaseAllowanceUnitTest { function setUp() public override { permit2 = new MockPermit2(); initializeERC20Tokens(); diff --git a/test/shared/AllowanceUnitTest_ERC721.t.sol b/test/shared/AllowanceUnitTestERC721.t.sol similarity index 61% rename from test/shared/AllowanceUnitTest_ERC721.t.sol rename to test/shared/AllowanceUnitTestERC721.t.sol index d4fa7e71..3d302bf0 100644 --- a/test/shared/AllowanceUnitTest_ERC721.t.sol +++ b/test/shared/AllowanceUnitTestERC721.t.sol @@ -2,13 +2,13 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; -import "../mocks/MockPermit2_ERC721.sol"; +import "../mocks/MockPermit2ERC721.sol"; import {BaseAllowanceUnitTest} from "./BaseAllowanceUnitTest.sol"; -import {TokenProvider_ERC721} from "../utils/TokenProvider_ERC721.sol"; +import {TokenProviderERC721} from "../utils/TokenProviderERC721.sol"; -contract AllowanceUnitTest_ERC721 is TokenProvider_ERC721, BaseAllowanceUnitTest { +contract AllowanceUnitTestERC721 is TokenProviderERC721, BaseAllowanceUnitTest { function setUp() public override { - permit2 = new MockPermit2_ERC721(); + permit2 = new MockPermit2ERC721(); initializeERC721TestTokens(); } @@ -18,7 +18,7 @@ contract AllowanceUnitTest_ERC721 is TokenProvider_ERC721, BaseAllowanceUnitTest override returns (uint160, uint48, uint48) { - return MockPermit2_ERC721(address(permit2)).allowance(from, token, spender); + return MockPermit2ERC721(address(permit2)).allowance(from, token, spender); } function token1() public view override returns (address) { diff --git a/test/shared/NonceBitmapTest_ERC721.t.sol b/test/shared/NonceBitmapTestERC721.t.sol similarity index 53% rename from test/shared/NonceBitmapTest_ERC721.t.sol rename to test/shared/NonceBitmapTestERC721.t.sol index 980b3b45..effc7af6 100644 --- a/test/shared/NonceBitmapTest_ERC721.t.sol +++ b/test/shared/NonceBitmapTestERC721.t.sol @@ -3,18 +3,18 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; import {BaseNonceBitmapTest} from "./BaseNonceBitmapTest.t.sol"; -import {MockPermit2_ERC721} from "../mocks/MockPermit2_ERC721.sol"; +import {MockPermit2ERC721} from "../mocks/MockPermit2ERC721.sol"; -contract NonceBitmapTest_ERC721 is BaseNonceBitmapTest { +contract NonceBitmapTestERC721 is BaseNonceBitmapTest { function setUp() public override { - permit2 = new MockPermit2_ERC721(); + permit2 = new MockPermit2ERC721(); } function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) public override { - MockPermit2_ERC721(address(permit2)).invalidateUnorderedNonces(wordPos, mask); + MockPermit2ERC721(address(permit2)).invalidateUnorderedNonces(wordPos, mask); } function nonceBitmap(address addr, uint256 wordPos) public override returns (uint256) { - return MockPermit2_ERC721(address(permit2)).nonceBitmap(addr, wordPos); + return MockPermit2ERC721(address(permit2)).nonceBitmap(addr, wordPos); } } diff --git a/test/utils/TokenProvider_ERC20.sol b/test/utils/TokenProviderERC20.sol similarity index 98% rename from test/utils/TokenProvider_ERC20.sol rename to test/utils/TokenProviderERC20.sol index e38503fd..24ece69d 100644 --- a/test/utils/TokenProvider_ERC20.sol +++ b/test/utils/TokenProviderERC20.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; import {MockERC20} from "../mocks/MockERC20.sol"; -contract TokenProvider_ERC20 { +contract TokenProviderERC20 { uint256 public constant MINT_AMOUNT_ERC20 = 100 ** 18; uint256 public constant MINT_AMOUNT_ERC1155 = 100; diff --git a/test/utils/TokenProvider_ERC721.sol b/test/utils/TokenProviderERC721.sol similarity index 98% rename from test/utils/TokenProvider_ERC721.sol rename to test/utils/TokenProviderERC721.sol index 630891b9..681f02d5 100644 --- a/test/utils/TokenProvider_ERC721.sol +++ b/test/utils/TokenProviderERC721.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.17; import "forge-std/Test.sol"; import {MockERC721} from "../mocks/MockERC721.sol"; -contract TokenProvider_ERC721 { +contract TokenProviderERC721 { uint256 public constant MINT_AMOUNT_ERC20 = 100 ** 18; uint256 public constant MINT_AMOUNT_ERC1155 = 100;