-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-v2-adapter-hook
- Loading branch information
Showing
21 changed files
with
1,176 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Release | ||
on: | ||
# manual trigger | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
name: release | ||
runs-on: | ||
group: npm-deploy | ||
environment: | ||
name: release | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- name: Load secret | ||
uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 | ||
with: | ||
# Export loaded secrets as environment variables | ||
export-env: true | ||
env: | ||
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | ||
# You may need to change this to your vault name and secret name | ||
# Refer to it by calling env.NPM_TOKEN | ||
# This token is also limited by IP to ONLY work on the runner | ||
NPM_TOKEN: op://npm-deploy/npm-runner-token/secret | ||
|
||
- name: Checkout | ||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected] | ||
with: | ||
node-version: "20.x" | ||
registry-url: "https://registry.npmjs.org" | ||
scope: "@uniswap" | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: stable | ||
|
||
- name: Install dependencies | ||
run: | | ||
git submodule update --init --recursive | ||
- name: Compile | ||
run: forge build | ||
|
||
- name: Release | ||
env: | ||
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npm set "//registry.npmjs.org/:_authToken" ${{ env.NPM_TOKEN }} | ||
npm publish --provenance --access public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# if you add a file here, add it to `.npmignore` too | ||
cache/ | ||
foundry-out/ | ||
.vscode/ | ||
broadcast/*/*/dry-run/*.json | ||
broadcast/*/*/run-[0-9]*.json | ||
broadcast/*/*/run-[0-9]*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cache/ | ||
.vscode/ | ||
broadcast/*/*/dry-run/*.json | ||
broadcast/*/*/run-[0-9]*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "@uniswap/v4-periphery", | ||
"version": "1.0.1", | ||
"description": "🦄 Peripheral smart contracts for interacting with Uniswap v4", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Uniswap/v4-periphery.git" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://uniswap.org/bug-bounty" | ||
}, | ||
"homepage": "https://github.com/Uniswap/v4-periphery#readme", | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"keywords": [ | ||
"uniswap", | ||
"periphery", | ||
"v4" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import "forge-std/Script.sol"; | ||
import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol"; | ||
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; | ||
import {HookMiner} from "../src/utils/HookMiner.sol"; | ||
|
||
/// @dev Replace import with your own hook | ||
import {MockCounterHook} from "../test/mocks/MockCounterHook.sol"; | ||
|
||
/// @notice Mines the address and deploys the Counter.sol Hook contract | ||
contract DeployHookScript is Script { | ||
address constant CREATE2_DEPLOYER = address(0x4e59b44847b379578588920cA78FbF26c0B4956C); | ||
|
||
/// @dev Replace with the desired PoolManager on its corresponding chain | ||
IPoolManager constant POOLMANAGER = IPoolManager(address(0xE03A1074c86CFeDd5C142C4F04F1a1536e203543)); | ||
|
||
function setUp() public {} | ||
|
||
function run() public { | ||
// hook contracts must have specific flags encoded in the address | ||
uint160 flags = uint160( | ||
Hooks.BEFORE_SWAP_FLAG | Hooks.AFTER_SWAP_FLAG | Hooks.BEFORE_ADD_LIQUIDITY_FLAG | ||
| Hooks.BEFORE_REMOVE_LIQUIDITY_FLAG | ||
); | ||
|
||
bytes memory constructorArgs = abi.encode(POOLMANAGER); | ||
|
||
// Mine a salt that will produce a hook address with the correct flags | ||
(address hookAddress, bytes32 salt) = | ||
HookMiner.find(CREATE2_DEPLOYER, flags, type(MockCounterHook).creationCode, constructorArgs); | ||
|
||
// Deploy the hook using CREATE2 | ||
vm.broadcast(); | ||
MockCounterHook counter = new MockCounterHook{salt: salt}(IPoolManager(POOLMANAGER)); | ||
require(address(counter) == hookAddress, "CounterScript: hook address mismatch"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.