forked from jklepatch/eattheblocks
-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
2,285 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
screencast/345-deploy-smart-contract-bsc/contracts/ContractA.sol
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,9 @@ | ||
pragma solidity ^0.8.4; | ||
|
||
contract ContractA { | ||
address public admin ; | ||
|
||
constructor(address _admin) { | ||
admin = _admin; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
screencast/345-deploy-smart-contract-bsc/contracts/ContractB.sol
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,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
19
screencast/345-deploy-smart-contract-bsc/contracts/Migrations.sol
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,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; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
screencast/345-deploy-smart-contract-bsc/migrations/1_initial_migration.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,5 @@ | ||
const Migrations = artifacts.require("Migrations"); | ||
|
||
module.exports = function (deployer) { | ||
deployer.deploy(Migrations); | ||
}; |
16 changes: 16 additions & 0 deletions
16
screencast/345-deploy-smart-contract-bsc/migrations/2_deploy_contracts.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,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 | ||
} | ||
}; |
Oops, something went wrong.