Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
28f08e1
add: changes
jatinj615 Apr 22, 2025
5f8f148
forge install: v4-periphery
jatinj615 Apr 22, 2025
aaaa99e
add: deps
jatinj615 Apr 22, 2025
0180ce8
Merge branch 'uniswapfoundation:main' into main
jatinj615 Apr 22, 2025
1f50a38
update: readme
jatinj615 Apr 22, 2025
4c02d78
update: exchangeRateToSqrtPriceX96
jatinj615 Apr 22, 2025
e67265c
add: test linear fee
jatinj615 Apr 22, 2025
c14c0ec
deploy: custom fee pool sepolia
jatinj615 Apr 23, 2025
29974f8
forge install: v4-core
jatinj615 Apr 23, 2025
223d6f3
add: add liquidity scripts
jatinj615 Apr 23, 2025
f816344
add: swap script
jatinj615 Apr 23, 2025
fa00cee
add: PoolSwapTest contract
jatinj615 Apr 23, 2025
1c9b7fa
add: add liquidity and swap scripts
jatinj615 Apr 24, 2025
5e7618e
cleanup: code readability
jatinj615 Apr 24, 2025
146a94e
Merge branch 'uniswapfoundation:main' into main
jatinj615 Apr 24, 2025
975adae
Refactor and add natspec
pooleja Apr 24, 2025
6bb197b
Merge pull request #1 from Renzo-Protocol/refactor
jatinj615 Apr 24, 2025
91e3ff4
add: after initialize pool pair ETH/ezETH
jatinj615 Apr 24, 2025
8b51d43
Merge pull request #2 from Renzo-Protocol/after-initialize-pair-check
pooleja Apr 24, 2025
5b0a48b
add: mainnet and unichain deployment configs
jatinj615 May 6, 2025
41876a0
add: audit
jatinj615 May 7, 2025
a108dc0
add: deploy pool mint liquidity
jatinj615 May 7, 2025
cff9772
add: configs
jatinj615 May 7, 2025
c9eac2b
add: configs
jatinj615 May 8, 2025
faf485b
update: config
jatinj615 May 8, 2025
fd0e47d
fix: review
jatinj615 May 9, 2025
2f05180
update: create2 deployer
jatinj615 May 12, 2025
83f79fa
add: unichain custom pool deployment
jatinj615 May 13, 2025
b39ef3e
add: swaps through custom hook
jatinj615 May 13, 2025
29514f6
Merge pull request #3 from Renzo-Protocol/pool-deployment-mainnet
pooleja May 14, 2025
6030fa6
Set trigger to start increasing fees
pooleja Jul 22, 2025
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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
[submodule "lib/uniswap-hooks"]
path = lib/uniswap-hooks
url = https://github.com/openzeppelin/uniswap-hooks
[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
52 changes: 11 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
## Foundry
# Custom Fee Uniswap V4 Hook
Custom fee hook for Uniswap V4 pool to charge dynamic fee in the range of configured `minFee% and maxFee%` according to the current `poolPrice` and `referencePrice`.

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
`referencePrice` => True exchange rate of ezETH from the `rateProvider`

Foundry consists of:
`poolPrice` => price of ezETH in the Uniswap Pool.

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.

## Documentation
- If pool is moving towards peg price. Then users will be charged `minFee%` configured.
- If pool is depegged by `depeg%` then users will be charged the fee as -

https://book.getfoundry.sh/
```
Fee => | minFee | if depeg% < minFee%
| maxFee | if depeg% > maxFee%
| depeg% | if minFee% <= depeg% <= maxFee%
```

## Usage

Expand All @@ -27,40 +29,8 @@ $ forge build
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
Binary file not shown.
213 changes: 213 additions & 0 deletions broadcast/AddLiquidity.s.sol/11155111/run-1745425741.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
{
"transactions": [
{
"hash": "0xcdd2fa83a6815e551504c33be95c7577bd36d81ee17b573c0bffd3fc70ab4a8e",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x8d7f20137041334fbd7c87796f03b1999770cc5f",
"function": "approve(address,uint256)",
"arguments": [
"0x000000000022D473030F116dDEE9F6B43aC78BA3",
"115792089237316195423570985008687907853269984665640564039457584007913129639935"
],
"transaction": {
"from": "0xad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"to": "0x8d7f20137041334fbd7c87796f03b1999770cc5f",
"gas": "0x10a74",
"value": "0x0",
"input": "0x095ea7b3000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"nonce": "0xf",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
},
{
"hash": "0x3f2af245e039e1f2daa0be2e10ff4a0e4003243bcae8a0e2f53d63cde8477249",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x000000000022d473030f116ddee9f6b43ac78ba3",
"function": "approve(address,address,uint160,uint48)",
"arguments": [
"0x8d7F20137041334FBd7c87796f03b1999770Cc5f",
"0x429ba70129df741B2Ca2a85BC3A2a3328e5c09b4",
"1461501637330902918203684832716283019655932542975",
"281474976710655"
],
"transaction": {
"from": "0xad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"to": "0x000000000022d473030f116ddee9f6b43ac78ba3",
"gas": "0x1112d",
"value": "0x0",
"input": "0x87517c450000000000000000000000008d7f20137041334fbd7c87796f03b1999770cc5f000000000000000000000000429ba70129df741b2ca2a85bc3a2a3328e5c09b4000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000ffffffffffff",
"nonce": "0x10",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
},
{
"hash": "0x548aa97451dbfe14e7f39dfd539e7d555462e1de32ff48ed21e5fa3d5fcadda3",
"transactionType": "CALL",
"contractName": null,
"contractAddress": "0x429ba70129df741b2ca2a85bc3a2a3328e5c09b4",
"function": "modifyLiquidities(bytes,uint256)",
"arguments": [
"0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002020d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008d7f20137041334fbd7c87796f03b1999770cc5f0000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000d9be8bb0c5fa892f1ec89e66608d6b9865d65080fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffda800000000000000000000000000000000000000000000000000000000000002580000000000000000000000000000000000000000000000001a58f82633391a42000000000000000000000000000000000000000000000000016345785d8a0001000000000000000000000000000000000000000000000000016345785d8a0001000000000000000000000000ad0f3f4bec42cda68d2cd31301b3c3de3b0f50e200000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008d7f20137041334fbd7c87796f03b1999770cc5f",
"1745425776"
],
"transaction": {
"from": "0xad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"to": "0x429ba70129df741b2ca2a85bc3a2a3328e5c09b4",
"gas": "0x8229c",
"value": "0x16345785d8a0001",
"input": "0xdd46508f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000680915700000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002020d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008d7f20137041334fbd7c87796f03b1999770cc5f0000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000d9be8bb0c5fa892f1ec89e66608d6b9865d65080fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffda800000000000000000000000000000000000000000000000000000000000002580000000000000000000000000000000000000000000000001a58f82633391a42000000000000000000000000000000000000000000000000016345785d8a0001000000000000000000000000000000000000000000000000016345785d8a0001000000000000000000000000ad0f3f4bec42cda68d2cd31301b3c3de3b0f50e200000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008d7f20137041334fbd7c87796f03b1999770cc5f",
"nonce": "0x11",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"status": "0x1",
"cumulativeGasUsed": "0xd5f875",
"logs": [
{
"address": "0x8d7f20137041334fbd7c87796f03b1999770cc5f",
"topics": [
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0x000000000000000000000000ad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"0x000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3"
],
"data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"blockHash": "0x320f6bdaf13493fc2bb71e7c9d88a689bf2aa4e6a3c8a49235f50794ca2b840a",
"blockNumber": "0x7cd217",
"blockTimestamp": "0x6809154c",
"transactionHash": "0xcdd2fa83a6815e551504c33be95c7577bd36d81ee17b573c0bffd3fc70ab4a8e",
"transactionIndex": "0x52",
"logIndex": "0x8f",
"removed": false
}
],
"logsBloom": "0x00000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000200000000000000000000000004000000000000000000000000800000000000000000000000000000000000000000000000000000000000100000000000000000040000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000010000000000000080000000000000000000000000000000002000000000000",
"type": "0x2",
"transactionHash": "0xcdd2fa83a6815e551504c33be95c7577bd36d81ee17b573c0bffd3fc70ab4a8e",
"transactionIndex": "0x52",
"blockHash": "0x320f6bdaf13493fc2bb71e7c9d88a689bf2aa4e6a3c8a49235f50794ca2b840a",
"blockNumber": "0x7cd217",
"gasUsed": "0xb631",
"effectiveGasPrice": "0x70ca14198",
"from": "0xad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"to": "0x8d7f20137041334fbd7c87796f03b1999770cc5f",
"contractAddress": null
},
{
"status": "0x1",
"cumulativeGasUsed": "0xd6b33f",
"logs": [
{
"address": "0x000000000022d473030f116ddee9f6b43ac78ba3",
"topics": [
"0xda9fa7c1b00402c17d0161b249b1ab8bbec047c5a52207b9c112deffd817036b",
"0x000000000000000000000000ad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"0x0000000000000000000000008d7f20137041334fbd7c87796f03b1999770cc5f",
"0x000000000000000000000000429ba70129df741b2ca2a85bc3a2a3328e5c09b4"
],
"data": "0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000ffffffffffff",
"blockHash": "0x320f6bdaf13493fc2bb71e7c9d88a689bf2aa4e6a3c8a49235f50794ca2b840a",
"blockNumber": "0x7cd217",
"blockTimestamp": "0x6809154c",
"transactionHash": "0x3f2af245e039e1f2daa0be2e10ff4a0e4003243bcae8a0e2f53d63cde8477249",
"transactionIndex": "0x53",
"logIndex": "0x90",
"removed": false
}
],
"logsBloom": "0x00010000000000000000000000000000000000000000000000000000000000000000000000000040080000000000010000000000000000000000000000080000000040000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000800000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000004000000000000000040000000000000000000000000000000000000000000000000000000000000000002000000000400",
"type": "0x2",
"transactionHash": "0x3f2af245e039e1f2daa0be2e10ff4a0e4003243bcae8a0e2f53d63cde8477249",
"transactionIndex": "0x53",
"blockHash": "0x320f6bdaf13493fc2bb71e7c9d88a689bf2aa4e6a3c8a49235f50794ca2b840a",
"blockNumber": "0x7cd217",
"gasUsed": "0xbaca",
"effectiveGasPrice": "0x70ca14198",
"from": "0xad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"to": "0x000000000022d473030f116ddee9f6b43ac78ba3",
"contractAddress": null
},
{
"status": "0x1",
"cumulativeGasUsed": "0xdc9705",
"logs": [
{
"address": "0x429ba70129df741b2ca2a85bc3a2a3328e5c09b4",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000ad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"0x0000000000000000000000000000000000000000000000000000000000002dc1"
],
"data": "0x",
"blockHash": "0x320f6bdaf13493fc2bb71e7c9d88a689bf2aa4e6a3c8a49235f50794ca2b840a",
"blockNumber": "0x7cd217",
"blockTimestamp": "0x6809154c",
"transactionHash": "0x548aa97451dbfe14e7f39dfd539e7d555462e1de32ff48ed21e5fa3d5fcadda3",
"transactionIndex": "0x54",
"logIndex": "0x91",
"removed": false
},
{
"address": "0xe03a1074c86cfedd5c142c4f04f1a1536e203543",
"topics": [
"0xf208f4912782fd25c7f114ca3723a2d5dd6f3bcc3ac8db5af63baa85f711d5ec",
"0xc1fcb31353e0b2ea80c7b901570ee535074df25fe49d9fb4179117380855cb73",
"0x000000000000000000000000429ba70129df741b2ca2a85bc3a2a3328e5c09b4"
],
"data": "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffda800000000000000000000000000000000000000000000000000000000000002580000000000000000000000000000000000000000000000001a58f82633391a420000000000000000000000000000000000000000000000000000000000002dc1",
"blockHash": "0x320f6bdaf13493fc2bb71e7c9d88a689bf2aa4e6a3c8a49235f50794ca2b840a",
"blockNumber": "0x7cd217",
"blockTimestamp": "0x6809154c",
"transactionHash": "0x548aa97451dbfe14e7f39dfd539e7d555462e1de32ff48ed21e5fa3d5fcadda3",
"transactionIndex": "0x54",
"logIndex": "0x92",
"removed": false
},
{
"address": "0x8d7f20137041334fbd7c87796f03b1999770cc5f",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000ad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"0x000000000000000000000000e03a1074c86cfedd5c142c4f04f1a1536e203543"
],
"data": "0x000000000000000000000000000000000000000000000000002eebabe1fba165",
"blockHash": "0x320f6bdaf13493fc2bb71e7c9d88a689bf2aa4e6a3c8a49235f50794ca2b840a",
"blockNumber": "0x7cd217",
"blockTimestamp": "0x6809154c",
"transactionHash": "0x548aa97451dbfe14e7f39dfd539e7d555462e1de32ff48ed21e5fa3d5fcadda3",
"transactionIndex": "0x54",
"logIndex": "0x93",
"removed": false
}
],
"logsBloom": "0x00000000000000000400001000000000000000800000000000000000080000100000000000000040080000000000000000000100000000000000000000000000000000200000000000000008000000000000000000000400000000000000000000000000020000000000000080000800000000000100100000000810000040000000000001000000000010000000000000001000000000000000000000000000000004000000000000000000000000000000000000400000000000000000000000000002000000000000000000000004000000000000000000001000000020001000000000000000080000000000000004000008000000000002000000000000",
"type": "0x2",
"transactionHash": "0x548aa97451dbfe14e7f39dfd539e7d555462e1de32ff48ed21e5fa3d5fcadda3",
"transactionIndex": "0x54",
"blockHash": "0x320f6bdaf13493fc2bb71e7c9d88a689bf2aa4e6a3c8a49235f50794ca2b840a",
"blockNumber": "0x7cd217",
"gasUsed": "0x5e3c6",
"effectiveGasPrice": "0x70ca14198",
"from": "0xad0f3f4bec42cda68d2cd31301b3c3de3b0f50e2",
"to": "0x429ba70129df741b2ca2a85bc3a2a3328e5c09b4",
"contractAddress": null
}
],
"libraries": [],
"pending": [],
"returns": {},
"timestamp": 1745425741,
"chain": 11155111,
"commit": "fa00cee"
}
Loading