Skip to content

Commit

Permalink
set up template for hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericselvig committed Nov 21, 2024
1 parent aa1c41f commit a78065e
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 57 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/v4-periphery"]
path = lib/v4-periphery
url = https://github.com/Uniswap/v4-periphery
[submodule "lib/v4-core"]
path = lib/v4-core
url = https://github.com/Uniswap/v4-core
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"solidity.compileUsingRemoteVersion": "v0.8.26+commit.8a97fa7a",
"solidity.defaultCompiler": "localNodeModule"
}
6 changes: 6 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ src = "src"
out = "out"
libs = ["lib"]

solc_version = '0.8.26'
evm_version = "cancun"
optimizer_runs = 800
via_ir = false
ffi = true

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
1 change: 1 addition & 0 deletions lib/v4-core
Submodule v4-core added at b619b6
1 change: 1 addition & 0 deletions lib/v4-periphery
Submodule v4-periphery added at d76780
14 changes: 14 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@ensdomains/=lib/v4-periphery/lib/v4-core/node_modules/@ensdomains/
@openzeppelin/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/
@openzeppelin/contracts/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/contracts/
@uniswap/v4-core/=lib/v4-periphery/lib/v4-core/
ds-test/=lib/v4-periphery/lib/v4-core/lib/forge-std/lib/ds-test/src/
erc4626-tests/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/
forge-gas-snapshot/=lib/v4-periphery/lib/forge-gas-snapshot/src/
forge-std/=lib/forge-std/src/
hardhat/=lib/v4-periphery/lib/v4-core/node_modules/hardhat/
openzeppelin-contracts/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/
permit2/=lib/v4-periphery/lib/permit2/
solmate/=lib/v4-periphery/lib/v4-core/lib/solmate/
v4-core/=lib/v4-periphery/lib/v4-core/src/
v4-periphery/=lib/v4-periphery/
19 changes: 0 additions & 19 deletions script/Counter.s.sol

This file was deleted.

111 changes: 111 additions & 0 deletions soljson-v0.8.26+commit.8a97fa7a.js

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions src/Counter.sol

This file was deleted.

35 changes: 35 additions & 0 deletions src/JITHook.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {BaseHook} from "v4-periphery/src/base/hooks/BaseHook.sol";
import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol";
import {Hooks} from "v4-core/libraries/Hooks.sol";

contract JITHook is BaseHook {
constructor(IPoolManager _manager) BaseHook(_manager) {}

function getHookPermissions()
public
pure
override
returns (Hooks.Permissions memory)
{
return
Hooks.Permissions({
beforeInitialize: false,
afterInitialize: false,
beforeAddLiquidity: false,
afterAddLiquidity: false,
beforeRemoveLiquidity: false,
afterRemoveLiquidity: false,
beforeSwap: true,
afterSwap: true,
beforeDonate: false,
afterDonate: false,
beforeSwapReturnDelta: false,
afterSwapReturnDelta: false,
afterAddLiquidityReturnDelta: false,
afterRemoveLiquidityReturnDelta: false
});
}
}
24 changes: 0 additions & 24 deletions test/Counter.t.sol

This file was deleted.

0 comments on commit a78065e

Please sign in to comment.