-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config and deploy for manual feed on xdai
- Loading branch information
1 parent
9af5149
commit e3aaade
Showing
6 changed files
with
265 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import retry from "async-retry"; | ||
|
||
import hre from "hardhat"; | ||
const { ethers } = hre; | ||
import { patchNetworks, asyncMain, readAddressFile, getSigner } from "./util"; | ||
import { AddressFile, getAddress } from "./config-utils"; | ||
patchNetworks(); | ||
|
||
const { | ||
network: { name: network }, | ||
} = hre; | ||
|
||
async function main(proxyAddresses: AddressFile) { | ||
proxyAddresses = proxyAddresses || readAddressFile(network); | ||
let cardUsdFeedAddress = getAddress("CARDUSDFeed", proxyAddresses); | ||
|
||
let signer = getSigner(); | ||
|
||
let price = process.env.CARD_USD_PRICE; | ||
|
||
if (!price) { | ||
throw new Error("Must provide env variable CARD_USD_PRICE"); | ||
} | ||
|
||
let startedAt = Math.floor(Date.now() / 1000); | ||
let updatedAt = startedAt; | ||
await retry( | ||
async () => { | ||
console.log( | ||
` adding round: price ${price}, startedAt(unix) ${startedAt}, updatedAt(unix) ${updatedAt}` | ||
); | ||
|
||
let instance = ( | ||
await ethers.getContractAt("ManualFeed", cardUsdFeedAddress) | ||
).connect(signer); | ||
await instance.addRound(price, startedAt, updatedAt); | ||
}, | ||
{ | ||
retries: 3, | ||
} | ||
); | ||
} | ||
|
||
asyncMain(main); |