This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
4 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
File renamed without changes.
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,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(); | ||
})(); |