ETH Price: $3,392.93 (-1.31%)
Gas: 12 Gwei

Contract

0xBA42BE149e5260EbA4B82418A6306f55D532eA47
 
Transaction Hash
Method
Block
From
To
0x60c06040143226802022-03-04 20:33:34866 days ago1646426014IN
 Create: OlympusProInverseBondCreator
0 ETH0.0675379648.38528163

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OlympusProInverseBondCreator

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 12 : OlympusProInverseBondCreator.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.6;

import {EnumerableMap} from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";

import "./types/OlympusAccessControlled.sol";
import "./interfaces/IOlympusAuthority.sol";
import "./interfaces/IOlympusPro.sol";
import "./interfaces/ITreasury.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IOHM.sol";

contract OlympusProInverseBondCreator is OlympusAccessControlled {
    using EnumerableMap for EnumerableMap.UintToAddressMap;

    IOlympusPro public depository;
    ITreasury public treasury;
    IOHM public ohm;

    EnumerableMap.UintToAddressMap private markets;

    constructor(IOHM _ohm, ITreasury _treasury, IOlympusPro _depository, IOlympusAuthority _authority)
        OlympusAccessControlled(_authority)
    {
        ohm = _ohm;
        treasury = _treasury;
        depository = _depository;
    }

    // creates a market selling reserves for ohm
    // bonds have no vesting (executes an instant swap)
    // see IProMarketCreator for _market and _intervals arguments
    // _conclusion is concluding timestamp
    function create(
        IERC20 _token,
        uint256[4] memory _market, 
        uint32[2] memory _intervals,
        uint256 _conclusion
    ) onlyPolicy external {
        IERC20[2] memory tokens = [_token, ohm];
        bool[2] memory booleans = [false, true];
        uint256[2] memory terms = [0, _conclusion];

        treasury.manage(address(_token), _market[0]);

        // approve tokens on depository and treasury (for return if needed)
        // add to the current allowances since there can be multiple markets
        _token.approve(address(depository), _market[0] + _token.allowance(address(this), address(depository)));
        _token.approve(address(treasury), _market[0] + _token.allowance(address(this), address(treasury)));

        uint256 id = depository.create(
            tokens, 
            _market, 
            booleans, 
            terms, 
            _intervals
        );

        markets.set(id, address(_token));
    }

    // Sets the treasury address to call manage on
    function setTreasury(address _treasury) external onlyPolicy {
        treasury = ITreasury(_treasury);
    }

    // halt all markets by revoking approval
    function halt(uint256 _id) external onlyPolicy {
        IERC20 token = IERC20(markets.get(_id));
        token.approve(address(depository), 0);
    }

    // close a market 
    function close(uint256 _id) external onlyPolicy {
        markets.remove(_id);
        depository.close(_id);
    }

    // burn repurchased ohm
    function burn() external onlyPolicy {
        ohm.burn(ohm.balanceOf(address(this)));
    }

    // return the rest of the tokens in this contract
    function returnReserve(address _token, uint256 amount) external onlyPolicy {
        treasury.deposit(amount, _token, treasury.tokenValue(_token, amount));
    }

    // function to get all active markets created by this contract
    function getMarkets() external view returns (uint256[] memory, address[] memory) {
        uint256 length = markets.length();
        uint256[] memory activeMarketIds = new uint256[](length);
        address[] memory activeMarketTokens = new address[](length);

        for (uint256 i = 0; i < length; i++) {
            (activeMarketIds[i], activeMarketTokens[i]) = markets.at(i);
        }

        return (activeMarketIds, activeMarketTokens);
    }
}

File 2 of 12 : EnumerableMap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./EnumerableSet.sol";

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct Map {
        // Storage of keys
        EnumerableSet.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(
        Map storage map,
        bytes32 key,
        bytes32 value
    ) private returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function _remove(Map storage map, bytes32 key) private returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function _contains(Map storage map, bytes32 key) private view returns (bool) {
        return map._keys.contains(key);
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._keys.length();
    }

    /**
     * @dev Returns the key-value pair stored at position `index` in the map. O(1).
     *
     * Note that there are no guarantees on the ordering of entries inside the
     * array, and it may change when more entries are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
        bytes32 key = map._keys.at(index);
        return (key, map._values[key]);
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
        bytes32 value = map._values[key];
        if (value == bytes32(0)) {
            return (_contains(map, key), bytes32(0));
        } else {
            return (true, value);
        }
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || _contains(map, key), "EnumerableMap: nonexistent key");
        return value;
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function _get(
        Map storage map,
        bytes32 key,
        string memory errorMessage
    ) private view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || _contains(map, key), errorMessage);
        return value;
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        UintToAddressMap storage map,
        uint256 key,
        address value
    ) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
        return _remove(map._inner, bytes32(key));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
        return _contains(map._inner, bytes32(key));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return _length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the set. O(1).
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint160(uint256(value))));
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToAddressMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
    }
}

File 3 of 12 : OlympusAccessControlled.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.7.5;

import "../interfaces/IOlympusAuthority.sol";

abstract contract OlympusAccessControlled {

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

    event AuthorityUpdated(IOlympusAuthority indexed authority);

    string UNAUTHORIZED = "UNAUTHORIZED"; // save gas

    /* ========== STATE VARIABLES ========== */

    IOlympusAuthority public authority;


    /* ========== Constructor ========== */

    constructor(IOlympusAuthority _authority) {
        authority = _authority;
        emit AuthorityUpdated(_authority);
    }
    

    /* ========== MODIFIERS ========== */
    
    modifier onlyGovernor() {
        require(msg.sender == authority.governor(), UNAUTHORIZED);
        _;
    }
    
    modifier onlyGuardian() {
        require(msg.sender == authority.guardian(), UNAUTHORIZED);
        _;
    }
    
    modifier onlyPolicy() {
        require(msg.sender == authority.policy(), UNAUTHORIZED);
        _;
    }

    modifier onlyVault() {
        require(msg.sender == authority.vault(), UNAUTHORIZED);
        _;
    }
    
    /* ========== GOV ONLY ========== */
    
    function setAuthority(IOlympusAuthority _newAuthority) external onlyGovernor {
        authority = _newAuthority;
        emit AuthorityUpdated(_newAuthority);
    }
}

File 4 of 12 : IOlympusAuthority.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.7.5;

interface IOlympusAuthority {
    /* ========== EVENTS ========== */
    
    event GovernorPushed(address indexed from, address indexed to, bool _effectiveImmediately);
    event GuardianPushed(address indexed from, address indexed to, bool _effectiveImmediately);    
    event PolicyPushed(address indexed from, address indexed to, bool _effectiveImmediately);    
    event VaultPushed(address indexed from, address indexed to, bool _effectiveImmediately);    

    event GovernorPulled(address indexed from, address indexed to);
    event GuardianPulled(address indexed from, address indexed to);
    event PolicyPulled(address indexed from, address indexed to);
    event VaultPulled(address indexed from, address indexed to);

    /* ========== VIEW ========== */
    
    function governor() external view returns (address);
    function guardian() external view returns (address);
    function policy() external view returns (address);
    function vault() external view returns (address);
}

File 5 of 12 : IOlympusPro.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.6;

import "./IProMarketCreator.sol";
import "./IProNoteKeeper.sol";
import "./IProViewer.sol";

interface IOlympusPro is IProMarketCreator, IProNoteKeeper, IProViewer {

  /**
   * @notice deposit quote tokens in exchange for a bond in a specified market
   */
  function deposit(
    uint48 _id,
    uint256[2] memory _amounts,
    address[2] memory _addresses
  ) external returns (
    uint256 payout_,
    uint256 expiry_,
    uint256 index_
  );
}

File 6 of 12 : ITreasury.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.7.5;

interface ITreasury {
    function deposit(
        uint256 _amount,
        address _token,
        uint256 _profit
    ) external returns (uint256);

    function withdraw(uint256 _amount, address _token) external;

    function tokenValue(address _token, uint256 _amount) external view returns (uint256 value_);

    function mint(address _recipient, uint256 _amount) external;

    function manage(address _token, uint256 _amount) external;

    function incurDebt(uint256 amount_, address token_) external;

    function repayDebtWithReserve(uint256 amount_, address token_) external;

    function excessReserves() external view returns (uint256);

    function baseSupply() external view returns (uint256);
}

File 7 of 12 : IERC20.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.7.5;

interface IERC20 {
  /**
   * @dev Returns the amount of tokens in existence.
   */
  function totalSupply() external view returns (uint256);

  /**
   * @dev Returns the amount of tokens owned by `account`.
   */
  function balanceOf(address account) external view returns (uint256);

  /**
   * @dev Moves `amount` tokens from the caller's account to `recipient`.
   *
   * Returns a boolean value indicating whether the operation succeeded.
   *
   * Emits a {Transfer} event.
   */
  function transfer(address recipient, uint256 amount) external returns (bool);

  /**
   * @dev Returns the remaining number of tokens that `spender` will be
   * allowed to spend on behalf of `owner` through {transferFrom}. This is
   * zero by default.
   *
   * This value changes when {approve} or {transferFrom} are called.
   */
  function allowance(address owner, address spender) external view returns (uint256);

  /**
   * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
   *
   * Returns a boolean value indicating whether the operation succeeded.
   *
   * IMPORTANT: Beware that changing an allowance with this method brings the risk
   * that someone may use both the old and the new allowance by unfortunate
   * transaction ordering. One possible solution to mitigate this race
   * condition is to first reduce the spender's allowance to 0 and set the
   * desired value afterwards:
   * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
   *
   * Emits an {Approval} event.
   */
  function approve(address spender, uint256 amount) external returns (bool);

  /**
   * @dev Moves `amount` tokens from `sender` to `recipient` using the
   * allowance mechanism. `amount` is then deducted from the caller's
   * allowance.
   *
   * Returns a boolean value indicating whether the operation succeeded.
   *
   * Emits a {Transfer} event.
   */
  function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

  /**
   * @dev Emitted when `value` tokens are moved from one account (`from`) to
   * another (`to`).
   *
   * Note that `value` may be zero.
   */
  event Transfer(address indexed from, address indexed to, uint256 value);

  /**
   * @dev Emitted when the allowance of a `spender` for an `owner` is set by
   * a call to {approve}. `value` is the new allowance.
   */
  event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 8 of 12 : IOHM.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.7.5;

import "./IERC20.sol";

interface IOHM is IERC20 {
  function mint(address account_, uint256 amount_) external;

  function burn(uint256 amount) external;

  function burnFrom(address account_, uint256 amount_) external;
}

File 9 of 12 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 10 of 12 : IProMarketCreator.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.6;

import "./IERC20.sol";

interface IProMarketCreator {

  // Info about each type of market
  struct Market {
    address creator; // market creator. sends base tokens, receives quote tokens
    IERC20 baseToken; // token to pay depositors with
    IERC20 quoteToken; // token to accept as payment
    bool call; // perform custom call for payout
    bool capacityInQuote; // capacity limit is in payment token (true) or in OHM (false, default)
    uint256 capacity; // capacity remaining
    uint256 totalDebt; // total base token debt from market
    uint256 minPrice; // minimum price (debt will stop decaying to maintain this)
    uint256 maxPayout; // max base tokens out in one order
    uint256 sold; // base tokens out
    uint256 purchased; // quote tokens in
  }

  // Info for creating new markets
  struct Terms {
    uint256 controlVariable; // scaling variable for price
    uint256 maxDebt; // max base token debt accrued
    bool fixedTerm; // fixed term or fixed expiration
    uint48 vesting; // length of time from deposit to maturity if fixed-term
    uint48 conclusion; // timestamp when market no longer offered (doubles as time when market matures if fixed-expiry)
  }

  // Additional info about market.
  struct Metadata {
    uint48 lastTune; // last timestamp when control variable was tuned
    uint48 lastDecay; // last timestamp when market was created and debt was decayed
    uint48 length; // time from creation to conclusion. used as speed to decay debt.
    uint48 depositInterval; // target frequency of deposits
    uint48 tuneInterval; // frequency of tuning
    uint8 baseDecimals; // decimals of base token
    uint8 quoteDecimals; // decimals of quote token
  }

  // Control variable adjustment data
  struct Adjustment {
    uint128 change;
    uint48 lastAdjustment;
    uint48 timeToAdjusted;
    bool active;
  }

  function create (
    IERC20[2] memory _tokens, // [base token, quote token]
    uint256[4] memory _market, // [capacity, initial price, minimum price, debt buffer]
    bool[2] memory _booleans, // [capacity in quote, fixed term]
    uint256[2] memory _terms, // [vesting, conclusion]
    uint32[2] memory _intervals // [deposit interval, tune interval]
  ) external returns (uint256 id_);

  function close(uint256 _id) external;
}

File 11 of 12 : IProNoteKeeper.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.6;

import "./IERC20.sol";

interface IProNoteKeeper {
  // Info for market note
  struct Note {
    uint256 payout; // gOHM remaining to be paid
    uint48 created; // time market was created
    uint48 matured; // timestamp when market is matured
    uint48 redeemed; // time market was redeemed
    uint48 marketID; // market ID of deposit. uint48 to avoid adding a slot.
    address token; // token to be paid.
  }

  function redeem(address _user, uint256[] memory _indexes) external;
  function redeemAll(address _user) external;
  function pushNote(address to, uint256 index) external;
  function pullNote(address from, uint256 index) external returns (uint256 newIndex_);

  function indexesFor(address _user) external view returns (uint256[] memory);
  function pendingFor(address _user, uint256 _index) external view returns (uint256 payout_, bool matured_);
}

File 12 of 12 : IProViewer.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.6;

interface IProViewer {
  function isLive(uint256 _bid) external view returns (bool);
  function liveMarkets() external view returns (uint256[] memory);
  function liveMarketsFor(bool _creator, bool _base, address _address) external view returns (uint256[] memory);
  function payoutFor(uint256 _amount, uint256 _bid) external view returns (uint256);
  function marketPrice(uint256 _bid) external view returns (uint256);
  function currentDebt(uint256 _bid) external view returns (uint256);
}

Settings
{
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 800
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IOHM","name":"_ohm","type":"address"},{"internalType":"contract ITreasury","name":"_treasury","type":"address"},{"internalType":"contract IOlympusPro","name":"_depository","type":"address"},{"internalType":"contract IOlympusAuthority","name":"_authority","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IOlympusAuthority","name":"authority","type":"address"}],"name":"AuthorityUpdated","type":"event"},{"inputs":[],"name":"authority","outputs":[{"internalType":"contract IOlympusAuthority","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"close","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256[4]","name":"_market","type":"uint256[4]"},{"internalType":"uint32[2]","name":"_intervals","type":"uint32[2]"},{"internalType":"uint256","name":"_conclusion","type":"uint256"}],"name":"create","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depository","outputs":[{"internalType":"contract IOlympusPro","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMarkets","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"halt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ohm","outputs":[{"internalType":"contract IOHM","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"returnReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOlympusAuthority","name":"_newAuthority","type":"address"}],"name":"setAuthority","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"contract ITreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60c0604052600c60808190526b15539055551213d49256915160a21b60a09081526200002f9160009190620000ef565b503480156200003d57600080fd5b5060405162001876380380620018768339810160408190526200006091620001ae565b600180546001600160a01b0319166001600160a01b0383169081179091556040518291907f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad90600090a25050600480546001600160a01b039485166001600160a01b03199182161790915560038054938516938216939093179092556002805491909316911617905562000253565b828054620000fd9062000216565b90600052602060002090601f0160209004810192826200012157600085556200016c565b82601f106200013c57805160ff19168380011785556200016c565b828001600101855582156200016c579182015b828111156200016c5782518255916020019190600101906200014f565b506200017a9291506200017e565b5090565b5b808211156200017a57600081556001016200017f565b6001600160a01b0381168114620001ab57600080fd5b50565b60008060008060808587031215620001c557600080fd5b8451620001d28162000195565b6020860151909450620001e58162000195565b6040860151909350620001f88162000195565b60608601519092506200020b8162000195565b939692955090935050565b600181811c908216806200022b57607f821691505b602082108114156200024d57634e487b7160e01b600052602260045260246000fd5b50919050565b61161380620002636000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80637a9e5e4b11610081578063ec2c90161161005b578063ec2c901614610198578063f0f44260146101ae578063fb1fad50146101c157600080fd5b80637a9e5e4b1461015f578063bedd12a514610172578063bf7e214f1461018557600080fd5b806341fd89ff116100b257806341fd89ff1461013157806344df8e701461014457806361d027b31461014c57600080fd5b806302b1d239146100d95780630aebeb4e14610109578063283fac491461011e575b600080fd5b6004546100ec906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61011c610117366004611122565b6101d4565b005b61011c61012c366004611153565b6102f6565b61011c61013f3660046111fd565b61049f565b61011c61087f565b6003546100ec906001600160a01b031681565b61011c61016d3660046112d6565b6109f2565b6002546100ec906001600160a01b031681565b6001546100ec906001600160a01b031681565b6101a0610af5565b6040516101009291906112f3565b61011c6101bc3660046112d6565b610c16565b61011c6101cf366004611122565b610cf1565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610227573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024b9190611377565b6001600160a01b0316336001600160a01b0316146000906102885760405162461bcd60e51b815260040161027f9190611394565b60405180910390fd5b50610294600582610e23565b50600254604051630575f5a760e11b8152600481018390526001600160a01b0390911690630aebeb4e90602401600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b5050505050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610349573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036d9190611377565b6001600160a01b0316336001600160a01b0316146000906103a15760405162461bcd60e51b815260040161027f9190611394565b5060035460405163f182178360e01b81526001600160a01b038481166004830152602482018490529091169063bc157ac19083908590849063f182178390604401602060405180830381865afa1580156103ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610423919061143c565b6040516001600160e01b031960e086901b16815260048101939093526001600160a01b03909116602483015260448201526064016020604051808303816000875af1158015610476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a919061143c565b505050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105169190611377565b6001600160a01b0316336001600160a01b03161460009061054a5760405162461bcd60e51b815260040161027f9190611394565b506040805180820182526001600160a01b03868116808352600480548316602080860191909152855180870187526000808252600182840152875180890189529081529182018890526003548a51975162b0eee360e41b8152938401949094526024830196909652939493929190911690630b0eee3090604401600060405180830381600087803b1580156105de57600080fd5b505af11580156105f2573d6000803e3d6000fd5b5050600254604051636eb1769f60e11b81523060048201526001600160a01b0391821660248201819052918b16935063095ea7b39250839063dd62ed3e90604401602060405180830381865afa158015610650573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610674919061143c565b89516106809190611481565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156106cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ef9190611499565b50600354604051636eb1769f60e11b81523060048201526001600160a01b03918216602482018190529189169163095ea7b391839063dd62ed3e90604401602060405180830381865afa15801561074a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076e919061143c565b895161077a9190611481565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156107c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e99190611499565b5060025460405163fabcbb7b60e01b81526000916001600160a01b03169063fabcbb7b906108239087908b90889088908d9060040161152c565b6020604051808303816000875af1158015610842573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610866919061143c565b90506108746005828a610e38565b505050505050505050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f69190611377565b6001600160a01b0316336001600160a01b03161460009061092a5760405162461bcd60e51b815260040161027f9190611394565b50600480546040516370a0823160e01b815230928101929092526001600160a01b0316906342966c689082906370a0823190602401602060405180830381865afa15801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a0919061143c565b6040518263ffffffff1660e01b81526004016109be91815260200190565b600060405180830381600087803b1580156109d857600080fd5b505af11580156109ec573d6000803e3d6000fd5b50505050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190611377565b6001600160a01b0316336001600160a01b031614600090610a9d5760405162461bcd60e51b815260040161027f9190611394565b506001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad90600090a250565b6060806000610b046005610e56565b905060008167ffffffffffffffff811115610b2157610b2161117f565b604051908082528060200260200182016040528015610b4a578160200160208202803683370190505b50905060008267ffffffffffffffff811115610b6857610b6861117f565b604051908082528060200260200182016040528015610b91578160200160208202803683370190505b50905060005b83811015610c0b57610baa600582610e61565b848381518110610bbc57610bbc611455565b60200260200101848481518110610bd557610bd5611455565b60200260200101826001600160a01b03166001600160a01b03168152508281525050508080610c03906115be565b915050610b97565b509094909350915050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8d9190611377565b6001600160a01b0316336001600160a01b031614600090610cc15760405162461bcd60e51b815260040161027f9190611394565b506003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190611377565b6001600160a01b0316336001600160a01b031614600090610d9c5760405162461bcd60e51b815260040161027f9190611394565b506000610daa600583610e7d565b60025460405163095ea7b360e01b81526001600160a01b0391821660048201526000602482015291925082169063095ea7b3906044016020604051808303816000875af1158015610dff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a9190611499565b6000610e2f8383610e89565b90505b92915050565b6000610e4e84846001600160a01b038516610ea6565b949350505050565b6000610e3282610ec3565b6000808080610e708686610ece565b9097909650945050505050565b6000610e2f8383610ef9565b60008181526002830160205260408120819055610e2f8383610f69565b60008281526002840160205260408120829055610e4e8484610f75565b6000610e3282610f81565b60008080610edc8585610f8b565b600081815260029690960160205260409095205494959350505050565b600081815260028301602052604081205480151580610f1d5750610f1d8484610f97565b610e2f5760405162461bcd60e51b815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b65790000604482015260640161027f565b6000610e2f8383610fb6565b6000610e2f83836110a9565b6000610e32825490565b6000610e2f83836110f8565b6000610e2f838360008181526001830160205260408120541515610e2f565b6000818152600183016020526040812054801561109f576000610fda6001836115d9565b8554909150600090610fee906001906115d9565b905081811461105357600086600001828154811061100e5761100e611455565b906000526020600020015490508087600001848154811061103157611031611455565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611064576110646115f0565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e32565b6000915050610e32565b60008181526001830160205260408120546110f057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e32565b506000610e32565b600082600001828154811061110f5761110f611455565b9060005260206000200154905092915050565b60006020828403121561113457600080fd5b5035919050565b6001600160a01b038116811461115057600080fd5b50565b6000806040838503121561116657600080fd5b82356111718161113b565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff811182821017156111c657634e487b7160e01b600052604160045260246000fd5b60405290565b6040805190810167ffffffffffffffff811182821017156111c657634e487b7160e01b600052604160045260246000fd5b600080600080610100858703121561121457600080fd5b843561121f8161113b565b93506020603f8601871361123257600080fd5b61123a611195565b8060a088018981111561124c57600080fd5b8389015b818110156112675780358452928401928401611250565b508196508960bf8a011261127a57600080fd5b6112826111cc565b925082915060e089018a81111561129857600080fd5b808210156112c457813563ffffffff811681146112b55760008081fd5b84529284019290840190611298565b979a9699509097505094359450505050565b6000602082840312156112e857600080fd5b8135610e2f8161113b565b604080825283519082018190526000906020906060840190828701845b8281101561132c57815184529284019290840190600101611310565b5050508381038285015284518082528583019183019060005b8181101561136a5783516001600160a01b031683529284019291840191600101611345565b5090979650505050505050565b60006020828403121561138957600080fd5b8151610e2f8161113b565b600060208083526000845481600182811c9150808316806113b657607f831692505b8583108114156113d457634e487b7160e01b85526022600452602485fd5b8786018381526020018180156113f157600181146114025761142d565b60ff1986168252878201965061142d565b60008b81526020902060005b868110156114275781548482015290850190890161140e565b83019750505b50949998505050505050505050565b60006020828403121561144e57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156114945761149461146b565b500190565b6000602082840312156114ab57600080fd5b81518015158114610e2f57600080fd5b8060005b60028110156109ec57815115158452602093840193909101906001016114bf565b8060005b60028110156109ec5781518452602093840193909101906001016114e4565b8060005b60028110156109ec57815163ffffffff16845260209384019390910190600101611507565b6101808101818760005b600281101561155e5781516001600160a01b0316835260209283019290910190600101611536565b505050604082018660005b6004811015611588578151835260209283019290910190600101611569565b50505061159860c08301866114bb565b6115a66101008301856114e0565b6115b4610140830184611503565b9695505050505050565b60006000198214156115d2576115d261146b565b5060010190565b6000828210156115eb576115eb61146b565b500390565b634e487b7160e01b600052603160045260246000fdfea164736f6c634300080a000a00000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d50000000000000000000000009a315bdf513367c0377fb36545857d12e85813ef00000000000000000000000022ae99d07584a2ae1af748de573c83f1b9cdb4c00000000000000000000000001c21f8ea7e39e2ba00bc12d2968d63f4acb38b7a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100d45760003560e01c80637a9e5e4b11610081578063ec2c90161161005b578063ec2c901614610198578063f0f44260146101ae578063fb1fad50146101c157600080fd5b80637a9e5e4b1461015f578063bedd12a514610172578063bf7e214f1461018557600080fd5b806341fd89ff116100b257806341fd89ff1461013157806344df8e701461014457806361d027b31461014c57600080fd5b806302b1d239146100d95780630aebeb4e14610109578063283fac491461011e575b600080fd5b6004546100ec906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61011c610117366004611122565b6101d4565b005b61011c61012c366004611153565b6102f6565b61011c61013f3660046111fd565b61049f565b61011c61087f565b6003546100ec906001600160a01b031681565b61011c61016d3660046112d6565b6109f2565b6002546100ec906001600160a01b031681565b6001546100ec906001600160a01b031681565b6101a0610af5565b6040516101009291906112f3565b61011c6101bc3660046112d6565b610c16565b61011c6101cf366004611122565b610cf1565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610227573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024b9190611377565b6001600160a01b0316336001600160a01b0316146000906102885760405162461bcd60e51b815260040161027f9190611394565b60405180910390fd5b50610294600582610e23565b50600254604051630575f5a760e11b8152600481018390526001600160a01b0390911690630aebeb4e90602401600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b5050505050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610349573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036d9190611377565b6001600160a01b0316336001600160a01b0316146000906103a15760405162461bcd60e51b815260040161027f9190611394565b5060035460405163f182178360e01b81526001600160a01b038481166004830152602482018490529091169063bc157ac19083908590849063f182178390604401602060405180830381865afa1580156103ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610423919061143c565b6040516001600160e01b031960e086901b16815260048101939093526001600160a01b03909116602483015260448201526064016020604051808303816000875af1158015610476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a919061143c565b505050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105169190611377565b6001600160a01b0316336001600160a01b03161460009061054a5760405162461bcd60e51b815260040161027f9190611394565b506040805180820182526001600160a01b03868116808352600480548316602080860191909152855180870187526000808252600182840152875180890189529081529182018890526003548a51975162b0eee360e41b8152938401949094526024830196909652939493929190911690630b0eee3090604401600060405180830381600087803b1580156105de57600080fd5b505af11580156105f2573d6000803e3d6000fd5b5050600254604051636eb1769f60e11b81523060048201526001600160a01b0391821660248201819052918b16935063095ea7b39250839063dd62ed3e90604401602060405180830381865afa158015610650573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610674919061143c565b89516106809190611481565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156106cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ef9190611499565b50600354604051636eb1769f60e11b81523060048201526001600160a01b03918216602482018190529189169163095ea7b391839063dd62ed3e90604401602060405180830381865afa15801561074a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076e919061143c565b895161077a9190611481565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156107c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e99190611499565b5060025460405163fabcbb7b60e01b81526000916001600160a01b03169063fabcbb7b906108239087908b90889088908d9060040161152c565b6020604051808303816000875af1158015610842573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610866919061143c565b90506108746005828a610e38565b505050505050505050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f69190611377565b6001600160a01b0316336001600160a01b03161460009061092a5760405162461bcd60e51b815260040161027f9190611394565b50600480546040516370a0823160e01b815230928101929092526001600160a01b0316906342966c689082906370a0823190602401602060405180830381865afa15801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a0919061143c565b6040518263ffffffff1660e01b81526004016109be91815260200190565b600060405180830381600087803b1580156109d857600080fd5b505af11580156109ec573d6000803e3d6000fd5b50505050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190611377565b6001600160a01b0316336001600160a01b031614600090610a9d5760405162461bcd60e51b815260040161027f9190611394565b506001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad90600090a250565b6060806000610b046005610e56565b905060008167ffffffffffffffff811115610b2157610b2161117f565b604051908082528060200260200182016040528015610b4a578160200160208202803683370190505b50905060008267ffffffffffffffff811115610b6857610b6861117f565b604051908082528060200260200182016040528015610b91578160200160208202803683370190505b50905060005b83811015610c0b57610baa600582610e61565b848381518110610bbc57610bbc611455565b60200260200101848481518110610bd557610bd5611455565b60200260200101826001600160a01b03166001600160a01b03168152508281525050508080610c03906115be565b915050610b97565b509094909350915050565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8d9190611377565b6001600160a01b0316336001600160a01b031614600090610cc15760405162461bcd60e51b815260040161027f9190611394565b506003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600160009054906101000a90046001600160a01b03166001600160a01b0316630505c8c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190611377565b6001600160a01b0316336001600160a01b031614600090610d9c5760405162461bcd60e51b815260040161027f9190611394565b506000610daa600583610e7d565b60025460405163095ea7b360e01b81526001600160a01b0391821660048201526000602482015291925082169063095ea7b3906044016020604051808303816000875af1158015610dff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a9190611499565b6000610e2f8383610e89565b90505b92915050565b6000610e4e84846001600160a01b038516610ea6565b949350505050565b6000610e3282610ec3565b6000808080610e708686610ece565b9097909650945050505050565b6000610e2f8383610ef9565b60008181526002830160205260408120819055610e2f8383610f69565b60008281526002840160205260408120829055610e4e8484610f75565b6000610e3282610f81565b60008080610edc8585610f8b565b600081815260029690960160205260409095205494959350505050565b600081815260028301602052604081205480151580610f1d5750610f1d8484610f97565b610e2f5760405162461bcd60e51b815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b65790000604482015260640161027f565b6000610e2f8383610fb6565b6000610e2f83836110a9565b6000610e32825490565b6000610e2f83836110f8565b6000610e2f838360008181526001830160205260408120541515610e2f565b6000818152600183016020526040812054801561109f576000610fda6001836115d9565b8554909150600090610fee906001906115d9565b905081811461105357600086600001828154811061100e5761100e611455565b906000526020600020015490508087600001848154811061103157611031611455565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611064576110646115f0565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e32565b6000915050610e32565b60008181526001830160205260408120546110f057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e32565b506000610e32565b600082600001828154811061110f5761110f611455565b9060005260206000200154905092915050565b60006020828403121561113457600080fd5b5035919050565b6001600160a01b038116811461115057600080fd5b50565b6000806040838503121561116657600080fd5b82356111718161113b565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff811182821017156111c657634e487b7160e01b600052604160045260246000fd5b60405290565b6040805190810167ffffffffffffffff811182821017156111c657634e487b7160e01b600052604160045260246000fd5b600080600080610100858703121561121457600080fd5b843561121f8161113b565b93506020603f8601871361123257600080fd5b61123a611195565b8060a088018981111561124c57600080fd5b8389015b818110156112675780358452928401928401611250565b508196508960bf8a011261127a57600080fd5b6112826111cc565b925082915060e089018a81111561129857600080fd5b808210156112c457813563ffffffff811681146112b55760008081fd5b84529284019290840190611298565b979a9699509097505094359450505050565b6000602082840312156112e857600080fd5b8135610e2f8161113b565b604080825283519082018190526000906020906060840190828701845b8281101561132c57815184529284019290840190600101611310565b5050508381038285015284518082528583019183019060005b8181101561136a5783516001600160a01b031683529284019291840191600101611345565b5090979650505050505050565b60006020828403121561138957600080fd5b8151610e2f8161113b565b600060208083526000845481600182811c9150808316806113b657607f831692505b8583108114156113d457634e487b7160e01b85526022600452602485fd5b8786018381526020018180156113f157600181146114025761142d565b60ff1986168252878201965061142d565b60008b81526020902060005b868110156114275781548482015290850190890161140e565b83019750505b50949998505050505050505050565b60006020828403121561144e57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156114945761149461146b565b500190565b6000602082840312156114ab57600080fd5b81518015158114610e2f57600080fd5b8060005b60028110156109ec57815115158452602093840193909101906001016114bf565b8060005b60028110156109ec5781518452602093840193909101906001016114e4565b8060005b60028110156109ec57815163ffffffff16845260209384019390910190600101611507565b6101808101818760005b600281101561155e5781516001600160a01b0316835260209283019290910190600101611536565b505050604082018660005b6004811015611588578151835260209283019290910190600101611569565b50505061159860c08301866114bb565b6115a66101008301856114e0565b6115b4610140830184611503565b9695505050505050565b60006000198214156115d2576115d261146b565b5060010190565b6000828210156115eb576115eb61146b565b500390565b634e487b7160e01b600052603160045260246000fdfea164736f6c634300080a000a

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

00000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d50000000000000000000000009a315bdf513367c0377fb36545857d12e85813ef00000000000000000000000022ae99d07584a2ae1af748de573c83f1b9cdb4c00000000000000000000000001c21f8ea7e39e2ba00bc12d2968d63f4acb38b7a

-----Decoded View---------------
Arg [0] : _ohm (address): 0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5
Arg [1] : _treasury (address): 0x9A315BdF513367C0377FB36545857d12e85813Ef
Arg [2] : _depository (address): 0x22AE99D07584A2AE1af748De573c83f1B9Cdb4c0
Arg [3] : _authority (address): 0x1c21F8EA7e39E2BA00BC12d2968D63F4acb38b7A

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5
Arg [1] : 0000000000000000000000009a315bdf513367c0377fb36545857d12e85813ef
Arg [2] : 00000000000000000000000022ae99d07584a2ae1af748de573c83f1b9cdb4c0
Arg [3] : 0000000000000000000000001c21f8ea7e39e2ba00bc12d2968d63f4acb38b7a


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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