Fix deployment scripts to work against testnet

This commit is contained in:
Joe Howarth 2023-01-09 14:09:45 -07:00
parent cd1f2fce37
commit cef9610d8c
7 changed files with 45 additions and 23 deletions

View File

@ -26,6 +26,7 @@ async function run() {
}
for (let i = 0; i < chains.length; i++) {
console.log(`Deploying for chain ${chains[i].chainId}...`)
const coreRelayerLibrary = await deployCoreRelayerLibrary(chains[i])
const coreRelayerImplementation = await deployCoreRelayerImplementation(
chains[i],
@ -44,6 +45,7 @@ async function run() {
output.coreRelayerImplementations.push(coreRelayerImplementation)
output.coreRelayerSetups.push(coreRelayerSetup)
output.coreRelayerProxies.push(coreRelayerProxy)
console.log("")
}
writeOutputFiles(output, processName)

View File

@ -7,6 +7,7 @@ import {
getRelayProviderAddress,
getCoreRelayerAddress,
} from "../helpers/env"
import { wait } from "../helpers/utils"
import { createRegisterChainVAA, createDefaultRelayProviderVAA } from "../helpers/vaa"
const processName = "registerChainsCoreRelayer"
@ -26,10 +27,14 @@ async function registerChainsCoreRelayer(chain: ChainInfo) {
const coreRelayer = getCoreRelayer(chain)
await coreRelayer.setDefaultRelayProvider(createDefaultRelayProviderVAA(chain))
await coreRelayer
.setDefaultRelayProvider(createDefaultRelayProviderVAA(chain))
.then(wait)
for (let i = 0; i < chains.length; i++) {
await coreRelayer.registerCoreRelayerContract(createRegisterChainVAA(chains[i]))
await coreRelayer
.registerCoreRelayerContract(createRegisterChainVAA(chains[i]))
.then(wait)
}
console.log("Did all contract registrations for the core relayer on " + chain.chainId)

View File

@ -0,0 +1,5 @@
import { ContractReceipt, ContractTransaction } from "ethers";
export function wait(tx: ContractTransaction): Promise<ContractReceipt> {
return tx.wait()
}

View File

@ -55,7 +55,7 @@ async function run() {
}
)
const rx = await tx.wait()
console.log(rx, "da receipt")
console.log(rx.logs, "da receipt")
}
console.log("Start!")

View File

@ -5,6 +5,7 @@ import {
loadScriptConfig,
getRelayProvider,
} from "../helpers/env"
import { wait } from "../helpers/utils"
const processName = "configureRelayProvider"
init()
@ -38,12 +39,14 @@ async function configureChainsRelayProvider(chain: ChainInfo) {
}
//Set address info
await relayProvider.updateRewardAddress(thisChainsConfigInfo.rewardAddress)
await relayProvider.updateRewardAddress(thisChainsConfigInfo.rewardAddress).then(wait)
for (let i = 0; i < thisChainsConfigInfo.approvedSenders.length; i++) {
await relayProvider.updateApprovedSender(
thisChainsConfigInfo.approvedSenders[i].address,
thisChainsConfigInfo.approvedSenders[i].approved
)
await relayProvider
.updateApprovedSender(
thisChainsConfigInfo.approvedSenders[i].address,
thisChainsConfigInfo.approvedSenders[i].approved
)
.then(wait)
}
//TODO refactor to use the batch price update, probably
@ -55,19 +58,22 @@ async function configureChainsRelayProvider(chain: ChainInfo) {
throw new Error("Failed to find pricingInfo for chain " + chains[i].chainId)
}
//delivery addresses are not done by this script, but rather the register chains script.
await relayProvider.updateDeliverGasOverhead(
chains[i].chainId,
targetChainPriceUpdate.deliverGasOverhead
)
await relayProvider.updatePrice(
chains[i].chainId,
targetChainPriceUpdate.updatePriceGas,
targetChainPriceUpdate.updatePriceNative
)
await relayProvider.updateMaximumBudget(
chains[i].chainId,
targetChainPriceUpdate.maximumBudget
)
await relayProvider
.updateDeliverGasOverhead(
chains[i].chainId,
targetChainPriceUpdate.deliverGasOverhead
)
.then(wait)
await relayProvider
.updatePrice(
chains[i].chainId,
targetChainPriceUpdate.updatePriceGas,
targetChainPriceUpdate.updatePriceNative
)
.then(wait)
await relayProvider
.updateMaximumBudget(chains[i].chainId, targetChainPriceUpdate.maximumBudget)
.then(wait)
}
console.log("done with registrations on " + chain.chainId)

View File

@ -19,6 +19,7 @@ async function run() {
}
for (let i = 0; i < chains.length; i++) {
console.log(`Deploying for chain ${chains[i].chainId}...`)
const relayProviderImplementation = await deployRelayProviderImplementation(chains[i])
const relayProviderSetup = await deployRelayProviderSetup(chains[i])
const relayProviderProxy = await deployRelayProviderProxy(
@ -30,6 +31,7 @@ async function run() {
output.relayProviderImplementations.push(relayProviderImplementation)
output.relayProviderSetups.push(relayProviderSetup)
output.relayProviderProxies.push(relayProviderProxy)
console.log("")
}
writeOutputFiles(output, processName)

View File

@ -8,6 +8,7 @@ import {
getRelayProvider,
getRelayProviderAddress,
} from "../helpers/env"
import { wait } from "../helpers/utils"
const processName = "registerChainsRelayProvider"
init()
@ -27,12 +28,13 @@ async function registerChainsRelayProvider(chain: ChainInfo) {
const relayProvider = getRelayProvider(chain)
const coreRelayerAddress = getCoreRelayerAddress(chain)
await relayProvider.updateCoreRelayer(coreRelayerAddress)
await relayProvider.updateCoreRelayer(coreRelayerAddress).then(wait)
for (let i = 0; i < chains.length; i++) {
console.log(`Cross registering with chain ${chains[i].chainId}...`)
const targetChainProviderAddress = getRelayProviderAddress(chains[i])
const whAddress = "0x" + tryNativeToHexString(targetChainProviderAddress, "ethereum")
await relayProvider.updateDeliveryAddress(chains[i].chainId, whAddress)
await relayProvider.updateDeliveryAddress(chains[i].chainId, whAddress).then(wait)
}
console.log("done with registrations on " + chain.chainId)