Skip to content

Commit

Permalink
Merge pull request #10 from CudoVentures/CUDOS-901-refactor-deploymen…
Browse files Browse the repository at this point in the history
…t-script-for-the-gravity-bridge-contract

Cudos 901 refactor deployment script for the gravity bridge contract
  • Loading branch information
kstoykov authored Apr 20, 2022
2 parents 888b52e + 91ab969 commit 0091a43
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
16 changes: 10 additions & 6 deletions solidity/contract-deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const args = commandLineArgs([
{ name: "contract", type: String },
// test mode, if enabled this script deploys three ERC20 contracts for testing
{ name: "test-mode", type: String },
// the address of the cudoss access control smart contract
{ name: "cudos-access-control", type: String}
]);

// 4. Now, the deployer script hits a full node api, gets the Eth signatures of the valset from the latest block, and deploys the Ethereum contract.
Expand Down Expand Up @@ -185,11 +187,7 @@ async function deploy() {


let cudosAccessControl:any
const AcArts = getContractArtifacts("artifacts/contracts/CudosAccessControls.sol/CudosAccessControls.json");
const AcFactory = new ethers.ContractFactory(AcArts.abi, AcArts.bytecode, wallet);

console.log("Deploying AccessControl contract...")
cudosAccessControl = (await AcFactory.deploy());
cudosAccessControl = args["cudos-access-control"];

console.log("Starting Gravity contract deploy");
const { abi, bytecode } = getContractArtifacts(args["contract"]);
Expand Down Expand Up @@ -223,6 +221,11 @@ async function deploy() {
console.log(latestValset)
exit(1)
}
console.log("gravity id:",gravityId)
console.log("vote power:",vote_power)
console.log("eth addresses:",eth_addresses)
console.log("powers:",powers)
console.log("cudos access control:",cudosAccessControl)

const gravity = (await factory.deploy(
// todo generate this randomly at deployment time that way we can avoid
Expand All @@ -231,12 +234,13 @@ async function deploy() {
vote_power,
eth_addresses,
powers,
cudosAccessControl.address
cudosAccessControl
)) as Gravity;

await gravity.deployed();
console.log("Gravity deployed at Address - ", gravity.address);
await submitGravityAddress(gravity.address);

}

function getContractArtifacts(path: string): { bytecode: string; abi: string } {
Expand Down
2 changes: 1 addition & 1 deletion solidity/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,5 +849,5 @@ module.exports = {
},
mocha: {
timeout: 2000000
}
},
};
3 changes: 2 additions & 1 deletion solidity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@ethersproject/bignumber": "^5.0.8",
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"@nomiclabs/hardhat-etherscan": "^3.0.3",
"@openzeppelin/contracts": "3.1.0",
"@typechain/ethers-v5": "^5.0.0",
"@types/chai": "^4.2.13",
Expand Down Expand Up @@ -62,4 +63,4 @@
"dependencies": {
"pkg": "^4.4.9"
}
}
}

0 comments on commit 0091a43

Please sign in to comment.