Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Add scripts to deploy new Impls
Browse files Browse the repository at this point in the history
  • Loading branch information
hayesgm committed Mar 6, 2021
1 parent 80258eb commit b84eae1
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
10 changes: 8 additions & 2 deletions ethereum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ yarn script deploy -n ropsten 0x2079A734292094702f4D7D64A59e980c20652Cae

where `0x2079A734292094702f4D7D64A59e980c20652Cae` is the admin, e.g. the Compound Timelock.

And to upgrade to 131:
And to upgrade to m3:

```
yarn script deploy:131 -n ropsten 0x2079A734292094702f4D7D64A59e980c20652Cae
yarn script deploy:m3 -n ropsten 0x2079A734292094702f4D7D64A59e980c20652Cae
```

And to upgrade to m4:

```
yarn script deploy:m4 -n ropsten 0x2079A734292094702f4D7D64A59e980c20652Cae
```

## Console
Expand Down
3 changes: 2 additions & 1 deletion ethereum/saddle.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ module.exports = {
},
scripts: {
"deploy": "scripts/deploy.js",
"deploy:131": "scripts/migrations/131.js"
"deploy:m3": "scripts/migrations/m3.js",
"deploy:m4": "scripts/migrations/m4.js"
} // Aliases for scripts
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
const NEW_LOCK_EVENT_TOPIC = '0xc459acef3ffe957663bb49d644b20d0c790bcb41573893752a72ba6f023b9386';

const main = async () => {
console.log(chalk.yellow(`\n\nDeploying Compound Chain 1.3.1 to ${network}\n`));
console.log(chalk.yellow(`\n\nDeploying Compound Chain m3 to ${network}\n`));

const root = saddle.account;

Expand Down
53 changes: 53 additions & 0 deletions ethereum/scripts/migrations/m4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const chalk = require('chalk');
const {
deployAndVerify,
checkAddress,
readNetwork,
saveNetwork,
} = require('../utils/deploy_utils');

const TEST_SIGNATURE = '0xc86ba4a27a0938efd58b397cf49e453e4abb3f3283acc64644a419c7734ede3c6a5704ded16ff1852340925ee6149c8fe76e9f1610af8c73bcf9b8d28ef086fd1c';

const main = async () => {
console.log(chalk.yellow(`\n\nDeploying Compound Chain m4 to ${network}\n`));

const root = saddle.account;

let { Contracts } = await readNetwork(saddle, env, network);
let cashAddress = Contracts['Cash'];
if (!cashAddress) {
throw new Error(`Missing Cash address for network ${network}`);
}

starportImpl = await deployAndVerify('Starport', [cashAddress, root], { from: root }, saddle, env, network);

let starportAddress = Contracts['Starport'];
if (!starportAddress) {
throw new Error(`Missing Starport address for network ${network}`);
}
cashImpl = await deployAndVerify('CashToken', [starportAddress], { from: root }, saddle, env, network);

if (await cashImpl.methods.symbol().call() !== "CASH") {
throw new Error(`Invalid CASH Token. Have you compiled recent contracts?`);
}

let error;
try {
await starportImpl.methods.invoke("0x", [TEST_SIGNATURE]).call()
} catch (e) {
error = e;
}
if (!error.message.includes('revert Below quorum threshold')) {
throw new Error(`Invalid Starport (expected quorum threshold error, got "${error.message}"). Have you compiled recent contracts?`);
}

await saveNetwork({
StarportImpl: starportImpl
}, saddle, env, network);

console.log(chalk.yellow(`\n\nNote: you will need to manually upgrade the Starport and Cash delegator to use the new StarportImpl and CashImpl\n`));
};

(async () => {
await main();
})();

0 comments on commit b84eae1

Please sign in to comment.