Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
b808c2b
init hooks wizard
gonzaotc Aug 11, 2025
1e007d7
add hook utilities
gonzaotc Aug 12, 2025
faba830
add initial hooks controls
gonzaotc Aug 12, 2025
b03c350
remove readme
gonzaotc Aug 12, 2025
e078e95
up generation
gonzaotc Aug 13, 2025
b6115c1
up
gonzaotc Aug 13, 2025
e0f654e
add reliable hooks organization and utilities tooltips
gonzaotc Aug 13, 2025
db952de
add initial tooltips
gonzaotc Aug 13, 2025
0b5ae64
add uniswap deps
gonzaotc Aug 13, 2025
5dfb647
fix prepare error
gonzaotc Aug 13, 2025
45d7d64
add uniswap hooks hyperlinks
gonzaotc Aug 13, 2025
194b355
iterate hooks tooltips
gonzaotc Aug 13, 2025
b7be91c
fix kind sanitization
gonzaotc Aug 14, 2025
c650954
up tooltip
gonzaotc Aug 14, 2025
762b5a1
update remappings
gonzaotc Aug 18, 2025
20c07d8
fix addUsing compilation via addImportOnly addition
gonzaotc Aug 19, 2025
4de46d6
add erc1155 shares
gonzaotc Aug 19, 2025
0b02d69
add optional override "compatibleSemver" to printContract
gonzaotc Aug 19, 2025
6d9ff54
add a hooks folder containing each hook static data
gonzaotc Aug 19, 2025
d1b7b51
fix BaseHook compilation
gonzaotc Aug 19, 2025
c061c4f
add base hook function overrides
gonzaotc Aug 19, 2025
004965c
add required overrides
gonzaotc Aug 20, 2025
a0c05c5
merge with origin, add printContract option for additional libraries
gonzaotc Aug 20, 2025
0580129
solve conflicts with origin
gonzaotc Aug 20, 2025
71f3786
lint ui
gonzaotc Aug 20, 2025
e2784c3
update hooks snapshots
gonzaotc Aug 20, 2025
88d1d53
update snapshots
gonzaotc Aug 20, 2025
1546b24
add permissions component
gonzaotc Aug 21, 2025
344e8c4
up hooks permissions
gonzaotc Aug 21, 2025
8feecce
up
gonzaotc Aug 21, 2025
2dbe171
reorder perms
gonzaotc Aug 21, 2025
79c3b8a
up snapshots
gonzaotc Aug 21, 2025
3962a18
up pausability construction
gonzaotc Aug 22, 2025
5a287ff
fix pausability conficting overrides on custom functions
gonzaotc Aug 22, 2025
b7e605e
add automatic types importing
gonzaotc Aug 22, 2025
0d436ef
fix double import bug
gonzaotc Aug 22, 2025
7b06a4d
add required import paths
gonzaotc Aug 22, 2025
48582fd
fix compilation
gonzaotc Aug 22, 2025
041d6d8
lint
gonzaotc Aug 22, 2025
4163fee
up
gonzaotc Aug 22, 2025
bf1ff20
reorder controls
gonzaotc Aug 22, 2025
c0881ae
up tooltips & normalize hook names in UI
gonzaotc Aug 25, 2025
af17f95
lint
gonzaotc Aug 25, 2025
43fe35f
update uniswap-hooks package commit reference
gonzaotc Aug 25, 2025
dedffd8
update uniswap-hooks package commit reference
gonzaotc Aug 25, 2025
34f020e
up ava snapshots for basedynamicfee
gonzaotc Aug 25, 2025
96f25f7
up tooltips & shortcut permissions in ui
gonzaotc Aug 25, 2025
5c1c8ed
add lateral size to the hooks wizard selector panel
gonzaotc Aug 25, 2025
8cf50c9
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc Aug 25, 2025
d0652cf
add try the ui builder component to hooks html
gonzaotc Aug 25, 2025
59e99dc
Add simple download button
gonzaotc Aug 25, 2025
302ef9d
download foundry project wip
gonzaotc Aug 25, 2025
305d7be
empty changelog
gonzaotc Aug 25, 2025
4adb616
removed openzeppelin community from inject hyperlinks
gonzaotc Aug 25, 2025
8b947af
up version tag
gonzaotc Aug 25, 2025
4fade89
refactor addUsing towards addLibrary
gonzaotc Aug 25, 2025
5b348a2
simplify get imports
gonzaotc Aug 25, 2025
f1ee4f9
print hooks functions if permissions are enabled
gonzaotc Aug 26, 2025
7e5cb2f
add permission depency auto-selection and permission function additio…
gonzaotc Aug 27, 2025
1f2ab4c
solve conflicting override
gonzaotc Aug 27, 2025
ae40d10
Add ExpandableSection and use in Hook Permissions
gonzaotc Aug 27, 2025
4e5ea07
up ava snapshots
gonzaotc Aug 27, 2025
38da7e1
modularize SharesControlsSection and make Utilities collapsable
gonzaotc Aug 27, 2025
75fda2f
up remappings in uniswap hooks repo
gonzaotc Aug 27, 2025
a89a016
reorganize shares tab
gonzaotc Aug 28, 2025
9b83ef6
make shares required in BaseCustomAccounting and CustomCurve
gonzaotc Aug 28, 2025
222a421
up base override fee permissions
gonzaotc Aug 28, 2025
c61b0e2
fix a state bug in permission selection
gonzaotc Aug 28, 2025
23f8c21
remove log
gonzaotc Aug 28, 2025
7c20743
simplify hook names
gonzaotc Aug 29, 2025
960ae35
Merge branch 'master' of github.com:OpenZeppelin/contracts-wizard int…
gonzaotc Aug 29, 2025
c637945
update imports
gonzaotc Aug 29, 2025
af18d7f
up tests
gonzaotc Aug 29, 2025
054bce0
enhance tooltips
gonzaotc Aug 29, 2025
ca4d391
merge with origin
gonzaotc Sep 24, 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
38 changes: 19 additions & 19 deletions packages/core/solidity/src/contract.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -21,7 +21,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Footec {␊
Expand All @@ -33,7 +33,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
import {Bar} from "./Bar.sol";␊
Expand All @@ -47,7 +47,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
import {Bar} from "./Bar.sol";␊
Expand All @@ -62,7 +62,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
import {Bar} from "./Bar.sol";␊
Expand All @@ -77,7 +77,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
import {Bar} from "./Bar.sol";␊
Expand All @@ -93,7 +93,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -105,7 +105,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -125,7 +125,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -149,7 +149,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -162,7 +162,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -177,7 +177,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -192,7 +192,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
import {Bar} from "./Bar.sol";␊
Expand All @@ -209,7 +209,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -224,7 +224,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -240,7 +240,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -253,7 +253,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Foo {␊
Expand All @@ -267,7 +267,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract FooBarBaz {␊
Expand All @@ -279,7 +279,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
/// @custom:security-contact security@example.com␊
Expand Down
Binary file modified packages/core/solidity/src/contract.test.ts.snap
Binary file not shown.
34 changes: 28 additions & 6 deletions packages/core/solidity/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface Contract {
license: string;
parents: Parent[];
natspecTags: NatspecTag[];
libraries: Library[];
imports: ImportContract[];
functions: ContractFunction[];
constructorCode: string[];
Expand All @@ -30,9 +31,9 @@ export interface ReferencedContract {
transpiled?: boolean;
}

export interface Using {
export interface Library {
library: ImportContract;
usingFor: string;
usingFor: Set<string>;
}

export interface BaseFunction {
Expand All @@ -52,7 +53,7 @@ export interface ContractFunction extends BaseFunction {
comments: string[];
}

export type FunctionKind = 'internal' | 'public';
export type FunctionKind = 'private' | 'internal' | 'public' | 'external';
export type FunctionMutability = (typeof mutabilityRank)[number];

// Order is important
Expand All @@ -77,15 +78,15 @@ export class ContractBuilder implements Contract {
license: string = 'MIT';
upgradeable = false;

readonly using: Using[] = [];
readonly natspecTags: NatspecTag[] = [];

readonly constructorArgs: FunctionArgument[] = [];
readonly constructorCode: string[] = [];
readonly variableSet: Set<string> = new Set();

private parentMap: Map<string, Parent> = new Map<string, Parent>();
private functionMap: Map<string, ContractFunction> = new Map();
private functionMap: Map<string, ContractFunction> = new Map<string, ContractFunction>();
private libraryMap: Map<string, Library> = new Map<string, Library>();

constructor(name: string) {
this.name = toIdentifier(name, true);
Expand All @@ -106,7 +107,13 @@ export class ContractBuilder implements Contract {
}

get imports(): ImportContract[] {
return [...[...this.parentMap.values()].map(p => p.contract), ...this.using.map(u => u.library)];
const parents = [...this.parentMap.values()].map(p => p.contract);
const libraries = [...this.libraryMap.values()].map(l => l.library);
return [...parents, ...libraries];
}

get libraries(): Library[] {
return [...this.libraryMap.values()];
}

get functions(): ContractFunction[] {
Expand All @@ -133,6 +140,21 @@ export class ContractBuilder implements Contract {
return !present;
}

addLibrary(library: ImportContract, usingFor: string[]): boolean {
let modified = false;
if (this.libraryMap.has(library.name)) {
const existing = this.libraryMap.get(library.name)!;
const initialSize = existing.usingFor.size;
usingFor.forEach(type => existing.usingFor.add(type));
modified = existing.usingFor.size > initialSize;
} else {
this.libraryMap.set(library.name, { library, usingFor: new Set(usingFor) });
modified = true;
}

return modified;
}

addOverride(parent: ReferencedContract, baseFn: BaseFunction, mutability?: FunctionMutability) {
const fn = this.addFunction(baseFn);
fn.override.add(parent);
Expand Down
6 changes: 3 additions & 3 deletions packages/core/solidity/src/custom.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract MyContract {␊
Expand All @@ -21,7 +21,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract Contract {␊
Expand Down Expand Up @@ -106,7 +106,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.4.0
pragma solidity ^0.8.27;␊
contract MyContract {␊
Expand Down
Binary file modified packages/core/solidity/src/custom.test.ts.snap
Binary file not shown.
15 changes: 13 additions & 2 deletions packages/core/solidity/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export type { GenericOptions, KindedOptions } from './build-generic';
export { buildGeneric } from './build-generic';

export type { Contract } from './contract';
export { generateAlternatives } from './generate/alternatives';

export type { Contract, BaseFunction, Value, ReferencedContract } from './contract';
export { ContractBuilder } from './contract';

export { printContract } from './print';
Expand All @@ -11,7 +13,9 @@ export type { Upgradeable } from './set-upgradeable';
export type { Info } from './set-info';

export { premintPattern, chainIdPattern } from './erc20';
export { defaults as infoDefaults } from './set-info';
export { defaults as infoDefaults, infoOptions, setInfo } from './set-info';
export { accessOptions, setAccessControl } from './set-access-control';
export { addPausable } from './add-pausable';

export type { OptionsErrorMessages } from './error';
export { OptionsError } from './error';
Expand All @@ -20,8 +24,15 @@ export type { Kind } from './kind';
export { sanitizeKind } from './kind';

export { erc20, erc721, erc1155, stablecoin, realWorldAsset, account, governor, custom } from './api';
export type { WizardContractAPI, AccessControlAPI } from './api';

export { compatibleContractsSemver } from './utils/version';
export { findCover } from './utils/find-cover';
export { defineFunctions } from './utils/define-functions';

export type { CommonOptions } from './common-options';
export { withCommonDefaults, defaults as commonDefaults } from './common-options';
export { supportsInterface } from './common-functions';

export type { ERC20Options } from './erc20';
export type { ERC721Options } from './erc721';
Expand Down
5 changes: 5 additions & 0 deletions packages/core/solidity/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export function upgradeableImport(p: ImportContract): ImportContract {

export interface Options {
transformImport?: (parent: ImportContract) => ImportContract;
/**
* Add additional libraries to the compatibility banner printed at the top of the contract.
*/
additionalCompatibleLibraries?: { name: string; path: string; version: string }[];
}

export interface Helpers extends Required<Options> {
Expand All @@ -45,5 +49,6 @@ export function withHelpers(contract: Contract, opts: Options = {}): Helpers {
const p2 = contractUpgradeable && inferTranspiled(p1) ? upgradeableImport(p1) : p1;
return opts.transformImport?.(p2) ?? p2;
},
additionalCompatibleLibraries: opts.additionalCompatibleLibraries ?? [],
};
}
Loading
Loading