View ReEntrancyExample.sol
pragma solidity ^0.5.0; | |
contract Reentrance { | |
mapping (address => uint) userBalance; | |
function getBalance(address u) public view returns(uint){ | |
return userBalance[u]; | |
} | |
function addToBalance() public payable { |
View Solidity050Changes.sol
pragma solidity 0.5.0; | |
contract SolidityChanges { | |
/** | |
* https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html#semantic-and-syntactic-changes | |
* | |
* The functions .call(), .delegatecall(), staticcall(), | |
* keccak256(), sha256() and ripemd160() now accept only | |
* a single bytes argument. Moreover, the argument is | |
* not padded. This was changed to make more explicit |
View EthereumSession.sol
pragma solidity 0.4.24; | |
contract EthereumSession { | |
uint myInt; | |
function setTheInt(uint _myInt) public { | |
myInt = _myInt; | |
} | |
function getTheInt() public view returns(uint) { |
View call_exception.sol
pragma solidity ^0.4.21; | |
contract A { | |
/** | |
* Example of a named contract call exception | |
*/ | |
function someAException() public { | |
B myContractB = new B(); | |
myContractB.myB(); |
View send_transfer_call.sol
pragma solidity ^0.4.13; | |
contract someContract { | |
mapping(address => uint) balances; | |
function deposit() payable { | |
balances[msg.sender] += msg.value; | |
} | |
View solidity-revert-require-assert-transfer-send-call.sol
pragma solidity ^0.4.13; | |
contract secondContract { | |
uint public number = 0; | |
function increaseNumber() { | |
number++; | |
} | |