Contract 0xfd0d8dab9a196b5097750cdbb8cc5a169de78730

Contract Overview

Balance:
0 Ether
TxHash Block Age From To Value [TxFee]
0x1555628f97d3cfe8007ac860f52c06c348293e0104e976bd8abba80c53000918481404069 days 9 hrs ago0xb551fc0b211599a1b91fc1acb0aaef7e6f48cc09 IN  0xfd0d8dab9a196b5097750cdbb8cc5a169de787300 Ether0.000944271
0x42f302fefda25b8b94cacd12da64c30b944442bfe842d7c15c4e370fe7150a99481402969 days 9 hrs ago0xb551fc0b211599a1b91fc1acb0aaef7e6f48cc09 IN  0xfd0d8dab9a196b5097750cdbb8cc5a169de787300 Ether0.003204929
0xc3c85281dbea9c117de70893cef2cec7fd3b1114559d4449d9c783d36b843fff481401469 days 9 hrs ago0xb551fc0b211599a1b91fc1acb0aaef7e6f48cc09 IN  0xfd0d8dab9a196b5097750cdbb8cc5a169de787300 Ether0.001288302
0xcc46348fb769b9255f56adb03a9926815b4699381340d31c1e1cc59f629ba596481400569 days 9 hrs ago0xb551fc0b211599a1b91fc1acb0aaef7e6f48cc09 IN  0xfd0d8dab9a196b5097750cdbb8cc5a169de787300 Ether0.003202305
0x5d8a907706df864b2783c4f4b7b844cc639a4c0769820f07fe4a10ee3d06c06c481398469 days 9 hrs ago0x7eefa8048608bb94190fe74cb5781b786e76bf3c IN  0xfd0d8dab9a196b5097750cdbb8cc5a169de787300 Ether0.001015324
0x5e1b200db8607448a159fe58cf96e9dd748e17f852879b3a235966e6985f31e3481396469 days 9 hrs ago0xb551fc0b211599a1b91fc1acb0aaef7e6f48cc09 IN  0xfd0d8dab9a196b5097750cdbb8cc5a169de787300 Ether0.001818391
0x5b3241575f49e175691ec741b15a9bbcaef1a6b2d13e9ab5b745aca969680a08481395969 days 9 hrs ago0xb551fc0b211599a1b91fc1acb0aaef7e6f48cc09 IN  0xfd0d8dab9a196b5097750cdbb8cc5a169de787300 Ether0.004178228
0xc1f41938e5cc213e887a0ffa8fe0b3b13b25548bba6328752fdbadba12932e48481393369 days 9 hrs ago0x3c2b18d72b8c9d7746dae2fa73dc05fa6decb911 IN  Contract Creation0 Ether0.001151874
[ Download CSV Export 

Latest 5 internal transactions Internal Transactions as a result of Contract Execution

[ Download CSV Export 
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)

Contract Name:
Escrow

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes

Runs (Optimizer):
200

Contract Source Code

pragma solidity ^0.4.24;

library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
    if (_a == 0) {
      return 0;
    }

    c = _a * _b;
    assert(c / _a == _b);
    return c;
  }

  /**
  * Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
    return _a / _b;
  }

  /**
  * Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
    assert(_b <= _a);
    return _a - _b;
  }

  /**
  *  Adds two numbers, throws on overflow.
  */
  function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
    c = _a + _b;
    assert(c >= _a);
    return c;
  }
}


contract IERC20Token {
  uint256 public totalSupply;

  function balanceOf(address _who) public view returns (uint256);

  function allowance(address _owner, address _spender) public view returns (uint256);

  function transfer(address _to, uint256 _value) public returns (bool);
  
  function approve(address _spender, uint256 _value) public returns (bool);

  function transferFrom(address _from, address _to, uint256 _value) public returns (bool);

  event Transfer( address indexed from, address indexed to,  uint256 value);

  event Approval(address indexed owner, address indexed spender, uint256 value);
  
  event Burn(address indexed from, uint256 value);
}

contract Escrow {
    using SafeMath for uint256;
    
    address public admin = 0xb551fC0b211599A1B91fc1ACB0aAEF7E6f48Cc09;
    address public sccBank = 0x9a19DEB52D63Adb36f908F8C28c28709F94Eb8E6;
    address public feeBank = 0x3c2B18D72B8C9d7746DAe2Fa73dc05fA6DEcB911;
    
    uint256 public minDeposit = 1000000;
    uint256 public fee = 120000;
    uint256 public salesFee = 150000;
    
    uint256 public feeBalance;
    
    constructor() public {
    }

    mapping(address => mapping(address => uint256)) public escrowBalance;
    mapping(address => mapping(address => uint256)) public sales;
    mapping(bytes32 => uint256) tradeID;
    
    
    function setAdmin(address newAdmin) public {
        require(msg.sender == admin);
        admin = newAdmin;
    }
    
    function setMinDeposit(uint256 value) public {
        require(msg.sender == admin);
        minDeposit = value;
    }
    
    function setFee(uint256 value) public {
        require(msg.sender == admin);
        fee = value;
    }
    
    function setSalesFee(uint256 value) public {
        require(msg.sender == admin);
        salesFee = value;
    }
    
    function setSCCBank(address newOwner) public {
        require(msg.sender == admin);
        sccBank = newOwner;
    }
    
    function setFeeBank(address newOwner) public {
        require(msg.sender == admin);
        feeBank = newOwner;
    }
    
    
    function validTx(
        bytes32 tid,
        address fromaddr,
        address to,
        uint256 amount,
        uint8 _v,
        bytes32 _r,
        bytes32 _s
        ) public pure returns (address signer) {
        
        
        bytes32 hash = keccak256(
          abi.encodePacked(tid, fromaddr, to, amount)
        );
        
        address theAddress = ecrecover(hash, _v, _r, _s);
        
        return theAddress;
    }
    
    

    function deposit(IERC20Token token, uint256 amount) public {
        uint256 minVal = minDeposit.add(fee);
        require(amount >= minVal);
        require(token.transferFrom(msg.sender, this, amount));
        
        uint256 userGet = amount.sub(fee);

        feeBalance = feeBalance.add(fee);
        escrowBalance[msg.sender][token] = escrowBalance[msg.sender][token].add(userGet);
    }
    
    function deposit2User(IERC20Token token, uint256 amount, address target) public {
        uint256 minVal = minDeposit.add(salesFee);
        require(amount >= minVal);
        require(sales[msg.sender][token] == 1);
        require(token.transferFrom(msg.sender, this, amount));
        
        uint256 userGet = amount.sub(salesFee);
        feeBalance = feeBalance.add(salesFee);
        
        escrowBalance[target][token] = escrowBalance[target][token].add(userGet);
    }
    
    function refund(IERC20Token token, address target) public {
        require(msg.sender == admin);
        require(escrowBalance[target][token] > 0);
        
        uint256 pre_amount = escrowBalance[target][token];
        escrowBalance[target][token] = 0;
        require(token.transfer(target, pre_amount));
    }
    
    function withdrawFee(IERC20Token token) public {
        require(msg.sender == admin);
        require(feeBalance > 0);
        
        uint256 pre_amount = feeBalance;
        feeBalance = 0;
        require(token.transfer(feeBank, pre_amount));
    }
    
    function withdraw(
        IERC20Token token,
        bytes32 tid,
        address fromaddr,
        address to,
        uint256 amount,
        uint8 _v,
        bytes32 _r,
        bytes32 _s
        ) public {
        //check tid
        require(tradeID[tid] == 0);
        
        //check amount
        require(escrowBalance[fromaddr][token] >= amount);
        
        //create hash
        bytes32 hash = keccak256(
          abi.encodePacked(tid, fromaddr, to, amount)
        );
        
        //check hash isValid
        address theAddress = ecrecover(hash, _v, _r, _s);
        require(theAddress == fromaddr);
        
        tradeID[tid] = 1;
        escrowBalance[fromaddr][token] = escrowBalance[fromaddr][token].sub(amount);
        require(token.transfer(sccBank, amount));
    }

    function transfer(
        address from,
        address to,
        IERC20Token token,
        uint256 tokens
    )
        internal
    {
        require(escrowBalance[from][token] >= tokens, "Insufficient balance.");

        escrowBalance[from][token] -= tokens;
        escrowBalance[to][token] += tokens;
    }
}

Contract ABI

[{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"setFeeBank","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"}],"name":"withdrawFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"minDeposit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"sales","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"tid","type":"bytes32"},{"name":"fromaddr","type":"address"},{"name":"to","type":"address"},{"name":"amount","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"sccBank","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"target","type":"address"}],"name":"refund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feeBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"amount","type":"uint256"},{"name":"target","type":"address"}],"name":"deposit2User","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"setFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newAdmin","type":"address"}],"name":"setAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"setMinDeposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"escrowBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"setSCCBank","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feeBank","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"salesFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tid","type":"bytes32"},{"name":"fromaddr","type":"address"},{"name":"to","type":"address"},{"name":"amount","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"name":"validTx","outputs":[{"name":"signer","type":"address"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"fee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"setSalesFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]

Contract Creation Code

608060405260008054600160a060020a031990811673b551fc0b211599a1b91fc1acb0aaef7e6f48cc0917909155600180548216739a19deb52d63adb36f908f8c28c28709f94eb8e617905560028054909116733c2b18d72b8c9d7746dae2fa73dc05fa6decb911179055620f42406003556201d4c0600455620249f060055534801561008b57600080fd5b50610e618061009b6000396000f30060806040526004361061011c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630774a85281146101215780631ac3ddeb1461014457806341b3d1851461016557806347e7ef241461018c578063498ca5db146101b057806352d75be5146101d75780635b7ecc62146102175780635e30b8a61461024857806360b71d4e1461026f5780636194d3051461028457806369fe0e2d146102af578063704b6c02146102c75780638fcc9cfb146102e85780639499be7614610300578063a53eeeb214610327578063af15d78614610348578063b050191f1461035d578063ce1edd1714610372578063ddca3f43146103ab578063e83e92ac146103c0578063f851a440146103d8575b600080fd5b34801561012d57600080fd5b50610142600160a060020a03600435166103ed565b005b34801561015057600080fd5b50610142600160a060020a0360043516610433565b34801561017157600080fd5b5061017a610512565b60408051918252519081900360200190f35b34801561019857600080fd5b50610142600160a060020a0360043516602435610518565b3480156101bc57600080fd5b5061017a600160a060020a036004358116906024351661067a565b3480156101e357600080fd5b50610142600160a060020a03600435811690602435906044358116906064351660843560ff60a4351660c43560e435610697565b34801561022357600080fd5b5061022c610911565b60408051600160a060020a039092168252519081900360200190f35b34801561025457600080fd5b50610142600160a060020a0360043581169060243516610920565b34801561027b57600080fd5b5061017a610a32565b34801561029057600080fd5b50610142600160a060020a036004358116906024359060443516610a38565b3480156102bb57600080fd5b50610142600435610bcf565b3480156102d357600080fd5b50610142600160a060020a0360043516610beb565b3480156102f457600080fd5b50610142600435610c31565b34801561030c57600080fd5b5061017a600160a060020a0360043581169060243516610c4d565b34801561033357600080fd5b50610142600160a060020a0360043516610c6a565b34801561035457600080fd5b5061022c610cb0565b34801561036957600080fd5b5061017a610cbf565b34801561037e57600080fd5b5061022c600435600160a060020a036024358116906044351660643560ff6084351660a43560c435610cc5565b3480156103b757600080fd5b5061017a610ddf565b3480156103cc57600080fd5b50610142600435610de5565b3480156103e457600080fd5b5061022c610e01565b600054600160a060020a0316331461040457600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461044b57600080fd5b60065460001061045a57600080fd5b5060068054600091829055600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101849052905192939185169263a9059cbb92604480840193602093929083900390910190829087803b1580156104d757600080fd5b505af11580156104eb573d6000803e3d6000fd5b505050506040513d602081101561050157600080fd5b5051151561050e57600080fd5b5050565b60035481565b600080610532600454600354610e1090919063ffffffff16565b91508183101561054157600080fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018590529051600160a060020a038616916323b872dd9160648083019260209291908290030181600087803b1580156105af57600080fd5b505af11580156105c3573d6000803e3d6000fd5b505050506040513d60208110156105d957600080fd5b505115156105e657600080fd5b6004546105fa90849063ffffffff610e2316565b9050610613600454600654610e1090919063ffffffff16565b600655336000908152600760209081526040808320600160a060020a038816845290915290205461064a908263ffffffff610e1016565b336000908152600760209081526040808320600160a060020a039890981683529690529490942093909355505050565b600860209081526000928352604080842090915290825290205481565b6000878152600960205260408120548190156106b257600080fd5b600160a060020a038089166000908152600760209081526040808320938e16835292905220548611156106e457600080fd5b6040805160208082018c90526c01000000000000000000000000600160a060020a03808d168202848601528b1602605483015260688083018a905283518084039091018152608890920192839052815191929182918401908083835b6020831061075f5780518252601f199092019160209182019101610740565b51815160209384036101000a600019018019909216911617905260408051929094018290038220600080845283830180875282905260ff8d1684870152606084018c9052608084018b905294519098506001965060a080840196509194601f19820194509281900390910191865af11580156107df573d6000803e3d6000fd5b5050604051601f190151915050600160a060020a038082169089161461080457600080fd5b600089815260096020908152604080832060019055600160a060020a03808c16845260078352818420908e168452909152902054610848908763ffffffff610e2316565b600160a060020a03808a1660009081526007602090815260408083208f85168085529083528184209590955560015481517fa9059cbb00000000000000000000000000000000000000000000000000000000815294166004850152602484018b90525163a9059cbb93604480820194918390030190829087803b1580156108ce57600080fd5b505af11580156108e2573d6000803e3d6000fd5b505050506040513d60208110156108f857600080fd5b5051151561090557600080fd5b50505050505050505050565b600154600160a060020a031681565b60008054600160a060020a0316331461093857600080fd5b600160a060020a0380831660009081526007602090815260408083209387168352929052908120541161096a57600080fd5b50600160a060020a03818116600081815260076020908152604080832094871680845294825280832080549084905581517fa9059cbb000000000000000000000000000000000000000000000000000000008152600481019590955260248501819052905190949363a9059cbb9360448083019493928390030190829087803b1580156109f657600080fd5b505af1158015610a0a573d6000803e3d6000fd5b505050506040513d6020811015610a2057600080fd5b50511515610a2d57600080fd5b505050565b60065481565b600080610a52600554600354610e1090919063ffffffff16565b915081841015610a6157600080fd5b336000908152600860209081526040808320600160a060020a0389168452909152902054600114610a9157600080fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018690529051600160a060020a038716916323b872dd9160648083019260209291908290030181600087803b158015610aff57600080fd5b505af1158015610b13573d6000803e3d6000fd5b505050506040513d6020811015610b2957600080fd5b50511515610b3657600080fd5b600554610b4a90859063ffffffff610e2316565b9050610b63600554600654610e1090919063ffffffff16565b600655600160a060020a03808416600090815260076020908152604080832093891683529290522054610b9c908263ffffffff610e1016565b600160a060020a039384166000908152600760209081526040808320989096168252969096529290942091909155505050565b600054600160a060020a03163314610be657600080fd5b600455565b600054600160a060020a03163314610c0257600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610c4857600080fd5b600355565b600760209081526000928352604080842090915290825290205481565b600054600160a060020a03163314610c8157600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600254600160a060020a031681565b60055481565b6040805160208082018a90526c01000000000000000000000000600160a060020a03808b168202848601528916026054830152606880830188905283518084039091018152608890920192839052815160009384938493909282918401908083835b60208310610d465780518252601f199092019160209182019101610d27565b51815160209384036101000a600019018019909216911617905260408051929094018290038220600080845283830180875282905260ff8e1684870152606084018d9052608084018c905294519098506001965060a080840196509194601f19820194509281900390910191865af1158015610dc6573d6000803e3d6000fd5b5050604051601f1901519b9a5050505050505050505050565b60045481565b600054600160a060020a03163314610dfc57600080fd5b600555565b600054600160a060020a031681565b81810182811015610e1d57fe5b92915050565b600082821115610e2f57fe5b509003905600a165627a7a72305820c4661da9b7e638daa16f7aee5975b16ba2721e9f15cc3ebc9cb288a60265d1c50029

Swarm Source

bzzr://c4661da9b7e638daa16f7aee5975b16ba2721e9f15cc3ebc9cb288a60265d1c5
Block Age Transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward