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 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 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 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.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 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.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.7.0 <0.9.0; | |
| contract Coin { | |
| address public minter; | |
| mapping(address => uint) public balances; | |
| event Sent(address from, address to, uint amount); | |
| constructor() { | |
| minter = msg.sender; |
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.7.0 <0.9.0; | |
| contract LittleGame { | |
| struct Player { | |
| Level playerLevel; | |
| string firstName; | |
| string lastName; | |
| address playerAddress; | |
| } |
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.7.0 <0.9.0; | |
| contract Coin { | |
| address public minter; | |
| mapping(address => uint) public balances; | |
| event Sent(address from, address to, uint amount); | |
| constructor() { | |
| minter = msg.sender; |