fix configure relay provider

This commit is contained in:
Joe Howarth 2023-01-18 11:52:49 -07:00
parent 4cdeca0d34
commit d49fcb128e
3 changed files with 31 additions and 25 deletions

View File

@ -3,34 +3,42 @@
{
"chainId": 6,
"rewardAddress": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approvedSenders": {
"address": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approved": true
}
"approvedSenders": [
{
"address": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approved": true
}
]
},
{
"chainId": 14,
"rewardAddress": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approvedSenders": {
"address": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approved": true
}
"approvedSenders": [
{
"address": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approved": true
}
]
},
{
"chainId": 5,
"rewardAddress": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approvedSenders": {
"address": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approved": true
}
"approvedSenders": [
{
"address": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approved": true
}
]
},
{
"chainId": 4,
"rewardAddress": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approvedSenders": {
"address": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approved": true
}
"approvedSenders": [
{
"address": "0x61a51662f0B30Bf176484cAc5B4a033C497cB2f3",
"approved": true
}
]
}
],
"pricingInfo": [

View File

@ -22,6 +22,8 @@ export type Deployment = {
address: string
}
const DEFAULT_ENV = "testnet"
export let env = ""
let lastRunOverride: boolean | undefined
@ -29,12 +31,12 @@ export function init(overrides: { lastRunOverride?: boolean } = {}): string {
env = get_env_var("ENV")
if (!env) {
console.log("No environment was specified, using default environment files")
env = "default"
env = DEFAULT_ENV
}
lastRunOverride = overrides?.lastRunOverride
require("dotenv").config({
path: `./ts-scripts/.env${env != "default" ? "." + env : ""}`,
path: `./ts-scripts/.env${env != DEFAULT_ENV ? "." + env : ""}`,
})
return env
}

View File

@ -40,13 +40,9 @@ async function configureChainsRelayProvider(chain: ChainInfo) {
console.log("Set address info...")
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
)
.then(wait)
for (const { address, approved } of thisChainsConfigInfo.approvedSenders) {
console.log(`Setting approved sender: ${address}, approved: ${approved}`)
await relayProvider.updateApprovedSender(address, approved).then(wait)
}
//TODO refactor to use the batch price update, probably