Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds committed Jan 13, 2023
1 parent 6ba10b5 commit d2f227e
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 63 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/AllowanceTransferInvariants.t.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/SignatureTransfer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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[];

Expand Down
44 changes: 44 additions & 0 deletions test/mocks/MockPermit2ERC721.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}
44 changes: 0 additions & 44 deletions test/mocks/MockPermit2_ERC721.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d2f227e

Please sign in to comment.