Skip to content

Instantly share code, notes, and snippets.

@duytai
Last active December 3, 2018 07:43
Show Gist options
  • Save duytai/8cff2c3feeb8e3b5dc18882f3636a0d5 to your computer and use it in GitHub Desktop.
Save duytai/8cff2c3feeb8e3b5dc18882f3636a0d5 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.24;
contract Victim {
// gasless send error
function withdraw0(uint n, address addr) payable {
require(address(addr).send(n));
}
// reentrancy
function withdraw1(uint n) payable {
msg.sender.call.value(n)();
}
// delegate
function delegate(address addr) {
address(addr).delegatecall(msg.data);
}
// block.number
function number(uint n, address addr) {
if (block.number > 100) {
address(addr).call.value(n)();
}
}
// block.now
function time(uint n, address addr) {
if (now < 100) {
address(addr).call.value(n)();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment