This file contains hidden or 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
pragma solidity 0.5.12; | |
contract Struct { | |
struct Todo { | |
string text; | |
bool completed; | |
} | |
Todo[] public todos; |
This file contains hidden or 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
pragma solidity 0.5.11; | |
contract Enum { | |
enum Status { | |
Pending, | |
Shipped, | |
Accepted, | |
Rejected, | |
Canceled | |
} |
This file contains hidden or 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
pragma solidity 0.8.11; | |
contract Persons { | |
uint public peopleCounter; | |
struct Person { | |
string firstName; | |
string lastName; | |
address PersonAddress; |
This file contains hidden or 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
pragma solidity 0.5.11; | |
contract Mapping { | |
mapping(address => uint) public myMap; | |
function setMapping(address _address, uint _number) external { | |
myMap[_address] = _number; | |
} | |
function getMapping(address _address) external view returns (uint) { |
This file contains hidden or 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
pragma solidity 0.5.11; | |
contract Loop { | |
uint public counter; | |
function loop(uint number) public { | |
for (uint i = 0; i < number; i ++) { | |
counter += 1; | |
} | |
} | |
} |
This file contains hidden or 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
pragma solidity 0.5.11; | |
contract Errors { | |
uint public balance; | |
uint public constant MAXAMOUNT = 2 ** 256 -1; | |
function deposit(uint _amount) external { | |
uint oldBalance = balance; | |
uint newBalance = balance + _amount; | |
require(newBalance >= balance, "Error"); |
This file contains hidden or 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
pragma solidity 0.5.11; | |
contract A { | |
string public name; | |
constructor(string memory _name) public { | |
name = _name; | |
} | |
} |
This file contains hidden or 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
pragma solidity 0.5.11; | |
contract A { | |
event Log(string message); | |
function foo() public { | |
emit Log("Contract A.foo was called"); | |
} |
This file contains hidden or 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
pragma solidity 0.8.11; | |
contract A { | |
string public name; | |
constructor(string memory _name) { | |
name = _name; | |
} | |
} |
This file contains hidden or 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
pragma solidity 0.8.11; | |
contract Constructor { | |
uint public a; | |
string public b; | |
address public owner; | |
uint public createdAt; | |
constructor(uint _a, string memory _b) { | |
a = _a; |