mirror of
https://github.com/luxfi/uma.git
synced 2026-10-30 15:14:44 +00:00
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
const argv = require("minimist")(process.argv.slice(), { string: ["ownershipAddress"] });
|
|
|
|
const DesignatedVotingFactory = artifacts.require("DesignatedVotingFactory");
|
|
|
|
async function run(deployedFactory, ownershipAddress) {
|
|
const account = (await web3.eth.getAccounts())[0];
|
|
// TODO(ptare): Handle the case where a DesignatedVoting is already deployed for this voting address `account`.
|
|
await deployedFactory.newDesignatedVoting(ownershipAddress, { from: account });
|
|
const designatedVotingAddress = await deployedFactory.designatedVotingContracts(account);
|
|
console.log("VOTING ADDRESS:", account);
|
|
console.log("DESIGNATED VOTING ADDRESS:", designatedVotingAddress);
|
|
}
|
|
|
|
const deployDesignatedVoting = async function (callback) {
|
|
if (!argv.ownershipAddress) {
|
|
callback("Must include <ownershipAddress>");
|
|
}
|
|
try {
|
|
const factory = await DesignatedVotingFactory.deployed();
|
|
await run(factory, argv.ownershipAddress);
|
|
} catch (e) {
|
|
console.log("ERROR:", e);
|
|
callback(e);
|
|
}
|
|
callback();
|
|
};
|
|
|
|
deployDesignatedVoting.run = run;
|
|
module.exports = deployDesignatedVoting;
|