Contract 0x57d586906Cb1b995DFcE24730906F59D60490ff6

 
 
Txn Hash
Method
Block
From
To
Value
0x612a0f3d9e36017320bbf291d790c3259117ed297dd89101b98461def48469edTransfer Ownersh...59582252018-07-13 18:35:061487 days 9 hrs ago0x001183d6fe9604fb2a1923d92a35b3fd063c4e05 IN  0x57d586906cb1b995dfce24730906f59d60490ff60 Ether0.0012120440
0x7959d1ef25ed2d7bf2a5239ff906a37a982a904e0b7750a13d1c5625d984d5180x6000805459537662018-07-13 0:33:501488 days 3 hrs ago0x001183d6fe9604fb2a1923d92a35b3fd063c4e05 IN  Create: FlashLender0 Ether0.007057029
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FlashLender

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes with 5000000 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-07-16
*/

pragma solidity 0.4.24;
 

interface IArbitrage {
    function executeArbitrage(
      address token,
      uint256 amount,
      address dest,
      bytes data
    )
      external
      returns (bool);
}

pragma solidity 0.4.24;


contract IBank {
    function totalSupplyOf(address token) public view returns (uint256 balance);
    function borrowFor(address token, address borrower, uint256 amount) public;
    function repay(address token, uint256 amount) external payable;
}


/**
 * @title Helps contracts guard agains reentrancy attacks.
 * @author Remco Bloemen <[email protected]π.com>
 * @notice If you mark a function `nonReentrant`, you should also
 * mark it `external`.
 */
contract ReentrancyGuard {

  /**
   * @dev We use a single lock for the whole contract.
   */
  bool private reentrancyLock = false;

  /**
   * @dev Prevents a contract from calling itself, directly or indirectly.
   * @notice If you mark a function `nonReentrant`, you should also
   * mark it `external`. Calling one nonReentrant function from
   * another is not supported. Instead, you can implement a
   * `private` function doing the actual work, and a `external`
   * wrapper marked as `nonReentrant`.
   */
  modifier nonReentrant() {
    require(!reentrancyLock);
    reentrancyLock = true;
    _;
    reentrancyLock = false;
  }

}


/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    // uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return a / b;
  }

  /**
  * @dev 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;
  }

  /**
  * @dev 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;
  }
}


/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;


  event OwnershipRenounced(address indexed previousOwner);
  event OwnershipTransferred(
    address indexed previousOwner,
    address indexed newOwner
  );


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() public {
    owner = msg.sender;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  /**
   * @dev Allows the current owner to relinquish control of the contract.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipRenounced(owner);
    owner = address(0);
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function transferOwnership(address _newOwner) public onlyOwner {
    _transferOwnership(_newOwner);
  }

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address _newOwner) internal {
    require(_newOwner != address(0));
    emit OwnershipTransferred(owner, _newOwner);
    owner = _newOwner;
  }
}


/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
  function totalSupply() public view returns (uint256);
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
}


/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
  function allowance(address owner, address spender)
    public view returns (uint256);

  function transferFrom(address from, address to, uint256 value)
    public returns (bool);

  function approve(address spender, uint256 value) public returns (bool);
  event Approval(
    address indexed owner,
    address indexed spender,
    uint256 value
  );
}


/*

  Copyright 2018 Contra Labs Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

pragma solidity 0.4.24;

// @title FlashLender: Borrow from the bank and enforce repayment by the end of transaction execution.
// @author Rich McAteer <[email protected]>, Max Wolff <[email protected]>
contract FlashLender is ReentrancyGuard, Ownable {
    using SafeMath for uint256;

    string public version = '0.1';
    address public bank;
    uint256 public fee;
    
    /**
    * @dev Verify that the borrowed tokens are returned to the bank plus a fee by the end of transaction execution.
    * @param token Address of the token to for arbitrage. 0x0 for Ether.
    * @param amount Amount borrowed.
    */
    modifier isArbitrage(address token, uint256 amount) {
        uint256 balance = IBank(bank).totalSupplyOf(token);
        uint256 feeAmount = amount.mul(fee).div(10 ** 18); 
        _;
        require(IBank(bank).totalSupplyOf(token) >= (balance.add(feeAmount)));
    }

    constructor(address _bank, uint256 _fee) public {
        bank = _bank;
        fee = _fee;
    }

    /**
    * @dev Borrow from the bank on behalf of an arbitrage contract and execute the arbitrage contract's callback function.
    * @param token Address of the token to borrow. 0x0 for Ether.
    * @param amount Amount to borrow.
    * @param dest Address of the account to receive arbitrage profits.
    * @param data The data to execute the arbitrage trade.
    */
    function borrow(
        address token,
        uint256 amount,
        address dest,
        bytes data
    )
        external
        nonReentrant
        isArbitrage(token, amount)
        returns (bool)
    {
        // Borrow from the bank and send to the arbitrageur.
        IBank(bank).borrowFor(token, msg.sender, amount);
        // Call the arbitrageur's execute arbitrage method.
        return IArbitrage(msg.sender).executeArbitrage(token, amount, dest, data);
    }

    /**
    * @dev Allow the owner to set the bank address.
    * @param _bank Address of the bank.
    */
    function setBank(address _bank) external onlyOwner {
        bank = _bank;
    }

    /**
    * @dev Allow the owner to set the fee.
    * @param _fee Fee to borrow, as a percentage of principal borrowed. 18 decimals of precision (e.g., 10^18 = 100% fee).
    */
    function setFee(uint256 _fee) external onlyOwner {
        fee = _fee;
    }

}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"_bank","type":"address"}],"name":"setBank","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"bank","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"amount","type":"uint256"},{"name":"dest","type":"address"},{"name":"data","type":"bytes"}],"name":"borrow","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"fee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_bank","type":"address"},{"name":"_fee","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

6000805460ff1916905560c0604052600360808190527f302e31000000000000000000000000000000000000000000000000000000000060a090815261004891600191906100ad565b5034801561005557600080fd5b50604051604080610ae48339810160405280516020909101516000805461010060a860020a031916336101000217905560028054600160a060020a031916600160a060020a0390931692909217909155600355610148565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100ee57805160ff191683800117855561011b565b8280016001018555821561011b579182015b8281111561011b578251825591602001919060010190610100565b5061012792915061012b565b5090565b61014591905b808211156101275760008155600101610131565b90565b61098d806101576000396000f3006080604052600436106100985763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663090d23b9811461009d57806354fd4d50146100cd57806369fe0e2d14610157578063715018a61461016f57806376cdb03b146101845780638da5cb5b146101c2578063c046d9b5146101d7578063ddca3f4314610230578063f2fde38b14610257575b600080fd5b3480156100a957600080fd5b506100cb73ffffffffffffffffffffffffffffffffffffffff60043516610285565b005b3480156100d957600080fd5b506100e26102f5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561011c578181015183820152602001610104565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016357600080fd5b506100cb6004356103a0565b34801561017b57600080fd5b506100cb6103ce565b34801561019057600080fd5b50610199610468565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101ce57600080fd5b50610199610484565b3480156101e357600080fd5b5061021c6004803573ffffffffffffffffffffffffffffffffffffffff90811691602480359260443516916064359182019101356104a5565b604080519115158252519081900360200190f35b34801561023c57600080fd5b5061024561081c565b60408051918252519081900360200190f35b34801561026357600080fd5b506100cb73ffffffffffffffffffffffffffffffffffffffff60043516610822565b600054610100900473ffffffffffffffffffffffffffffffffffffffff1633146102ae57600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156103985780601f1061036d57610100808354040283529160200191610398565b820191906000526020600020905b81548152906001019060200180831161037b57829003601f168201915b505050505081565b600054610100900473ffffffffffffffffffffffffffffffffffffffff1633146103c957600080fd5b600355565b600054610100900473ffffffffffffffffffffffffffffffffffffffff1633146103f757600080fd5b6000805460405161010090910473ffffffffffffffffffffffffffffffffffffffff16917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a2600080547fffffffffffffffffffffff0000000000000000000000000000000000000000ff169055565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b600054610100900473ffffffffffffffffffffffffffffffffffffffff1681565b6000805460ff16156104b657600080fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001178155600254604080517fcf9530d000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808b16600483015291518a948a949093849391169163cf9530d09160248082019260209290919082900301818787803b15801561055c57600080fd5b505af1158015610570573d6000803e3d6000fd5b505050506040513d602081101561058657600080fd5b50516003549092506105b990670de0b6b3a7640000906105ad90869063ffffffff61085716565b9063ffffffff61088616565b600254604080517f3088044100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e81166004830152336024830152604482018e9052915193945091169163308804419160648082019260009290919082900301818387803b15801561063c57600080fd5b505af1158015610650573d6000803e3d6000fd5b50506040517f7b0f6f1800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d811660048301908152602483018e9052908c166044830152608060648301908152608483018b9052339450637b0f6f1893508e928e928e928e928e92919060a40184848082843782019150509650505050505050602060405180830381600087803b1580156106fc57600080fd5b505af1158015610710573d6000803e3d6000fd5b505050506040513d602081101561072657600080fd5b5051945061073a828263ffffffff61089b16565b600254604080517fcf9530d000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301529151919092169163cf9530d09160248083019260209291908290030181600087803b1580156107af57600080fd5b505af11580156107c3573d6000803e3d6000fd5b505050506040513d60208110156107d957600080fd5b505110156107e657600080fd5b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550909695505050505050565b60035481565b600054610100900473ffffffffffffffffffffffffffffffffffffffff16331461084b57600080fd5b610854816108a8565b50565b600082151561086857506000610880565b5081810281838281151561087857fe5b041461088057fe5b92915050565b6000818381151561089357fe5b049392505050565b8181018281101561088057fe5b73ffffffffffffffffffffffffffffffffffffffff811615156108ca57600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff8085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff9092169190911790555600a165627a7a723058201769c67fb74530aba1254cf883c325bdc7099756c8b9f9cb0107f66f709d889b0029000000000000000000000000a04e5b78fbd31caec8f8af126d00a57f56c1f7ae0000000000000000000000000000000000000000000000000000000000000000

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000a04e5b78fbd31caec8f8af126d00a57f56c1f7ae0000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _bank (address): 0xa04e5b78fbd31caec8f8af126d00a57f56c1f7ae
Arg [1] : _fee (uint256): 0

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000a04e5b78fbd31caec8f8af126d00a57f56c1f7ae
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000


Swarm Source

bzzr://1769c67fb74530aba1254cf883c325bdc7099756c8b9f9cb0107f66f709d889b
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.