Contract 0x8D65Ed88D6162a2b3B5F71c45D433d4aeAc93065

Contract Overview

Balance:
0 Ether
Txn Hash Method
Block
From
To
Value
0x1af712421f6e4c1fc6a755efdadef7bde74bf12a68d570902c1d674378ea830cAccept Ownership243386162021-04-19 21:36:4828 days 23 hrs ago0x73570075092502472e4b61a7058df1a4a1db12f2 IN  0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether0.0000220351
0xb783586bde53a771fbe8d8b2d0ce8a232c06b01d1b27c1994c218740fb1acc2bNominate New Own...243376812021-04-19 20:33:3229 days 19 mins ago0xb64ff7a4a33acdf48d97dab0d764afd0f6176882 IN  0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether0.0000448091
0x390d361e6e9be1a364498d33329ab3b7d9f42bb41d9c43386caf501fe0a60278Accept Ownership227336822020-12-24 1:16:12145 days 19 hrs ago0x7d7b6dfcf3287feb5bc7e88dec12323f5b29e893 IN  0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether0.0004473820
0x2909a07d6e2fd16372ac888b8b4c0aa2f48a5fa255ea5ef1c5ce2b30651845bcAccept Ownership227336292020-12-24 1:10:20145 days 19 hrs ago0x7d7b6dfcf3287feb5bc7e88dec12323f5b29e893 IN  0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether0.0004473820
0xd7fba7a45bbe31919a836f676aadddbc7c11930513758ba373ff656e626fc1fbSet Associated C...227319482020-12-23 22:02:52145 days 22 hrs ago0xb64ff7a4a33acdf48d97dab0d764afd0f6176882 IN  0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether0.000148995
0x773f7fb5d432e96d5e1ec19322314601a2b9f68473ed67cf1ef29d1c7c2bb28c0x60806040227319452020-12-23 22:02:32145 days 22 hrs ago0xb64ff7a4a33acdf48d97dab0d764afd0f6176882 IN  Contract Creation0 Ether0.00481725
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x60addf7c2a742bea34572cb73f6fce49f3f37c5512e62b1edb05ec8ec2473b8e249184482021-05-18 18:58:321 hr 54 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x60addf7c2a742bea34572cb73f6fce49f3f37c5512e62b1edb05ec8ec2473b8e249184482021-05-18 18:58:321 hr 54 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x60addf7c2a742bea34572cb73f6fce49f3f37c5512e62b1edb05ec8ec2473b8e249184482021-05-18 18:58:321 hr 54 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x60addf7c2a742bea34572cb73f6fce49f3f37c5512e62b1edb05ec8ec2473b8e249184482021-05-18 18:58:321 hr 54 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x60addf7c2a742bea34572cb73f6fce49f3f37c5512e62b1edb05ec8ec2473b8e249184482021-05-18 18:58:321 hr 54 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x47f32b506cc45369eb57776ad052080d17d9de5dc43a2da1f9cf68a5045bc27f249112962021-05-18 10:48:3610 hrs 4 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x47f32b506cc45369eb57776ad052080d17d9de5dc43a2da1f9cf68a5045bc27f249112962021-05-18 10:48:3610 hrs 4 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x47f32b506cc45369eb57776ad052080d17d9de5dc43a2da1f9cf68a5045bc27f249112962021-05-18 10:48:3610 hrs 4 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x47f32b506cc45369eb57776ad052080d17d9de5dc43a2da1f9cf68a5045bc27f249112962021-05-18 10:48:3610 hrs 4 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x47f32b506cc45369eb57776ad052080d17d9de5dc43a2da1f9cf68a5045bc27f249112962021-05-18 10:48:3610 hrs 4 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x284c223e2a2ddeb290bddb9089764e8da71ba8654797818b2beeb113e798a921249039492021-05-18 2:38:3218 hrs 14 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x284c223e2a2ddeb290bddb9089764e8da71ba8654797818b2beeb113e798a921249039492021-05-18 2:38:3218 hrs 14 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x284c223e2a2ddeb290bddb9089764e8da71ba8654797818b2beeb113e798a921249039492021-05-18 2:38:3218 hrs 14 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x284c223e2a2ddeb290bddb9089764e8da71ba8654797818b2beeb113e798a921249039492021-05-18 2:38:3218 hrs 14 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x284c223e2a2ddeb290bddb9089764e8da71ba8654797818b2beeb113e798a921249039492021-05-18 2:38:3218 hrs 14 mins ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x2f5a3f1f63460e01688440cca53f796dc829e85286a51f8964a8fc7833f341fa248966052021-05-17 18:28:361 day 2 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x2f5a3f1f63460e01688440cca53f796dc829e85286a51f8964a8fc7833f341fa248966052021-05-17 18:28:361 day 2 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x2f5a3f1f63460e01688440cca53f796dc829e85286a51f8964a8fc7833f341fa248966052021-05-17 18:28:361 day 2 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x2f5a3f1f63460e01688440cca53f796dc829e85286a51f8964a8fc7833f341fa248966052021-05-17 18:28:361 day 2 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0x2f5a3f1f63460e01688440cca53f796dc829e85286a51f8964a8fc7833f341fa248966052021-05-17 18:28:361 day 2 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0xb26023710c5699f5ff551e03bcfb17b3cb2bf1a028c45584224df36216aa57ef248892612021-05-17 10:18:361 day 10 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0xb26023710c5699f5ff551e03bcfb17b3cb2bf1a028c45584224df36216aa57ef248892612021-05-17 10:18:361 day 10 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0xb26023710c5699f5ff551e03bcfb17b3cb2bf1a028c45584224df36216aa57ef248892612021-05-17 10:18:361 day 10 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0xb26023710c5699f5ff551e03bcfb17b3cb2bf1a028c45584224df36216aa57ef248892612021-05-17 10:18:361 day 10 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
0xb26023710c5699f5ff551e03bcfb17b3cb2bf1a028c45584224df36216aa57ef248892612021-05-17 10:18:361 day 10 hrs ago 0x53bae964339e8a742b5b47f6c10bbfa8ff138f34 0x8d65ed88d6162a2b3b5f71c45d433d4aeac930650 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CollateralManagerState

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-12-23
*/

/*
   ____            __   __        __   _
  / __/__ __ ___  / /_ / /  ___  / /_ (_)__ __
 _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
     /___/

* Synthetix: CollateralManagerState.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/CollateralManagerState.sol
* Docs: https://docs.synthetix.io/contracts/CollateralManagerState
*
* Contract Dependencies: 
*	- Owned
*	- State
* Libraries: 
*	- SafeDecimalMath
*	- SafeMath
*
* MIT License
* ===========
*
* Copyright (c) 2020 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/



pragma solidity ^0.5.16;


// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
    address public owner;
    address public nominatedOwner;

    constructor(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}


// Inheritance


// https://docs.synthetix.io/contracts/source/contracts/state
contract State is Owned {
    // the address of the contract that can modify variables
    // this can only be changed by the owner of this contract
    address public associatedContract;

    constructor(address _associatedContract) internal {
        // This contract is abstract, and thus cannot be instantiated directly
        require(owner != address(0), "Owner must be set");

        associatedContract = _associatedContract;
        emit AssociatedContractUpdated(_associatedContract);
    }

    /* ========== SETTERS ========== */

    // Change the associated contract to a new address
    function setAssociatedContract(address _associatedContract) external onlyOwner {
        associatedContract = _associatedContract;
        emit AssociatedContractUpdated(_associatedContract);
    }

    /* ========== MODIFIERS ========== */

    modifier onlyAssociatedContract {
        require(msg.sender == associatedContract, "Only the associated contract can perform this action");
        _;
    }

    /* ========== EVENTS ========== */

    event AssociatedContractUpdated(address associatedContract);
}


/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring '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;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, "SafeMath: division by zero");
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0, "SafeMath: modulo by zero");
        return a % b;
    }
}


// Libraries


// https://docs.synthetix.io/contracts/source/libraries/safedecimalmath
library SafeDecimalMath {
    using SafeMath for uint;

    /* Number of decimal places in the representations. */
    uint8 public constant decimals = 18;
    uint8 public constant highPrecisionDecimals = 27;

    /* The number representing 1.0. */
    uint public constant UNIT = 10**uint(decimals);

    /* The number representing 1.0 for higher fidelity numbers. */
    uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals);
    uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals);

    /**
     * @return Provides an interface to UNIT.
     */
    function unit() external pure returns (uint) {
        return UNIT;
    }

    /**
     * @return Provides an interface to PRECISE_UNIT.
     */
    function preciseUnit() external pure returns (uint) {
        return PRECISE_UNIT;
    }

    /**
     * @return The result of multiplying x and y, interpreting the operands as fixed-point
     * decimals.
     *
     * @dev A unit factor is divided out after the product of x and y is evaluated,
     * so that product must be less than 2**256. As this is an integer division,
     * the internal division always rounds down. This helps save on gas. Rounding
     * is more expensive on gas.
     */
    function multiplyDecimal(uint x, uint y) internal pure returns (uint) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        return x.mul(y) / UNIT;
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of the specified precision unit.
     *
     * @dev The operands should be in the form of a the specified unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function _multiplyDecimalRound(
        uint x,
        uint y,
        uint precisionUnit
    ) private pure returns (uint) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        uint quotientTimesTen = x.mul(y) / (precisionUnit / 10);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen += 10;
        }

        return quotientTimesTen / 10;
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of a precise unit.
     *
     * @dev The operands should be in the precise unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
        return _multiplyDecimalRound(x, y, PRECISE_UNIT);
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of a standard unit.
     *
     * @dev The operands should be in the standard unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) {
        return _multiplyDecimalRound(x, y, UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is a high
     * precision decimal.
     *
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and UNIT must be less than 2**256. As
     * this is an integer division, the result is always rounded down.
     * This helps save on gas. Rounding is more expensive on gas.
     */
    function divideDecimal(uint x, uint y) internal pure returns (uint) {
        /* Reintroduce the UNIT factor that will be divided out by y. */
        return x.mul(UNIT).div(y);
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * decimal in the precision unit specified in the parameter.
     *
     * @dev y is divided after the product of x and the specified precision unit
     * is evaluated, so the product of x and the specified precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function _divideDecimalRound(
        uint x,
        uint y,
        uint precisionUnit
    ) private pure returns (uint) {
        uint resultTimesTen = x.mul(precisionUnit * 10).div(y);

        if (resultTimesTen % 10 >= 5) {
            resultTimesTen += 10;
        }

        return resultTimesTen / 10;
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * standard precision decimal.
     *
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and the standard precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function divideDecimalRound(uint x, uint y) internal pure returns (uint) {
        return _divideDecimalRound(x, y, UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * high precision decimal.
     *
     * @dev y is divided after the product of x and the high precision unit
     * is evaluated, so the product of x and the high precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
        return _divideDecimalRound(x, y, PRECISE_UNIT);
    }

    /**
     * @dev Convert a standard decimal representation to a high precision one.
     */
    function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
        return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
    }

    /**
     * @dev Convert a high precision decimal to a standard decimal representation.
     */
    function preciseDecimalToDecimal(uint i) internal pure returns (uint) {
        uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen += 10;
        }

        return quotientTimesTen / 10;
    }
}


pragma experimental ABIEncoderV2;

// Inheritance


// Libraries


contract CollateralManagerState is Owned, State {
    using SafeMath for uint;
    using SafeDecimalMath for uint;

    struct Balance {
        uint long;
        uint short;
    }

    uint public totalLoans;

    uint[] public borrowRates;
    uint public borrowRatesLastUpdated;

    mapping(bytes32 => uint[]) public shortRates;
    mapping(bytes32 => uint) public shortRatesLastUpdated;

    // The total amount of long and short for a synth,
    mapping(bytes32 => Balance) public totalIssuedSynths;

    constructor(address _owner, address _associatedContract) public Owned(_owner) State(_associatedContract) {
        borrowRates.push(0);
        borrowRatesLastUpdated = block.timestamp;
    }

    function incrementTotalLoans() external onlyAssociatedContract returns (uint) {
        totalLoans = totalLoans.add(1);
        return totalLoans;
    }

    function long(bytes32 synth) external view onlyAssociatedContract returns (uint) {
        return totalIssuedSynths[synth].long;
    }

    function short(bytes32 synth) external view onlyAssociatedContract returns (uint) {
        return totalIssuedSynths[synth].short;
    }

    function incrementLongs(bytes32 synth, uint256 amount) external onlyAssociatedContract {
        totalIssuedSynths[synth].long = totalIssuedSynths[synth].long.add(amount);
    }

    function decrementLongs(bytes32 synth, uint256 amount) external onlyAssociatedContract {
        totalIssuedSynths[synth].long = totalIssuedSynths[synth].long.sub(amount);
    }

    function incrementShorts(bytes32 synth, uint256 amount) external onlyAssociatedContract {
        totalIssuedSynths[synth].short = totalIssuedSynths[synth].short.add(amount);
    }

    function decrementShorts(bytes32 synth, uint256 amount) external onlyAssociatedContract {
        totalIssuedSynths[synth].short = totalIssuedSynths[synth].short.sub(amount);
    }

    // Borrow rates, one array here for all currencies.

    function getRateAt(uint index) public view returns (uint) {
        return borrowRates[index];
    }

    function getRatesLength() public view returns (uint) {
        return borrowRates.length;
    }

    function updateBorrowRates(uint rate) external onlyAssociatedContract {
        borrowRates.push(rate);
        borrowRatesLastUpdated = block.timestamp;
    }

    function ratesLastUpdated() public view returns (uint) {
        return borrowRatesLastUpdated;
    }

    function getRatesAndTime(uint index)
        external
        view
        returns (
            uint entryRate,
            uint lastRate,
            uint lastUpdated,
            uint newIndex
        )
    {
        newIndex = getRatesLength();
        entryRate = getRateAt(index);
        lastRate = getRateAt(newIndex - 1);
        lastUpdated = ratesLastUpdated();
    }

    // Short rates, one array per currency.

    function addShortCurrency(bytes32 currency) external onlyAssociatedContract {
        if (shortRates[currency].length > 0) {} else {
            shortRates[currency].push(0);
            shortRatesLastUpdated[currency] = block.timestamp;
        }
    }

    function removeShortCurrency(bytes32 currency) external onlyAssociatedContract {
        delete shortRates[currency];
    }

    function getShortRateAt(bytes32 currency, uint index) internal view returns (uint) {
        return shortRates[currency][index];
    }

    function getShortRatesLength(bytes32 currency) public view returns (uint) {
        return shortRates[currency].length;
    }

    function updateShortRates(bytes32 currency, uint rate) external onlyAssociatedContract {
        shortRates[currency].push(rate);
        shortRatesLastUpdated[currency] = block.timestamp;
    }

    function shortRateLastUpdated(bytes32 currency) internal view returns (uint) {
        return shortRatesLastUpdated[currency];
    }

    function getShortRatesAndTime(bytes32 currency, uint index)
        external
        view
        returns (
            uint entryRate,
            uint lastRate,
            uint lastUpdated,
            uint newIndex
        )
    {
        newIndex = getShortRatesLength(currency);
        entryRate = getShortRateAt(currency, index);
        lastRate = getShortRateAt(currency, newIndex - 1);
        lastUpdated = shortRateLastUpdated(currency);
    }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_associatedContract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"associatedContract","type":"address"}],"name":"AssociatedContractUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currency","type":"bytes32"}],"name":"addShortCurrency","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"associatedContract","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"borrowRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatesLastUpdated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"synth","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"decrementLongs","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"synth","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"decrementShorts","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRateAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRatesAndTime","outputs":[{"internalType":"uint256","name":"entryRate","type":"uint256"},{"internalType":"uint256","name":"lastRate","type":"uint256"},{"internalType":"uint256","name":"lastUpdated","type":"uint256"},{"internalType":"uint256","name":"newIndex","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRatesLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"currency","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getShortRatesAndTime","outputs":[{"internalType":"uint256","name":"entryRate","type":"uint256"},{"internalType":"uint256","name":"lastRate","type":"uint256"},{"internalType":"uint256","name":"lastUpdated","type":"uint256"},{"internalType":"uint256","name":"newIndex","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"currency","type":"bytes32"}],"name":"getShortRatesLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"synth","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"incrementLongs","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"synth","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"incrementShorts","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"incrementTotalLoans","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"synth","type":"bytes32"}],"name":"long","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ratesLastUpdated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currency","type":"bytes32"}],"name":"removeShortCurrency","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_associatedContract","type":"address"}],"name":"setAssociatedContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"synth","type":"bytes32"}],"name":"short","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"shortRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"shortRatesLastUpdated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"totalIssuedSynths","outputs":[{"internalType":"uint256","name":"long","type":"uint256"},{"internalType":"uint256","name":"short","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalLoans","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"rate","type":"uint256"}],"name":"updateBorrowRates","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currency","type":"bytes32"},{"internalType":"uint256","name":"rate","type":"uint256"}],"name":"updateShortRates","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620011b2380380620011b2833981016040819052620000349162000190565b80826001600160a01b038116620000685760405162461bcd60e51b81526004016200005f906200029d565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0383161781556040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91620000b591849062000265565b60405180910390a1506000546001600160a01b0316620000e95760405162461bcd60e51b81526004016200005f906200028b565b600280546001600160a01b0319166001600160a01b0383161790556040517f73f20cff579e8a4086fa607db83867595f1b6a798e718c0bfa0b94a404128e03906200013690839062000255565b60405180910390a150506004805460018101825560009182527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01555042600555620002f8565b80516200018a81620002de565b92915050565b60008060408385031215620001a457600080fd5b6000620001b285856200017d565b9250506020620001c5858286016200017d565b9150509250929050565b620001da81620002ca565b82525050565b620001da81620002b8565b6000620001fa601183620002af565b7013dddb995c881b5d5cdd081899481cd95d607a1b815260200192915050565b600062000229601983620002af565b7f4f776e657220616464726573732063616e6e6f74206265203000000000000000815260200192915050565b602081016200018a8284620001e0565b60408101620002758285620001cf565b620002846020830184620001e0565b9392505050565b602080825281016200018a81620001eb565b602080825281016200018a816200021a565b90815260200190565b60006001600160a01b0382166200018a565b60006200018a8260006200018a82620002b8565b620002e981620002b8565b8114620002f557600080fd5b50565b610eaa80620003086000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80638c58250311610104578063cc952b57116100a2578063e50a31b311610071578063e50a31b31461038f578063eb94bbde146103a2578063ed039154146103b5578063f53037b6146103c8576101cf565b8063cc952b571461034e578063d2f0047514610356578063e31f27c114610369578063e32261fe1461037c576101cf565b8063a29fe7b8116100de578063a29fe7b81461030d578063aefc4ccb14610320578063af07aa9d14610328578063b52e0dc81461033b576101cf565b80638c582503146102ea5780638da5cb5b146102f2578063a0356f6e146102fa576101cf565b806352f445ca116101715780636431e0bd1161014b5780636431e0bd146102a6578063781dc0e2146102b957806379ba5097146102c157806383d625d4146102c9576101cf565b806352f445ca1461026b57806353a47bb71461027e5780635537479914610293576101cf565b806322e07b7a116101ad57806322e07b7a14610235578063246206391461023d578063381c5cb5146102505780635246f2b914610258576101cf565b806303f048b0146101d45780631627540c14610200578063173fcb4114610215575b600080fd5b6101e76101e2366004610b70565b6103db565b6040516101f79493929190610df2565b60405180910390f35b61021361020e366004610b4a565b610415565b005b610228610223366004610b8e565b610473565b6040516101f79190610dc9565b6102286104a1565b61021361024b366004610b8e565b6104a7565b61022861050d565b610213610266366004610b8e565b610514565b610213610279366004610b4a565b610579565b6102866105cc565b6040516101f79190610d50565b6102286102a1366004610b70565b6105db565b6102136102b4366004610b70565b6105ed565b610228610631565b610213610637565b6102dc6102d7366004610b70565b6106d3565b6040516101f7929190610dd7565b6102286106ec565b610286610737565b610228610308366004610b70565b610746565b61022861031b366004610b70565b610758565b610286610776565b6101e7610336366004610b8e565b610785565b610228610349366004610b70565b6107c5565b6102286107e6565b610228610364366004610b70565b6107ec565b610213610377366004610b8e565b61082c565b61022861038a366004610b70565b610878565b61021361039d366004610b8e565b6108bb565b6102136103b0366004610b8e565b61091a565b6102136103c3366004610b70565b610963565b6102136103d6366004610b70565b6109d6565b6000806000806103e961050d565b90506103f4856107c5565b9350610402600182036107c5565b925061040c610631565b91509193509193565b61041d610a39565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290610468908390610d50565b60405180910390a150565b6006602052816000526040600020818154811061048c57fe5b90600052602060002001600091509150505481565b60055481565b6002546001600160a01b031633146104da5760405162461bcd60e51b81526004016104d190610db9565b60405180910390fd5b60008281526006602090815260408083208054600181018255908452828420019390935592815260079092529020429055565b6004545b90565b6002546001600160a01b0316331461053e5760405162461bcd60e51b81526004016104d190610db9565b600082815260086020526040902060010154610560908263ffffffff610a6516565b6000928352600860205260409092206001019190915550565b610581610a39565b600280546001600160a01b0319166001600160a01b0383161790556040517f73f20cff579e8a4086fa607db83867595f1b6a798e718c0bfa0b94a404128e0390610468908390610d50565b6001546001600160a01b031681565b60076020526000908152604090205481565b6002546001600160a01b031633146106175760405162461bcd60e51b81526004016104d190610db9565b600081815260066020526040812061062e91610afd565b50565b60055490565b6001546001600160a01b031633146106615760405162461bcd60e51b81526004016104d190610d79565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c926106a4926001600160a01b0391821692911690610d5e565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6008602052600090815260409020805460019091015482565b6002546000906001600160a01b031633146107195760405162461bcd60e51b81526004016104d190610db9565b60035461072d90600163ffffffff610a9216565b6003819055905090565b6000546001600160a01b031681565b60009081526006602052604090205490565b6004818154811061076557fe5b600091825260209091200154905081565b6002546001600160a01b031681565b60008060008061079486610746565b90506107a08686610abe565b93506107af8660018303610abe565b92506107ba86610aeb565b915092959194509250565b6000600482815481106107d457fe5b90600052602060002001549050919050565b60035481565b6002546000906001600160a01b031633146108195760405162461bcd60e51b81526004016104d190610db9565b5060009081526008602052604090205490565b6002546001600160a01b031633146108565760405162461bcd60e51b81526004016104d190610db9565b600082815260086020526040902060010154610560908263ffffffff610a9216565b6002546000906001600160a01b031633146108a55760405162461bcd60e51b81526004016104d190610db9565b5060009081526008602052604090206001015490565b6002546001600160a01b031633146108e55760405162461bcd60e51b81526004016104d190610db9565b600082815260086020526040902054610904908263ffffffff610a6516565b6000928352600860205260409092209190915550565b6002546001600160a01b031633146109445760405162461bcd60e51b81526004016104d190610db9565b600082815260086020526040902054610904908263ffffffff610a9216565b6002546001600160a01b0316331461098d5760405162461bcd60e51b81526004016104d190610db9565b600081815260066020526040902054156109a65761062e565b60008181526006602090815260408083208054600181018255908452828420018390559282526007905220429055565b6002546001600160a01b03163314610a005760405162461bcd60e51b81526004016104d190610db9565b600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b015542600555565b6000546001600160a01b03163314610a635760405162461bcd60e51b81526004016104d190610da9565b565b600082821115610a875760405162461bcd60e51b81526004016104d190610d99565b508082035b92915050565b600082820183811015610ab75760405162461bcd60e51b81526004016104d190610d89565b9392505050565b6000828152600660205260408120805483908110610ad857fe5b9060005260206000200154905092915050565b60009081526007602052604090205490565b508054600082559060005260206000209081019061062e919061051191905b80821115610b305760008155600101610b1c565b5090565b8035610a8c81610e4a565b8035610a8c81610e5e565b600060208284031215610b5c57600080fd5b6000610b688484610b34565b949350505050565b600060208284031215610b8257600080fd5b6000610b688484610b3f565b60008060408385031215610ba157600080fd5b6000610bad8585610b3f565b9250506020610bbe85828601610b3f565b9150509250929050565b610bd181610e39565b82525050565b6000610be4603583610e30565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b6000610c3b601b83610e30565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000610c74601e83610e30565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000610cad602f83610e30565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b6000610cfe603483610e30565b7f4f6e6c7920746865206173736f63696174656420636f6e74726163742063616e815273103832b93337b936903a3434b99030b1ba34b7b760611b602082015260400192915050565b610bd181610511565b60208101610a8c8284610bc8565b60408101610d6c8285610bc8565b610ab76020830184610bc8565b60208082528101610a8c81610bd7565b60208082528101610a8c81610c2e565b60208082528101610a8c81610c67565b60208082528101610a8c81610ca0565b60208082528101610a8c81610cf1565b60208101610a8c8284610d47565b60408101610de58285610d47565b610ab76020830184610d47565b60808101610e008287610d47565b610e0d6020830186610d47565b610e1a6040830185610d47565b610e276060830184610d47565b95945050505050565b90815260200190565b60006001600160a01b038216610a8c565b610e5381610e39565b811461062e57600080fd5b610e538161051156fea365627a7a7231582091503a827566fb95d584f2050719a607ef349a163fcecc6fa8da3f5f578977266c6578706572696d656e74616cf564736f6c63430005100040000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882

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

000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882

-----Decoded View---------------
Arg [0] : _owner (address): 0xb64ff7a4a33acdf48d97dab0d764afd0f6176882
Arg [1] : _associatedContract (address): 0xb64ff7a4a33acdf48d97dab0d764afd0f6176882

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


Library Used

SafeDecimalMath : 0x1a60e2e2a8be0bc2b6381dd31fd3fd5f9a28de4c

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading