mirror of https://github.com/crytic/slither
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
986 B
32 lines
986 B
4 years ago
|
// pragma solidity ^0.4.24;
|
||
6 years ago
|
|
||
4 years ago
|
abstract contract Token{
|
||
|
function transfer(address to, uint value) public virtual returns(bool);
|
||
|
function transferFrom(address from, address to, uint value) public virtual returns(bool);
|
||
6 years ago
|
}
|
||
|
|
||
|
contract Reentrancy {
|
||
|
|
||
|
mapping(address => mapping(address => uint)) eth_deposed;
|
||
|
mapping(address => mapping(address => uint)) token_deposed;
|
||
|
|
||
4 years ago
|
function deposit_eth(address token) public payable{
|
||
6 years ago
|
eth_deposed[token][msg.sender] += msg.value;
|
||
|
}
|
||
|
|
||
4 years ago
|
function deposit_token(address token, uint value) public {
|
||
6 years ago
|
token_deposed[token][msg.sender] += value;
|
||
|
require(Token(token).transferFrom(msg.sender, address(this), value));
|
||
|
}
|
||
|
|
||
4 years ago
|
function withdraw(address token) public {
|
||
6 years ago
|
msg.sender.transfer(eth_deposed[token][msg.sender]);
|
||
6 years ago
|
require(Token(token).transfer(msg.sender, token_deposed[token][msg.sender]));
|
||
6 years ago
|
|
||
|
eth_deposed[token][msg.sender] = 0;
|
||
|
token_deposed[token][msg.sender] = 0;
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|