Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create deploy_proxy.ts #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions scripts/deploy_proxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { ethers, BigNumber } from 'hardhat';

const PROJECT_REGISTRY_ADDRESS = process.env.PROJECT_REGISTRY;
const IOIDSTORE_ADDRESS = process.env.IOID_STORE;
const DEVICE_NFT_ADDRESS = process.env.DEVICE_NFT;

async function main() {
if (!PROJECT_REGISTRY_ADDRESS) {
console.log(`Please provide project registry address`);
return;
}
if (!IOIDSTORE_ADDRESS) {
console.log(`Please provide ioIDStore address`);
return;
}
if (!DEVICE_NFT_ADDRESS) {
console.log(`Please provide device NFT address`);
return;
}

// Log the Project Registry, ioID Store and Device NFT addresses
console.log(`Project Registry Address: ${PROJECT_REGISTRY_ADDRESS}`);
console.log(`ioID Store Address: ${IOIDSTORE_ADDRESS}`);
console.log(`Device NFT Address: ${DEVICE_NFT_ADDRESS}`);

const [deployer] = await ethers.getSigners();

// Get the balance of the deployer
const deployerBalance = Number(ethers.formatEther(await ethers.provider.getBalance(deployer.address))).toFixed(2);

console.log(`Deploying the Proxy contract with account: ${deployer.address}`);
console.log(`Balance is ${deployerBalance} IOTX`);

// Fetch the contract factory
const VerifyingProxy = await ethers.getContractFactory('VerifyingProxy');

// Deploy the contract
console.log("Deploying...");
const verifyingProxy = await VerifyingProxy.deploy(IOIDSTORE_ADDRESS, PROJECT_REGISTRY_ADDRESS, DEVICE_NFT_ADDRESS);

// Wait for the deployment to complete
await verifyingProxy.waitForDeployment();

console.log(`Verifying Proxy Contract deployed to: ${verifyingProxy.target}`);
}

main().catch((error) => {
console.error('Error during deployment:', error.message);
process.exitCode = 1;
});