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
const { default: axios } = require("axios"); | |
const Web3 = require("web3"); | |
const provider = "https://bsc-dataseed1.binance.org:443"; | |
const web3 = new Web3(provider); | |
const contractAddress = "0x18B2A687610328590Bc8F2e5fEdDe3b582A49cdA"; | |
const execute = async() => { |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
contract ParentContract{ | |
uint internal simpleInteger; | |
function setInteger(uint _value) external{ | |
simpleInteger = _value; | |
} | |
} |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
contract Demo { | |
uint private simpleUint; | |
constructor() { | |
simpleUint = 5; | |
} | |
function getValue() public view returns(uint){ | |
return simpleUint; |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
// usage: contract is already deployed and instantiated, a reference to it is made by using its address | |
contract DeployedDemo{ | |
uint private simpleUint; | |
constructor() payable{} | |
function getValue() public view returns(uint){ | |
return simpleUint; | |
} |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
// usage: one contract(client) deploys and creates a new insatnce of another contract(Demo) by using new keyword, salt and initial value | |
contract Demo{ | |
uint private simpleUint; | |
constructor() payable{} | |
function getValue() public view returns(uint){ | |
return simpleUint; | |
} |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
// usage: one contract(client) deploys and creates a new insatnce of another contract(Demo) by using new keyword and salt | |
contract Demo{ | |
uint private simpleUint; | |
constructor() payable{} | |
function getValue() public view returns(uint){ | |
return simpleUint; | |
} |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
// usage: one contract(client) deploys and creates a new insatnce of another contract(Demo) by using new keyword | |
contract Demo { | |
uint private simpleUint; | |
constructor() payable{} | |
function getValue() public view returns(uint){ | |
return simpleUint; |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
contract GeneralStructure{ | |
// state variables | |
uint public stateUintVariable; | |
string stateStringVariable; | |
address owner; | |
Person person; |