Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v4-core latest: solmate MockERC20 #70

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeFirstSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
154763
154780
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeInitialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
879542
879745
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
200095
200139
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
379287
379404
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeSecondSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
112303
112332
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
153038
153055
2 changes: 1 addition & 1 deletion .forge-snapshots/TWAMMSubmitOrder.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
123576
123620
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
[submodule "lib/forge-gas-snapshot"]
path = lib/forge-gas-snapshot
url = https://github.com/marktoda/forge-gas-snapshot
[submodule "lib/v4-core"]
path = lib/v4-core
url = [email protected]:Uniswap/v4-core.git
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "lib/v4-core"]
path = lib/v4-core
url = https://github.com/uniswap/v4-core
6 changes: 1 addition & 5 deletions contracts/hooks/examples/VolatilityOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ contract VolatilityOracle is BaseHook, IDynamicFeeManager {

uint32 deployTimestamp;

function getFee(address, PoolKey calldata, IPoolManager.SwapParams calldata, bytes calldata)
external
view
returns (uint24)
{
function getFee(address, PoolKey calldata) external view returns (uint24) {
uint24 startingFee = 3000;
uint32 lapsed = _blockTimestamp() - deployTimestamp;
return startingFee + (uint24(lapsed) * 100) / 60; // 100 bps a minute
Expand Down
2 changes: 1 addition & 1 deletion lib/v4-core
Submodule v4-core updated 62 files
+1 −0 .forge-snapshots/SwapMath_oneForZero_exactInCapped.snap
+1 −0 .forge-snapshots/SwapMath_oneForZero_exactInPartial.snap
+1 −0 .forge-snapshots/SwapMath_oneForZero_exactOutCapped.snap
+1 −0 .forge-snapshots/SwapMath_oneForZero_exactOutPartial.snap
+1 −0 .forge-snapshots/SwapMath_zeroForOne_exactInCapped.snap
+1 −0 .forge-snapshots/SwapMath_zeroForOne_exactInPartial.snap
+1 −0 .forge-snapshots/SwapMath_zeroForOne_exactOutCapped.snap
+1 −0 .forge-snapshots/SwapMath_zeroForOne_exactOutPartial.snap
+1 −0 .forge-snapshots/before swap hook, already cached dynamic fee.snap
+1 −0 .forge-snapshots/cached dynamic fee, no hooks.snap
+1 −1 .forge-snapshots/donate gas with 1 token.snap
+1 −1 .forge-snapshots/donate gas with 2 tokens.snap
+1 −1 .forge-snapshots/initialize.snap
+1 −1 .forge-snapshots/mint with empty hook.snap
+1 −1 .forge-snapshots/mint.snap
+0 −1 .forge-snapshots/poolExtsloadSlot0.snap
+0 −1 .forge-snapshots/poolExtsloadTickInfoStruct.snap
+1 −1 .forge-snapshots/simple swap.snap
+1 −1 .forge-snapshots/swap against liquidity with native token.snap
+1 −1 .forge-snapshots/swap against liquidity.snap
+1 −1 .forge-snapshots/swap with dynamic fee.snap
+1 −1 .forge-snapshots/swap with hooks.snap
+1 −1 .forge-snapshots/swap with native.snap
+1 −0 .forge-snapshots/update dynamic fee in before swap.snap
+3 −3 README.md
+9 −0 contracts/Fees.sol
+23 −29 contracts/PoolManager.sol
+2 −4 contracts/interfaces/IDynamicFeeManager.sol
+3 −1 contracts/interfaces/IFees.sol
+1 −1 contracts/interfaces/IHookFeeManager.sol
+1 −1 contracts/interfaces/IHooks.sol
+8 −3 contracts/interfaces/IPoolManager.sol
+1 −1 contracts/interfaces/IProtocolFeeController.sol
+1 −1 contracts/interfaces/callback/ILockCallback.sol
+1 −1 contracts/libraries/Hooks.sol
+25 −6 contracts/libraries/Pool.sol
+87 −0 contracts/test/BaseTestHooks.sol
+47 −0 contracts/test/DynamicFeesTest.sol
+0 −52 contracts/test/SwapMathEchidnaTest.sol
+0 −28 contracts/test/SwapMathTest.sol
+1 −1 contracts/types/BalanceDelta.sol
+6 −2 contracts/types/Currency.sol
+1 −1 contracts/types/PoolId.sol
+1 −1 contracts/types/PoolKey.sol
+2 −1 foundry.toml
+1 −1 justfile
+0 −324 test/SwapMath.spec.ts
+19 −19 test/__snapshots__/PoolManager.gas.spec.ts.snap
+1 −1 test/__snapshots__/PoolManager.spec.ts.snap
+0 −17 test/__snapshots__/SwapMath.spec.ts.snap
+82 −26 test/foundry-tests/DynamicFees.t.sol
+1 −1 test/foundry-tests/Fees.t.sol
+1 −1 test/foundry-tests/Hooks.t.sol
+9 −7 test/foundry-tests/Pool.t.sol
+14 −1 test/foundry-tests/PoolManager.t.sol
+1 −1 test/foundry-tests/PoolManagerReentrancyTest.t.sol
+272 −0 test/foundry-tests/SwapMath.t.sol
+4 −2 test/foundry-tests/types/Currency.t.sol
+10 −3 test/foundry-tests/utils/Deployers.sol
+0 −24 test/foundry-tests/utils/MockERC20.sol
+1 −1 test/foundry-tests/utils/SortTokens.sol
+5 −3 test/foundry-tests/utils/TokenFixture.sol
11 changes: 7 additions & 4 deletions test/FullRange.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {FullRangeImplementation} from "./shared/implementation/FullRangeImplemen
import {PoolManager} from "@uniswap/v4-core/contracts/PoolManager.sol";
import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol";
import {Deployers} from "@uniswap/v4-core/test/foundry-tests/utils/Deployers.sol";
import {MockERC20} from "@uniswap/v4-core/test/foundry-tests/utils/MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {Currency, CurrencyLibrary} from "@uniswap/v4-core/contracts/types/Currency.sol";
import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol";
import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol";
Expand Down Expand Up @@ -84,9 +84,12 @@ contract TestFullRange is Test, Deployers, GasSnapshot {
PoolSwapTest swapRouter;

function setUp() public {
token0 = new MockERC20("TestA", "A", 18, 2 ** 128);
token1 = new MockERC20("TestB", "B", 18, 2 ** 128);
token2 = new MockERC20("TestC", "C", 18, 2 ** 128);
token0 = new MockERC20("TestA", "A", 18);
token0.mint(address(this), 2 ** 128);
token1 = new MockERC20("TestB", "B", 18);
token1.mint(address(this), 2 ** 128);
token2 = new MockERC20("TestC", "C", 18);
token2.mint(address(this), 2 ** 128);

manager = new PoolManager(500000);

Expand Down
2 changes: 1 addition & 1 deletion test/TWAMM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.15;
import {Test} from "forge-std/Test.sol";
import {Vm} from "forge-std/Vm.sol";
import {GasSnapshot} from "forge-gas-snapshot/GasSnapshot.sol";
import {MockERC20} from "@uniswap/v4-core/test/foundry-tests/utils/MockERC20.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {IERC20Minimal} from "@uniswap/v4-core/contracts/interfaces/external/IERC20Minimal.sol";
import {TWAMMImplementation} from "./shared/implementation/TWAMMImplementation.sol";
import {IHooks} from "@uniswap/v4-core/contracts/interfaces/IHooks.sol";
Expand Down