Skip to content

Commit e129ed8

Browse files
author
Franck
authored
OUSD deploy - migration 9 (#469)
* rinkeby ousd reset part2 * revert commented out deploy * mainnet ousd reset part2 * Add a log * Review feedback
1 parent be9a894 commit e129ed8

15 files changed

+6671
-4446
lines changed

contracts/deploy/009_ousd_fix.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const hre = require("hardhat");
33
const {
44
isMainnet,
55
isFork,
6+
isRinkeby,
67
isMainnetOrRinkebyOrFork,
78
} = require("../test/helpers.js");
89
const {
@@ -75,23 +76,31 @@ const fixOUSD = async () => {
7576
await executeProposal(propResetArgs, propResetDescription);
7677
log("Proposal executed.");
7778
} else {
79+
// Hardcoding gas estimate on Rinkeby since it fails for an undetermined reason...
80+
const gasLimit = isRinkeby ? 1000000 : null;
7881
await withConfirmation(
7982
cOUSDProxy
8083
.connect(sGovernor)
81-
.upgradeTo(dOUSDReset.address, await getTxOpts())
84+
.upgradeTo(dOUSDReset.address, await getTxOpts(gasLimit))
8285
);
8386
log("Upgraded OUSD to reset implementation");
8487

8588
await withConfirmation(
8689
cOUSDReset
8790
.connect(sGovernor)
88-
.setVaultAddress(cVaultProxy.address, await getTxOpts())
91+
.setVaultAddress(cVaultProxy.address, await getTxOpts(gasLimit))
92+
);
93+
log("Vault address set");
94+
95+
await withConfirmation(
96+
cOUSDReset.connect(sGovernor).reset(await getTxOpts(gasLimit))
8997
);
90-
await withConfirmation(cOUSDReset.connect(sGovernor).reset());
9198
log("Called reset on OUSD");
9299

93100
await withConfirmation(
94-
cOUSDProxy.connect(sGovernor).upgradeTo(dOUSD.address, await getTxOpts())
101+
cOUSDProxy
102+
.connect(sGovernor)
103+
.upgradeTo(dOUSD.address, await getTxOpts(gasLimit))
95104
);
96105
log("Upgraded OUSD to standard implementation");
97106
}

contracts/deployments/mainnet/.migrations.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"003_governor": 1608190277,
55
"004_single_asset_staking": 1608192583,
66
"007_upgrade_single_asset_staking": 1608527258,
7-
"008_ousd_reset": 1609285987
7+
"008_ousd_reset": 1609285987,
8+
"009_ousd_fix": 1609736357
89
}

contracts/deployments/mainnet/OUSD.json

Lines changed: 65 additions & 35 deletions
Large diffs are not rendered by default.

contracts/deployments/mainnet/OUSDReset.json

Lines changed: 65 additions & 35 deletions
Large diffs are not rendered by default.

contracts/deployments/mainnet/solcInputs/6c5ec0829f89df496fcae564eaa88d66.json

Lines changed: 287 additions & 0 deletions
Large diffs are not rendered by default.

contracts/deployments/rinkeby/.migrations.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
"002_upgrade_vault": 1605229268,
55
"003_governor": 1608185281,
66
"004_single_asset_staking": 1608185799,
7-
"007_upgrade_single_asset_staking": 1608526958
7+
"007_upgrade_single_asset_staking": 1608526958,
8+
"008_ousd_reset": 1609285987,
9+
"009_ousd_fix": 1609652662
810
}

contracts/deployments/rinkeby/ChainlinkOracle.json

Lines changed: 16 additions & 16 deletions
Large diffs are not rendered by default.

contracts/deployments/rinkeby/OUSD.json

Lines changed: 65 additions & 35 deletions
Large diffs are not rendered by default.

contracts/deployments/rinkeby/OUSDReset.json

Lines changed: 65 additions & 35 deletions
Large diffs are not rendered by default.

contracts/deployments/rinkeby/solcInputs/6c5ec0829f89df496fcae564eaa88d66.json

Lines changed: 287 additions & 0 deletions
Large diffs are not rendered by default.

contracts/utils/deploy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ const sendProposal = async (proposalArgs, description) => {
187187
const governor = await ethers.getContract("Governor");
188188

189189
log(`Submitting proposal for ${description} to governor ${governor.address}`);
190+
log(`Args: ${proposalArgs}`)
190191
await withConfirmation(
191192
governor
192193
.connect(sDeployer)

contracts/utils/tx.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,21 @@ async function premiumGasPrice(multiplier) {
3838
*
3939
* @returns {Promise<{gasPrice: ethers.BigNumber}|{}>}
4040
*/
41-
async function getTxOpts() {
41+
/**
42+
* Returns extra options to use when sending a tx to the network.
43+
* @param {Number} gasLimit: Optional gas limit to set.
44+
* @returns {Promise<void>}
45+
*/
46+
async function getTxOpts(gasLimit=null) {
47+
let txOpts = {}
48+
if (gasLimit) {
49+
txOpts.gasLimit = gasLimit;
50+
}
4251
if (process.env.GAS_PRICE_MULTIPLIER) {
4352
const gasPrice = await premiumGasPrice(process.env.GAS_PRICE_MULTIPLIER);
44-
return { gasPrice };
53+
txOpts.gasPrice = gasPrice;
4554
}
46-
return {};
55+
return txOpts;
4756
}
4857

4958
module.exports = {

0 commit comments

Comments
 (0)