-
Notifications
You must be signed in to change notification settings - Fork 179
Hooks Wizard v0.0.1 #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
Open
gonzaotc
wants to merge
150
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.
+25,183
−243
Open
Hooks Wizard v0.0.1 #628
Changes from 149 commits
Commits
Show all changes
150 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 8310cb5
add dynamic inputs for hooks
gonzaotc 5fb4631
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc decdf20
add hooks input tooltip, improve wizard output comments
gonzaotc 97441fb
add constructionOnly contracts directive
gonzaotc 015a66f
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc 81e7a8d
remove foundry dependency
gonzaotc 3e515d4
lint
gonzaotc f638f7c
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc 3e9b8a9
apply fixes from pr review
gonzaotc 1659ac1
Merge pull request #2 from gonzaotc/pr-fixes
gonzaotc 641a7f2
Update CHANGELOG.md
gonzaotc ce382af
add uniswap hooks to github test workflow matrix
gonzaotc 6e1dc62
import solidity version from solidity package and bump compatible semver
gonzaotc ad391c7
Remove package-lock, update yarn.lock
ericglau fadfa59
Restore deno lock
ericglau d213d32
Update git dependency format
ericglau 16f4a19
Merge remote-tracking branch 'upstream/master' into hooks-wizard
ericglau 5450636
add oracles
gonzaotc 5c87881
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc 5380d2f
merge with origin
gonzaotc 8c88661
Add Wizard AI assistant for uniswap hooks
CoveMB 76c4ea3
Merge branch 'master' into hooks-wizard
ericglau 296e973
only reset hooks permission upon changing selected hook
gonzaotc 42c9c3a
Merge branch 'hooks-wizard' of https://github.com/gonzaotc/contracts-…
gonzaotc b120cd7
add input validations
gonzaotc c2fa828
Add MCP config
CoveMB 5fa1adc
add input validations
gonzaotc 6bdf770
Addjust MCP schema
CoveMB aeb606a
Addjust MCP schema
CoveMB e9dd205
Merge branch 'hooks-wizard' of https://github.com/gonzaotc/contracts-…
CoveMB f569fe5
Add mcp tests
CoveMB 2912157
Remove unecessary fields
CoveMB d913b50
Use consts
CoveMB 9d96139
revert const
CoveMB 5201e1b
Adjust types
CoveMB 2013585
Adjust types
CoveMB 1e95301
merge with origin
gonzaotc 6bf1ddd
up
gonzaotc d024591
add natspec comments for better hook building guidance
gonzaotc ac764ac
up comments
gonzaotc 3194d5c
rename natspec comments to top level comments
gonzaotc 5b405a4
up comments
gonzaotc a7fd4db
require access controls on baseDynamicFee and update snapshots
gonzaotc 55aaca9
apply fixes from pr
gonzaotc fe3f732
apply fixes from pr
gonzaotc 8760936
apply fixes from pr
gonzaotc d7c6a6b
before refactor
CoveMB 17a96d5
regenerate yarn.lock
gonzaotc 068357c
simplifyed types
CoveMB 10e245b
lint
gonzaotc 2ef6fd7
use helper
CoveMB 077ced3
rollback yarn.lock with master version
gonzaotc a7d435e
Use helper other languages
CoveMB 3861aa8
Add extract string enum helper
CoveMB cd40989
Merge master
CoveMB 7f9d2d3
Adjust import
CoveMB 2a120e5
Fix type issue
CoveMB 0a214b7
Add type check for required keys, add each hook description
CoveMB 890ecb1
Fix UI type upgradable
CoveMB f47e500
Lint
CoveMB 0daf90d
Fix snapshots
ericglau d13fe09
Add changeset
ericglau 9795986
Fix tooltip URLs for Contracts
ericglau a0ddd00
apply fixes from pr
gonzaotc 5390441
divide addHook into specific hook functions for modularity
gonzaotc 9732a0b
up
gonzaotc c2b4506
up
gonzaotc b22adde
refactor addTopLevelComment
gonzaotc 6b2b81d
patch topLevelComment issue
gonzaotc a7d5cdd
Merge branch 'master' into hooks-wizard
ericglau 15488b9
Update minor version for hooks wizard
ericglau 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@openzeppelin/wizard-uniswap-hooks': patch | ||
| '@openzeppelin/wizard': patch | ||
| '@openzeppelin/wizard-common': patch | ||
| '@openzeppelin/contracts-mcp': patch | ||
| --- | ||
|
|
||
| Add support for Uniswap Hooks Wizard |
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
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,94 @@ | ||
| // IMPORTANT: This file must not have any imports since it is used in both Node and Deno environments, | ||
| // which have different requirements for file extensions in import statements. | ||
|
|
||
| export const byHooksDescriptions = { | ||
| BaseHook: | ||
| 'Base hook implementation that defines all hook entry points, security and permission helpers. Based on the Uniswap v4 periphery implementation. Hook entry points must be overridden and implemented by the inheriting hook to be used, with respective flags set in getHookPermissions.', | ||
| BaseAsyncSwap: | ||
| 'Base implementation for async swaps that skip the v3-like swap implementation by taking the full swap input amount and returning a delta that nets out the specified amount to 0. Allows developers to implement arbitrary logic for executing swaps, including asynchronous swaps and custom swap-ordering. Mints ERC-6909 claim tokens for the specified currency and amount.', | ||
| BaseCustomAccounting: | ||
| 'Base implementation for custom accounting and hook-owned liquidity. Enables tokens to be deposited via the hook to allow control and flexibility over how liquidity is computed. The hook is the sole owner of the liquidity and manages fees over liquidity shares accordingly. Designed to work with a single pool key.', | ||
| BaseCustomCurve: | ||
| 'Base implementation for custom curves that overrides the default v3-like concentrated liquidity implementation. During a swap, calls a function to get the amount of tokens to be sent to the receiver. The return delta is then consumed and applied by the PoolManager. Does not include fee or salt mechanisms by default.', | ||
| BaseDynamicFee: | ||
| "Base implementation to apply a dynamic fee via the PoolManager's updateDynamicLPFee function. Allows hooks to update LP fees dynamically based on external conditions. Includes a poke function that can be called by anyone to update the fee. Alternative names to refer to the hook: 'Dynamic pool fee'.", | ||
| BaseOverrideFee: | ||
| "Base implementation for automatic dynamic fees applied before swaps. Allows hooks to override the pool's fee before a swap is processed using the override fee flag. The fee is calculated dynamically and applied to the swap. Alternative names to refer to the hook: 'Dynamic swap fee'.", | ||
| BaseDynamicAfterFee: | ||
| "Base implementation for dynamic target hook fees applied after swaps. Enforces a dynamic target for the unspecified currency during beforeSwap, where if the swap outcome is better than the target, any positive difference is taken as a hook fee. Fees are handled or distributed by the hook via afterSwapHandler. Alternative names to refer to the hook: 'Swap target enforcer'.", | ||
| BaseHookFee: | ||
| "Base implementation for applying hook fees to the unspecified currency of the swap. These fees are independent of the pool's LP fee and are charged as a percentage of the output amount after the swap completes. Fees are taken as ERC-6909 claims.", | ||
| AntiSandwichHook: | ||
| "Implements sandwich-resistant AMM design that guarantees no swaps get filled at a price better than the price at the beginning of the slot window. Within a slot window, swaps impact the pool asymmetrically for buys and sells. Only protects swaps in the zeroForOne direction. Alternative names to refer to the hook: 'Sandwich resistance'.", | ||
| LiquidityPenaltyHook: | ||
| "Just-in-Time (JIT) liquidity provisioning resistant hook that disincentivizes JIT attacks by penalizing LP fee collection during liquidity removal and disabling it during liquidity addition if liquidity was recently added. The penalty is donated to the pool's liquidity providers in range at the time of removal. Alternative names to refer to the hook: 'JIT liquidity resistance'.", | ||
| LimitOrderHook: | ||
| "Limit Order Mechanism hook that allows users to place limit orders at specific ticks outside of the current price range. Orders will be filled if the pool's price crosses the order's tick. Orders can be cancelled at any time until filled. Once completely filled, the resulting liquidity can be withdrawn from the pool.", | ||
| ReHypothecationHook: | ||
| "A Uniswap V4 hook that enables rehypothecation of liquidity positions. Allows users to deposit assets into yield-generating sources while providing liquidity to Uniswap pools Just-in-Time during swaps. Assets earn yield when idle and are temporarily injected as pool liquidity only when needed for swap execution, then immediately withdrawn back to yield sources. Users receive ERC20 shares representing their rehypothecated position. Alternative names to refer to the hook: 'Liquidity rehypothecation'.", | ||
| BaseOracleHook: | ||
| 'A hook that enables a Uniswap V4 pool to record price observations and expose an oracle interface. Records cumulative tick values and provides time-weighted average price data. Allows increasing observation cardinality to store more historical price data. Provides observe function to get cumulative tick values for specified time periods.', | ||
| OracleHookWithV3Adapters: | ||
| 'A hook that enables a Uniswap V4 pool to record price observations and expose an oracle interface with Uniswap V3-compatible adapters. Extends BaseOracleHook by automatically deploying standard and truncated V3 oracle adapters for each pool, making the oracle data compatible with existing V3 oracle interfaces and tools.', | ||
| } as const; | ||
|
|
||
| export const uniswapHooksPrompts = { | ||
| Hooks: `Make a Uniswap v4 hook contract using the OpenZeppelin Uniswap Hooks library. ${Object.entries( | ||
| byHooksDescriptions, | ||
| ) | ||
| .map(([hookName, hookDescription]) => `${hookName}: ${hookDescription}`) | ||
| .join(', ')}`, | ||
| }; | ||
|
|
||
| export const uniswapHooksSharesDescriptions = { | ||
| options: | ||
| 'The implementation used to represent position shares. Options include disabling shares or issuing ERC20, ERC6909, or ERC1155 tokens.', | ||
| name: 'The name of the share token when ERC20 shares are enabled.', | ||
| symbol: 'The symbol of the share token when ERC20 shares are enabled.', | ||
| uri: 'The metadata URI used when ERC1155 shares are enabled.', | ||
| }; | ||
|
|
||
| export const uniswapHooksDescriptions = { | ||
| hook: 'The name of the Uniswap hook', | ||
| currencySettler: | ||
| 'Whether to include the CurrencySettler utility to settle pending deltas with the PoolManager during flash accounting.', | ||
| safeCast: 'Whether to include the SafeCast library for safe integer conversions when handling balances or fees.', | ||
| transientStorage: | ||
| 'Whether to include the TransientSlot and SlotDerivation helpers for temporary state that clears at the end of the transaction.', | ||
| shares: 'Configuration for optional share tokens exposed by the hook.', | ||
| permissions: | ||
| 'Toggle lifecycle permissions to enable specific core hook callbacks. Required permissions are enforced automatically.', | ||
| inputs: 'Hook-specific configuration inputs used by certain templates.', | ||
| }; | ||
|
|
||
| export const uniswapHooksPermissionDescriptions = { | ||
| beforeInitialize: 'Whether to enable the `_beforeInitialize` callback to run before pools are initialized.', | ||
| afterInitialize: 'Whether to enable the `_afterInitialize` callback to react after pool initialization.', | ||
| beforeAddLiquidity: | ||
| 'Whether to enable the `_beforeAddLiquidity` callback to validate or modify adds before liquidity is deposited.', | ||
| afterAddLiquidity: | ||
| 'Whether to enable the `_afterAddLiquidity` callback to update accounting after liquidity is added.', | ||
| beforeRemoveLiquidity: | ||
| 'Whether to enable the `_beforeRemoveLiquidity` callback to validate removals before liquidity is withdrawn.', | ||
| afterRemoveLiquidity: | ||
| 'Whether to enable the `_afterRemoveLiquidity` callback to update accounting after liquidity is withdrawn.', | ||
| beforeSwap: 'Whether to enable the `_beforeSwap` callback to inspect and optionally modify swap parameters.', | ||
| afterSwap: 'Whether to enable the `_afterSwap` callback to perform post-swap accounting or logic.', | ||
| beforeDonate: 'Whether to enable the `_beforeDonate` callback to run before donations are processed.', | ||
| afterDonate: 'Whether to enable the `_afterDonate` callback to run after donations are processed.', | ||
| beforeSwapReturnDelta: | ||
| 'Whether to allow `_beforeSwap` to return a `BeforeSwapDelta`, adjusting the assets that must be provided for the swap.', | ||
| afterSwapReturnDelta: | ||
| 'Whether to allow `_afterSwap` to return an additional delta that adjusts the final swap settlement.', | ||
| afterAddLiquidityReturnDelta: | ||
| 'Whether to allow `_afterAddLiquidity` to return a `BalanceDelta` that adjusts how liquidity addition balances are settled.', | ||
| afterRemoveLiquidityReturnDelta: | ||
| 'Whether to allow `_afterRemoveLiquidity` to return a `BalanceDelta` that adjusts how liquidity removal balances are settled.', | ||
| }; | ||
|
|
||
| export const uniswapHooksInputsDescriptions = { | ||
| blockNumberOffset: | ||
| 'The number of blocks that must elapse after liquidity is added before it can be removed without penalties. Used by liquidity protection hooks.', | ||
| maxAbsTickDelta: | ||
| 'The maximum absolute tick change that can be recorded per oracle observation. Lower values resist manipulation but lag during volatility.', | ||
| }; |
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
Binary file not shown.
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.