Contract 0x32DD9802B83aEC762a38e0d3738549BFE5660B30

Contract Overview

Balance:
0 Ether
Txn Hash
Method
Block
From
To
Value
0x245683f41849778f8403950e7679cd66a50214af43a46d989e6fbf68d8e90bed0x6e46c9bb36109922018-07-10 20:11:311501 days 3 hrs ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.0002697810
0x786609ade637d17d9f340bd52cc613672368a9d5f1f0fa5730b0ac7b71535bdc0x6e46c9bb36109912018-07-10 20:10:111501 days 3 hrs ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.0002697810
0x2aa5675ca4f289dd7a6abe2a6c99f61d2ae5bbe2cc157fc1b98437d0d04b34d20x6e46c9bb36109912018-07-10 20:10:111501 days 3 hrs ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.0002697810
0x1fb437f18e819edf16f166e44fb1cc684ca3843016b27f938eda9ca9348925b00x6e46c9bb36109912018-07-10 20:10:111501 days 3 hrs ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.0002691410
0x0c02a3e3c4e1efdac8d2239b9fe3f8ee83c36f64a0317353e0323be66b4f3b310x6e46c9bb36109892018-07-10 20:09:201501 days 3 hrs ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.0002697810
0x3ea99d60db3ce2d01a921b2c984edbd3cedad8df2c748f92976ded556c0764960xb3f73c4036104092018-07-10 15:20:161501 days 8 hrs ago0x43f818ebc9181ed81c9bbd390bfd25dfce638adb IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.001459325
0x4e73ed004582e118b5094368d32111295712a1a43aad6d68185dcd75291d9cb90x8fbbe7a236104002018-07-10 15:17:581501 days 8 hrs ago0x43f818ebc9181ed81c9bbd390bfd25dfce638adb IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.000837611
0xde85683872c8e5ac4dd8a033e970cd0bb032e952f7106b5f420ccf94a0b7cc2f0xf4ff7d2d36098462018-07-10 13:19:241501 days 10 hrs ago0xa6bc274e03b86ffafdef5ed76e534752e7d9e8be IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.001083022
0x06cd3d11f3c30f512066ea304b3b5ed90a455c1dfe1bef338564f0ad0cc5c0f50xf4ff7d2d36098382018-07-10 13:17:041501 days 10 hrs ago0xa6bc274e03b86ffafdef5ed76e534752e7d9e8be IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.001352332
0x9f4cae801d835fb1ea476b6d0e24277ca3090618a88386c1b661e771a310f2f70xb3f73c4036097732018-07-10 12:58:491501 days 10 hrs ago0xa6bc274e03b86ffafdef5ed76e534752e7d9e8be IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.001384785
0x998532545b6094de3cb99428d4106d846bdc10d6e428217954f9a0084f17364d0x8fbbe7a236097602018-07-10 12:55:551501 days 10 hrs ago0xa6bc274e03b86ffafdef5ed76e534752e7d9e8be IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.000524491
0xc9068aa97d8fb375432537c1bd7c7c83984ea13f6b97e7fe20789f91fefea37d0x92a9fe8b36060772018-07-09 23:56:541501 days 23 hrs ago0x618e2323b8ce49b66c00a6d2a7c59ed470c07272 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.000540285
0x5da6cce16136a6ece94b73e5c39e4a340c97165b2e82a6746f5dd890c7f601410xe7246aa336059132018-07-09 23:19:111502 days 28 mins ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.00070115
0xec8341137edcd308415c838f109d1b0397e64df214771ae697469a7964660e300xb3f73c4036058652018-07-09 23:08:561502 days 38 mins ago0x186eb75122e555d22181b5f1262ff847a4d27f7d IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.002728975
0x3eb6c7c71358be80f24764b2325fd81bdb68104a4eabfb266eb714312cc1f5e00xb3f73c4036058572018-07-09 23:06:531502 days 40 mins ago0x186eb75122e555d22181b5f1262ff847a4d27f7d IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.002999765
0x26234b17c159b7bb39e1fb2fca57171ea483dbec6390f763c2b72eaf606cdb030xb3f73c4036058562018-07-09 23:06:201502 days 40 mins ago0x618e2323b8ce49b66c00a6d2a7c59ed470c07272 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.002229025
0x7a7dd17e52519023ba830eac1d627a0bee3e9d3eb6c821e619b6b2a31dd15d520x3076973636057802018-07-09 22:50:221502 days 56 mins ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.000942231
0xf254952f621e3d335c50580dd3881933b5dd39de1c5d84f75d4e2106f7898e820xf4ff7d2d35952292018-07-08 17:06:531503 days 6 hrs ago0xc7b8aac56d4d3a5d39a08d17ad6029cd72e7840d IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.000471962
0x2fe1ef85e164a07f3c0087489d20a25b1b5fbb5168f41aef4550cb13c04a3fca0x8fbbe7a235951322018-07-08 16:43:051503 days 7 hrs ago0xc7b8aac56d4d3a5d39a08d17ad6029cd72e7840d IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.000852951
0x3fada5ae9d5c441d4e432533f6c9105dc517a41f30183b159a494e911ef47aa90x8fbbe7a235951262018-07-08 16:41:411503 days 7 hrs ago0xc7b8aac56d4d3a5d39a08d17ad6029cd72e7840d IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.00086761
0x428d923fb40ae8af458dab05cb54914a8f29cf8124be51b8b852e8b800dce3da0xb3f73c4035898762018-07-07 21:44:091504 days 2 hrs ago0x618e2323b8ce49b66c00a6d2a7c59ed470c07272 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.003143275
0x71b5475a20169c1c906b89356ecc4c53f28d9f4f7d9b778050ccd7710a8b15b30x60056cf935898382018-07-07 21:35:461504 days 2 hrs ago0x618e2323b8ce49b66c00a6d2a7c59ed470c07272 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.001615045
0x01f822903f49ac3d73a31947d26be0bdf20cbe548b3aa41358cc0ce2ef58e7510x52cccdb335898242018-07-07 21:32:311504 days 2 hrs ago0x618e2323b8ce49b66c00a6d2a7c59ed470c07272 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.000458345
0x56d0be199ff807ce5122889f33c828caf32935927346fcc95330e4ff8966b7070xe7246aa335898182018-07-07 21:31:301504 days 2 hrs ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.00070285
0x5fa69d8eca1dbfafc256f77300484bb098d7e5e3a1d39e1ba441c80857e7c6970xe7246aa335898142018-07-07 21:30:351504 days 2 hrs ago0x9bffd1579bd6760a186fff1a720f2a5db35de0f4 IN  0x32dd9802b83aec762a38e0d3738549bfe5660b300 Ether0.00070115
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x245683f41849778f8403950e7679cd66a50214af43a46d989e6fbf68d8e90bed36109922018-07-10 20:11:311501 days 3 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b300x00000000000000000000000000000000000000000 Ether
0x786609ade637d17d9f340bd52cc613672368a9d5f1f0fa5730b0ac7b71535bdc36109912018-07-10 20:10:111501 days 3 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b300x00000000000000000000000000000000000000000 Ether
0x2aa5675ca4f289dd7a6abe2a6c99f61d2ae5bbe2cc157fc1b98437d0d04b34d236109912018-07-10 20:10:111501 days 3 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b300x00000000000000000000000000000000000000000 Ether
0x1fb437f18e819edf16f166e44fb1cc684ca3843016b27f938eda9ca9348925b036109912018-07-10 20:10:111501 days 3 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b300x00000000000000000000000000000000000000000 Ether
0x0c02a3e3c4e1efdac8d2239b9fe3f8ee83c36f64a0317353e0323be66b4f3b3136109892018-07-10 20:09:201501 days 3 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b300x00000000000000000000000000000000000000000 Ether
0x3ea99d60db3ce2d01a921b2c984edbd3cedad8df2c748f92976ded556c07649636104092018-07-10 15:20:161501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xf2d4bc521de8b4470ce2d591b4f0aa30ddee06840 Ether
0x3ea99d60db3ce2d01a921b2c984edbd3cedad8df2c748f92976ded556c07649636104092018-07-10 15:20:161501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xc778417e063141139fce010982780140aa0cd5ab0 Ether
0x3ea99d60db3ce2d01a921b2c984edbd3cedad8df2c748f92976ded556c07649636104092018-07-10 15:20:161501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xf2d4bc521de8b4470ce2d591b4f0aa30ddee06840 Ether
0x3ea99d60db3ce2d01a921b2c984edbd3cedad8df2c748f92976ded556c07649636104092018-07-10 15:20:161501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x035325907c43a71fc7c9b46c20a8324a095b80780 Ether
0x3ea99d60db3ce2d01a921b2c984edbd3cedad8df2c748f92976ded556c07649636104092018-07-10 15:20:161501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xc778417e063141139fce010982780140aa0cd5ab0 Ether
0x3ea99d60db3ce2d01a921b2c984edbd3cedad8df2c748f92976ded556c07649636104092018-07-10 15:20:161501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xf2d4bc521de8b4470ce2d591b4f0aa30ddee06840 Ether
0x3ea99d60db3ce2d01a921b2c984edbd3cedad8df2c748f92976ded556c07649636104092018-07-10 15:20:161501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xf5991106bc66896efae41f77920ea756517e98080 Ether
0x4e73ed004582e118b5094368d32111295712a1a43aad6d68185dcd75291d9cb936104002018-07-10 15:17:581501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xf2d4bc521de8b4470ce2d591b4f0aa30ddee06840 Ether
0x4e73ed004582e118b5094368d32111295712a1a43aad6d68185dcd75291d9cb936104002018-07-10 15:17:581501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x035325907c43a71fc7c9b46c20a8324a095b80780 Ether
0x4e73ed004582e118b5094368d32111295712a1a43aad6d68185dcd75291d9cb936104002018-07-10 15:17:581501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x035325907c43a71fc7c9b46c20a8324a095b80780 Ether
0x4e73ed004582e118b5094368d32111295712a1a43aad6d68185dcd75291d9cb936104002018-07-10 15:17:581501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x035325907c43a71fc7c9b46c20a8324a095b80780 Ether
0x4e73ed004582e118b5094368d32111295712a1a43aad6d68185dcd75291d9cb936104002018-07-10 15:17:581501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xf2d4bc521de8b4470ce2d591b4f0aa30ddee06840 Ether
0x4e73ed004582e118b5094368d32111295712a1a43aad6d68185dcd75291d9cb936104002018-07-10 15:17:581501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xa7ec20743e9eb544655215debb0ec3349de843f50 Ether
0x4e73ed004582e118b5094368d32111295712a1a43aad6d68185dcd75291d9cb936104002018-07-10 15:17:581501 days 8 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x5a5fcb13ea24c56027978f954d291a4ebfce91880 Ether
0xde85683872c8e5ac4dd8a033e970cd0bb032e952f7106b5f420ccf94a0b7cc2f36098462018-07-10 13:19:241501 days 10 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xf2d4bc521de8b4470ce2d591b4f0aa30ddee06840 Ether
0xde85683872c8e5ac4dd8a033e970cd0bb032e952f7106b5f420ccf94a0b7cc2f36098462018-07-10 13:19:241501 days 10 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x035325907c43a71fc7c9b46c20a8324a095b80780 Ether
0xde85683872c8e5ac4dd8a033e970cd0bb032e952f7106b5f420ccf94a0b7cc2f36098462018-07-10 13:19:241501 days 10 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x035325907c43a71fc7c9b46c20a8324a095b80780 Ether
0xde85683872c8e5ac4dd8a033e970cd0bb032e952f7106b5f420ccf94a0b7cc2f36098462018-07-10 13:19:241501 days 10 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0xf2d4bc521de8b4470ce2d591b4f0aa30ddee06840 Ether
0xde85683872c8e5ac4dd8a033e970cd0bb032e952f7106b5f420ccf94a0b7cc2f36098462018-07-10 13:19:241501 days 10 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x035325907c43a71fc7c9b46c20a8324a095b80780 Ether
0xde85683872c8e5ac4dd8a033e970cd0bb032e952f7106b5f420ccf94a0b7cc2f36098462018-07-10 13:19:241501 days 10 hrs ago 0x32dd9802b83aec762a38e0d3738549bfe5660b30 0x035325907c43a71fc7c9b46c20a8324a095b80780 Ether
[ Download CSV Export 
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
B0xProxy

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes with 200 runs

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

pragma solidity ^0.4.24;

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

}

contract Debugger {
    
    bool public DEBUG_MODE = false;
    
    event DebugLine(uint lineNumber);

    function voidOrRevert(uint lineno)
        internal
    {
        if (!DEBUG_MODE) {
            revert();
        }

        emit DebugLine(lineno);
        return;
    }
    
    function intOrRevert(uint retVal, uint lineno)
        internal 
        returns (uint)
    {
        if (!DEBUG_MODE) {
            revert();
        }

        emit DebugLine(lineno);
        return retVal;
    }

    function boolOrRevert(bool retVal, uint lineno)
        internal 
        returns (bool)
    {
        if (!DEBUG_MODE) {
            revert();
        }

        emit DebugLine(lineno);
        return retVal;
    }
}

contract GasTracker {

    uint internal gasUsed;

    modifier tracksGas() {
        gasUsed = gasleft();

        _; // modified function body inserted here

        gasUsed = 0; // zero out the storage so we don't persist anything
    }
}

contract B0xObjects {

    struct LoanOrder {
        address maker;
        address loanTokenAddress;
        address interestTokenAddress;
        address collateralTokenAddress;
        address feeRecipientAddress;
        address oracleAddress;
        uint loanTokenAmount;
        uint interestAmount;
        uint initialMarginAmount;
        uint maintenanceMarginAmount;
        uint lenderRelayFee;
        uint traderRelayFee;
        uint expirationUnixTimestampSec;
        bytes32 loanOrderHash;
    }

    struct LoanRef {
        bytes32 loanOrderHash;
        address trader;
    }

    struct LoanPosition {
        address lender;
        address trader;
        address collateralTokenAddressFilled;
        address positionTokenAddressFilled;
        uint loanTokenAmountFilled;
        uint collateralTokenAmountFilled;
        uint positionTokenAmountFilled;
        uint loanStartUnixTimestampSec;
        uint index;
        bool active;
    }

    struct InterestData {
        address lender;
        address interestTokenAddress;
        uint interestTotalAccrued;
        uint interestPaidSoFar;
    }


    event LogLoanTaken (
        address lender,
        address trader,
        address collateralTokenAddressFilled,
        address positionTokenAddressFilled,
        uint loanTokenAmountFilled,
        uint collateralTokenAmountFilled,
        uint positionTokenAmountFilled,
        uint loanStartUnixTimestampSec,
        bool active,
        bytes32 loanOrderHash
    );

    event LogLoanCancelled(
        address maker,
        uint cancelLoanTokenAmount,
        uint remainingLoanTokenAmount,
        bytes32 loanOrderHash
    );

    event LogLoanClosed(
        address lender,
        address trader,
        bool isLiquidation,
        bytes32 loanOrderHash
    );

    event LogPositionTraded(
        bytes32 loanOrderHash,
        address trader,
        address sourceTokenAddress,
        address destTokenAddress,
        uint sourceTokenAmount,
        uint destTokenAmount
    );

    event LogMarginLevels(
        bytes32 loanOrderHash,
        address trader,
        uint initialMarginAmount,
        uint maintenanceMarginAmount,
        uint currentMarginAmount
    );

    event LogWithdrawProfit(
        bytes32 loanOrderHash,
        address trader,
        uint profitWithdrawn,
        uint remainingPosition
    );

    event LogPayInterest(
        bytes32 loanOrderHash,
        address lender,
        address trader,
        uint amountPaid,
        uint totalAccrued
    );

    function buildLoanOrderStruct(
        bytes32 loanOrderHash,
        address[6] addrs,
        uint[9] uints) 
        internal
        pure
        returns (LoanOrder) {

        return LoanOrder({
            maker: addrs[0],
            loanTokenAddress: addrs[1],
            interestTokenAddress: addrs[2],
            collateralTokenAddress: addrs[3],
            feeRecipientAddress: addrs[4],
            oracleAddress: addrs[5],
            loanTokenAmount: uints[0],
            interestAmount: uints[1],
            initialMarginAmount: uints[2],
            maintenanceMarginAmount: uints[3],
            lenderRelayFee: uints[4],
            traderRelayFee: uints[5],
            expirationUnixTimestampSec: uints[6],
            loanOrderHash: loanOrderHash
        });
    }
}

contract B0xStorage is B0xObjects, ReentrancyGuard, Ownable, GasTracker, Debugger {
    uint constant MAX_UINT = 2**256 - 1;

    address public B0X_TOKEN_CONTRACT;
    address public VAULT_CONTRACT;
    address public ORACLE_REGISTRY_CONTRACT;
    address public B0XTO0X_CONTRACT;

    mapping (bytes32 => LoanOrder) public orders; // mapping of loanOrderHash to taken loanOrders
    mapping (address => bytes32[]) public orderList; // mapping of lenders and trader addresses to array of loanOrderHashes
    mapping (bytes32 => address) public orderLender; // mapping of loanOrderHash to lender address
    mapping (bytes32 => address[]) public orderTraders; // mapping of loanOrderHash to array of trader addresses
    mapping (bytes32 => uint) public orderFilledAmounts; // mapping of loanOrderHash to loanTokenAmount filled
    mapping (bytes32 => uint) public orderCancelledAmounts; // mapping of loanOrderHash to loanTokenAmount cancelled
    mapping (bytes32 => mapping (address => LoanPosition)) public loanPositions; // mapping of loanOrderHash to mapping of traders to loanPositions
    mapping (bytes32 => mapping (address => uint)) public interestPaid; // mapping of loanOrderHash to mapping of traders to amount of interest paid so far to a lender

    LoanRef[] loanList; // array of loans that need to be checked for liquidation or expiration
}

contract Proxiable {
    mapping (bytes4 => address) public targets;

    function initialize(address _target) public;

    function _replaceContract(address _target) internal {
        require(_target.delegatecall(bytes4(keccak256("initialize(address)")), _target));
    }
}

contract B0xProxy is B0xStorage, Proxiable {

    function initialize(
        address)
        public
    {
        revert();
    }

    function() public {
        address target = targets[msg.sig];
        bytes memory data = msg.data;
        assembly {
            let result := delegatecall(gas, target, add(data, 0x20), mload(data), 0, 0)
            let size := returndatasize
            let ptr := mload(0x40)
            returndatacopy(ptr, 0, size)
            switch result
            case 0 { revert(ptr, size) }
            default { return(ptr, size) }
        }
    }

    /*
     * Owner only functions
     */

    function replaceContract(
        address _target)
        public
        onlyOwner
    {
        _replaceContract(_target);
    }

    function setTarget(
        string _funcId,  // example: "takeLoanOrderAsTrader(address[6],uint256[9],address,uint256,bytes)"
        address _target) // logic contract address
        public
        onlyOwner
        returns(bytes4)
    {
        bytes4 f = bytes4(keccak256(abi.encodePacked(_funcId)));
        targets[f] = _target;
        return f;
    }

    function setB0xAddresses(
        address _b0xToken,
        address _vault,
        address _oracleregistry,
        address _exchange0xWrapper) 
        public
        onlyOwner
    {
        if (_b0xToken != address(0) && _vault != address(0) && _oracleregistry != address(0) && _exchange0xWrapper != address(0))
        B0X_TOKEN_CONTRACT = _b0xToken;
        VAULT_CONTRACT = _vault;
        ORACLE_REGISTRY_CONTRACT = _oracleregistry;
        B0XTO0X_CONTRACT = _exchange0xWrapper;
    }

    function setDebugMode (
        bool _debug)
        public
        onlyOwner
    {
        if (DEBUG_MODE != _debug)
            DEBUG_MODE = _debug;
    }

    function setB0xToken (
        address _token)
        public
        onlyOwner
    {
        if (_token != address(0))
            B0X_TOKEN_CONTRACT = _token;
    }

    function setVault (
        address _vault)
        public
        onlyOwner
    {
        if (_vault != address(0))
            VAULT_CONTRACT = _vault;
    }

    function setOracleRegistry (
        address _registry)
        public
        onlyOwner
    {
        if (_registry != address(0))
            ORACLE_REGISTRY_CONTRACT = _registry;
    }

    function set0xExchangeWrapper (
        address _wrapper)
        public
        onlyOwner
    {
        if (_wrapper != address(0))
            B0XTO0X_CONTRACT = _wrapper;
    }

    /*
     * View functions
     */

    function getTarget(
        string _funcId) // example: "takeLoanOrderAsTrader(address[6],uint256[9],address,uint256,bytes)"
        public
        view
        returns (address)
    {
        return targets[bytes4(keccak256(abi.encodePacked(_funcId)))];
    }
}

Contract ABI

[{"constant":true,"inputs":[],"name":"ORACLE_REGISTRY_CONTRACT","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"orderLender","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes4"}],"name":"targets","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"B0X_TOKEN_CONTRACT","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"uint256"}],"name":"orderTraders","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"address"}],"name":"loanPositions","outputs":[{"name":"lender","type":"address"},{"name":"trader","type":"address"},{"name":"collateralTokenAddressFilled","type":"address"},{"name":"positionTokenAddressFilled","type":"address"},{"name":"loanTokenAmountFilled","type":"uint256"},{"name":"collateralTokenAmountFilled","type":"uint256"},{"name":"positionTokenAmountFilled","type":"uint256"},{"name":"loanStartUnixTimestampSec","type":"uint256"},{"name":"index","type":"uint256"},{"name":"active","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_wrapper","type":"address"}],"name":"set0xExchangeWrapper","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_vault","type":"address"}],"name":"setVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"setOracleRegistry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"DEBUG_MODE","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_debug","type":"bool"}],"name":"setDebugMode","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"orders","outputs":[{"name":"maker","type":"address"},{"name":"loanTokenAddress","type":"address"},{"name":"interestTokenAddress","type":"address"},{"name":"collateralTokenAddress","type":"address"},{"name":"feeRecipientAddress","type":"address"},{"name":"oracleAddress","type":"address"},{"name":"loanTokenAmount","type":"uint256"},{"name":"interestAmount","type":"uint256"},{"name":"initialMarginAmount","type":"uint256"},{"name":"maintenanceMarginAmount","type":"uint256"},{"name":"lenderRelayFee","type":"uint256"},{"name":"traderRelayFee","type":"uint256"},{"name":"expirationUnixTimestampSec","type":"uint256"},{"name":"loanOrderHash","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"address"}],"name":"interestPaid","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"setB0xToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_funcId","type":"string"},{"name":"_target","type":"address"}],"name":"setTarget","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"orderFilledAmounts","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"B0XTO0X_CONTRACT","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_b0xToken","type":"address"},{"name":"_vault","type":"address"},{"name":"_oracleregistry","type":"address"},{"name":"_exchange0xWrapper","type":"address"}],"name":"setB0xAddresses","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"orderCancelledAmounts","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_funcId","type":"string"}],"name":"getTarget","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"orderList","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"VAULT_CONTRACT","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_target","type":"address"}],"name":"replaceContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"lineNumber","type":"uint256"}],"name":"DebugLine","type":"event"},{"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"},{"anonymous":false,"inputs":[{"indexed":false,"name":"lender","type":"address"},{"indexed":false,"name":"trader","type":"address"},{"indexed":false,"name":"collateralTokenAddressFilled","type":"address"},{"indexed":false,"name":"positionTokenAddressFilled","type":"address"},{"indexed":false,"name":"loanTokenAmountFilled","type":"uint256"},{"indexed":false,"name":"collateralTokenAmountFilled","type":"uint256"},{"indexed":false,"name":"positionTokenAmountFilled","type":"uint256"},{"indexed":false,"name":"loanStartUnixTimestampSec","type":"uint256"},{"indexed":false,"name":"active","type":"bool"},{"indexed":false,"name":"loanOrderHash","type":"bytes32"}],"name":"LogLoanTaken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"maker","type":"address"},{"indexed":false,"name":"cancelLoanTokenAmount","type":"uint256"},{"indexed":false,"name":"remainingLoanTokenAmount","type":"uint256"},{"indexed":false,"name":"loanOrderHash","type":"bytes32"}],"name":"LogLoanCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"lender","type":"address"},{"indexed":false,"name":"trader","type":"address"},{"indexed":false,"name":"isLiquidation","type":"bool"},{"indexed":false,"name":"loanOrderHash","type":"bytes32"}],"name":"LogLoanClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"loanOrderHash","type":"bytes32"},{"indexed":false,"name":"trader","type":"address"},{"indexed":false,"name":"sourceTokenAddress","type":"address"},{"indexed":false,"name":"destTokenAddress","type":"address"},{"indexed":false,"name":"sourceTokenAmount","type":"uint256"},{"indexed":false,"name":"destTokenAmount","type":"uint256"}],"name":"LogPositionTraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"loanOrderHash","type":"bytes32"},{"indexed":false,"name":"trader","type":"address"},{"indexed":false,"name":"initialMarginAmount","type":"uint256"},{"indexed":false,"name":"maintenanceMarginAmount","type":"uint256"},{"indexed":false,"name":"currentMarginAmount","type":"uint256"}],"name":"LogMarginLevels","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"loanOrderHash","type":"bytes32"},{"indexed":false,"name":"trader","type":"address"},{"indexed":false,"name":"profitWithdrawn","type":"uint256"},{"indexed":false,"name":"remainingPosition","type":"uint256"}],"name":"LogWithdrawProfit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"loanOrderHash","type":"bytes32"},{"indexed":false,"name":"lender","type":"address"},{"indexed":false,"name":"trader","type":"address"},{"indexed":false,"name":"amountPaid","type":"uint256"},{"indexed":false,"name":"totalAccrued","type":"uint256"}],"name":"LogPayInterest","type":"event"}]

6080604052600080546002805460ff191690553361010002600160a860020a0319909116179055610fe4806100356000396000f3006080604052600436106101445763ffffffff60e060020a60003504166243333781146101d0578063093983bd1461020157806316a6bff6146102195780631d1742e11461023b5780631df04b721461025057806335dc7c381461026b57806350e4b069146102f15780636817031b14610314578063715018a6146103355780638165354e1461034a5780638638aa651461036b5780638811e191146103945780638da5cb5b146103ae5780639c3f1e90146103c3578063a812d41c146104c0578063a9974338146104f6578063c11296fc14610517578063c4d66de814610598578063cce37f3e146105b9578063d394b6c9146105d1578063d4eb4186146105e6578063d9fd734114610619578063da1b620b14610631578063f2fde38b1461068a578063f4fb9b2f146106ab578063f589f106146106cf578063fb08fdaa146106e4575b34801561015057600080fd5b5060008035600160e060020a0319168152600f6020908152604080832054815136601f8101859004850282018501909352828152600160a060020a039091169360609391929091819084018382808284378201915050505050509050600080825160208401855af43d604051816000823e8280156101cc578282f35b8282fd5b3480156101dc57600080fd5b506101e5610705565b60408051600160a060020a039092168252519081900360200190f35b34801561020d57600080fd5b506101e5600435610714565b34801561022557600080fd5b506101e5600160e060020a03196004351661072f565b34801561024757600080fd5b506101e561074a565b34801561025c57600080fd5b506101e560043560243561075e565b34801561027757600080fd5b5061028f600435600160a060020a0360243516610795565b60408051600160a060020a039b8c168152998b1660208b0152978a1689890152959098166060880152608087019390935260a086019190915260c085015260e08401526101008301939093529115156101208201529051908190036101400190f35b3480156102fd57600080fd5b50610312600160a060020a0360043516610805565b005b34801561032057600080fd5b50610312600160a060020a036004351661085c565b34801561034157600080fd5b506103126108b4565b34801561035657600080fd5b50610312600160a060020a036004351661092a565b34801561037757600080fd5b50610380610982565b604080519115158252519081900360200190f35b3480156103a057600080fd5b50610312600435151561098b565b3480156103ba57600080fd5b506101e56109ca565b3480156103cf57600080fd5b506103db6004356109de565b604051808f600160a060020a0316600160a060020a031681526020018e600160a060020a0316600160a060020a031681526020018d600160a060020a0316600160a060020a031681526020018c600160a060020a0316600160a060020a031681526020018b600160a060020a0316600160a060020a031681526020018a600160a060020a0316600160a060020a0316815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182600019166000191681526020019e50505050505050505050505050505060405180910390f35b3480156104cc57600080fd5b506104e4600435600160a060020a0360243516610a62565b60408051918252519081900360200190f35b34801561050257600080fd5b50610312600160a060020a0360043516610a7f565b34801561052357600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261057b94369492936024939284019190819084018382808284375094975050509235600160a060020a03169350610adc92505050565b60408051600160e060020a03199092168252519081900360200190f35b3480156105a457600080fd5b50610312600160a060020a0360043516610c07565b3480156105c557600080fd5b506104e4600435610c0c565b3480156105dd57600080fd5b506101e5610c1e565b3480156105f257600080fd5b50610312600160a060020a0360043581169060243581169060443581169060643516610c2d565b34801561062557600080fd5b506104e4600435610d11565b34801561063d57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101e5943694929360249392840191908190840183828082843750949750610d239650505050505050565b34801561069657600080fd5b50610312600160a060020a0360043516610e13565b3480156106b757600080fd5b506104e4600160a060020a0360043516602435610e38565b3480156106db57600080fd5b506101e5610e68565b3480156106f057600080fd5b50610312600160a060020a0360043516610e77565b600454600160a060020a031681565b600860205260009081526040902054600160a060020a031681565b600f60205260009081526040902054600160a060020a031681565b6002546101009004600160a060020a031681565b60096020528160005260406000208181548110151561077957fe5b600091825260209091200154600160a060020a03169150829050565b600c6020908152600092835260408084209091529082529020805460018201546002830154600384015460048501546005860154600687015460078801546008890154600990990154600160a060020a039889169997891698968716979590961695939492939192909160ff168a565b6000546101009004600160a060020a0316331461082157600080fd5b600160a060020a03811615610859576005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000546101009004600160a060020a0316331461087857600080fd5b600160a060020a038116156108595760038054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b6000546101009004600160a060020a031633146108d057600080fd5b60008054604051610100909104600160a060020a0316917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805474ffffffffffffffffffffffffffffffffffffffff0019169055565b6000546101009004600160a060020a0316331461094657600080fd5b600160a060020a038116156108595760048054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b60025460ff1681565b6000546101009004600160a060020a031633146109a757600080fd5b60025460ff16151581151514610859576002805482151560ff1990911617905550565b6000546101009004600160a060020a031681565b600660208190526000918252604090912080546001820154600283015460038401546004850154600586015496860154600787015460088801546009890154600a8a0154600b8b0154600c8c0154600d909c0154600160a060020a039b8c169d9a8c169c998c169b9889169a9789169997909816979596949593949293919290918e565b600d60209081526000928352604080842090915290825290205481565b6000546101009004600160a060020a03163314610a9b57600080fd5b600160a060020a038116156108595760028054600160a060020a0383166101000274ffffffffffffffffffffffffffffffffffffffff001990911617905550565b6000805481906101009004600160a060020a03163314610afb57600080fd5b836040516020018082805190602001908083835b60208310610b2e5780518252601f199092019160209182019101610b0f565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310610b915780518252601f199092019160209182019101610b72565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120600160e060020a031981166000908152600f909252929020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0398909816979097179096559695505050505050565b600080fd5b600a6020526000908152604090205481565b600554600160a060020a031681565b6000546101009004600160a060020a03163314610c4957600080fd5b600160a060020a03841615801590610c695750600160a060020a03831615155b8015610c7d5750600160a060020a03821615155b8015610c915750600160a060020a03811615155b15610cc4576002805474ffffffffffffffffffffffffffffffffffffffff001916610100600160a060020a038716021790555b60038054600160a060020a0394851673ffffffffffffffffffffffffffffffffffffffff199182161790915560048054938516938216939093179092556005805491909316911617905550565b600b6020526000908152604090205481565b6000600f6000836040516020018082805190602001908083835b60208310610d5c5780518252601f199092019160209182019101610d3d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310610dbf5780518252601f199092019160209182019101610da0565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120600160e060020a03191686528501959095529290920160002054600160a060020a031695945050505050565b6000546101009004600160a060020a03163314610e2f57600080fd5b61085981610e9c565b600760205281600052604060002081815481101515610e5357fe5b90600052602060002001600091509150505481565b600354600160a060020a031681565b6000546101009004600160a060020a03163314610e9357600080fd5b61085981610f24565b600160a060020a0381161515610eb157600080fd5b60008054604051600160a060020a038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b80600160a060020a031660405180807f696e697469616c697a65286164647265737329000000000000000000000000008152506013019050604051809103902060e060020a9004826040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381865af492505050151561085957600080fd00a165627a7a72305820c407343caf4457c2ed165cc57950705d45724e6b043fa03609884996c07704d30029

Swarm Source

bzzr://c407343caf4457c2ed165cc57950705d45724e6b043fa03609884996c07704d3
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading

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.