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

🏗️👷‍♂️ Deploying more ULN options #109

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 16 additions & 0 deletions packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network
args: [endpointV2Deployment.address],
})

await deployments.delete('SendUln302_Opt2')
const SendUln302_Opt2 = await deployments.deploy('SendUln302_Opt2', {
contract: 'SendUln302',
from: deployer,
args: [endpointV2Deployment.address, 0, 0],
})

await deployments.delete('ReceiveUln302_Opt2')
const ReceiveUln302_Opt2 = await deployments.deploy('ReceiveUln302_Opt2', {
contract: 'ReceiveUln302',
from: deployer,
args: [endpointV2Deployment.address],
})

await Promise.all(
['DefaultProxyAdmin', 'PriceFeed_Proxy', 'PriceFeed', 'PriceFeed_Implementation'].map((contractName) =>
deployments.delete(contractName)
Expand Down Expand Up @@ -134,6 +148,8 @@ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network
EndpointV2: endpointV2Deployment.address,
SendUln302: sendUln302.address,
ReceiveUln302: receiveUln302.address,
SendUln302_Opt2: SendUln302_Opt2.address,
ReceiveUln302_Opt2: ReceiveUln302_Opt2.address,
PriceFeed: priceFeed.address,
Executor: executor.address,
ExecutorFeeLib: executorFeeLib.address,
Expand Down
65 changes: 64 additions & 1 deletion packages/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ import { formatOmniPoint } from '@layerzerolabs/utils'
export const ethEndpoint = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'EndpointV2' }
export const ethReceiveUln = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'ReceiveUln302' }
export const ethSendUln = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'SendUln302' }
export const ethReceiveUln2_Opt2 = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'ReceiveUln302_Opt2' }
export const ethSendUln2_Opt2 = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'SendUln302_Opt2' }
export const ethExecutor = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'Executor' }
export const ethDvn = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'DVN' }
export const avaxEndpoint = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'EndpointV2' }
export const avaxReceiveUln = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'ReceiveUln302' }
export const avaxSendUln = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'SendUln302' }
export const avaxReceiveUln2_Opt2 = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'ReceiveUln302_Opt2' }
export const avaxSendUln2_Opt2 = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'SendUln302_Opt2' }
export const avaxExecutor = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'Executor' }
export const avaxDvn = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'DVN' }

Expand Down Expand Up @@ -155,6 +159,51 @@ export const setupDefaultEndpoint = async (): Promise<void> => {
connections: [],
}

const sendUlnConfig_Opt2: OmniGraphHardhat<Uln302NodeConfig, unknown> = {
contracts: [
{
contract: ethSendUln2_Opt2,
config: {
defaultUlnConfigs: [[EndpointId.AVALANCHE_MAINNET, ethUlnConfig]],
defaultExecutorConfigs: [
[EndpointId.AVALANCHE_MAINNET, getDefaultExecutorConfig(ethExecutorPoint.address)],
],
},
},
{
contract: avaxSendUln2_Opt2,
config: {
defaultUlnConfigs: [[EndpointId.ETHEREUM_MAINNET, avaxUlnConfig]],
defaultExecutorConfigs: [
[EndpointId.ETHEREUM_MAINNET, getDefaultExecutorConfig(avaxExecutorPoint.address)],
],
},
},
],
connections: [],
}

// This is the graph for ReceiveUln302
const receiveUlnConfig_Opt2: OmniGraphHardhat<Uln302NodeConfig, unknown> = {
contracts: [
{
contract: ethReceiveUln2_Opt2,
config: {
defaultUlnConfigs: [[EndpointId.AVALANCHE_MAINNET, ethUlnConfig]],
defaultExecutorConfigs: [],
},
},
{
contract: avaxReceiveUln2_Opt2,
config: {
defaultUlnConfigs: [[EndpointId.ETHEREUM_MAINNET, avaxUlnConfig]],
defaultExecutorConfigs: [],
},
},
],
connections: [],
}

// This is the graph for EndpointV2
const config: OmniGraphHardhat<unknown, EndpointEdgeConfig> = {
contracts: [
Expand Down Expand Up @@ -188,12 +237,26 @@ export const setupDefaultEndpoint = async (): Promise<void> => {
// Now we compile a list of all the transactions that need to be executed for the ULNs and Endpoints
const builderEndpoint = await OmniGraphBuilderHardhat.fromConfig(config)
const endpointTransactions = await configureEndpoint(builderEndpoint.graph, endpointSdkFactory)

const builderSendUln = await OmniGraphBuilderHardhat.fromConfig(sendUlnConfig)
const sendUlnTransactions = await configureUln302(builderSendUln.graph, ulnSdkFactory)

const builderReceiveUln = await OmniGraphBuilderHardhat.fromConfig(receiveUlnConfig)
const receiveUlnTransactions = await configureUln302(builderReceiveUln.graph, ulnSdkFactory)

const transactions = [...sendUlnTransactions, ...receiveUlnTransactions, ...endpointTransactions]
const builderSendUln_Opt2 = await OmniGraphBuilderHardhat.fromConfig(sendUlnConfig_Opt2)
const sendUlnTransactions_Opt2 = await configureUln302(builderSendUln_Opt2.graph, ulnSdkFactory)

const builderReceiveUln_Opt2 = await OmniGraphBuilderHardhat.fromConfig(receiveUlnConfig_Opt2)
const receiveUlnTransactions_Opt2 = await configureUln302(builderReceiveUln_Opt2.graph, ulnSdkFactory)

const transactions = [
...sendUlnTransactions,
...receiveUlnTransactions,
...endpointTransactions,
...sendUlnTransactions_Opt2,
...receiveUlnTransactions_Opt2,
]

logger.debug(`Executing ${transactions.length} transactions`)

Expand Down