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: AGPL-3.0-only | |
pragma solidity >=0.8.0; | |
import "https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol"; | |
contract MemeToken is ERC20 { | |
constructor(string memory _name, string memory _symbol, uint8 _decimals) ERC20 (_name, _symbol, _decimals) { | |
// Creating shitcoin | |
} |
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
pragma solidity ^0.5.11; | |
contract EventExample { | |
mapping(address => uint) public tokenBalance; | |
event TokensSent(address _from, address _to, uint _amount); | |
constructor() public { | |
tokenBalance[msg.sender] = 100; |
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
pragma solidity ^0.5.11; | |
contract Owned { | |
address owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
modifier onlyOwner() { |
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
pragma solidity ^0.5.11; | |
import "./Owned.sol"; | |
contract InheritanceModifierExample is Owned { | |
mapping(address => uint) public tokenBalance; | |
uint tokenPrice = 1 ether; | |
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
pragma solidity ^0.5.13; | |
contract FunctionExample { | |
mapping(address => uint) public balanceReceived; | |
address payable owner; | |
constructor() public { | |
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-Idenfitier: MIT | |
pragma solidity 0.8.4; | |
contract WillThrow { | |
function aFunction() public { | |
require (false, "Error message Test"); | |
} | |
} |
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.8.1; | |
contract IntegerExample { | |
uint public myUint; | |
} |
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
pragma solidity ^0.5.13; | |
contract ExceptionExample { | |
mapping(address => uint64) public balanceReceived; | |
function receiveMoney() public payable { | |
assert(balanceReceived[msg.sender] + uint64(msg.value) >= balanceReceived[msg.sender]); | |
balanceReceived[msg.sender] += uint64(msg.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
pragma solidity ^0.6.0; | |
contract SimpleMappingExample { | |
mapping(uint => bool) public myMapping; | |
mapping(address => bool) public myAddressMapping; | |
mapping(uint => mapping(uint => bool)) uintUintBoolMapping; | |
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
pragma solidity ^0.5.13; | |
contract StartStopUpdateExample { | |
address owner; | |
bool paused; | |
constructor() public { | |
owner = msg.sender; |
NewerOlder