Skip to content

Instantly share code, notes, and snippets.

Thomas Wiesner tomw1808

Block or report user

Report or block tomw1808

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 {
@tomw1808
tomw1808 / Solidity050Changes.sol
Created Nov 23, 2018
Breaking Changes From Solidity 0.5.0
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) {
@tomw1808
tomw1808 / call_exception.sol
Last active Apr 29, 2018
Example of a contract calling another contract and exceptions are thrown. One time with a named contract call, another time with a low level function call with call.value()()
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();
@tomw1808
tomw1808 / send_transfer_call.sol
Last active Dec 6, 2018
This is an example of the difference between "address.send()", "address.call.value()()" and "address.transfer()" in Solidity. If you like this example, then checkout my courses I do on Udemy (https://vomtom.at/tag/course/)
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++;
}
You can’t perform that action at this time.