Skip to content

Commit

Permalink
Replace MockERC20 with solmate's MockERC20 (#374)
Browse files Browse the repository at this point in the history
* rename MockERC20 -> UniMockERC20

* remove UniMockERC20 in favor of solmate/MockERC20

* update snapshots
  • Loading branch information
saucepoint authored and zhongeric committed Dec 14, 2023
1 parent c7d3206 commit 8874029
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 1 token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
95983
95961
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 2 tokens.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
153336
153292
2 changes: 1 addition & 1 deletion .forge-snapshots/mint with empty hook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
307152
307130
2 changes: 1 addition & 1 deletion .forge-snapshots/mint.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
293760
293738
2 changes: 1 addition & 1 deletion .forge-snapshots/swap against liquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
109743
109721
2 changes: 1 addition & 1 deletion test/foundry-tests/Fees.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {Deployers} from "./utils/Deployers.sol";
import {TokenFixture} from "./utils/TokenFixture.sol";
import {PoolModifyPositionTest} from "../../contracts/test/PoolModifyPositionTest.sol";
import {Currency, CurrencyLibrary} from "../../contracts/types/Currency.sol";
import {MockERC20} from "./utils/MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {MockHooks} from "../../contracts/test/MockHooks.sol";
import {PoolSwapTest} from "../../contracts/test/PoolSwapTest.sol";
import {GasSnapshot} from "forge-gas-snapshot/GasSnapshot.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/foundry-tests/Hooks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Hooks} from "../../contracts/libraries/Hooks.sol";
import {FeeLibrary} from "../../contracts/libraries/FeeLibrary.sol";
import {MockHooks} from "../../contracts/test/MockHooks.sol";
import {IPoolManager} from "../../contracts/interfaces/IPoolManager.sol";
import {MockERC20} from "./utils/MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {IHooks} from "../../contracts/interfaces/IHooks.sol";
import {Currency} from "../../contracts/types/Currency.sol";
import {IERC20Minimal} from "../../contracts/interfaces/external/IERC20Minimal.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/foundry-tests/PoolManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {Deployers} from "./utils/Deployers.sol";
import {TokenFixture} from "./utils/TokenFixture.sol";
import {PoolModifyPositionTest} from "../../contracts/test/PoolModifyPositionTest.sol";
import {Currency, CurrencyLibrary} from "../../contracts/types/Currency.sol";
import {MockERC20} from "./utils/MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {MockHooks} from "../../contracts/test/MockHooks.sol";
import {MockContract} from "../../contracts/test/MockContract.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/foundry-tests/PoolManagerReentrancyTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {MockERC20} from "./utils/MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {Currency, CurrencyLibrary} from "../../contracts/types/Currency.sol";
import {LockDataLibrary} from "../../contracts/libraries/LockDataLibrary.sol";
import {IPoolManager} from "../../contracts/interfaces/IPoolManager.sol";
Expand Down
6 changes: 4 additions & 2 deletions test/foundry-tests/types/Currency.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {MockERC20} from "../utils/MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {Currency, CurrencyLibrary} from "../../../contracts/types/Currency.sol";

contract TestCurrency is Test {
Expand All @@ -18,7 +18,9 @@ contract TestCurrency is Test {

function setUp() public {
nativeCurrency = Currency.wrap(address(0));
erc20Currency = Currency.wrap(address(new MockERC20("TestA", "A", 18, initialERC20Balance)));
MockERC20 token = new MockERC20("TestA", "A", 18);
token.mint(address(this), initialERC20Balance);
erc20Currency = Currency.wrap(address(token));
erc20Currency.transfer(address(1), sentBalance);
nativeCurrency.transfer(address(1), sentBalance);
}
Expand Down
5 changes: 3 additions & 2 deletions test/foundry-tests/utils/Deployers.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import {MockERC20} from "./MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {Hooks} from "../../../contracts/libraries/Hooks.sol";
import {Currency} from "../../../contracts/types/Currency.sol";
import {IHooks} from "../../../contracts/interfaces/IHooks.sol";
Expand Down Expand Up @@ -32,7 +32,8 @@ contract Deployers {
function deployTokens(uint8 count, uint256 totalSupply) internal returns (MockERC20[] memory tokens) {
tokens = new MockERC20[](count);
for (uint8 i = 0; i < count; i++) {
tokens[i] = new MockERC20("TEST", "TEST", 18, totalSupply);
tokens[i] = new MockERC20("TEST", "TEST", 18);
tokens[i].mint(address(this), totalSupply);
}
}

Expand Down
24 changes: 0 additions & 24 deletions test/foundry-tests/utils/MockERC20.sol

This file was deleted.

2 changes: 1 addition & 1 deletion test/foundry-tests/utils/SortTokens.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import {MockERC20} from "./MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {Currency} from "../../../contracts/types/Currency.sol";

library SortTokens {
Expand Down
8 changes: 5 additions & 3 deletions test/foundry-tests/utils/TokenFixture.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import {MockERC20} from "./MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {Currency} from "../../../contracts/types/Currency.sol";
import {SortTokens} from "./SortTokens.sol";

Expand All @@ -10,8 +10,10 @@ contract TokenFixture {
Currency internal currency0;

function initializeTokens() internal {
MockERC20 tokenA = new MockERC20("TestA", "A", 18, 1000 ether);
MockERC20 tokenB = new MockERC20("TestB", "B", 18, 1000 ether);
MockERC20 tokenA = new MockERC20("TestA", "A", 18);
tokenA.mint(address(this), 1000 ether);
MockERC20 tokenB = new MockERC20("TestB", "B", 18);
tokenB.mint(address(this), 1000 ether);

(currency0, currency1) = SortTokens.sort(tokenA, tokenB);
}
Expand Down

0 comments on commit 8874029

Please sign in to comment.