Latest 15 txns

TxHash Age From To Value [TxFee]
0x2c883fb7f1d49768508f0f46d9b84375a9346b36f943c4fa9d64476d14ebc1c096 days 14 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.000093793
0xfec16bd38ed6750938990ff8630fe733f32886e953ff5e1363adb0b83fbf891b99 days 4 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.000093793
0x3d0ad78ebec8a2390c4d3ce7d3d80a3bbc1f34da64cce3f1012e274ba7f6f10f99 days 4 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001408815
0xc0300477e2b8dd408cf06d144b5c344e827b93e5422a8bbf1ab3c4841bbd814299 days 4 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001408815
0xe8cee64c391c0417128193702cdc9267b23c17caeb9c842d8e44033c22ce2d3799 days 4 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001408815
0x432571566c0e3584f7231062337e93beb2867baf94b04e7f5927e6e9868c7fb599 days 4 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001406895
0x273d0b511535262490c46788aa8f54a8f3a404ebde5251fbc68ba8d7895c3c1299 days 4 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001404015
0x2a3399901697787d931e09a57ae4003debbf507387b71e2cdd487e2b058ba92899 days 5 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001407855
0x6a761101ef5d4dfc343c03616878cb208f62e37f0f2b10d5609a0b353aee15d499 days 5 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001406895
0x80d03579d5dee31a80f633d343f083b631f503e3a360b59f4e3103b5e43465a099 days 5 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001408815
0x7a6b403247d539b07516fa799952b3137ffff30d58cb87b34f356d4e89c5d41a99 days 5 hrs ago0x2bc8a15c1f261a484d69fe093f15fa0646e5b3c3  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.0001408815
0xb9affc3aa3d61aca12092fc230e85b05ccd3282b42fa6e9a9a94231ffb4a65db101 days 5 hrs ago0x7c07d32e18d6495efdc487a32f8d20dafba53a5e  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.000604202
0xcc97762e0403cce1a615c9d6479a900d2bbbcee7c957c40f10807f1a6beaddfe101 days 5 hrs ago0x7c07d32e18d6495efdc487a32f8d20dafba53a5e  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.000533677
0xe067f822c0d12328972692cb5c9d0b723b72f41b86f729ea7d2be78fdda7c26e101 days 6 hrs ago0x3eb74f5e771c9760168d5968faf7369a7b4fcc15  IN   0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0 Ether0.000589138
0x05641e51cabf140f77b3ae243eece3c36f12a321f0e5c62cb035d82b6cdffab5101 days 7 hrs ago0x001d51cdc8f4b378e136642ddb95dfc4ff6a4b72  IN    Contract Creation0 Ether0.002337326
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click here To View More View All
ParentTxHash Block Age From To Value
0x2c883fb7f1d49768508f0f46d9b84375a9346b36f943c4fa9d64476d14ebc1c0942158296 days 14 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
0x2c883fb7f1d49768508f0f46d9b84375a9346b36f943c4fa9d64476d14ebc1c0942158296 days 14 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xe1ccba52a8f7c4885ef10b10c3ba438072bd96e10 Ether
0x2c883fb7f1d49768508f0f46d9b84375a9346b36f943c4fa9d64476d14ebc1c0942158296 days 14 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0x49d35dd866ed2ea011e2797fcce0bf321d086cf10 Ether
0xfec16bd38ed6750938990ff8630fe733f32886e953ff5e1363adb0b83fbf891b939697099 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
0xfec16bd38ed6750938990ff8630fe733f32886e953ff5e1363adb0b83fbf891b939697099 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xe1ccba52a8f7c4885ef10b10c3ba438072bd96e10 Ether
0xfec16bd38ed6750938990ff8630fe733f32886e953ff5e1363adb0b83fbf891b939697099 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0x49d35dd866ed2ea011e2797fcce0bf321d086cf10 Ether
0x3d0ad78ebec8a2390c4d3ce7d3d80a3bbc1f34da64cce3f1012e274ba7f6f10f939685999 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
0x3d0ad78ebec8a2390c4d3ce7d3d80a3bbc1f34da64cce3f1012e274ba7f6f10f939685999 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xe1ccba52a8f7c4885ef10b10c3ba438072bd96e10 Ether
0x3d0ad78ebec8a2390c4d3ce7d3d80a3bbc1f34da64cce3f1012e274ba7f6f10f939685999 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0x49d35dd866ed2ea011e2797fcce0bf321d086cf10 Ether
0xc0300477e2b8dd408cf06d144b5c344e827b93e5422a8bbf1ab3c4841bbd8142939682499 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
0xc0300477e2b8dd408cf06d144b5c344e827b93e5422a8bbf1ab3c4841bbd8142939682499 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xe1ccba52a8f7c4885ef10b10c3ba438072bd96e10 Ether
0xc0300477e2b8dd408cf06d144b5c344e827b93e5422a8bbf1ab3c4841bbd8142939682499 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0x49d35dd866ed2ea011e2797fcce0bf321d086cf10 Ether
0xe8cee64c391c0417128193702cdc9267b23c17caeb9c842d8e44033c22ce2d37939676699 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
0xe8cee64c391c0417128193702cdc9267b23c17caeb9c842d8e44033c22ce2d37939676699 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xe1ccba52a8f7c4885ef10b10c3ba438072bd96e10 Ether
0xe8cee64c391c0417128193702cdc9267b23c17caeb9c842d8e44033c22ce2d37939676699 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0x49d35dd866ed2ea011e2797fcce0bf321d086cf10 Ether
0x432571566c0e3584f7231062337e93beb2867baf94b04e7f5927e6e9868c7fb5939665699 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
0x432571566c0e3584f7231062337e93beb2867baf94b04e7f5927e6e9868c7fb5939665699 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xe1ccba52a8f7c4885ef10b10c3ba438072bd96e10 Ether
0x432571566c0e3584f7231062337e93beb2867baf94b04e7f5927e6e9868c7fb5939665699 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0x49d35dd866ed2ea011e2797fcce0bf321d086cf10 Ether
0x273d0b511535262490c46788aa8f54a8f3a404ebde5251fbc68ba8d7895c3c12939662599 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
0x273d0b511535262490c46788aa8f54a8f3a404ebde5251fbc68ba8d7895c3c12939662599 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xe1ccba52a8f7c4885ef10b10c3ba438072bd96e10 Ether
0x273d0b511535262490c46788aa8f54a8f3a404ebde5251fbc68ba8d7895c3c12939662599 days 4 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0x49d35dd866ed2ea011e2797fcce0bf321d086cf10 Ether
0x2a3399901697787d931e09a57ae4003debbf507387b71e2cdd487e2b058ba928939659399 days 5 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
0x2a3399901697787d931e09a57ae4003debbf507387b71e2cdd487e2b058ba928939659399 days 5 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xe1ccba52a8f7c4885ef10b10c3ba438072bd96e10 Ether
0x2a3399901697787d931e09a57ae4003debbf507387b71e2cdd487e2b058ba928939659399 days 5 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0x49d35dd866ed2ea011e2797fcce0bf321d086cf10 Ether
0x6a761101ef5d4dfc343c03616878cb208f62e37f0f2b10d5609a0b353aee15d4939656099 days 5 hrs ago0xd6f542718fbace4d1e9d11ed2e10fd3c73b2495b0xd5ca3dec1f3155e2c182299afa2413ac1a9f35300 Ether
[ Download CSV Export  ] 
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: LTVCreditorProxy
Compiler Version: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;

contract CollateralizerInterface {

	function unpackCollateralParametersFromBytes(
		bytes32 parameters
	) public pure returns (uint, uint, uint);

}
contract DebtKernelInterface {

	enum Errors {
		// Debt has been already been issued
		DEBT_ISSUED,
		// Order has already expired
		ORDER_EXPIRED,
		// Debt issuance associated with order has been cancelled
		ISSUANCE_CANCELLED,
		// Order has been cancelled
		ORDER_CANCELLED,
		// Order parameters specify amount of creditor / debtor fees
		// that is not equivalent to the amount of underwriter / relayer fees
		ORDER_INVALID_INSUFFICIENT_OR_EXCESSIVE_FEES,
		// Order parameters specify insufficient principal amount for
		// debtor to at least be able to meet his fees
		ORDER_INVALID_INSUFFICIENT_PRINCIPAL,
		// Order parameters specify non zero fee for an unspecified recipient
		ORDER_INVALID_UNSPECIFIED_FEE_RECIPIENT,
		// Order signatures are mismatched / malformed
		ORDER_INVALID_NON_CONSENSUAL,
		// Insufficient balance or allowance for principal token transfer
		CREDITOR_BALANCE_OR_ALLOWANCE_INSUFFICIENT
	}

	// solhint-disable-next-line var-name-mixedcase
	address public TOKEN_TRANSFER_PROXY;
	bytes32 constant public NULL_ISSUANCE_HASH = bytes32(0);

	/* NOTE(kayvon): Currently, the `view` keyword does not actually enforce the
	static nature of the method; this will change in the future, but for now, in
	order to prevent reentrancy we'll need to arbitrarily set an upper bound on
	the gas limit allotted for certain method calls. */
	uint16 constant public EXTERNAL_QUERY_GAS_LIMIT = 8000;

	mapping (bytes32 => bool) public issuanceCancelled;
	mapping (bytes32 => bool) public debtOrderCancelled;

	event LogDebtOrderFilled(
		bytes32 indexed _agreementId,
		uint _principal,
		address _principalToken,
		address indexed _underwriter,
		uint _underwriterFee,
		address indexed _relayer,
		uint _relayerFee
	);

	event LogIssuanceCancelled(
		bytes32 indexed _agreementId,
		address indexed _cancelledBy
	);

	event LogDebtOrderCancelled(
		bytes32 indexed _debtOrderHash,
		address indexed _cancelledBy
	);

	event LogError(
		uint8 indexed _errorId,
		bytes32 indexed _orderHash
	);

	struct Issuance {
		address version;
		address debtor;
		address underwriter;
		uint underwriterRiskRating;
		address termsContract;
		bytes32 termsContractParameters;
		uint salt;
		bytes32 agreementId;
	}

	struct DebtOrder {
		Issuance issuance;
		uint underwriterFee;
		uint relayerFee;
		uint principalAmount;
		address principalToken;
		uint creditorFee;
		uint debtorFee;
		address relayer;
		uint expirationTimestampInSec;
		bytes32 debtOrderHash;
	}

    function fillDebtOrder(
        address creditor,
        address[6] orderAddresses,
        uint[8] orderValues,
        bytes32[1] orderBytes32,
        uint8[3] signaturesV,
        bytes32[3] signaturesR,
        bytes32[3] signaturesS
    )
        public
        returns (bytes32 _agreementId);

}

contract DebtTokenInterface {

    function transfer(address _to, uint _tokenId) public;

    function exists(uint256 _tokenId) public view returns (bool);

}
contract TokenTransferProxyInterface {}

contract ContractRegistryInterface {

    CollateralizerInterface public collateralizer;
    DebtKernelInterface public debtKernel;
    DebtTokenInterface public debtToken;
    TokenTransferProxyInterface public tokenTransferProxy;

    function ContractRegistryInterface(
        address _collateralizer,
        address _debtKernel,
        address _debtToken,
        address _tokenTransferProxy
    )
        public
    {
        collateralizer = CollateralizerInterface(_collateralizer);
        debtKernel = DebtKernelInterface(_debtKernel);
        debtToken = DebtTokenInterface(_debtToken);
        tokenTransferProxy = TokenTransferProxyInterface(_tokenTransferProxy);
    }

}

// Internal mixins
// External dependencies
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;
  }
}


// Libraries
contract SignaturesLibrary {
	bytes constant internal PREFIX = "\x19Ethereum Signed Message:\n32";

	struct ECDSASignature {
		uint8 v;
		bytes32 r;
		bytes32 s;
	}

	function isValidSignature(
		address signer,
		bytes32 hash,
		ECDSASignature signature
	)
		public
		pure
		returns (bool valid)
	{
		bytes32 prefixedHash = keccak256(PREFIX, hash);
		return ecrecover(prefixedHash, signature.v, signature.r, signature.s) == signer;
	}
}


contract OrderLibrary {
	struct DebtOrder {
		address kernelVersion;
		address issuanceVersion;
		uint principalAmount;
		address principalToken;
		uint collateralAmount;
		address collateralToken;
		address debtor;
		uint debtorFee;
		address creditor;
		uint creditorFee;
		address relayer;
		uint relayerFee;
		address underwriter;
		uint underwriterFee;
		uint underwriterRiskRating;
		address termsContract;
		bytes32 termsContractParameters;
		uint expirationTimestampInSec;
		uint salt;
		SignaturesLibrary.ECDSASignature debtorSignature;
		SignaturesLibrary.ECDSASignature creditorSignature;
		SignaturesLibrary.ECDSASignature underwriterSignature;
	}

	function unpackDebtOrder(DebtOrder memory order)
		public
		pure
		returns (
	        address[6] orderAddresses,
	        uint[8] orderValues,
	        bytes32[1] orderBytes32,
	        uint8[3] signaturesV,
	        bytes32[3] signaturesR,
	        bytes32[3] signaturesS
		)
	{
		return (
			[order.kernelVersion, order.debtor, order.underwriter, order.termsContract, order.principalToken, order.relayer],
            [order.underwriterRiskRating, order.salt, order.principalAmount, order.underwriterFee, order.relayerFee, order.creditorFee, order.debtorFee, order.expirationTimestampInSec],
			[order.termsContractParameters],
            [order.debtorSignature.v, order.creditorSignature.v, order.underwriterSignature.v],
			[order.debtorSignature.r, order.creditorSignature.r, order.underwriterSignature.r],
			[order.debtorSignature.s, order.creditorSignature.s, order.underwriterSignature.s]
		);
	}
}

contract LTVDecisionEngineTypes
{
	// The parameters used during the consent and decision evaluations.
	struct Params {
		address creditor;
		address priceFeedOperator;
		// The values and signature for the creditor commitment hash.
		CreditorCommitment creditorCommitment;
		// Price feed data.
		Price principalPrice;
		Price collateralPrice;
		// A DebtOrderData is required to confirm parity with the submitted order.
		OrderLibrary.DebtOrder order;
	}

	struct Price {
		uint value;
		uint timestamp;
		address tokenAddress;
		SignaturesLibrary.ECDSASignature signature;
	}

	struct CreditorCommitment {
		CommitmentValues values;
		SignaturesLibrary.ECDSASignature signature;
	}

	struct CommitmentValues {
		uint maxLTV;
	}

	struct SimpleInterestParameters {
		uint principalTokenIndex;
		uint principalAmount;
        uint interestRate;
        uint amortizationUnitType;
        uint termLengthInAmortizationUnits;
	}

	struct CollateralParameters {
		uint collateralTokenIndex;
		uint collateralAmount;
		uint gracePeriodInDays;
	}
}


// Interfaces
contract TermsContractInterface {

	function registerTermStart(
        bytes32 agreementId,
        address debtor
    ) public returns (bool _success);

	function registerRepayment(
        bytes32 agreementId,
        address payer,
        address beneficiary,
        uint256 unitsOfRepayment,
        address tokenAddress
    ) public returns (bool _success);

	function getExpectedRepaymentValue(
        bytes32 agreementId,
        uint256 timestamp
    ) public view returns (uint256);

	function getValueRepaidToDate(
        bytes32 agreementId
    ) public view returns (uint256);

	function getTermEndTimestamp(
        bytes32 _agreementId
    ) public view returns (uint);

}

contract SimpleInterestTermsContractInterface is TermsContractInterface {

    function unpackParametersFromBytes(
        bytes32 parameters
    ) public pure returns (
        uint _principalTokenIndex,
        uint _principalAmount,
        uint _interestRate,
        uint _amortizationUnitType,
        uint _termLengthInAmortizationUnits
    );

}

contract LTVDecisionEngine is LTVDecisionEngineTypes, SignaturesLibrary, OrderLibrary
{
	using SafeMath for uint;

	uint public constant PRECISION = 4;

	uint public constant MAX_PRICE_TTL_IN_SECONDS = 600;

	ContractRegistryInterface public contractRegistry;

	function LTVDecisionEngine(address _contractRegistry) public {
        contractRegistry = ContractRegistryInterface(_contractRegistry);
    }

	function evaluateConsent(Params params, bytes32 commitmentHash)
		public view returns (bool)
	{
		// Checks that the given creditor values were signed by the creditor.
		if (!isValidSignature(
			params.creditor,
			commitmentHash,
			params.creditorCommitment.signature
		)) {
			// We return early if the creditor values were not signed correctly.
			return false;
		}

		// Checks that the given price feed data was signed by the price feed operator.
		return (
			verifyPrices(
				params.priceFeedOperator,
				params.principalPrice,
				params.collateralPrice
			)
		);
	}

	// Returns true if the creditor-initiated order has not expired, and the LTV is below the max.
	function evaluateDecision(Params memory params)
		public view returns (bool _success)
	{
		LTVDecisionEngineTypes.Price memory principalTokenPrice = params.principalPrice;
		LTVDecisionEngineTypes.Price memory collateralTokenPrice = params.collateralPrice;

		uint maxLTV = params.creditorCommitment.values.maxLTV;
		OrderLibrary.DebtOrder memory order = params.order;

		uint collateralValue = collateralTokenPrice.value;

		if (isExpired(order.expirationTimestampInSec)) {
			return false;
		}

		if (order.collateralAmount == 0 || collateralValue == 0) {
			return false;
		}

		uint ltv = computeLTV(
			principalTokenPrice.value,
			collateralTokenPrice.value,
			order.principalAmount,
			order.collateralAmount
		);

		uint maxLTVWithPrecision = maxLTV.mul(10 ** (PRECISION.sub(2)));

		return ltv <= maxLTVWithPrecision;
	}

	function hashCreditorCommitmentForOrder(CommitmentValues commitmentValues, OrderLibrary.DebtOrder order)
	public view returns (bytes32)
	{
		bytes32 termsContractCommitmentHash =
			getTermsContractCommitmentHash(order.termsContract, order.termsContractParameters);

		return keccak256(
			// order values
			order.creditor,
			order.kernelVersion,
			order.issuanceVersion,
			order.termsContract,
			order.principalToken,
			order.salt,
			order.principalAmount,
			order.creditorFee,
			order.expirationTimestampInSec,
			// commitment values
			commitmentValues.maxLTV,
			// hashed terms contract commitments
			termsContractCommitmentHash
		);
	}

	function getTermsContractCommitmentHash(
		address termsContract,
		bytes32 termsContractParameters
	) public view returns (bytes32) {
		SimpleInterestParameters memory simpleInterestParameters =
			unpackSimpleInterestParameters(termsContract, termsContractParameters);

		CollateralParameters memory collateralParameters =
			unpackCollateralParameters(termsContractParameters);

		return keccak256(
			// unpacked termsContractParameters
			simpleInterestParameters.principalTokenIndex,
			simpleInterestParameters.principalAmount,
			simpleInterestParameters.interestRate,
			simpleInterestParameters.amortizationUnitType,
			simpleInterestParameters.termLengthInAmortizationUnits,
			collateralParameters.collateralTokenIndex,
			collateralParameters.gracePeriodInDays
		);
	}

	function unpackSimpleInterestParameters(
		address termsContract,
		bytes32 termsContractParameters
	)
		public pure returns (SimpleInterestParameters)
	{
		// use simple interest terms contract interface to unpack simple interest terms
		SimpleInterestTermsContractInterface simpleInterestTermsContract = SimpleInterestTermsContractInterface(termsContract);

		var (principalTokenIndex, principalAmount, interestRate, amortizationUnitType, termLengthInAmortizationUnits) =
			simpleInterestTermsContract.unpackParametersFromBytes(termsContractParameters);

		return SimpleInterestParameters({
			principalTokenIndex: principalTokenIndex,
			principalAmount: principalAmount,
			interestRate: interestRate,
			amortizationUnitType: amortizationUnitType,
			termLengthInAmortizationUnits: termLengthInAmortizationUnits
		});
	}

	function unpackCollateralParameters(
		bytes32 termsContractParameters
	)
		public view returns (CollateralParameters)
	{
		CollateralizerInterface collateralizer = CollateralizerInterface(contractRegistry.collateralizer());

		var (collateralTokenIndex, collateralAmount, gracePeriodInDays) =
			collateralizer.unpackCollateralParametersFromBytes(termsContractParameters);

		return CollateralParameters({
			collateralTokenIndex: collateralTokenIndex,
			collateralAmount: collateralAmount,
			gracePeriodInDays: gracePeriodInDays
		});
	}

	function verifyPrices(
		address priceFeedOperator,
		LTVDecisionEngineTypes.Price principalPrice,
		LTVDecisionEngineTypes.Price collateralPrice
	)
		internal view returns (bool)
	{
		uint minPriceTimestamp = block.timestamp - MAX_PRICE_TTL_IN_SECONDS;

		if (principalPrice.timestamp < minPriceTimestamp ||
			collateralPrice.timestamp < minPriceTimestamp) {
			return false;
		}

		bytes32 principalPriceHash = keccak256(
			principalPrice.value,
			principalPrice.tokenAddress,
			principalPrice.timestamp
		);

		bytes32 collateralPriceHash = keccak256(
			collateralPrice.value,
			collateralPrice.tokenAddress,
			collateralPrice.timestamp
		);

		bool principalPriceValid = isValidSignature(
			priceFeedOperator,
			principalPriceHash,
			principalPrice.signature
		);

		// We return early if the principal price information was not signed correctly.
		if (!principalPriceValid) {
			return false;
		}

		return isValidSignature(
			priceFeedOperator,
			collateralPriceHash,
			collateralPrice.signature
		);
	}

	function computeLTV(
		uint principalTokenPrice,
		uint collateralTokenPrice,
		uint principalAmount,
		uint collateralAmount
	)
		internal constant returns (uint)
	{
		uint principalValue = principalTokenPrice.mul(principalAmount).mul(10 ** PRECISION);
		uint collateralValue = collateralTokenPrice.mul(collateralAmount);

		return principalValue.div(collateralValue);
	}

	function isExpired(uint expirationTimestampInSec)
		internal view returns (bool expired)
	{
		return expirationTimestampInSec < block.timestamp;
	}
}

// External libraries
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);
}
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
  );
}
// Internal interfaces

contract CreditorProxyErrors {
    enum Errors {
            DEBT_OFFER_CANCELLED,
            DEBT_OFFER_ALREADY_FILLED,
            DEBT_OFFER_NON_CONSENSUAL,
            CREDITOR_BALANCE_OR_ALLOWANCE_INSUFFICIENT,
            DEBT_OFFER_CRITERIA_NOT_MET
        }

    event CreditorProxyError(
        uint8 indexed _errorId,
        address indexed _creditor,
        bytes32 indexed _creditorCommitmentHash
    );
}

contract CreditorProxyCoreInterface is CreditorProxyErrors {
    event DebtOfferFilled(address indexed _creditor, bytes32 indexed _creditorCommitmentHash, bytes32 indexed _agreementId);
}


contract CreditorProxyCore is CreditorProxyCoreInterface {

	uint16 constant public EXTERNAL_QUERY_GAS_LIMIT = 8000;

	ContractRegistryInterface public contractRegistry;

	/**
	 * Helper function for transferring a specified amount of tokens between two parties.
	 */
	function transferTokensFrom(
		address _token,
		address _from,
		address _to,
		uint _amount
	)
		internal
		returns (bool _success)
	{
		return ERC20(_token).transferFrom(_from, _to, _amount);
	}

	/**
     * Helper function for querying this contract's allowance for transferring the given token.
     */
	function getAllowance(
		address token,
		address owner,
		address granter
	)
		internal
		view
	returns (uint _allowance)
	{
		// Limit gas to prevent reentrancy.
		return ERC20(token).allowance.gas(EXTERNAL_QUERY_GAS_LIMIT)(
			owner,
			granter
		);
	}
}



contract LTVCreditorProxy is CreditorProxyCore, LTVDecisionEngine {

	mapping (bytes32 => bool) public debtOfferCancelled;
	mapping (bytes32 => bool) public debtOfferFilled;

	bytes32 constant internal NULL_ISSUANCE_HASH = bytes32(0);

	function LTVCreditorProxy(address _contractRegistry) LTVDecisionEngine(_contractRegistry)
		public
	{
		contractRegistry = ContractRegistryInterface(_contractRegistry);
	}

	function fillDebtOffer(LTVDecisionEngineTypes.Params params)
		public returns (bytes32 agreementId)
	{
		OrderLibrary.DebtOrder memory order = params.order;
		CommitmentValues memory commitmentValues = params.creditorCommitment.values;

		bytes32 creditorCommitmentHash = hashCreditorCommitmentForOrder(commitmentValues, order);

		if (!evaluateConsent(params, creditorCommitmentHash)) {
			emit CreditorProxyError(uint8(Errors.DEBT_OFFER_NON_CONSENSUAL), order.creditor, creditorCommitmentHash);
			return NULL_ISSUANCE_HASH;
		}

		if (debtOfferFilled[creditorCommitmentHash]) {
			emit CreditorProxyError(uint8(Errors.DEBT_OFFER_ALREADY_FILLED), order.creditor, creditorCommitmentHash);
			return NULL_ISSUANCE_HASH;
		}

		if (debtOfferCancelled[creditorCommitmentHash]) {
			emit CreditorProxyError(uint8(Errors.DEBT_OFFER_CANCELLED), order.creditor, creditorCommitmentHash);
			return NULL_ISSUANCE_HASH;
		}

		if (!evaluateDecision(params)) {
			emit CreditorProxyError(
				uint8(Errors.DEBT_OFFER_CRITERIA_NOT_MET),
				order.creditor,
				creditorCommitmentHash
			);
			return NULL_ISSUANCE_HASH;
		}

		address principalToken = order.principalToken;

		// The allowance that the token transfer proxy has for this contract's tokens.
		uint tokenTransferAllowance = getAllowance(
			principalToken,
			address(this),
			contractRegistry.tokenTransferProxy()
		);

		uint totalCreditorPayment = order.principalAmount.add(order.creditorFee);

		// Ensure the token transfer proxy can transfer tokens from the creditor proxy
		if (tokenTransferAllowance < totalCreditorPayment) {
			require(setTokenTransferAllowance(principalToken, totalCreditorPayment));
		}

		// Transfer principal from creditor to CreditorProxy
		if (totalCreditorPayment > 0) {
			require(
				transferTokensFrom(
					principalToken,
					order.creditor,
					address(this),
					totalCreditorPayment
				)
			);
		}

		agreementId = sendOrderToKernel(order);

		require(agreementId != NULL_ISSUANCE_HASH);

		debtOfferFilled[creditorCommitmentHash] = true;

		contractRegistry.debtToken().transfer(order.creditor, uint256(agreementId));

		emit DebtOfferFilled(order.creditor, creditorCommitmentHash, agreementId);

		return agreementId;
	}

	function sendOrderToKernel(DebtOrder memory order) internal returns (bytes32 id)
	{
		address[6] memory orderAddresses;
		uint[8] memory orderValues;
		bytes32[1] memory orderBytes32;
		uint8[3] memory signaturesV;
		bytes32[3] memory signaturesR;
		bytes32[3] memory signaturesS;

		(orderAddresses, orderValues, orderBytes32, signaturesV, signaturesR, signaturesS) = unpackDebtOrder(order);

		return contractRegistry.debtKernel().fillDebtOrder(
			address(this),
			orderAddresses,
			orderValues,
			orderBytes32,
			signaturesV,
			signaturesR,
			signaturesS
		);
	}

	function cancelDebtOffer(LTVDecisionEngineTypes.Params params) public returns (bool) {
		// sender must be the creditor.
		require(msg.sender == order.creditor);

		LTVDecisionEngineTypes.CommitmentValues memory commitmentValues = params.creditorCommitment.values;
		OrderLibrary.DebtOrder memory order = params.order;

		bytes32 creditorCommitmentHash = hashCreditorCommitmentForOrder(commitmentValues, order);

		// debt offer must not already be filled.
		require(!debtOfferFilled[creditorCommitmentHash]);

		debtOfferCancelled[creditorCommitmentHash] = true;

		return true;
	}

	/**
     * Helper function for approving this address' allowance to Dharma's token transfer proxy.
     */
	function setTokenTransferAllowance(
		address token,
		uint amount
	)
		internal
		returns (bool _success)
	{
		return ERC20(token).approve(
			address(contractRegistry.tokenTransferProxy()),
			amount
		);
	}
}

    Contract ABI  
[{"constant":true,"inputs":[{"name":"termsContract","type":"address"},{"name":"termsContractParameters","type":"bytes32"}],"name":"getTermsContractCommitmentHash","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"components":[{"name":"maxLTV","type":"uint256"}],"name":"commitmentValues","type":"tuple"},{"components":[{"name":"kernelVersion","type":"address"},{"name":"issuanceVersion","type":"address"},{"name":"principalAmount","type":"uint256"},{"name":"principalToken","type":"address"},{"name":"collateralAmount","type":"uint256"},{"name":"collateralToken","type":"address"},{"name":"debtor","type":"address"},{"name":"debtorFee","type":"uint256"},{"name":"creditor","type":"address"},{"name":"creditorFee","type":"uint256"},{"name":"relayer","type":"address"},{"name":"relayerFee","type":"uint256"},{"name":"underwriter","type":"address"},{"name":"underwriterFee","type":"uint256"},{"name":"underwriterRiskRating","type":"uint256"},{"name":"termsContract","type":"address"},{"name":"termsContractParameters","type":"bytes32"},{"name":"expirationTimestampInSec","type":"uint256"},{"name":"salt","type":"uint256"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"debtorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"creditorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"underwriterSignature","type":"tuple"}],"name":"order","type":"tuple"}],"name":"hashCreditorCommitmentForOrder","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"components":[{"name":"creditor","type":"address"},{"name":"priceFeedOperator","type":"address"},{"components":[{"components":[{"name":"maxLTV","type":"uint256"}],"name":"values","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"creditorCommitment","type":"tuple"},{"components":[{"name":"value","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"tokenAddress","type":"address"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"principalPrice","type":"tuple"},{"components":[{"name":"value","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"tokenAddress","type":"address"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"collateralPrice","type":"tuple"},{"components":[{"name":"kernelVersion","type":"address"},{"name":"issuanceVersion","type":"address"},{"name":"principalAmount","type":"uint256"},{"name":"principalToken","type":"address"},{"name":"collateralAmount","type":"uint256"},{"name":"collateralToken","type":"address"},{"name":"debtor","type":"address"},{"name":"debtorFee","type":"uint256"},{"name":"creditor","type":"address"},{"name":"creditorFee","type":"uint256"},{"name":"relayer","type":"address"},{"name":"relayerFee","type":"uint256"},{"name":"underwriter","type":"address"},{"name":"underwriterFee","type":"uint256"},{"name":"underwriterRiskRating","type":"uint256"},{"name":"termsContract","type":"address"},{"name":"termsContractParameters","type":"bytes32"},{"name":"expirationTimestampInSec","type":"uint256"},{"name":"salt","type":"uint256"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"debtorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"creditorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"underwriterSignature","type":"tuple"}],"name":"order","type":"tuple"}],"name":"params","type":"tuple"}],"name":"cancelDebtOffer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"signer","type":"address"},{"name":"hash","type":"bytes32"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"isValidSignature","outputs":[{"name":"valid","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"MAX_PRICE_TTL_IN_SECONDS","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"components":[{"name":"creditor","type":"address"},{"name":"priceFeedOperator","type":"address"},{"components":[{"components":[{"name":"maxLTV","type":"uint256"}],"name":"values","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"creditorCommitment","type":"tuple"},{"components":[{"name":"value","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"tokenAddress","type":"address"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"principalPrice","type":"tuple"},{"components":[{"name":"value","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"tokenAddress","type":"address"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"collateralPrice","type":"tuple"},{"components":[{"name":"kernelVersion","type":"address"},{"name":"issuanceVersion","type":"address"},{"name":"principalAmount","type":"uint256"},{"name":"principalToken","type":"address"},{"name":"collateralAmount","type":"uint256"},{"name":"collateralToken","type":"address"},{"name":"debtor","type":"address"},{"name":"debtorFee","type":"uint256"},{"name":"creditor","type":"address"},{"name":"creditorFee","type":"uint256"},{"name":"relayer","type":"address"},{"name":"relayerFee","type":"uint256"},{"name":"underwriter","type":"address"},{"name":"underwriterFee","type":"uint256"},{"name":"underwriterRiskRating","type":"uint256"},{"name":"termsContract","type":"address"},{"name":"termsContractParameters","type":"bytes32"},{"name":"expirationTimestampInSec","type":"uint256"},{"name":"salt","type":"uint256"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"debtorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"creditorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"underwriterSignature","type":"tuple"}],"name":"order","type":"tuple"}],"name":"params","type":"tuple"}],"name":"evaluateDecision","outputs":[{"name":"_success","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"debtOfferCancelled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PRECISION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"contractRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"components":[{"name":"creditor","type":"address"},{"name":"priceFeedOperator","type":"address"},{"components":[{"components":[{"name":"maxLTV","type":"uint256"}],"name":"values","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"creditorCommitment","type":"tuple"},{"components":[{"name":"value","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"tokenAddress","type":"address"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"principalPrice","type":"tuple"},{"components":[{"name":"value","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"tokenAddress","type":"address"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"collateralPrice","type":"tuple"},{"components":[{"name":"kernelVersion","type":"address"},{"name":"issuanceVersion","type":"address"},{"name":"principalAmount","type":"uint256"},{"name":"principalToken","type":"address"},{"name":"collateralAmount","type":"uint256"},{"name":"collateralToken","type":"address"},{"name":"debtor","type":"address"},{"name":"debtorFee","type":"uint256"},{"name":"creditor","type":"address"},{"name":"creditorFee","type":"uint256"},{"name":"relayer","type":"address"},{"name":"relayerFee","type":"uint256"},{"name":"underwriter","type":"address"},{"name":"underwriterFee","type":"uint256"},{"name":"underwriterRiskRating","type":"uint256"},{"name":"termsContract","type":"address"},{"name":"termsContractParameters","type":"bytes32"},{"name":"expirationTimestampInSec","type":"uint256"},{"name":"salt","type":"uint256"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"debtorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"creditorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"underwriterSignature","type":"tuple"}],"name":"order","type":"tuple"}],"name":"params","type":"tuple"},{"name":"commitmentHash","type":"bytes32"}],"name":"evaluateConsent","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"debtOfferFilled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"components":[{"name":"creditor","type":"address"},{"name":"priceFeedOperator","type":"address"},{"components":[{"components":[{"name":"maxLTV","type":"uint256"}],"name":"values","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"creditorCommitment","type":"tuple"},{"components":[{"name":"value","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"tokenAddress","type":"address"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"principalPrice","type":"tuple"},{"components":[{"name":"value","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"tokenAddress","type":"address"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"signature","type":"tuple"}],"name":"collateralPrice","type":"tuple"},{"components":[{"name":"kernelVersion","type":"address"},{"name":"issuanceVersion","type":"address"},{"name":"principalAmount","type":"uint256"},{"name":"principalToken","type":"address"},{"name":"collateralAmount","type":"uint256"},{"name":"collateralToken","type":"address"},{"name":"debtor","type":"address"},{"name":"debtorFee","type":"uint256"},{"name":"creditor","type":"address"},{"name":"creditorFee","type":"uint256"},{"name":"relayer","type":"address"},{"name":"relayerFee","type":"uint256"},{"name":"underwriter","type":"address"},{"name":"underwriterFee","type":"uint256"},{"name":"underwriterRiskRating","type":"uint256"},{"name":"termsContract","type":"address"},{"name":"termsContractParameters","type":"bytes32"},{"name":"expirationTimestampInSec","type":"uint256"},{"name":"salt","type":"uint256"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"debtorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"creditorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"underwriterSignature","type":"tuple"}],"name":"order","type":"tuple"}],"name":"params","type":"tuple"}],"name":"fillDebtOffer","outputs":[{"name":"agreementId","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"termsContractParameters","type":"bytes32"}],"name":"unpackCollateralParameters","outputs":[{"components":[{"name":"collateralTokenIndex","type":"uint256"},{"name":"collateralAmount","type":"uint256"},{"name":"gracePeriodInDays","type":"uint256"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"components":[{"name":"kernelVersion","type":"address"},{"name":"issuanceVersion","type":"address"},{"name":"principalAmount","type":"uint256"},{"name":"principalToken","type":"address"},{"name":"collateralAmount","type":"uint256"},{"name":"collateralToken","type":"address"},{"name":"debtor","type":"address"},{"name":"debtorFee","type":"uint256"},{"name":"creditor","type":"address"},{"name":"creditorFee","type":"uint256"},{"name":"relayer","type":"address"},{"name":"relayerFee","type":"uint256"},{"name":"underwriter","type":"address"},{"name":"underwriterFee","type":"uint256"},{"name":"underwriterRiskRating","type":"uint256"},{"name":"termsContract","type":"address"},{"name":"termsContractParameters","type":"bytes32"},{"name":"expirationTimestampInSec","type":"uint256"},{"name":"salt","type":"uint256"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"debtorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"creditorSignature","type":"tuple"},{"components":[{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"underwriterSignature","type":"tuple"}],"name":"order","type":"tuple"}],"name":"unpackDebtOrder","outputs":[{"name":"orderAddresses","type":"address[6]"},{"name":"orderValues","type":"uint256[8]"},{"name":"orderBytes32","type":"bytes32[1]"},{"name":"signaturesV","type":"uint8[3]"},{"name":"signaturesR","type":"bytes32[3]"},{"name":"signaturesS","type":"bytes32[3]"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"termsContract","type":"address"},{"name":"termsContractParameters","type":"bytes32"}],"name":"unpackSimpleInterestParameters","outputs":[{"components":[{"name":"principalTokenIndex","type":"uint256"},{"name":"principalAmount","type":"uint256"},{"name":"interestRate","type":"uint256"},{"name":"amortizationUnitType","type":"uint256"},{"name":"termLengthInAmortizationUnits","type":"uint256"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"EXTERNAL_QUERY_GAS_LIMIT","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_contractRegistry","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_creditor","type":"address"},{"indexed":true,"name":"_creditorCommitmentHash","type":"bytes32"},{"indexed":true,"name":"_agreementId","type":"bytes32"}],"name":"DebtOfferFilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_errorId","type":"uint8"},{"indexed":true,"name":"_creditor","type":"address"},{"indexed":true,"name":"_creditorCommitmentHash","type":"bytes32"}],"name":"CreditorProxyError","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60806040523480156200001157600080fd5b50604051602080620021f2833981018060405262000033919081019062000073565b60018054600160a060020a03909216600160a060020a031992831681179092169091179055620000a8565b60006200006c82516200009c565b9392505050565b6000602082840312156200008657600080fd5b60006200009484846200005e565b949350505050565b600160a060020a031690565b61213a80620000b86000396000f3006080604052600436106100cc5763ffffffff60e060020a6000350416630257dbc981146100d15780630a89d47c14610107578063314bdcdc14610127578063578911ac146101545780637c3ea9fc14610174578063879ffab014610189578063a318b5f7146101a9578063aaf5eb68146101c9578063abf410e5146101de578063b120f0b414610200578063c1614d0014610220578063cc9dbb1314610240578063cf99685c14610260578063e301885c1461028d578063e7083d24146102bf578063f06bbf75146102ec575b600080fd5b3480156100dd57600080fd5b506100f16100ec366004611a6b565b61030e565b6040516100fe919061200b565b60405180910390f35b34801561011357600080fd5b506100f1610122366004611b6a565b610395565b34801561013357600080fd5b50610147610142366004611bba565b610464565b6040516100fe9190611ffd565b34801561016057600080fd5b5061014761016f366004611aa5565b6104f0565b34801561018057600080fd5b506100f16105fd565b34801561019557600080fd5b506101476101a4366004611bba565b610603565b3480156101b557600080fd5b506101476101c4366004611b10565b6106d2565b3480156101d557600080fd5b506100f16106e7565b3480156101ea57600080fd5b506101f36106ec565b6040516100fe9190612057565b34801561020c57600080fd5b5061014761021b366004611bd9565b6106fb565b34801561022c57600080fd5b5061014761023b366004611b10565b610742565b34801561024c57600080fd5b506100f161025b366004611bba565b610757565b34801561026c57600080fd5b5061028061027b366004611b10565b610af6565b6040516100fe9190612065565b34801561029957600080fd5b506102ad6102a8366004611b9b565b610c4c565b6040516100fe96959493929190611fa9565b3480156102cb57600080fd5b506102df6102da366004611a6b565b610ddd565b6040516100fe9190612073565b3480156102f857600080fd5b50610301610ea5565b6040516100fe9190612081565b6000610318611458565b610320611488565b61032a8585610ddd565b915061033584610af6565b82516020808501516040808701516060808901516080808b01518951868b015187519a8b52988a0197909752888601949094529187015285015260a084019190915260c0830191909152519081900360e001902093509050505092915050565b6000806103ac836101e0015184610200015161030e565b610100840151845160208601516101e087015160608801516102408901516040808b01516101208c0151610220909c01519c5182516c01000000000000000000000000600160a060020a039a8b1681028252988a1689026014820152968916880260288801529488168702603c8701529690921690940260508401526064830193909352608482019390935260a481019690965260c486019690965260e4850152610104840152505090519081900361012401902090565b600061046e6114aa565b6104766114bc565b610100810151600090600160a060020a0316331461049357600080fd5b60408501515160a086015190935091506104ad8383610395565b60008181526003602052604090205490915060ff16156104cc57600080fd5b6000908152600260205260409020805460ff19166001908117909155949350505050565b6000806040805190810160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250846040518083805190602001908083835b602083106105595780518252601f19909201916020918201910161053a565b51815160209384036101000a60001901801990921691161790529201938452506040805193849003820184208851898401518a840151600088529690940192839052909650600160a060020a038b1695506001946105bb945087939192612019565b60206040516020810390808403906000865af11580156105df573d6000803e3d6000fd5b50505060206040510351600160a060020a0316149150509392505050565b61025881565b600061060d611581565b610615611581565b600061061f6114bc565b50505050606082015160808301516040840151515160a08501518251610220820151600090819061064f90610eab565b1561065d57600097506106c6565b6080840151158061066c575082155b1561067a57600097506106c6565b6106968760000151876000015186604001518760800151610eb0565b91506106bd6106ad6004600263ffffffff610f0516565b8690600a0a63ffffffff610f1716565b90508082111597505b50505050505050919050565b60026020526000908152604090205460ff1681565b600481565b600154600160a060020a031681565b60006107148360000151838560400151602001516104f0565b15156107225750600061073c565b610739836020015184606001518560800151610f40565b90505b92915050565b60036020526000908152604090205460ff1681565b60006107616114bc565b6107696114aa565b505060a082015160408301515160008080806107858587610395565b935061079188856106fb565b15156107e3576101008601518490600160a060020a031660025b60ff167f9fd787e2a5fcbda76c8a1a1f8bb14a3328d4991b94bd7461fe7468aaedbd6d2460405160405180910390a460009650610aeb565b60008481526003602052604090205460ff1615610812576101008601518490600160a060020a031660016107ab565b60008481526002602052604090205460ff1615610841576101008601518490600160a060020a031660006107ab565b61084a88610603565b1515610868576101008601518490600160a060020a031660046107ab565b856060015192506109048330600160009054906101000a9004600160a060020a0316600160a060020a0316630eefdbad6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156108c757600080fd5b505af11580156108db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108ff9190810190611b4c565b61105a565b9150610922866101200151876040015161110590919063ffffffff16565b905080821015610941576109368382611112565b151561094157600080fd5b60008111156109665761095b838761010001513084611221565b151561096657600080fd5b61096f866112ca565b965086151561097d57600080fd5b6000848152600360209081526040808320805460ff191660019081179091555481517ff8d898980000000000000000000000000000000000000000000000000000000081529151600160a060020a039091169363f8d8989893600480850194919392918390030190829087803b1580156109f657600080fd5b505af1158015610a0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a2e9190810190611b4c565b6101008701516040517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03929092169163a9059cbb91610a7b918b90600401611f8e565b600060405180830381600087803b158015610a9557600080fd5b505af1158015610aa9573d6000803e3d6000fd5b5050506101008701516040518992508691600160a060020a0316907fdc3cdf07a43996ceac82462ded070dbc1bf60c3d66cfa11770cd91a41b1c62e090600090a45b505050505050919050565b610afe611488565b600080600080600160009054906101000a9004600160a060020a0316600160a060020a031663869f05116040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610b5757600080fd5b505af1158015610b6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b8f9190810190611b4c565b6040517fca062647000000000000000000000000000000000000000000000000000000008152909450600160a060020a0385169063ca06264790610bd790899060040161200b565b606060405180830381600087803b158015610bf157600080fd5b505af1158015610c05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c299190810190611c0b565b604080516060810182529384526020840192909252908201529695505050505050565b610c546115b3565b610c5c6115d2565b610c646115f2565b610c6c611611565b610c74611611565b610c7c611611565b50506040805160c080820183528751600160a060020a0390811683528882015181166020808501919091526101808a01518216848601526101e08a01518216606080860191909152808b015183166080808701919091526101408c015190931660a0808701919091528651610100810188526101c08d015181526102408d0151818501528c880151818901526101a08d0151818401526101608d0151948101949094526101208c01519084015260e0808c0151948401949094526102208b015193830193909352845180820186526102008b01518152855180850187526102608c0180515160ff90811683526102808e018051518216848701526102a0909e01805151909116838a015288518088018a52825186015181528e51860151818701528151860151818b015289519788018a52915189015187529c51880151938601939093529a5186015195840195909552929990989397509295509093509150565b610de5611458565b60008060008060008088955085600160a060020a031663ed8907d7896040518263ffffffff1660e060020a028152600401610e20919061200b565b60a060405180830381600087803b158015610e3a57600080fd5b505af1158015610e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e729190810190611c4e565b6040805160a081018252958652602086019490945292840191909152606083015260808201529998505050505050505050565b611f4081565b421190565b60008080610ed6612710610eca898863ffffffff610f1716565b9063ffffffff610f1716565b9150610ee8868563ffffffff610f1716565b9050610efa828263ffffffff61144316565b979650505050505050565b600082821115610f1157fe5b50900390565b6000821515610f285750600061073c565b50818102818382811515610f3857fe5b041461073c57fe5b6000806000806000610258420393508387602001511080610f645750838660200151105b15610f72576000945061104f565b8660000151876040015188602001516040518084815260200183600160a060020a0316600160a060020a03166c010000000000000000000000000281526014018281526020019350505050604051809103902092508560000151866040015187602001516040518084815260200183600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140182815260200193505050506040518091039020915061102b888489606001516104f0565b905080151561103d576000945061104f565b61104c888388606001516104f0565b94505b505050509392505050565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600090600160a060020a0385169063dd62ed3e90611f40906110a89087908790600401611eea565b602060405180830381600088803b1580156110c257600080fd5b5087f11580156110d6573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052506110fb9190810190611b2e565b90505b9392505050565b8181018281101561073c57fe5b600082600160a060020a031663095ea7b3600160009054906101000a9004600160a060020a0316600160a060020a0316630eefdbad6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561117657600080fd5b505af115801561118a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506111ae9190810190611b4c565b846040518363ffffffff1660e060020a0281526004016111cf929190611f8e565b602060405180830381600087803b1580156111e957600080fd5b505af11580156111fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107399190810190611af2565b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152600090600160a060020a038616906323b872dd9061126d90879087908790600401611f05565b602060405180830381600087803b15801561128757600080fd5b505af115801561129b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112bf9190810190611af2565b90505b949350505050565b60006112d46115b3565b6112dc6115d2565b6112e46115f2565b6112ec611611565b6112f4611611565b6112fc611611565b61130588610c4c565b600154604080517f079dd4b70000000000000000000000000000000000000000000000000000000081529051979d50959b5093995091975095509350600160a060020a03169163079dd4b7916004808201926020929091908290030181600087803b15801561137357600080fd5b505af1158015611387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506113ab9190810190611b4c565b600160a060020a031663e6488fc9308888888888886040518863ffffffff1660e060020a0281526004016113e59796959493929190611f2d565b602060405180830381600087803b1580156113ff57600080fd5b505af1158015611413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506114379190810190611b2e565b98975050505050505050565b6000818381151561145057fe5b049392505050565b60a06040519081016040528060008152602001600081526020016000815260200160008152602001600081525090565b6060604051908101604052806000815260200160008152602001600081525090565b60408051602081019091526000815290565b6040805161038081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081018290526101c081018290526101e08101829052610200810182905261022081018290526102408101919091526102608101611562611630565b815260200161156f611630565b815260200161157c611630565b905290565b60c06040519081016040528060008152602001600081526020016000600160a060020a0316815260200161157c611630565b60c0604051908101604052806006906020820280388339509192915050565b610100604051908101604052806008906020820280388339509192915050565b6020604051908101604052806001906020820280388339509192915050565b6060604051908101604052806003906020820280388339509192915050565b604080516060810182526000808252602082018190529181019190915290565b600061073982356120d7565b600061073982516120e3565b600061073982356120b6565b600061073982516120b6565b600061073982516120f5565b60006020828403121561169e57600080fd5b6116a8602061208f565b905060006116b68484611668565b82525092915050565b6000608082840312156116d157600080fd5b6116db604061208f565b905060006116e9848461168c565b82525060206116fa848483016118fb565b60208301525092915050565b6000610380828403121561171957600080fd5b6117246102c061208f565b905060006117328484611650565b825250602061174384848301611650565b602083015250604061175784828501611668565b604083015250606061176b84828501611650565b606083015250608061177f84828501611668565b60808301525060a061179384828501611650565b60a08301525060c06117a784828501611650565b60c08301525060e06117bb84828501611668565b60e0830152506101006117d084828501611650565b610100830152506101206117e684828501611668565b610120830152506101406117fc84828501611650565b6101408301525061016061181284828501611668565b6101608301525061018061182884828501611650565b610180830152506101a061183e84828501611668565b6101a0830152506101c061185484828501611668565b6101c0830152506101e061186a84828501611650565b6101e08301525061020061188084828501611668565b6102008301525061022061189684828501611668565b610220830152506102406118ac84828501611668565b610240830152506102606118c2848285016118fb565b610260830152506102c06118d8848285016118fb565b610280830152506103206118ee848285016118fb565b6102a08301525092915050565b60006060828403121561190d57600080fd5b611917606061208f565b905060006119258484611a5f565b825250602061193684848301611668565b602083015250604061194a84828501611668565b60408301525092915050565b60006105c0828403121561196957600080fd5b61197360c061208f565b905060006119818484611650565b825250602061199284848301611650565b60208301525060406119a6848285016116bf565b60408301525060c06119ba848285016119f0565b6060830152506101806119cf848285016119f0565b6080830152506102406119e484828501611706565b60a08301525092915050565b600060c08284031215611a0257600080fd5b611a0c608061208f565b90506000611a1a8484611668565b8252506020611a2b84848301611668565b6020830152506040611a3f84828501611650565b6040830152506060611a53848285016118fb565b60608301525092915050565b600061073982356120ef565b60008060408385031215611a7e57600080fd5b6000611a8a8585611650565b9250506020611a9b85828601611668565b9150509250929050565b600080600060a08486031215611aba57600080fd5b6000611ac68686611650565b9350506020611ad786828701611668565b9250506040611ae8868287016118fb565b9150509250925092565b600060208284031215611b0457600080fd5b60006112c2848461165c565b600060208284031215611b2257600080fd5b60006112c28484611668565b600060208284031215611b4057600080fd5b60006112c28484611674565b600060208284031215611b5e57600080fd5b60006112c28484611680565b6000806103a08385031215611b7e57600080fd5b6000611b8a858561168c565b9250506020611a9b85828601611706565b60006103808284031215611bae57600080fd5b60006112c28484611706565b60006105c08284031215611bcd57600080fd5b60006112c28484611956565b6000806105e08385031215611bed57600080fd5b6000611bf98585611956565b9250506105c0611a9b85828601611668565b600080600060608486031215611c2057600080fd5b6000611c2c8686611674565b9350506020611c3d86828701611674565b9250506040611ae886828701611674565b600080600080600060a08688031215611c6657600080fd5b6000611c728888611674565b9550506020611c8388828901611674565b9450506040611c9488828901611674565b9350506060611ca588828901611674565b9250506080611cb688828901611674565b9150509295509295909350565b611ccc816120d7565b82525050565b611cdb816120b9565b611ce4826120b6565b60005b82811015611d1457611cfa858351611cc3565b611d03826120d1565b602095909501949150600101611ce7565b5050505050565b611d24816120bf565b611d2d826120b6565b60005b82811015611d1457611d43858351611e2c565b611d4c826120d1565b602095909501949150600101611d30565b611d66816120c5565b611d6f826120b6565b60005b82811015611d1457611d85858351611e2c565b611d8e826120d1565b602095909501949150600101611d72565b611da8816120cb565b611db1826120b6565b60005b82811015611d1457611dc7858351611e2c565b611dd0826120d1565b602095909501949150600101611db4565b611dea816120c5565b611df3826120b6565b60005b82811015611d1457611e09858351611ee1565b611e12826120d1565b602095909501949150600101611df6565b611ccc816120e3565b611ccc816120b6565b611ccc816120f5565b80516060830190611e4f8482611e2c565b506020820151611e626020850182611e2c565b506040820151611e756040850182611e2c565b50505050565b805160a0830190611e8c8482611e2c565b506020820151611e9f6020850182611e2c565b506040820151611eb26040850182611e2c565b506060820151611ec56060850182611e2c565b506080820151611e756080850182611e2c565b611ccc816120e8565b611ccc816120ef565b60408101611ef88285611cc3565b6110fe6020830184611cc3565b60608101611f138286611cc3565b611f206020830185611cc3565b6112c26040830184611e2c565b6103208101611f3c828a611cc3565b611f496020830189611cd2565b611f5660e0830188611d9f565b611f646101e0830187611d1b565b611f72610200830186611de1565b611f80610260830185611d5d565b6114376102c0830184611d5d565b60408101611f9c8285611cc3565b6110fe6020830184611e2c565b6103008101611fb88289611cd2565b611fc560c0830188611d9f565b611fd36101c0830187611d1b565b611fe16101e0830186611de1565b611fef610240830185611d5d565b610efa6102a0830184611d5d565b6020810161073c8284611e23565b6020810161073c8284611e2c565b608081016120278287611e2c565b6120346020830186611ee1565b6120416040830185611e2c565b61204e6060830184611e2c565b95945050505050565b6020810161073c8284611e35565b6060810161073c8284611e3e565b60a0810161073c8284611e7b565b6020810161073c8284611ed8565b60405181810167ffffffffffffffff811182821017156120ae57600080fd5b604052919050565b90565b50600690565b50600190565b50600390565b50600890565b60200190565b600160a060020a031690565b151590565b61ffff1690565b60ff1690565b600061073c826120d75600a265627a7a723058208420dc932d0dc62f51d31d552c40da5fdb8ad5c6d7d49e9736f5c2d9ba1131c66c6578706572696d656e74616cf50037000000000000000000000000e1ccba52a8f7c4885ef10b10c3ba438072bd96e1

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

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000e1ccba52a8f7c4885ef10b10c3ba438072bd96e1


   Swarm Source:
bzzr://8420dc932d0dc62f51d31d552c40da5fdb8ad5c6d7d49e9736f5c2d9ba1131c6

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward