From 3135b7f8bb7316c6748bd368b85cab98d6921da2 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sun, 16 Jun 2024 11:28:35 +0700 Subject: [PATCH] Create 2_deploy_contracts.js --- .../PI-bank/migrations/2_deploy_contracts.js | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 blockchain_integration/pi_network/contracts/PI-bank/migrations/2_deploy_contracts.js diff --git a/blockchain_integration/pi_network/contracts/PI-bank/migrations/2_deploy_contracts.js b/blockchain_integration/pi_network/contracts/PI-bank/migrations/2_deploy_contracts.js new file mode 100644 index 000000000..ec5cd7c21 --- /dev/null +++ b/blockchain_integration/pi_network/contracts/PI-bank/migrations/2_deploy_contracts.js @@ -0,0 +1,48 @@ +const { deployer, web3 } = require('@openzeppelin/truffle-deployer'); + +module.exports = async function(deployer) { + // Initialize the deployer + await deployer.initialize(); + + // Create a new migration + const migration = await deployer.createMigration('2_deploy_contracts'); + + // Set the network ID + const networkId = await web3.eth.net.getId(); + + // Set the gas price + const gasPrice = await web3.eth.getGasPrice(); + + // Set the gas limit + const gasLimit = 8000000; + + // Deploy the contracts + await deployer.deploy([ + { + contract: 'PIBankAccessControl', + args: [], + gas: gasLimit, + gasPrice: gasPrice, + }, + { + contract: 'PIBank Gamification', + args: [], + gas: gasLimit, + gasPrice: gasPrice, + }, + { + contract: 'PIBankRegulatoryCompliance', + args: [], + gas: gasLimit, + gasPrice: gasPrice, + }, + ]); + + // Link the contracts + await deployer.link('PIBankAccessControl', 'PIBank'); + await deployer.link('PIBankGamification', 'PIBank'); + await deployer.link('PIBankRegulatoryCompliance', 'PIBank'); + + // Save the migration + await migration.save(); +};