Skip to content
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

🧹 oft upgradeable example deploy script #1317

Merged
merged 3 commits into from
Feb 21, 2025
Merged

Conversation

shankars99
Copy link
Contributor

The old OFT Upgradeable deploy used to assume that the layerzero's internally defined network names founds under deployments https://www.npmjs.com/package/@layerzerolabs/lz-evm-sdk-v2?activeTab=code is the same as those defined in hardhat.config.ts's network config.

This isn't the case as developers can name networks differently.

Other examples https://github.com/LayerZero-Labs/devtools/blob/main/examples/oapp/deploy/MyOApp.ts use this pattern where we load the deployments (EndpointV2 among others) and artifacts into Hardhat in toolbox-hardhat

    // And we check the config for packages from which to import deployments as well
    const deploymentSourcePackages = layerZero?.deploymentSourcePackages ?? ['@layerzerolabs/lz-evm-sdk-v2']

    // Here we create our two config extenders, two curried functions
    // that accept hardhat user config and return a hardhat user config with external
    // artifacts and deployments configured
    const withArtifacts = withLayerZeroArtifacts(...artifactSourcePackages)
    const withDeployments = withLayerZeroDeployments(...deploymentSourcePackages)

For some reason this does not work with Upgradeable which could be due to some internal hardcoding or use of other packages.

The solution is to unabstract the abstraction created by the above code snippet and raw fetch the EndpointV2 information from the layerzero network name

…ays equals lz network names

Signed-off-by: shankar <shankar@layerzerolabs.org>
Signed-off-by: shankar <shankar@layerzerolabs.org>
@shankars99 shankars99 force-pushed the fix/deploy_network_name branch from 3cd37f1 to f3c9e90 Compare February 21, 2025 19:59
@shankars99 shankars99 requested a review from a team February 21, 2025 20:17
…kForChainId

Signed-off-by: shankar <shankar@layerzerolabs.org>
@shankars99 shankars99 merged commit 389d6c9 into main Feb 21, 2025
10 checks passed
@shankars99 shankars99 deleted the fix/deploy_network_name branch February 21, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants