This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import os | |
import requests | |
import codecs | |
from bs4 import BeautifulSoup | |
ETHERSCAN_URL = 'https://etherscan.io/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
/* | |
* WARNING: Proof of concept. Do not use in production. No warranty. | |
*/ | |
interface BadERC20 { | |
function transfer(address to, uint value) external; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.4.24; | |
/* | |
* WARNING: Proof of concept. Do not use in production. No warranty. | |
*/ | |
interface BadERC20 { | |
function transfer() external; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
/* | |
* WARNING: Proof of concept. Do not use in production. No warranty. | |
*/ | |
interface BadERC20 { | |
function transfer() external; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
/* | |
* WARNING: Proof of concept. Do not use in production. No warranty. | |
*/ | |
interface BadERC20 { | |
function transfer() external; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface BadERC20Basic { | |
function balanceOf(address who) external constant returns (uint); | |
function transfer(address to, uint value) external; | |
function allowance(address owner, address spender) external constant returns (uint); | |
function transferFrom(address from, address to, uint value) external; | |
function approve(address spender, uint value) external; | |
event Approval(address indexed owner, address indexed spender, uint value); | |
event Transfer(address indexed from, address indexed to, uint value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Token { | |
function transfer() returns (bool); | |
} | |
contract GoodToken is Token { | |
function transfer() returns (bool) { return true; } | |
} | |
contract BadToken { | |
function transfer() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ERC20Interface { | |
function totalSupply() external constant returns (uint); | |
function balanceOf(address tokenOwner) external constant returns (uint balance); | |
function allowance(address tokenOwner, address spender) external constant returns (uint remaining); | |
function transfer(address to, uint tokens) external returns (bool success); | |
function approve(address spender, uint tokens) external returns (bool success); | |
function transferFrom(address from, address to, uint tokens) external returns (bool success); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function withdrawToken(address token, uint amount) { | |
if (token==0) throw; | |
if (tokens[token][msg.sender] < amount) throw; | |
tokens[token][msg.sender] = safeSub(tokens[token][msg.sender], amount); | |
if (!Token(token).transfer(msg.sender, amount)) throw; //This will fail for BadTokens | |
Withdraw(token, msg.sender, amount, tokens[token][msg.sender]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Token { | |
function transfer() returns (bool); | |
} | |
contract GoodToken { | |
function transfer() returns (bool) { return true; } | |
} | |
contract BadToken { |
NewerOlder