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.7.0; | |
import './CloneFactory.sol'; | |
contract Factory is CloneFactory { | |
Child[] public children; | |
address masterContract; | |
constructor(address _masterContract){ |
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
contract Factory{ | |
Child[] public children; | |
uint disabledCount; | |
event ChildCreated(address childAddress, uint data); | |
function createChild(uint data) external{ | |
Child child = new Child(data, children.length); | |
children.push(child); | |
emit ChildCreated(address(child), data); |
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: GPL-3.0 | |
pragma solidity >=0.4.22 <0.8.0; | |
contract OwnedToken { | |
TokenCreator creator; | |
address owner; | |
bytes32 public name; | |
constructor(bytes32 _name) { | |
owner = msg.sender; |
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.4.22 <0.8.0; | |
pragma experimental ABIEncoderV2; | |
contract Wallet { | |
address[] public approvers; | |
uint8 public quorum; | |
struct Transfer { |
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.7.0; | |
contract Crud { | |
struct User { | |
uint256 id; | |
string name; | |
} |
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.7.0; | |
contract B { | |
function createMemArrays() external view { | |
uint256[20] memory numbers; | |
numbers[0] = 1; | |
numbers[1] = 2; |
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.7.0; | |
contract A { | |
uint256[] public numbers;// dynamic length array | |
address[10] private users; // fixed length array | |
uint8 users_count; | |
function addUser(address _user) external { |
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: GPL-3.0 | |
pragma solidity ^0.7.0; | |
contract DataLocationTest { | |
uint[] stateVar = [1,4,5]; | |
function foo() public{ | |
// case 1 : from storage to memory |
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: GPL-3.0 | |
pragma solidity ^0.7.0; | |
contract Checker { | |
address owner; | |
constructor() { | |
owner = msg.sender; | |
} |
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: GPL-3.0 | |
pragma solidity ^0.7.0; | |
contract HelloWorldContract { | |
string greeting; | |
address owner; | |
constructor() { |