Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1c1de3a
Pass remappings URL params when opening in Remix
ericglau Mar 27, 2026
030cad9
Use exported getVersionedRemappings for internal use
ericglau Mar 27, 2026
2908f87
Cleanup confidential app for remix button
ericglau Mar 27, 2026
48f22b5
Remove unused styles
ericglau Mar 27, 2026
e6a6fe8
remove v4-periphery from devDependencies, enable remix for hooks
ericglau Mar 27, 2026
a314c69
Remove upgradeable from hooks remappings handling
ericglau Mar 27, 2026
4a680c7
fix import
ericglau Mar 27, 2026
b0cf02c
fix imports
ericglau Mar 27, 2026
6ea8d77
fix packaging
ericglau Mar 27, 2026
ac7e5ed
rename for clarity
ericglau Mar 27, 2026
2e41bf9
Fix import
ericglau Mar 27, 2026
1cb0873
pin specific version of uniswap-hooks lib
ericglau Mar 27, 2026
cc65387
remove external api for getVersionedRemappings from confidential and …
ericglau Mar 27, 2026
c3fedba
Remove version pin and let it be script generated
ericglau Mar 27, 2026
db9b67b
gitignore version pin
ericglau Mar 27, 2026
bbf62c6
revert parts
ericglau Mar 27, 2026
14cf39e
fix lint
ericglau Mar 27, 2026
e005fbd
format
ericglau Mar 27, 2026
a89431c
Revert "revert parts"
ericglau Mar 30, 2026
d28532a
Revert "gitignore version pin"
ericglau Mar 30, 2026
c7e4be0
Revert "Remove version pin and let it be script generated"
ericglau Mar 30, 2026
0e2f6eb
Revert "remove external api for getVersionedRemappings from confident…
ericglau Mar 30, 2026
7fa5d81
Use package-root imports in uniswap hooks UI
ericglau Mar 30, 2026
dc9fc16
Update confidential and hooks readmes for API usage
ericglau Mar 30, 2026
6450b17
Add changeset
ericglau Mar 30, 2026
7832c3a
Merge branch 'master' into remixremappings
ericglau Apr 2, 2026
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
10 changes: 10 additions & 0 deletions .changeset/remix-remappings-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@openzeppelin/wizard': patch
'@openzeppelin/wizard-confidential': patch
'@openzeppelin/wizard-uniswap-hooks': patch
---

Add package APIs for getting versioned remappings.
- Export `getVersionedRemappings` from the Solidity, Confidential, and Uniswap Hooks package roots for internal use by other Wizard packages.
- Add `getVersionedRemappings` to the Confidential `erc7984` API and the Uniswap Hooks `hooks` API for consistency with the Solidity contract APIs.
- **Internal breaking change**: Removed the internal `print-versioned` entrypoints; internal consumers should use `getVersionedRemappings` instead.
14 changes: 14 additions & 0 deletions packages/core/confidential/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ function print(opts?: ERC7984Options): string

Returns a string representation of a contract generated using the provided options. If `opts` is not provided, uses [`defaults`](#defaults).

#### `getVersionedRemappings`
```js
function getVersionedRemappings(): string[]
```

Returns an array of remappings that map unversioned import prefixes to versioned import prefixes. For example:
```js
[
"@openzeppelin/contracts/=@openzeppelin/contracts@5.6.0/",
"@openzeppelin/confidential-contracts/=@openzeppelin/confidential-contracts@0.3.1/",
"@fhevm/solidity/=@fhevm/solidity@0.9.1/"
]
```

#### `defaults`
```js
const defaults: Required<ERC7984Options>
Expand Down
4 changes: 3 additions & 1 deletion packages/core/confidential/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"NOTICE",
"/dist",
"/src",
"contract-version-pins.json",
"contract-version-pins.d.ts",
"!**/*.test.*"
],
"scripts": {
Expand Down Expand Up @@ -41,4 +43,4 @@
"semver": "^7.6.0",
"ts-node": "^10.4.0"
}
}
}
1 change: 0 additions & 1 deletion packages/core/confidential/print-versioned.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/confidential/print-versioned.ts

This file was deleted.

16 changes: 3 additions & 13 deletions packages/core/confidential/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import type { CommonOptions } from './common-options';
import type { WizardContractAPI } from '@openzeppelin/wizard';
import type { ERC7984Options } from './erc7984';
import { printERC7984, defaults as erc7984Defaults } from './erc7984';

export interface WizardContractAPI<Options extends CommonOptions> {
/**
* Returns a string representation of a contract generated using the provided options. If opts is not provided, uses `defaults`.
*/
print: (opts?: Options) => string;

/**
* The default options that are used for `print`.
*/
defaults: Required<Options>;
}
import { getVersionedRemappings } from './get-versioned-remappings';

export type ERC7984 = WizardContractAPI<ERC7984Options>;

export const erc7984: ERC7984 = {
print: printERC7984,
getVersionedRemappings: getVersionedRemappings,
defaults: erc7984Defaults,
};
17 changes: 17 additions & 0 deletions packages/core/confidential/src/get-versioned-remappings.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import test from 'ava';
import { getVersionedRemappings } from './get-versioned-remappings';
import openzeppelinContracts from '../../solidity/openzeppelin-contracts';
import contractVersionPins from '../contract-version-pins';

test('getVersionedRemappings returns remappings for all confidential dependencies', t => {
const remappings = getVersionedRemappings();
t.is(remappings.length, 3);
t.is(remappings[0], `@openzeppelin/contracts/=@openzeppelin/contracts@${openzeppelinContracts.version}/`);
t.is(
remappings[1],
`@openzeppelin/confidential-contracts/=@openzeppelin/confidential-contracts@${contractVersionPins.confidentialContractsVersion}/`,
);
t.is(remappings[2], `@fhevm/solidity/=@fhevm/solidity@${contractVersionPins.fhevmSolidityVersion}/`);
t.false(remappings.some(remapping => remapping.includes('^')));
t.snapshot(remappings);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Snapshot report for `src/get-versioned-remappings.test.ts`

The actual snapshot is saved in `get-versioned-remappings.test.ts.snap`.

Generated by [AVA](https://avajs.dev).

## getVersionedRemappings returns remappings for all confidential dependencies

> Snapshot 1

[
'@openzeppelin/contracts/=@openzeppelin/contracts@5.6.0/',
'@openzeppelin/confidential-contracts/=@openzeppelin/confidential-contracts@0.3.1/',
'@fhevm/solidity/=@fhevm/solidity@0.9.1/',
]
Binary file not shown.
10 changes: 10 additions & 0 deletions packages/core/confidential/src/get-versioned-remappings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import openzeppelinContractsVersion from '@openzeppelin/wizard/openzeppelin-contracts-version.json';
import contractVersionPins from '../contract-version-pins';

export function getVersionedRemappings(): string[] {
Comment thread
ernestognw marked this conversation as resolved.
return [
`@openzeppelin/contracts/=@openzeppelin/contracts@${openzeppelinContractsVersion.version}/`,
`@openzeppelin/confidential-contracts/=@openzeppelin/confidential-contracts@${contractVersionPins.confidentialContractsVersion}/`,
`@fhevm/solidity/=@fhevm/solidity@${contractVersionPins.fhevmSolidityVersion}/`,
];
}
1 change: 1 addition & 0 deletions packages/core/confidential/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type { GenericOptions, KindedOptions } from './build-generic';
export { buildGeneric } from './build-generic';

export { printContract } from './print';
export { getVersionedRemappings } from './get-versioned-remappings';

export { premintPattern } from './erc7984';

Expand Down
78 changes: 0 additions & 78 deletions packages/core/confidential/src/print-versioned.test.ts

This file was deleted.

43 changes: 0 additions & 43 deletions packages/core/confidential/src/print-versioned.test.ts.md

This file was deleted.

Binary file not shown.
18 changes: 0 additions & 18 deletions packages/core/confidential/src/print-versioned.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/solidity/print-versioned.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/solidity/print-versioned.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/core/solidity/src/get-versioned-remappings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ test('getVersionedRemappings not upgradeable', t => {
const remappings = getVersionedRemappings({});
t.is(remappings.length, 1);
t.is(remappings[0], `@openzeppelin/contracts/=@openzeppelin/contracts@${contracts.version}/`);
t.false(remappings.some(remapping => remapping.includes('^')));
t.snapshot(remappings);
});

Expand All @@ -14,6 +15,7 @@ test('getVersionedRemappings upgradeable uups', t => {
t.is(remappings.length, 2);
t.is(remappings[0], `@openzeppelin/contracts/=@openzeppelin/contracts@${contracts.version}/`);
t.is(remappings[1], `@openzeppelin/contracts-upgradeable/=@openzeppelin/contracts-upgradeable@${contracts.version}/`);
t.false(remappings.some(remapping => remapping.includes('^')));
t.snapshot(remappings);
});

Expand All @@ -22,5 +24,6 @@ test('getVersionedRemappings upgradeable transparent', t => {
t.is(remappings.length, 2);
t.is(remappings[0], `@openzeppelin/contracts/=@openzeppelin/contracts@${contracts.version}/`);
t.is(remappings[1], `@openzeppelin/contracts-upgradeable/=@openzeppelin/contracts-upgradeable@${contracts.version}/`);
t.false(remappings.some(remapping => remapping.includes('^')));
t.snapshot(remappings);
});
1 change: 1 addition & 0 deletions packages/core/solidity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type { Contract, BaseFunction, Value, ReferencedContract, FunctionArgumen
export { ContractBuilder } from './contract';

export { printContract } from './print';
export { getVersionedRemappings } from './get-versioned-remappings';

export type { Access } from './set-access-control';
export { accessOptions, setAccessControl, requireAccessControl } from './set-access-control';
Expand Down
14 changes: 0 additions & 14 deletions packages/core/solidity/src/print-versioned.ts

This file was deleted.

42 changes: 42 additions & 0 deletions packages/core/uniswap-hooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ This package provides a programmatic API. For a web interface, see https://wizar

`npm install @openzeppelin/wizard-uniswap-hooks`

### Contract types

The following contract types are supported:
- `hooks`

### Hook templates

The following hook templates are supported:
Expand All @@ -26,6 +31,43 @@ The following hook templates are supported:
- `LiquidityPenaltyHook` - Applies penalties to early liquidity removals
- `ReHypothecationHook` - Enables yield generation from deposited liquidity

### Functions

#### `print`
```js
function print(opts?: HooksOptions): string
```

Returns a string representation of a hook generated using the provided options. If `opts` is not provided, uses [`defaults`](#defaults).

#### `getVersionedRemappings`
```js
function getVersionedRemappings(): string[]
```

Returns an array of remappings that map unversioned import prefixes to versioned import prefixes. For example:
```js
[
"@openzeppelin/contracts/=@openzeppelin/contracts@5.6.0/",
"@openzeppelin/uniswap-hooks/=@openzeppelin/uniswap-hooks@1.2.1/src/"
]
```

#### `defaults`
```js
const defaults: Required<HooksOptions>
```

The default options that are used for [`print`](#print).

#### `isAccessControlRequired`
```js
function isAccessControlRequired(opts: Partial<HooksOptions>): boolean
```

Whether any of the provided options require access control to be enabled. If this returns `true`, then calling `print` with the
same options would cause the `access` option to default to `'ownable'` if it was `undefined` or `false`.

### Examples

Import the hooks API from the `@openzeppelin/wizard-uniswap-hooks` package:
Expand Down
7 changes: 7 additions & 0 deletions packages/core/uniswap-hooks/contract-version-pins.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface ContractVersionPins {
uniswapHooksVersion: string;
}

declare const contractVersionPins: ContractVersionPins;

export default contractVersionPins;
3 changes: 3 additions & 0 deletions packages/core/uniswap-hooks/contract-version-pins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"uniswapHooksVersion": "1.2.1"
}
Loading
Loading