-
Notifications
You must be signed in to change notification settings - Fork 178
Hooks Wizard v0.0.0 [WIP] #628
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
Draft
gonzaotc
wants to merge
79
commits into
OpenZeppelin:master
Choose a base branch
from
gonzaotc:hooks-wizard
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 12 commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
b808c2b
init hooks wizard
gonzaotc 1e007d7
add hook utilities
gonzaotc faba830
add initial hooks controls
gonzaotc b03c350
remove readme
gonzaotc e078e95
up generation
gonzaotc b6115c1
up
gonzaotc e0f654e
add reliable hooks organization and utilities tooltips
gonzaotc db952de
add initial tooltips
gonzaotc 0b5ae64
add uniswap deps
gonzaotc 5dfb647
fix prepare error
gonzaotc 45d7d64
add uniswap hooks hyperlinks
gonzaotc 194b355
iterate hooks tooltips
gonzaotc b7be91c
fix kind sanitization
gonzaotc c650954
up tooltip
gonzaotc 762b5a1
update remappings
gonzaotc 20c07d8
fix addUsing compilation via addImportOnly addition
gonzaotc 4de46d6
add erc1155 shares
gonzaotc 0b02d69
add optional override "compatibleSemver" to printContract
gonzaotc 6d9ff54
add a hooks folder containing each hook static data
gonzaotc d1b7b51
fix BaseHook compilation
gonzaotc c061c4f
add base hook function overrides
gonzaotc 004965c
add required overrides
gonzaotc a0c05c5
merge with origin, add printContract option for additional libraries
gonzaotc 0580129
solve conflicts with origin
gonzaotc 71f3786
lint ui
gonzaotc e2784c3
update hooks snapshots
gonzaotc 88d1d53
update snapshots
gonzaotc 1546b24
add permissions component
gonzaotc 344e8c4
up hooks permissions
gonzaotc 8feecce
up
gonzaotc 2dbe171
reorder perms
gonzaotc 79c3b8a
up snapshots
gonzaotc 3962a18
up pausability construction
gonzaotc 5a287ff
fix pausability conficting overrides on custom functions
gonzaotc b7e605e
add automatic types importing
gonzaotc 0d436ef
fix double import bug
gonzaotc 7b06a4d
add required import paths
gonzaotc 48582fd
fix compilation
gonzaotc 041d6d8
lint
gonzaotc 4163fee
up
gonzaotc bf1ff20
reorder controls
gonzaotc c0881ae
up tooltips & normalize hook names in UI
gonzaotc af17f95
lint
gonzaotc 43fe35f
update uniswap-hooks package commit reference
gonzaotc dedffd8
update uniswap-hooks package commit reference
gonzaotc 34f020e
up ava snapshots for basedynamicfee
gonzaotc 96f25f7
up tooltips & shortcut permissions in ui
gonzaotc 5c1c8ed
add lateral size to the hooks wizard selector panel
gonzaotc 8cf50c9
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc d0652cf
add try the ui builder component to hooks html
gonzaotc 59e99dc
Add simple download button
gonzaotc 302ef9d
download foundry project wip
gonzaotc 305d7be
empty changelog
gonzaotc 4adb616
removed openzeppelin community from inject hyperlinks
gonzaotc 8b947af
up version tag
gonzaotc 4fade89
refactor addUsing towards addLibrary
gonzaotc 5b348a2
simplify get imports
gonzaotc f1ee4f9
print hooks functions if permissions are enabled
gonzaotc 7e5cb2f
add permission depency auto-selection and permission function additio…
gonzaotc 1f2ab4c
solve conflicting override
gonzaotc ae40d10
Add ExpandableSection and use in Hook Permissions
gonzaotc 4e5ea07
up ava snapshots
gonzaotc 38da7e1
modularize SharesControlsSection and make Utilities collapsable
gonzaotc 75fda2f
up remappings in uniswap hooks repo
gonzaotc a89a016
reorganize shares tab
gonzaotc 9b83ef6
make shares required in BaseCustomAccounting and CustomCurve
gonzaotc 222a421
up base override fee permissions
gonzaotc c61b0e2
fix a state bug in permission selection
gonzaotc 23f8c21
remove log
gonzaotc 7c20743
simplify hook names
gonzaotc 960ae35
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc c637945
update imports
gonzaotc af18d7f
up tests
gonzaotc 054bce0
enhance tooltips
gonzaotc ca4d391
merge with origin
gonzaotc 4b39243
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc dda3ca4
add rehypothecation hook and hookfee
gonzaotc 30352d8
implemented better shares config handling in core and ui
gonzaotc 4b2815d
remove pool manager construction param
gonzaotc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 | ||
/artifacts | ||
/contracts/generated | ||
/openzeppelin-contracts.json |
This file contains hidden or 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,6 @@ | ||
# Changelog | ||
|
||
|
||
## 0.0.1 (2025-08-11) | ||
|
||
- Initial version. (PR link) | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,8 @@ | ||
OpenZeppelin Contracts Wizard | ||
Copyright (C) 2021-2025 Zeppelin Group Ltd | ||
|
||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3. | ||
|
||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. |
This file contains hidden or 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 @@ | ||
# OpenZeppelin Contracts Wizard for Uniswap Hooks |
This file contains hidden or 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,9 @@ | ||
module.exports = { | ||
extensions: ['ts'], | ||
require: ['ts-node/register'], | ||
watchmode: { | ||
ignoreChanges: ['contracts', 'artifacts', 'cache'], | ||
}, | ||
timeout: '10m', | ||
workerThreads: false, | ||
}; |
This file contains hidden or 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,38 @@ | ||
{ | ||
"name": "@openzeppelin/wizard-uniswap-hooks", | ||
"version": "0.0.1", | ||
gonzaotc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
"description": "A boilerplate generator to get started with OpenZeppelin Contracts for Uniswap Hooks", | ||
"license": "AGPL-3.0-only", | ||
"repository": "https://github.com/OpenZeppelin/contracts-wizard", | ||
"main": "dist/index.js", | ||
"ts:main": "src/index.ts", | ||
"files": [ | ||
"LICENSE", | ||
"NOTICE", | ||
"/dist", | ||
"/src", | ||
"!**/*.test.*" | ||
], | ||
"scripts": { | ||
"prepare": "tsc", | ||
"prepublish": "rimraf dist *.tsbuildinfo && hardhat clean", | ||
"test": "ava", | ||
"test:update-snapshots": "ava --update-snapshots", | ||
"test:watch": "ava --watch" | ||
}, | ||
"devDependencies": { | ||
"@openzeppelin/contracts": "^5.3.0", | ||
"@openzeppelin/uniswap-hooks": "https://github.com/OpenZeppelin/uniswap-hooks", | ||
"@uniswap/v4-core": "^1.0.2", | ||
"@uniswap/v4-periphery": "^1.0.3", | ||
"@types/node": "^20.0.0", | ||
"@types/semver": "^7.5.7", | ||
"ava": "^6.0.0", | ||
"hardhat": "^2.22.11", | ||
"rimraf": "^5.0.0", | ||
"semver": "^7.6.0", | ||
"solidity-ast": "^0.4.18", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^5.0.0" | ||
} | ||
} |
This file contains hidden or 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,16 @@ | ||
import type { WizardContractAPI, AccessControlAPI } from '@openzeppelin/wizard/src/api'; | ||
|
||
import { | ||
printHooks, | ||
defaults as hooksDefaults, | ||
isAccessControlRequired as hooksIsAccessControlRequired, | ||
} from './hooks'; | ||
import type { HooksOptions } from './hooks'; | ||
|
||
export type Hooks = WizardContractAPI<HooksOptions> & AccessControlAPI<HooksOptions>; | ||
|
||
export const hooks: Hooks = { | ||
print: printHooks, | ||
defaults: hooksDefaults, | ||
isAccessControlRequired: hooksIsAccessControlRequired, | ||
}; |
This file contains hidden or 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,16 @@ | ||
import type { Contract } from '@openzeppelin/wizard/src/contract'; | ||
import type { HooksOptions } from './hooks'; | ||
import { buildHooks } from './hooks'; | ||
|
||
export interface KindedOptions { | ||
Hooks: { kind: 'Hooks' } & HooksOptions; | ||
} | ||
|
||
export type GenericOptions = KindedOptions[keyof KindedOptions]; | ||
|
||
export function buildGeneric(opts: GenericOptions): Contract { | ||
switch (opts.kind) { | ||
case 'Hooks': | ||
return buildHooks(opts); | ||
} | ||
} |
This file contains hidden or 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,33 @@ | ||
import type { HookName, HooksOptions } from '../hooks'; | ||
import { Hooks } from '../hooks'; | ||
import { accessOptions } from '@openzeppelin/wizard/src/set-access-control'; | ||
import { infoOptions } from '@openzeppelin/wizard/src/set-info'; | ||
import { generateAlternatives } from '@openzeppelin/wizard/src/generate/alternatives'; | ||
|
||
const booleanOptions = [true, false]; | ||
|
||
const sharesOptions = [ | ||
{ options: false, name: 'MyShares', symbol: 'MSH' }, | ||
{ options: 'ERC20', name: 'MyShares', symbol: 'MSH' }, | ||
{ options: 'ERC6909', name: 'MyShares', symbol: 'MSH' }, | ||
] as const; | ||
|
||
const hooksOptions: HookName[] = Hooks.map(hook => hook.name); | ||
|
||
const blueprint = { | ||
hook: hooksOptions as readonly HookName[], | ||
name: ['MyHook'] as const, | ||
pausable: booleanOptions, | ||
currencySettler: booleanOptions, | ||
safeCast: booleanOptions, | ||
transientStorage: booleanOptions, | ||
access: accessOptions, | ||
// Hooks are not upgradeable yet; fix to false | ||
upgradeable: [false] as const, | ||
info: infoOptions, | ||
shares: sharesOptions, | ||
}; | ||
|
||
export function* generateHooksOptions(): Generator<Required<HooksOptions>> { | ||
yield* generateAlternatives(blueprint); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.