From d90805de9c88cb60f3851842a21598e0555be6aa Mon Sep 17 00:00:00 2001 From: Simon Dosch Date: Tue, 19 Sep 2023 10:24:35 +0200 Subject: [PATCH] add DepositManager update script --- scripts/updateDepositManager.js | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/updateDepositManager.js diff --git a/scripts/updateDepositManager.js b/scripts/updateDepositManager.js new file mode 100644 index 000000000..2c37a92c0 --- /dev/null +++ b/scripts/updateDepositManager.js @@ -0,0 +1,34 @@ +const contractAddresses = require('../contractAddresses.json') + +const DepositManager = artifacts.require('DepositManager') +const DepositManagerProxy = artifacts.require('DepositManagerProxy') + +async function deployAndUpdateWM() { + const newDM = await DepositManager.new() + console.log('new DM deployed at: ', newDM.address) + const dmProxy = await DepositManagerProxy.at( + contractAddresses.root.DepositManagerProxy + ) + const result = await dmProxy.updateImplementation(newDM.address) + console.log('tx hash: ', result.tx) + + const impl = await dmProxy.implementation() + console.log('new impl: ', impl) +} + +module.exports = async function(callback) { + // args starts with index 6, example: first arg == process.args[6] + console.log(process.argv) + try { + const accounts = await web3.eth.getAccounts() + console.log( + 'Current configured address to make transactions:', + accounts[0] + ) + await deployAndUpdateWM() + } catch (e) { + // truffle exec