View contracts...Exceptions.sol
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.6.12; | |
contract Exceptions { | |
mapping(address => uint64) public balanceReceived; | |
function receiveMoney() public payable { | |
assert(msg.value == uint64(msg.value)); | |
balanceReceived[msg.sender] += uint64(msg.value); |
View contracts...AlwaysFails.sol
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.4; | |
contract AlwaysFails { | |
function aFunction() public { | |
require(false, "Error message"); | |
} | |
} |
View contracts...FunctionsExample.sol
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.3; | |
contract FunctionsExample { | |
mapping(address => uint) public balanceReceived; | |
address payable owner; | |
constructor() { |
View contracts...InheritanceModifier.sol
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.8.4; | |
import "./Owned.sol"; | |
contract InheritanceModifier is Owned { | |
mapping(address => uint) public tokenBalance; | |
uint tokenPrice = 1 ether; | |
View contracts...Owned.sol
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.8.4; | |
contract Owned { | |
address owner; | |
constructor() { | |
owner = msg.sender; | |
} | |
modifier onlyOwner { |
View contracts...EventExample.sol
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.8.4; | |
contract EventExample { | |
mapping(address => uint) public tokenBalance; | |
event TokensSent(address _from, address _to, uint _amount); | |
constructor() { | |
tokenBalance[msg.sender] = 100; | |
} |
View contracts...ABIExample.sol
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.8.4; | |
contract AbiExample { | |
string public myString = "hello world!"; | |
} |
OlderNewer