Skip to content

Commit

Permalink
OUSD deploy - migration 9 (#469)
Browse files Browse the repository at this point in the history
* rinkeby ousd reset part2

* revert commented out deploy

* mainnet ousd reset part2

* Add a log

* Review feedback
  • Loading branch information
Franck authored Jan 4, 2021
1 parent be9a894 commit e129ed8
Show file tree
Hide file tree
Showing 15 changed files with 6,671 additions and 4,446 deletions.
17 changes: 13 additions & 4 deletions contracts/deploy/009_ousd_fix.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const hre = require("hardhat");
const {
isMainnet,
isFork,
isRinkeby,
isMainnetOrRinkebyOrFork,
} = require("../test/helpers.js");
const {
Expand Down Expand Up @@ -75,23 +76,31 @@ const fixOUSD = async () => {
await executeProposal(propResetArgs, propResetDescription);
log("Proposal executed.");
} else {
// Hardcoding gas estimate on Rinkeby since it fails for an undetermined reason...
const gasLimit = isRinkeby ? 1000000 : null;
await withConfirmation(
cOUSDProxy
.connect(sGovernor)
.upgradeTo(dOUSDReset.address, await getTxOpts())
.upgradeTo(dOUSDReset.address, await getTxOpts(gasLimit))
);
log("Upgraded OUSD to reset implementation");

await withConfirmation(
cOUSDReset
.connect(sGovernor)
.setVaultAddress(cVaultProxy.address, await getTxOpts())
.setVaultAddress(cVaultProxy.address, await getTxOpts(gasLimit))
);
log("Vault address set");

await withConfirmation(
cOUSDReset.connect(sGovernor).reset(await getTxOpts(gasLimit))
);
await withConfirmation(cOUSDReset.connect(sGovernor).reset());
log("Called reset on OUSD");

await withConfirmation(
cOUSDProxy.connect(sGovernor).upgradeTo(dOUSD.address, await getTxOpts())
cOUSDProxy
.connect(sGovernor)
.upgradeTo(dOUSD.address, await getTxOpts(gasLimit))
);
log("Upgraded OUSD to standard implementation");
}
Expand Down
3 changes: 2 additions & 1 deletion contracts/deployments/mainnet/.migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"003_governor": 1608190277,
"004_single_asset_staking": 1608192583,
"007_upgrade_single_asset_staking": 1608527258,
"008_ousd_reset": 1609285987
"008_ousd_reset": 1609285987,
"009_ousd_fix": 1609736357
}
100 changes: 65 additions & 35 deletions contracts/deployments/mainnet/OUSD.json

Large diffs are not rendered by default.

100 changes: 65 additions & 35 deletions contracts/deployments/mainnet/OUSDReset.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion contracts/deployments/rinkeby/.migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"002_upgrade_vault": 1605229268,
"003_governor": 1608185281,
"004_single_asset_staking": 1608185799,
"007_upgrade_single_asset_staking": 1608526958
"007_upgrade_single_asset_staking": 1608526958,
"008_ousd_reset": 1609285987,
"009_ousd_fix": 1609652662
}
32 changes: 16 additions & 16 deletions contracts/deployments/rinkeby/ChainlinkOracle.json

Large diffs are not rendered by default.

100 changes: 65 additions & 35 deletions contracts/deployments/rinkeby/OUSD.json

Large diffs are not rendered by default.

100 changes: 65 additions & 35 deletions contracts/deployments/rinkeby/OUSDReset.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions contracts/utils/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ const sendProposal = async (proposalArgs, description) => {
const governor = await ethers.getContract("Governor");

log(`Submitting proposal for ${description} to governor ${governor.address}`);
log(`Args: ${proposalArgs}`)
await withConfirmation(
governor
.connect(sDeployer)
Expand Down
15 changes: 12 additions & 3 deletions contracts/utils/tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ async function premiumGasPrice(multiplier) {
*
* @returns {Promise<{gasPrice: ethers.BigNumber}|{}>}
*/
async function getTxOpts() {
/**
* Returns extra options to use when sending a tx to the network.
* @param {Number} gasLimit: Optional gas limit to set.
* @returns {Promise<void>}
*/
async function getTxOpts(gasLimit=null) {
let txOpts = {}
if (gasLimit) {
txOpts.gasLimit = gasLimit;
}
if (process.env.GAS_PRICE_MULTIPLIER) {
const gasPrice = await premiumGasPrice(process.env.GAS_PRICE_MULTIPLIER);
return { gasPrice };
txOpts.gasPrice = gasPrice;
}
return {};
return txOpts;
}

module.exports = {
Expand Down
Loading

0 comments on commit e129ed8

Please sign in to comment.