Skip to content

Instantly share code, notes, and snippets.

View PeterBorah's full-sized avatar

Peter Borah PeterBorah

View GitHub Profile
contract BrokenToken {
mapping(address => uint) public balanceOf;
uint public totalSupply;
function deposit(uint amount) {
// intentionally vulnerable
balanceOf[msg.sender] += amount;
totalSupply += amount;
}
contract TokenWithEStop {
mapping(address => uint) public balanceOf;
address public curator;
bool public stopped;
uint public totalSupply;
modifier stopInEmergency { if (!stopped) _ }
modifier onlyInEmergency { if (stopped) _ }
function TokenWithEStop(address _curator) {
contract CircuitBreaker {
struct Transfer { uint amount; address to; uint releaseBlock; bool released; bool stopped; }
Transfer[] public transfers;
address public curator;
address public authorizedSender;
uint public period;
uint public limit;
uint public currentPeriodEnd;
contract TokenWithInvariants {
mapping(address => uint) public balanceOf;
uint public totalSupply;
modifier checkInvariants {
_
if (this.balance < totalSupply) throw;
}
function deposit(uint amount) checkInvariants {
import "BrokenToken.sol";
contract Bounty {
// This bounty will pay out if you can cause BrokenToken's balance
// to be lower than its totalSupply, which would mean that it doesn't
// have sufficient ether for everyone to withdraw.
uint public totalBounty;
bool public claimed;
mapping(address => address) public owners;
contract EtherRouter {
function() {
// Look up the latest version of the contract, and then delegatecall.
}
}
contract EtherRouter {
function() {
// Look up the latest version of the code, and delegatecall
}
}
calldatacopy(mload(0x40), 0, calldatasize)
delegatecall(gas, destination, mload(0x40), calldatasize, mload(0x40), outsize)
calldatacopy(mload(0x40), 0, calldatasize)
delegatecall(gas, destination, mload(0x40), calldatasize, mload(0x40), outsize)
return(mload(0x40), outsize)
import "./Resolver.sol";
contract EtherRouter {
Resolver resolver;
address creator;
function EtherRouter(Resolver _resolver) {
resolver = _resolver;
creator = msg.sender;
}