Skip to content

Commit

Permalink
add deploy bsc
Browse files Browse the repository at this point in the history
  • Loading branch information
jklepatch committed May 6, 2021
1 parent cf7947b commit c85187a
Show file tree
Hide file tree
Showing 9 changed files with 2,285 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma solidity ^0.8.4;

contract ContractA {
address public admin ;

constructor(address _admin) {
admin = _admin;
}
}
11 changes: 11 additions & 0 deletions screencast/345-deploy-smart-contract-bsc/contracts/ContractB.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pragma solidity ^0.8.4;

contract ContractB {
address public admin ;
address public contractB;

constructor(address _admin, address _contractB) {
admin = _admin;
contractB = _contractB;
}
}
19 changes: 19 additions & 0 deletions screencast/345-deploy-smart-contract-bsc/contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract Migrations {
address public owner = msg.sender;
uint public last_completed_migration;

modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}

function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Migrations = artifacts.require("Migrations");

module.exports = function (deployer) {
deployer.deploy(Migrations);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const ContractA = artifacts.require('ContractA.sol');
const ContractB = artifacts.require('ContractB.sol');

module.exports = async function (deployer, network, accounts) {
const [admin, _] = accounts;

if(network === 'bscTestnet' || network === 'develop') {
await deployer.deploy(ContractA, admin);
const contractA = await ContractA.deployed();
deployer.deploy(ContractB, admin, contractA.address);
}

if(network === 'bsc') {
//Deployment logic for mainnet
}
};
Loading

0 comments on commit c85187a

Please sign in to comment.