mirror of https://github.com/crytic/slither
parent
fa3ba105be
commit
c1c182aac5
@ -0,0 +1,43 @@ |
|||||||
|
|
||||||
|
contract ERC20Buggy { |
||||||
|
|
||||||
|
uint256 public _totalSupply; |
||||||
|
mapping(address => uint) public _balanceOf; |
||||||
|
mapping(address => mapping(address => uint)) public _allowance; |
||||||
|
|
||||||
|
function transfer(address to, uint256 value) public returns (bool success){ |
||||||
|
_balanceOf[msg.sender] -= value; |
||||||
|
_balanceOf[to] += value; |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
function transferFrom(address from, address to, uint256 value) public returns (bool success){ |
||||||
|
if(_allowance[msg.sender][from] >= value){ |
||||||
|
_allowance[msg.sender][from] -= value; |
||||||
|
_balanceOf[from] -= value; |
||||||
|
_balanceOf[to] += value; |
||||||
|
return true; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
function approve(address _spender, uint256 value) public returns (bool success){ |
||||||
|
_allowance[msg.sender][_spender] = value; |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
function balanceOf(address from) public returns(uint) { |
||||||
|
return _balanceOf[from]; |
||||||
|
} |
||||||
|
|
||||||
|
function allowance(address from, address to) public returns(uint) { |
||||||
|
return _allowance[from][to]; |
||||||
|
} |
||||||
|
|
||||||
|
function totalSupply() public returns(uint){ |
||||||
|
return _totalSupply; |
||||||
|
} |
||||||
|
|
||||||
|
event Transfer(address indexed _from, address indexed _to, uint256 _value); |
||||||
|
event Approval(address indexed _owner, address indexed _spender, uint256 _value); |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
pragma solidity >=0.4.25 <0.7.0; |
||||||
|
|
||||||
|
contract Migrations { |
||||||
|
address public owner; |
||||||
|
uint public last_completed_migration; |
||||||
|
|
||||||
|
modifier restricted() { |
||||||
|
if (msg.sender == owner) _; |
||||||
|
} |
||||||
|
|
||||||
|
constructor() public { |
||||||
|
owner = msg.sender; |
||||||
|
} |
||||||
|
|
||||||
|
function setCompleted(uint completed) public restricted { |
||||||
|
last_completed_migration = completed; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
const Migrations = artifacts.require("Migrations"); |
||||||
|
|
||||||
|
module.exports = function(deployer) { |
||||||
|
deployer.deploy(Migrations); |
||||||
|
}; |
Loading…
Reference in new issue