Skip to content

Instantly share code, notes, and snippets.

@tomw1808
tomw1808 / Dockerfile
Created March 14, 2023 09:43
Working Blockscout 5.1.1 Dockerfile Apple Silicon M2 Elixier 1.14
FROM elixir:1.14.3 AS builder
# RUN apt-get update && apt-get install -y gmp-dev automake libtool inotify-tools autoconf python3 file qemu-x86_64
# Update default packages
RUN apt-get update
# Get Ubuntu packages
RUN apt-get install -y \
build-essential \
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 November 23, 2018 12:22
Breaking Changes From Solidity 0.5.0
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
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 April 29, 2018 09:12
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()()
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 December 6, 2018 08:46
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/)
pragma solidity ^0.4.13;
contract someContract {
mapping(address => uint) balances;
function deposit() payable {
balances[msg.sender] += msg.value;
}
pragma solidity ^0.4.13;
contract secondContract {
uint public number = 0;
function increaseNumber() {
number++;
}