-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from Into-the-Fathom/dev
1.3.0 "MOLLOY DEEP V3"
- Loading branch information
Showing
9 changed files
with
469 additions
and
13 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
23 changes: 23 additions & 0 deletions
23
scripts/migrations/deploy-new-staking-package/1_deploy_staking_package.js
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,23 @@ | ||
const PackageStakingImplementation = artifacts.require('./dao/staking/packages/StakingPackage.sol'); | ||
const fs = require("fs"); | ||
|
||
module.exports = async function(deployer) { | ||
let promises = [ | ||
deployer.deploy(PackageStakingImplementation, {gas: 8000000}), | ||
] | ||
await Promise.all(promises); | ||
|
||
let addresses = { | ||
newStakingPackageImplementation: PackageStakingImplementation.address | ||
} | ||
|
||
let env = process.env.NODE_ENV || 'demo'; | ||
let filePath = `./addresses.new-staking-package.${env}.json`; | ||
|
||
let data = JSON.stringify(addresses, null, " "); | ||
fs.writeFileSync(filePath, data, function (err) { | ||
if (err) { | ||
console.log(err); | ||
} | ||
}); | ||
} |
51 changes: 51 additions & 0 deletions
51
scripts/migrations/deploy-new-staking-package/2_staking_upgrade.js
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,51 @@ | ||
const constants = require("../../tests/helpers/testConstants"); | ||
const eventsHelper = require("../../tests/helpers/eventsHelper"); | ||
|
||
const PackageStakingImplementation = artifacts.require('./dao/staking/packages/StakingPackage.sol'); | ||
const fs = require("fs"); | ||
const { EMPTY_BYTES } = require("../../tests/helpers/testConstants"); | ||
let env = process.env.NODE_ENV; | ||
let addressesFilePath = `../../../addresses.${env}.json`; | ||
const rawdata = fs.readFileSync(addressesFilePath); | ||
const addresses = JSON.parse(rawdata); | ||
const IMultiSigWallet = artifacts.require("./dao/treasury/interfaces/IMultiSigWallet.sol"); | ||
|
||
const MultisigWalletAddress = addresses.multiSigWallet; | ||
const StakingProxyAddress = addresses.staking; | ||
const StakingProxyAdminAddress = addresses.stakingProxyAdmin; | ||
const SUBMIT_TRANSACTION_EVENT = constants.SUBMIT_TRANSACTION_EVENT | ||
|
||
const _encodeUpgradeFunction = (_proxy, _impl) => { | ||
let toRet = web3.eth.abi.encodeFunctionCall({ | ||
name: 'upgrade', | ||
type: 'function', | ||
inputs: [{ | ||
type: 'address', | ||
name: 'proxy' | ||
},{ | ||
type: 'address', | ||
name: 'implementation' | ||
}] | ||
}, [_proxy, _impl]); | ||
|
||
return toRet; | ||
} | ||
|
||
module.exports = async function(deployer) { | ||
const multiSigWallet = await IMultiSigWallet.at(MultisigWalletAddress) | ||
|
||
let resultUpgrade = await multiSigWallet.submitTransaction( | ||
StakingProxyAdminAddress, | ||
EMPTY_BYTES, | ||
_encodeUpgradeFunction( | ||
StakingProxyAddress, | ||
PackageStakingImplementation.address | ||
), | ||
0, | ||
{gas: 8000000} | ||
) | ||
|
||
let txnIndexUpgrade = eventsHelper.getIndexedEventArgs(resultUpgrade, SUBMIT_TRANSACTION_EVENT)[0]; | ||
await multiSigWallet.confirmTransaction(txnIndexUpgrade, {gas: 8000000}); | ||
await multiSigWallet.executeTransaction(txnIndexUpgrade, {gas: 8000000}); | ||
} |
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
Oops, something went wrong.