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

LayerZero deployment to Base and BSC #1565

Merged
merged 5 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
4 changes: 2 additions & 2 deletions packages/deploy/deploy/800_oft_sand/801_deploy_oft_sand.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;
const {deployer, sandAdmin, sandExecutionAdmin} = await getNamedAccounts();

const TRUSTED_FORWARDER_V2 = await deployments.get('TRUSTED_FORWARDER_V2');
const EndpointV2 = await deployments.get('EndpointV2');
const EndpointV2 = await deployments.get('EndPointV2');

await deploy('OFTSand', {
from: deployer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ethers} from 'ethers';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {ethers} from 'ethers';
import {DEPLOY_NETWORKS} from '../../hardhat.config';

const func: DeployFunction = async function (
hre: HardhatRuntimeEnvironment
Expand All @@ -11,22 +12,21 @@ const func: DeployFunction = async function (

let eidBase, eidBsc;

if (hre.network.name == 'mainnnet') {
if (hre.network.name == 'mainnet') {
eidBase = process.env[`EID_${'BASE'}`];
eidBsc = process.env[`EID_${'BSCMAINNET'}`];
} else if (hre.network.name == 'sepolia') {
eidBase = process.env[`EID_${'BASESEPOLIA'}`];
eidBsc = process.env[`EID_${'BSCTESTNET'}`];
} else {
eidBsc = 0;
eidBase = 0;
throw new Error('Cannot find EID for network');
}

const hreBase = hre.companionNetworks.base;
const hreBase = hre.companionNetworks[DEPLOY_NETWORKS.BASE_MAINNET];
const deploymentsBase = hreBase.deployments;
const OFTSandBase = await deploymentsBase.getOrNull('OFTSand');

const hreBsc = hre.companionNetworks.bscMainnet;
const hreBsc = hre.companionNetworks[DEPLOY_NETWORKS.BSC_MAINNET];
const deploymentsBsc = hreBsc.deployments;
const OFTSandBsc = await deploymentsBsc.getOrNull('OFTSand');

Expand Down
10 changes: 5 additions & 5 deletions packages/deploy/deploy/800_oft_sand/803_oft_sand_setup_base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ethers} from 'ethers';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {ethers} from 'ethers';
import {DEPLOY_NETWORKS} from '../../hardhat.config';

const func: DeployFunction = async function (
hre: HardhatRuntimeEnvironment
Expand All @@ -18,17 +19,16 @@ const func: DeployFunction = async function (
eidEthereum = process.env[`EID_${'SEPOLIA'}`];
eidBsc = process.env[`EID_${'BSCTESTNET'}`];
} else {
eidEthereum = 0;
eidBsc = 0;
throw new Error('Cannot find EID for network');
}

const hreEthereum = hre.companionNetworks.mainnet;
const hreEthereum = hre.companionNetworks[DEPLOY_NETWORKS.ETH_MAINNET];
const deploymentsEthereum = hreEthereum.deployments;
const OFTAdapterForSand = await deploymentsEthereum.getOrNull(
'OFTAdapterForSand'
);

const hreBsc = hre.companionNetworks.bscMainnet;
const hreBsc = hre.companionNetworks[DEPLOY_NETWORKS.BSC_MAINNET];
const deploymentsBsc = hreBsc.deployments;
const OFTSandBsc = await deploymentsBsc.getOrNull('OFTSand');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace OFTAdapterForSand with OFTSand in isPeerForEthereum and isPeerForBsc

Expand Down
14 changes: 7 additions & 7 deletions packages/deploy/deploy/800_oft_sand/804_oft_sand_setup_bsc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ethers} from 'ethers';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {ethers} from 'ethers';
import {DEPLOY_NETWORKS} from '../../hardhat.config';

const func: DeployFunction = async function (
hre: HardhatRuntimeEnvironment
Expand All @@ -18,23 +19,22 @@ const func: DeployFunction = async function (
eidEthereum = process.env[`EID_${'SEPOLIA'}`];
eidBase = process.env[`EID_${'BASESEPOLIA'}`];
} else {
eidEthereum = 0;
eidBase = 0;
throw new Error('Cannot find EID for network');
}

const hreEthereum = hre.companionNetworks.mainnet;
const hreEthereum = hre.companionNetworks[DEPLOY_NETWORKS.ETH_MAINNET];
const deploymentsEthereum = hreEthereum.deployments;
const OFTAdapterForSand = await deploymentsEthereum.getOrNull(
'OFTAdapterForSand'
);

const hreBase = hre.companionNetworks.base;
const hreBase = hre.companionNetworks[DEPLOY_NETWORKS.BASE_MAINNET];
const deploymentsBase = hreBase.deployments;
const OFTSandBase = await deploymentsBase.getOrNull('OFTSand');

if (OFTAdapterForSand && OFTSandBase) {
const isPeerForEthereum = await read(
'OFTAdapterForSand',
'OFTSand',
'isPeer',
eidEthereum,
ethers.zeroPadValue(OFTAdapterForSand.address, 32)
Expand All @@ -51,7 +51,7 @@ const func: DeployFunction = async function (
}

const isPeerForBase = await read(
'OFTAdapterForSand',
'OFTSand',
'isPeer',
eidBase,
ethers.zeroPadValue(OFTSandBase.address, 32)
Expand Down
Loading
Loading