-
Notifications
You must be signed in to change notification settings - Fork 177
Remix - Use remappings file instead of import version pins #786
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
Merged
Merged
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 030cad9
Use exported getVersionedRemappings for internal use
ericglau 2908f87
Cleanup confidential app for remix button
ericglau 48f22b5
Remove unused styles
ericglau e6a6fe8
remove v4-periphery from devDependencies, enable remix for hooks
ericglau a314c69
Remove upgradeable from hooks remappings handling
ericglau 4a680c7
fix import
ericglau b0cf02c
fix imports
ericglau 6ea8d77
fix packaging
ericglau ac7e5ed
rename for clarity
ericglau 2e41bf9
Fix import
ericglau 1cb0873
pin specific version of uniswap-hooks lib
ericglau cc65387
remove external api for getVersionedRemappings from confidential and …
ericglau c3fedba
Remove version pin and let it be script generated
ericglau db9b67b
gitignore version pin
ericglau bbf62c6
revert parts
ericglau 14cf39e
fix lint
ericglau e005fbd
format
ericglau a89431c
Revert "revert parts"
ericglau d28532a
Revert "gitignore version pin"
ericglau c7e4be0
Revert "Remove version pin and let it be script generated"
ericglau 0e2f6eb
Revert "remove external api for getVersionedRemappings from confident…
ericglau 7fa5d81
Use package-root imports in uniswap hooks UI
ericglau dc9fc16
Update confidential and hooks readmes for API usage
ericglau 6450b17
Add changeset
ericglau 7832c3a
Merge branch 'master' into remixremappings
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,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. |
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 was deleted.
Oops, something went wrong.
This file was deleted.
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 |
|---|---|---|
| @@ -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
17
packages/core/confidential/src/get-versioned-remappings.test.ts
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,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); | ||
| }); |
15 changes: 15 additions & 0 deletions
15
packages/core/confidential/src/get-versioned-remappings.test.ts.md
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,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 added
BIN
+309 Bytes
packages/core/confidential/src/get-versioned-remappings.test.ts.snap
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
packages/core/confidential/src/get-versioned-remappings.ts
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,10 @@ | ||
| import openzeppelinContractsVersion from '@openzeppelin/wizard/openzeppelin-contracts-version.json'; | ||
| import contractVersionPins from '../contract-version-pins'; | ||
|
|
||
| export function getVersionedRemappings(): string[] { | ||
| return [ | ||
| `@openzeppelin/contracts/=@openzeppelin/contracts@${openzeppelinContractsVersion.version}/`, | ||
| `@openzeppelin/confidential-contracts/=@openzeppelin/confidential-contracts@${contractVersionPins.confidentialContractsVersion}/`, | ||
| `@fhevm/solidity/=@fhevm/solidity@${contractVersionPins.fhevmSolidityVersion}/`, | ||
| ]; | ||
| } | ||
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
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 was deleted.
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
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,7 @@ | ||
| export interface ContractVersionPins { | ||
| uniswapHooksVersion: string; | ||
| } | ||
|
|
||
| declare const contractVersionPins: ContractVersionPins; | ||
|
|
||
| export default contractVersionPins; |
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,3 @@ | ||
| { | ||
| "uniswapHooksVersion": "1.2.1" | ||
| } |
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.