-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
blockchain_integration/pi_network/PiComply/scripts/deploy.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,41 @@ | ||
const { ethers } = require("hardhat"); | ||
const { ChainlinkOracle } = require("../contracts/oracles/ChainlinkOracle.sol"); | ||
const { RegulatoryKnowledgeGraph } = require("../contracts/RegulatoryKnowledgeGraph.sol"); | ||
|
||
async function deploy() { | ||
// Set up the provider and signer | ||
const provider = new ethers.providers.JsonRpcProvider("https://mainnet.infura.io/v3/YOUR_PROJECT_ID"); | ||
const signer = new ethers.Wallet("0xYOUR_PRIVATE_KEY", provider); | ||
|
||
// Deploy the Chainlink Oracle contract | ||
const chainlinkOracleFactory = new ethers.ContractFactory(ChainlinkOracle.abi, ChainlinkOracle.bytecode, signer); | ||
const chainlinkOracle = await chainlinkOracleFactory.deploy("0xLINK_TOKEN_ADDRESS", "0xORACLE_ADDRESS"); | ||
await chainlinkOracle.deployed(); | ||
console.log(`Chainlink Oracle deployed to ${chainlinkOracle.address}`); | ||
|
||
// Deploy the Regulatory Knowledge Graph contract | ||
const regulatoryKnowledgeGraphFactory = new ethers.ContractFactory(RegulatoryKnowledgeGraph.abi, RegulatoryKnowledgeGraph.bytecode, signer); | ||
const regulatoryKnowledgeGraph = await regulatoryKnowledgeGraphFactory.deploy(); | ||
await regulatoryKnowledgeGraph.deployed(); | ||
console.log(`Regulatory Knowledge Graph deployed to ${regulatoryKnowledgeGraph.address}`); | ||
|
||
// Set up the Chainlink Oracle as the data provider for the Regulatory Knowledge Graph | ||
await regulatoryKnowledgeGraph.setChainlinkOracle(chainlinkOracle.address); | ||
console.log(`Chainlink Oracle set as data provider for Regulatory Knowledge Graph`); | ||
|
||
// Verify the contracts on Etherscan | ||
await hre.run("verify:verify", { | ||
address: chainlinkOracle.address, | ||
constructorArguments: ["0xLINK_TOKEN_ADDRESS", "0xORACLE_ADDRESS"], | ||
}); | ||
await hre.run("verify:verify", { | ||
address: regulatoryKnowledgeGraph.address, | ||
}); | ||
} | ||
|
||
deploy() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |