Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Sponsored
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
MiltonSpreadModelUsdc
Compiler Version
v0.8.15+commit.e14f2714
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2022-11-05 */ // SPDX-License-Identifier: BUSL-1.1 // File: contracts/interfaces/IMiltonSpreadInternal.sol pragma solidity 0.8.15; /// @title Interface for interacting with Milton Spread - for internal use. interface IMiltonSpreadInternal { /// @notice Gets Base in Region 1 for Pay Fixed - Receive Floating leg /// @return base in region 1 for pay fixed - receive floating leg represented in 18 decimals function getPayFixedRegionOneBase() external view returns (int256); /// @notice Gets slope factor 1 for volatility in Region 1 for Pay Fixed - Receive Floating leg /// @return slope factor 1 for volatility in region 1 for pay fixed - receive floating leg represented in 18 decimals function getPayFixedRegionOneSlopeForVolatility() external view returns (int256); /// @notice Gets slope factor 2 for mean reversion in Region 1 for Pay Fixed - Receive Floating leg /// @return slope factor 2 for mean reversion in region 1 for pay fixed - receive floating leg represented in 18 decimals function getPayFixedRegionOneSlopeForMeanReversion() external view returns (int256); /// @notice Gets Base in Region 2 for Pay Fixed - Receive Floating leg /// @return base in region 2 for pay fixed - receive floating leg represented in 18 decimals function getPayFixedRegionTwoBase() external view returns (int256); /// @notice Gets slope factor 1 for volatility in Region 2 for Pay Fixed - Receive Floating leg /// @return slope factor 1 for volatility in region 2 for pay fixed - receive floating leg represented in 18 decimals function getPayFixedRegionTwoSlopeForVolatility() external view returns (int256); /// @notice Gets slope factor 2 for mean reversion in Region 2 for Pay Fixed - Receive Floating leg /// @return slope factor 2 for mean reversion in region 2 for pay fixed - receive floating leg represented in 18 decimals function getPayFixedRegionTwoSlopeForMeanReversion() external view returns (int256); /// @notice Gets Base in Region 1 for Receive Fixed - Pay Floating leg /// @return base in region 1 for receive fixed - pay floating leg represented in 18 decimals function getReceiveFixedRegionOneBase() external view returns (int256); /// @notice Gets slope factor 1 for volatility in Region 1 for Receive Fixed - Pay Floating leg /// @return slope factor 1 for volatility in region 1 for receive fixed - pay floating leg represented in 18 decimals function getReceiveFixedRegionOneSlopeForVolatility() external view returns (int256); /// @notice Gets slope factor 2 for mean reversion in Region 1 for Receive Fixed - Pay Floating leg /// @return slope factor 2 for mean reversion in region 1 for receive fixed - pay floating leg represented in 18 decimals function getReceiveFixedRegionOneSlopeForMeanReversion() external view returns (int256); /// @notice Gets Base in Region 2 for Receive Fixed - Pay Floating leg /// @return base in region 2 for receive fixed - pay floating leg represented in 18 decimals function getReceiveFixedRegionTwoBase() external view returns (int256); /// @notice Gets slope factor 1 for volatility in Region 2 for Receive Fixed - Pay Floating leg /// @return slope factor 1 for volatility in region 2 for receive fixed - pay floating leg represented in 18 decimals function getReceiveFixedRegionTwoSlopeForVolatility() external view returns (int256); /// @notice Gets slope factor 2 for mean reversion in Region 2 for Receive Fixed - Pay Floating leg /// @return slope factor 2 for mean reversion in region 2 for receive fixed - pay floating leg represented in 18 decimals function getReceiveFixedRegionTwoSlopeForMeanReversion() external view returns (int256); } // File: contracts/libraries/errors/IporErrors.sol pragma solidity 0.8.15; library IporErrors { // 000-199 - general codes /// @notice General problem, address is wrong string public constant WRONG_ADDRESS = "IPOR_000"; /// @notice General problem. Wrong decimals string public constant WRONG_DECIMALS = "IPOR_001"; string public constant ADDRESSES_MISMATCH = "IPOR_002"; //@notice Trader doesnt have enought tokens to execute transaction string public constant ASSET_BALANCE_TOO_LOW = "IPOR_003"; string public constant VALUE_NOT_GREATER_THAN_ZERO = "IPOR_004"; string public constant INPUT_ARRAYS_LENGTH_MISMATCH = "IPOR_005"; //@notice Amount is too low to transfer string public constant NOT_ENOUGH_AMOUNT_TO_TRANSFER = "IPOR_006"; //@notice msg.sender is not an appointed owner, so cannot confirm his appointment to be an owner of a specific smart contract string public constant SENDER_NOT_APPOINTED_OWNER = "IPOR_007"; //only milton can have access to function string public constant CALLER_NOT_MILTON = "IPOR_008"; string public constant CHUNK_SIZE_EQUAL_ZERO = "IPOR_009"; string public constant CHUNK_SIZE_TOO_BIG = "IPOR_010"; } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: contracts/security/IporOwnable.sol pragma solidity 0.8.15; contract IporOwnable is Ownable { address private _appointedOwner; event AppointedToTransferOwnership(address indexed appointedOwner); function transferOwnership(address appointedOwner) public override onlyOwner { require(appointedOwner != address(0), IporErrors.WRONG_ADDRESS); _appointedOwner = appointedOwner; emit AppointedToTransferOwnership(appointedOwner); } function confirmTransferOwnership() external onlyAppointedOwner { _appointedOwner = address(0); _transferOwnership(_msgSender()); } modifier onlyAppointedOwner() { require(_appointedOwner == _msgSender(), IporErrors.SENDER_NOT_APPOINTED_OWNER); _; } } // File: contracts/libraries/math/IporMath.sol pragma solidity 0.8.15; library IporMath { //@notice Division with rounding up on last position, x, and y is with MD function division(uint256 x, uint256 y) internal pure returns (uint256 z) { z = (x + (y / 2)) / y; } function divisionInt(int256 x, int256 y) internal pure returns (int256 z) { z = (x + (y / 2)) / y; } function divisionWithoutRound(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x / y; } function convertWadToAssetDecimals(uint256 value, uint256 assetDecimals) internal pure returns (uint256) { if (assetDecimals == 18) { return value; } else if (assetDecimals > 18) { return value * 10**(assetDecimals - 18); } else { return division(value, 10**(18 - assetDecimals)); } } function convertToWad(uint256 value, uint256 assetDecimals) internal pure returns (uint256) { if (value > 0) { if (assetDecimals == 18) { return value; } else if (assetDecimals > 18) { return division(value, 10**(assetDecimals - 18)); } else { return value * 10**(18 - assetDecimals); } } else { return value; } } function absoluteValue(int256 value) internal pure returns (uint256) { return (uint256)(value < 0 ? -value : value); } function percentOf(uint256 value, uint256 rate) internal pure returns (uint256) { return division(value * rate, 1e18); } } // File: contracts/libraries/Constants.sol pragma solidity 0.8.15; library Constants { uint256 public constant MAX_VALUE = 115792089237316195423570985008687907853269984665640564039457584007913129639935; uint256 public constant D18 = 1e18; int256 public constant D18_INT = 1e18; uint256 public constant D36 = 1e36; uint256 public constant D54 = 1e54; uint256 public constant YEAR_IN_SECONDS = 365 days; uint256 public constant WAD_YEAR_IN_SECONDS = D18 * YEAR_IN_SECONDS; int256 public constant WAD_YEAR_IN_SECONDS_INT = int256(WAD_YEAR_IN_SECONDS); uint256 public constant WAD_P2_YEAR_IN_SECONDS = D18 * D18 * YEAR_IN_SECONDS; int256 public constant WAD_P2_YEAR_IN_SECONDS_INT = int256(WAD_P2_YEAR_IN_SECONDS); uint256 public constant MAX_CHUNK_SIZE = 50; //@notice By default every swap takes 28 days, this variable show this value in seconds uint256 public constant SWAP_DEFAULT_PERIOD_IN_SECONDS = 60 * 60 * 24 * 28; } // File: @openzeppelin/contracts/utils/math/SafeCast.sol // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol) pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such 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. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248) { require(value >= type(int248).min && value <= type(int248).max, "SafeCast: value doesn't fit in 248 bits"); return int248(value); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240) { require(value >= type(int240).min && value <= type(int240).max, "SafeCast: value doesn't fit in 240 bits"); return int240(value); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232) { require(value >= type(int232).min && value <= type(int232).max, "SafeCast: value doesn't fit in 232 bits"); return int232(value); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224) { require(value >= type(int224).min && value <= type(int224).max, "SafeCast: value doesn't fit in 224 bits"); return int224(value); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216) { require(value >= type(int216).min && value <= type(int216).max, "SafeCast: value doesn't fit in 216 bits"); return int216(value); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208) { require(value >= type(int208).min && value <= type(int208).max, "SafeCast: value doesn't fit in 208 bits"); return int208(value); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200) { require(value >= type(int200).min && value <= type(int200).max, "SafeCast: value doesn't fit in 200 bits"); return int200(value); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192) { require(value >= type(int192).min && value <= type(int192).max, "SafeCast: value doesn't fit in 192 bits"); return int192(value); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184) { require(value >= type(int184).min && value <= type(int184).max, "SafeCast: value doesn't fit in 184 bits"); return int184(value); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176) { require(value >= type(int176).min && value <= type(int176).max, "SafeCast: value doesn't fit in 176 bits"); return int176(value); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168) { require(value >= type(int168).min && value <= type(int168).max, "SafeCast: value doesn't fit in 168 bits"); return int168(value); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160) { require(value >= type(int160).min && value <= type(int160).max, "SafeCast: value doesn't fit in 160 bits"); return int160(value); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152) { require(value >= type(int152).min && value <= type(int152).max, "SafeCast: value doesn't fit in 152 bits"); return int152(value); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144) { require(value >= type(int144).min && value <= type(int144).max, "SafeCast: value doesn't fit in 144 bits"); return int144(value); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136) { require(value >= type(int136).min && value <= type(int136).max, "SafeCast: value doesn't fit in 136 bits"); return int136(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120) { require(value >= type(int120).min && value <= type(int120).max, "SafeCast: value doesn't fit in 120 bits"); return int120(value); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112) { require(value >= type(int112).min && value <= type(int112).max, "SafeCast: value doesn't fit in 112 bits"); return int112(value); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104) { require(value >= type(int104).min && value <= type(int104).max, "SafeCast: value doesn't fit in 104 bits"); return int104(value); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96) { require(value >= type(int96).min && value <= type(int96).max, "SafeCast: value doesn't fit in 96 bits"); return int96(value); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88) { require(value >= type(int88).min && value <= type(int88).max, "SafeCast: value doesn't fit in 88 bits"); return int88(value); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80) { require(value >= type(int80).min && value <= type(int80).max, "SafeCast: value doesn't fit in 80 bits"); return int80(value); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72) { require(value >= type(int72).min && value <= type(int72).max, "SafeCast: value doesn't fit in 72 bits"); return int72(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56) { require(value >= type(int56).min && value <= type(int56).max, "SafeCast: value doesn't fit in 56 bits"); return int56(value); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48) { require(value >= type(int48).min && value <= type(int48).max, "SafeCast: value doesn't fit in 48 bits"); return int48(value); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40) { require(value >= type(int40).min && value <= type(int40).max, "SafeCast: value doesn't fit in 40 bits"); return int40(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24) { require(value >= type(int24).min && value <= type(int24).max, "SafeCast: value doesn't fit in 24 bits"); return int24(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } } // File: contracts/amm/spread/MiltonSpreadInternal.sol pragma solidity 0.8.15; abstract contract MiltonSpreadInternal is IporOwnable, IMiltonSpreadInternal { using SafeCast for int256; using SafeCast for uint256; function getPayFixedRegionOneBase() external view override returns (int256) { return _getPayFixedRegionOneBase(); } function getPayFixedRegionOneSlopeForVolatility() external view override returns (int256) { return _getPayFixedRegionOneSlopeForVolatility(); } function getPayFixedRegionOneSlopeForMeanReversion() external view override returns (int256) { return _getPayFixedRegionOneSlopeForMeanReversion(); } function getPayFixedRegionTwoBase() external view override returns (int256) { return _getPayFixedRegionTwoBase(); } function getPayFixedRegionTwoSlopeForVolatility() external view override returns (int256) { return _getPayFixedRegionTwoSlopeForVolatility(); } function getPayFixedRegionTwoSlopeForMeanReversion() external view override returns (int256) { return _getPayFixedRegionTwoSlopeForMeanReversion(); } function getReceiveFixedRegionOneBase() external view override returns (int256) { return _getReceiveFixedRegionOneBase(); } function getReceiveFixedRegionOneSlopeForVolatility() external view override returns (int256) { return _getReceiveFixedRegionOneSlopeForVolatility(); } function getReceiveFixedRegionOneSlopeForMeanReversion() external view override returns (int256) { return _getReceiveFixedRegionOneSlopeForMeanReversion(); } function getReceiveFixedRegionTwoBase() external view override returns (int256) { return _getReceiveFixedRegionTwoBase(); } function getReceiveFixedRegionTwoSlopeForVolatility() external view override returns (int256) { return _getReceiveFixedRegionTwoSlopeForVolatility(); } function getReceiveFixedRegionTwoSlopeForMeanReversion() external view override returns (int256) { return _getReceiveFixedRegionTwoSlopeForMeanReversion(); } function _getPayFixedRegionOneBase() internal view virtual returns (int256); function _getPayFixedRegionOneSlopeForVolatility() internal view virtual returns (int256); function _getPayFixedRegionOneSlopeForMeanReversion() internal view virtual returns (int256); function _getPayFixedRegionTwoBase() internal view virtual returns (int256); function _getPayFixedRegionTwoSlopeForVolatility() internal view virtual returns (int256); function _getPayFixedRegionTwoSlopeForMeanReversion() internal view virtual returns (int256); function _getReceiveFixedRegionOneBase() internal view virtual returns (int256); function _getReceiveFixedRegionOneSlopeForVolatility() internal view virtual returns (int256); function _getReceiveFixedRegionOneSlopeForMeanReversion() internal view virtual returns (int256); function _getReceiveFixedRegionTwoBase() internal view virtual returns (int256); function _getReceiveFixedRegionTwoSlopeForVolatility() internal view virtual returns (int256); function _getReceiveFixedRegionTwoSlopeForMeanReversion() internal view virtual returns (int256); } // File: contracts/interfaces/types/IporTypes.sol pragma solidity 0.8.15; /// @title Struct used across various interfaces in IPOR Protocol. library IporTypes { /// @notice The struct describing the IPOR and its params calculated for the time when it was most recently updated and the change that took place since the update. /// Namely, the interest that would be computed into IBT should the rebalance occur. struct AccruedIpor { /// @notice IPOR Index Value /// @dev value represented in 18 decimals uint256 indexValue; /// @notice IBT Price (IBT - Interest Bearing Token). For more information reffer to the documentation: /// https://ipor-labs.gitbook.io/ipor-labs/interest-rate-derivatives/ibt /// @dev value represented in 18 decimals uint256 ibtPrice; /// @notice Exponential Moving Average /// @dev value represented in 18 decimals uint256 exponentialMovingAverage; /// @notice Exponential Weighted Moving Variance /// @dev value represented in 18 decimals uint256 exponentialWeightedMovingVariance; } /// @notice Struct representing swap item, used for listing and in internal calculations struct IporSwapMemory { /// @notice Swap's unique ID uint256 id; /// @notice Swap's buyer address buyer; /// @notice Swap opening epoch timestamp uint256 openTimestamp; /// @notice Epoch when the swap will reach its maturity uint256 endTimestamp; /// @notice Index position of this Swap in an array of swaps' identification associated to swap buyer /// @dev Field used for gas optimization purposes, it allows for quick removal by id in the array. /// During removal the last item in the array is switched with the one that just has been removed. uint256 idsIndex; /// @notice Swap's collateral /// @dev value represented in 18 decimals uint256 collateral; /// @notice Swap's notional amount /// @dev value represented in 18 decimals uint256 notional; /// @notice Swap's notional amount denominated in the Interest Bearing Token (IBT) /// @dev value represented in 18 decimals uint256 ibtQuantity; /// @notice Fixed interest rate at which the position has been opened /// @dev value represented in 18 decimals uint256 fixedInterestRate; /// @notice Liquidation deposit amount /// @dev value represented in 18 decimals uint256 liquidationDepositAmount; /// @notice State of the swap /// @dev 0 - INACTIVE, 1 - ACTIVE uint256 state; } /// @notice Struct representing balances used internally for asset calculations /// @dev all balances in 18 decimals struct MiltonBalancesMemory { /// @notice Sum of all collateral put forward by the derivative buyer's on Pay Fixed & Receive Floating leg. uint256 totalCollateralPayFixed; /// @notice Sum of all collateral put forward by the derivative buyer's on Pay Floating & Receive Fixed leg. uint256 totalCollateralReceiveFixed; /// @notice Liquidity Pool Balance. This balance is where the liquidity from liquidity providers and the opening fee are accounted for, /// @dev Amount of opening fee accounted in this balance is defined by _OPENING_FEE_FOR_TREASURY_PORTION_RATE param. uint256 liquidityPool; /// @notice Vault's balance, describes how much asset has been transfered to Asset Management Vault (Stanley) uint256 vault; } } // File: contracts/interfaces/IMiltonSpreadModel.sol pragma solidity 0.8.15; /// @title Interface for interaction with Milton Spread Model smart contract. interface IMiltonSpreadModel { /// @notice Calculates the quote for Pay-Fixed leg. /// @param accruedIpor - interest accrued by IPOR at the moment of calculation /// @param accruedBalance - Milton balance including Stanley's interest and collateral if present /// @return quoteValue calculated quote for Pay Fixed leg function calculateQuotePayFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) external view returns (uint256 quoteValue); /// @notice Calculates the quote for Receive-Fixed leg. /// @param accruedIpor - accrued IPOR at moment of calculation /// @param accruedBalance - Milton's balance including Stanley's interest and collateral if present /// @return quoteValue calculated quote for Receive-Fixed leg function calculateQuoteReceiveFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) external view returns (uint256 quoteValue); /// @notice Calculates the spread for Pay-Fixed leg. /// @param accruedIpor - interest accrued by IPOR at the moment of calculation /// @param accruedBalance - Milton's balance including Stanley's interest and collateral if present /// @return spreadValue calculated spread for Pay-Fixed leg function calculateSpreadPayFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) external view returns (int256 spreadValue); /// @notice Calculates the spread for Receive-Fixed leg. /// @param accruedIpor - interest accrued by IPOR at the moment of calculation /// @param accruedBalance - Milton's balance including Stanley's interest and collateral if present /// @return spreadValue calculated spread for Receive-Fixed leg function calculateSpreadReceiveFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) external view returns (int256 spreadValue); } // File: contracts/libraries/errors/MiltonErrors.sol pragma solidity 0.8.15; /// @title Errors which occur inside Milton's method execution. library MiltonErrors { // 300-399-milton /// @notice Liquidity Pool balance is equal 0. string public constant LIQUIDITY_POOL_IS_EMPTY = "IPOR_300"; /// @notice Liquidity Pool balance is too low, should be equal or higher than 0. string public constant LIQUIDITY_POOL_AMOUNT_TOO_LOW = "IPOR_301"; /// @notice Liquidity Pool Utilization exceeded. Liquidity Pool utilization is higher than configured in Milton maximum liquidity pool utilization. string public constant LP_UTILIZATION_EXCEEDED = "IPOR_302"; /// @notice Liquidity Pool Utilization Per Leg exceeded. Liquidity Pool utilization per leg is higher than configured in Milton maximu liquidity pool utilization per leg. string public constant LP_UTILIZATION_PER_LEG_EXCEEDED = "IPOR_303"; /// @notice Liquidity Pool Balance is too high string public constant LIQUIDITY_POOL_BALANCE_IS_TOO_HIGH = "IPOR_304"; /// @notice Liquidity Pool account contribution is too high. string public constant LP_ACCOUNT_CONTRIBUTION_IS_TOO_HIGH = "IPOR_305"; /// @notice Swap id used in input has incorrect value (like 0) or not exists. string public constant INCORRECT_SWAP_ID = "IPOR_306"; /// @notice Swap has incorrect status. string public constant INCORRECT_SWAP_STATUS = "IPOR_307"; /// @notice Leverage given as a parameter when opening swap is lower than configured in Milton minimum leverage. string public constant LEVERAGE_TOO_LOW = "IPOR_308"; /// @notice Leverage given as a parameter when opening swap is higher than configured in Milton maxumum leverage. string public constant LEVERAGE_TOO_HIGH = "IPOR_309"; /// @notice Total amount given as a parameter when opening swap is too low. Cannot be equal zero. string public constant TOTAL_AMOUNT_TOO_LOW = "IPOR_310"; /// @notice Total amount given as a parameter when opening swap is lower than sum of liquidation deposit amount and ipor publication fee. string public constant TOTAL_AMOUNT_LOWER_THAN_FEE = "IPOR_311"; /// @notice Amount of collateral used to open swap is higher than configured in Milton max swap collateral amount string public constant COLLATERAL_AMOUNT_TOO_HIGH = "IPOR_312"; /// @notice Acceptable fixed interest rate defined by traded exceeded. string public constant ACCEPTABLE_FIXED_INTEREST_RATE_EXCEEDED = "IPOR_313"; /// @notice Swap Notional Amount is higher than Total Notional for specific leg. string public constant SWAP_NOTIONAL_HIGHER_THAN_TOTAL_NOTIONAL = "IPOR_314"; /// @notice Number of swaps per leg which are going to be liquidated is too high, is higher than configured in Milton liquidation leg limit. string public constant LIQUIDATION_LEG_LIMIT_EXCEEDED = "IPOR_315"; /// @notice Sum of SOAP and Liquidity Pool Balance is lower than zero. /// @dev SOAP can be negative, Sum of SOAP and Liquidity Pool Balance can be negative, but this is undesirable. string public constant SOAP_AND_LP_BALANCE_SUM_IS_TOO_LOW = "IPOR_316"; /// @notice Calculation timestamp is earlier than last SOAP rebalance timestamp. string public constant CALC_TIMESTAMP_LOWER_THAN_SOAP_REBALANCE_TIMESTAMP = "IPOR_317"; /// @notice Calculation timestamp is lower than Swap's open timestamp. string public constant CALC_TIMESTAMP_LOWER_THAN_SWAP_OPEN_TIMESTAMP = "IPOR_318"; /// @notice Closing timestamp is lower than Swap's open timestamp. string public constant CLOSING_TIMESTAMP_LOWER_THAN_SWAP_OPEN_TIMESTAMP = "IPOR_319"; /// @notice Swap cannot be closed because liquidity pool is too low for payid out cash. Situation should never happen where Liquidity Pool is insolvent. string public constant CANNOT_CLOSE_SWAP_LP_IS_TOO_LOW = "IPOR_320"; /// @notice Swap cannot be closed because sender is not an owner of derivative and derivative maturity not achieved. string public constant CANNOT_CLOSE_SWAP_SENDER_IS_NOT_BUYER_AND_NO_MATURITY = "IPOR_321"; /// @notice Interest from Strategy is below zero. string public constant INTEREST_FROM_STRATEGY_BELOW_ZERO = "IPOR_322"; /// @notice Accrued Liquidity Pool is equal zero. string public constant LIQUIDITY_POOL_ACCRUED_IS_EQUAL_ZERO = "IPOR_323"; /// @notice During spread calculation - Exponential Weighted Moving Variance cannot be higher than 1. string public constant SPREAD_EMVAR_CANNOT_BE_HIGHER_THAN_ONE = "IPOR_324"; /// @notice During spread calculation - Alpha param cannot be higher than 1. string public constant SPREAD_ALPHA_CANNOT_BE_HIGHER_THAN_ONE = "IPOR_325"; /// @notice IPOR publication fee balance is too low. string public constant PUBLICATION_FEE_BALANCE_IS_TOO_LOW = "IPOR_326"; /// @notice The caller must be the Joseph (Smart Contract responsible for managing Milton's tokens and balances). string public constant CALLER_NOT_JOSEPH = "IPOR_327"; /// @notice Deposit amount is too low. string public constant DEPOSIT_AMOUNT_IS_TOO_LOW = "IPOR_328"; /// @notice Vault balance is lower than deposit value. string public constant VAULT_BALANCE_LOWER_THAN_DEPOSIT_VALUE = "IPOR_329"; /// @notice Treasury balance is too low. string public constant TREASURY_BALANCE_IS_TOO_LOW = "IPOR_330"; } // File: contracts/amm/spread/MiltonSpreadModel.sol pragma solidity 0.8.15; abstract contract MiltonSpreadModel is MiltonSpreadInternal, IMiltonSpreadModel { using SafeCast for uint256; using SafeCast for int256; function calculateQuotePayFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) external view override returns (uint256 quoteValue) { int256 spreadPremiums = _calculateSpreadPremiumsPayFixed(accruedIpor, accruedBalance); int256 intQuoteValue = accruedIpor.indexValue.toInt256() + spreadPremiums; if (intQuoteValue > 0) { return intQuoteValue.toUint256(); } } function calculateQuoteReceiveFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) external view override returns (uint256 quoteValue) { int256 spreadPremiums = _calculateSpreadPremiumsReceiveFixed(accruedIpor, accruedBalance); int256 intQuoteValueWithIpor = accruedIpor.indexValue.toInt256() + spreadPremiums; quoteValue = _calculateReferenceLegReceiveFixed( intQuoteValueWithIpor > 0 ? intQuoteValueWithIpor.toUint256() : 0, accruedIpor.exponentialMovingAverage ); } function calculateSpreadPayFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) external view override returns (int256 spreadValue) { spreadValue = _calculateSpreadPremiumsPayFixed(accruedIpor, accruedBalance); } function calculateSpreadReceiveFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) external view override returns (int256 spreadValue) { spreadValue = _calculateSpreadPremiumsReceiveFixed(accruedIpor, accruedBalance); } function _calculateSpreadPremiumsPayFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) internal view returns (int256 spreadPremiums) { require( accruedBalance.liquidityPool > 0, MiltonErrors.LIQUIDITY_POOL_ACCRUED_IS_EQUAL_ZERO ); int256 diffIporIndexEma = accruedIpor.indexValue.toInt256() - accruedIpor.exponentialMovingAverage.toInt256(); spreadPremiums = _calculateVolatilityAndMeanReversionPayFixed( accruedIpor.exponentialWeightedMovingVariance, diffIporIndexEma ); } function _calculateSpreadPremiumsReceiveFixed( IporTypes.AccruedIpor memory accruedIpor, IporTypes.MiltonBalancesMemory memory accruedBalance ) internal view returns (int256 spreadPremiums) { require( accruedBalance.liquidityPool > 0, MiltonErrors.LIQUIDITY_POOL_ACCRUED_IS_EQUAL_ZERO ); int256 diffIporIndexEma = accruedIpor.indexValue.toInt256() - accruedIpor.exponentialMovingAverage.toInt256(); spreadPremiums = _calculateVolatilityAndMeanReversionReceiveFixed( accruedIpor.exponentialWeightedMovingVariance, diffIporIndexEma ); } /// @dev Volatility and mean revesion component for Pay Fixed Receive Floating leg. Maximum value between regions. function _calculateVolatilityAndMeanReversionPayFixed(uint256 emaVar, int256 diffIporIndexEma) internal view returns (int256) { int256 regionOne = _volatilityAndMeanReversionPayFixedRegionOne(emaVar, diffIporIndexEma); int256 regionTwo = _volatilityAndMeanReversionPayFixedRegionTwo(emaVar, diffIporIndexEma); if (regionOne >= regionTwo) { return regionOne; } else { return regionTwo; } } /// @dev Volatility and mean revesion component for Receive Fixed Pay Floating leg. Minimum value between regions. function _calculateVolatilityAndMeanReversionReceiveFixed( uint256 emaVar, int256 diffIporIndexEma ) internal view returns (int256) { int256 regionOne = _volatilityAndMeanReversionReceiveFixedRegionOne( emaVar, diffIporIndexEma ); int256 regionTwo = _volatilityAndMeanReversionReceiveFixedRegionTwo( emaVar, diffIporIndexEma ); if (regionOne >= regionTwo) { return regionTwo; } else { return regionOne; } } function _volatilityAndMeanReversionPayFixedRegionOne(uint256 emaVar, int256 diffIporIndexEma) internal view returns (int256) { return _getPayFixedRegionOneBase() + IporMath.divisionInt( _getPayFixedRegionOneSlopeForVolatility() * emaVar.toInt256() + _getPayFixedRegionOneSlopeForMeanReversion() * diffIporIndexEma, Constants.D18_INT ); } function _volatilityAndMeanReversionPayFixedRegionTwo(uint256 emaVar, int256 diffIporIndexEma) internal view returns (int256) { return _getPayFixedRegionTwoBase() + IporMath.divisionInt( _getPayFixedRegionTwoSlopeForVolatility() * emaVar.toInt256() + _getPayFixedRegionTwoSlopeForMeanReversion() * diffIporIndexEma, Constants.D18_INT ); } function _volatilityAndMeanReversionReceiveFixedRegionOne( uint256 emaVar, int256 diffIporIndexEma ) internal view returns (int256) { return _getReceiveFixedRegionOneBase() + IporMath.divisionInt( _getReceiveFixedRegionOneSlopeForVolatility() * emaVar.toInt256() + _getReceiveFixedRegionOneSlopeForMeanReversion() * diffIporIndexEma, Constants.D18_INT ); } function _volatilityAndMeanReversionReceiveFixedRegionTwo( uint256 emaVar, int256 diffIporIndexEma ) internal view returns (int256) { return _getReceiveFixedRegionTwoBase() + IporMath.divisionInt( _getReceiveFixedRegionTwoSlopeForVolatility() * emaVar.toInt256() + _getReceiveFixedRegionTwoSlopeForMeanReversion() * diffIporIndexEma, Constants.D18_INT ); } function _calculateReferenceLegReceiveFixed( uint256 iporIndexValue, uint256 exponentialMovingAverage ) internal pure returns (uint256) { if (iporIndexValue < exponentialMovingAverage) { return iporIndexValue; } else { return exponentialMovingAverage; } } } // File: contracts/amm/spread/MiltonSpreadModelUsdc.sol pragma solidity 0.8.15; contract MiltonSpreadModelUsdc is MiltonSpreadModel { function _getPayFixedRegionOneBase() internal view virtual override returns (int256) { return 37930765449792; } function _getPayFixedRegionOneSlopeForVolatility() internal view virtual override returns (int256) { return 31230683742008606720; } function _getPayFixedRegionOneSlopeForMeanReversion() internal view virtual override returns (int256) { return -1000529805354521088; } function _getPayFixedRegionTwoBase() internal view virtual override returns (int256) { return 37489567944637; } function _getPayFixedRegionTwoSlopeForVolatility() internal view virtual override returns (int256) { return 28996072243415703552; } function _getPayFixedRegionTwoSlopeForMeanReversion() internal view virtual override returns (int256) { return -1000994078840167424; } function _getReceiveFixedRegionOneBase() internal view virtual override returns (int256) { return -122762757422490; } function _getReceiveFixedRegionOneSlopeForVolatility() internal view virtual override returns (int256) { return -106003266867109625856; } function _getReceiveFixedRegionOneSlopeForMeanReversion() internal view virtual override returns (int256) { return -1045884298106898944; } function _getReceiveFixedRegionTwoBase() internal view virtual override returns (int256) { return -158867838624609; } function _getReceiveFixedRegionTwoSlopeForVolatility() internal view virtual override returns (int256) { return -110594227975461961728; } function _getReceiveFixedRegionTwoSlopeForMeanReversion() internal view virtual override returns (int256) { return 6710359117987209; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"appointedOwner","type":"address"}],"name":"AppointedToTransferOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"components":[{"internalType":"uint256","name":"indexValue","type":"uint256"},{"internalType":"uint256","name":"ibtPrice","type":"uint256"},{"internalType":"uint256","name":"exponentialMovingAverage","type":"uint256"},{"internalType":"uint256","name":"exponentialWeightedMovingVariance","type":"uint256"}],"internalType":"struct IporTypes.AccruedIpor","name":"accruedIpor","type":"tuple"},{"components":[{"internalType":"uint256","name":"totalCollateralPayFixed","type":"uint256"},{"internalType":"uint256","name":"totalCollateralReceiveFixed","type":"uint256"},{"internalType":"uint256","name":"liquidityPool","type":"uint256"},{"internalType":"uint256","name":"vault","type":"uint256"}],"internalType":"struct IporTypes.MiltonBalancesMemory","name":"accruedBalance","type":"tuple"}],"name":"calculateQuotePayFixed","outputs":[{"internalType":"uint256","name":"quoteValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"indexValue","type":"uint256"},{"internalType":"uint256","name":"ibtPrice","type":"uint256"},{"internalType":"uint256","name":"exponentialMovingAverage","type":"uint256"},{"internalType":"uint256","name":"exponentialWeightedMovingVariance","type":"uint256"}],"internalType":"struct IporTypes.AccruedIpor","name":"accruedIpor","type":"tuple"},{"components":[{"internalType":"uint256","name":"totalCollateralPayFixed","type":"uint256"},{"internalType":"uint256","name":"totalCollateralReceiveFixed","type":"uint256"},{"internalType":"uint256","name":"liquidityPool","type":"uint256"},{"internalType":"uint256","name":"vault","type":"uint256"}],"internalType":"struct IporTypes.MiltonBalancesMemory","name":"accruedBalance","type":"tuple"}],"name":"calculateQuoteReceiveFixed","outputs":[{"internalType":"uint256","name":"quoteValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"indexValue","type":"uint256"},{"internalType":"uint256","name":"ibtPrice","type":"uint256"},{"internalType":"uint256","name":"exponentialMovingAverage","type":"uint256"},{"internalType":"uint256","name":"exponentialWeightedMovingVariance","type":"uint256"}],"internalType":"struct IporTypes.AccruedIpor","name":"accruedIpor","type":"tuple"},{"components":[{"internalType":"uint256","name":"totalCollateralPayFixed","type":"uint256"},{"internalType":"uint256","name":"totalCollateralReceiveFixed","type":"uint256"},{"internalType":"uint256","name":"liquidityPool","type":"uint256"},{"internalType":"uint256","name":"vault","type":"uint256"}],"internalType":"struct IporTypes.MiltonBalancesMemory","name":"accruedBalance","type":"tuple"}],"name":"calculateSpreadPayFixed","outputs":[{"internalType":"int256","name":"spreadValue","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"indexValue","type":"uint256"},{"internalType":"uint256","name":"ibtPrice","type":"uint256"},{"internalType":"uint256","name":"exponentialMovingAverage","type":"uint256"},{"internalType":"uint256","name":"exponentialWeightedMovingVariance","type":"uint256"}],"internalType":"struct IporTypes.AccruedIpor","name":"accruedIpor","type":"tuple"},{"components":[{"internalType":"uint256","name":"totalCollateralPayFixed","type":"uint256"},{"internalType":"uint256","name":"totalCollateralReceiveFixed","type":"uint256"},{"internalType":"uint256","name":"liquidityPool","type":"uint256"},{"internalType":"uint256","name":"vault","type":"uint256"}],"internalType":"struct IporTypes.MiltonBalancesMemory","name":"accruedBalance","type":"tuple"}],"name":"calculateSpreadReceiveFixed","outputs":[{"internalType":"int256","name":"spreadValue","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"confirmTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPayFixedRegionOneBase","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayFixedRegionOneSlopeForMeanReversion","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayFixedRegionOneSlopeForVolatility","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayFixedRegionTwoBase","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayFixedRegionTwoSlopeForMeanReversion","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayFixedRegionTwoSlopeForVolatility","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReceiveFixedRegionOneBase","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReceiveFixedRegionOneSlopeForMeanReversion","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReceiveFixedRegionOneSlopeForVolatility","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReceiveFixedRegionTwoBase","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReceiveFixedRegionTwoSlopeForMeanReversion","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReceiveFixedRegionTwoSlopeForVolatility","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"appointedOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610bde8061007e6000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c8063a2e8ab3a116100cd578063b57c3bc711610081578063cc29516a11610066578063cc29516a14610290578063f2fde38b14610298578063f3601625146102ab57600080fd5b8063b57c3bc714610274578063bdad991c1461028457600080fd5b8063a90b7825116100b2578063a90b782514610245578063ad99a42f14610254578063b1b0ce9f1461026157600080fd5b8063a2e8ab3a14610227578063a58c1d3e1461023657600080fd5b80634d33edbc11610124578063715018a611610109578063715018a6146101f55780638da5cb5b146101ff5780638fed02e71461021a57600080fd5b80634d33edbc146101d65780635a66432c146101e957600080fd5b80631d317d22116101555780631d317d22146101aa578063296eeb50146101b75780633e0174a9146101c757600080fd5b80630232bd5714610171578063040b162114610197575b600080fd5b61018461017f36600461099c565b6102ba565b6040519081526020015b60405180910390f35b6101846101a536600461099c565b610313565b65907d4d16636019610184565b6805fecda063edfa7fff19610184565b68019266be13de5b6000610184565b6101846101e436600461099c565b610326565b65227f71ccfa40610184565b6101fd610332565b005b6000546040516001600160a01b03909116815260200161018e565b6617d7093b8afd89610184565b6801b169ad6566fd8000610184565b670de43ecfab899bff19610184565b670e83ba3a50d209ff19610184565b656fa6ee8c3d9919610184565b61018461026f36600461099c565b610346565b6805bf1741961500ffff19610184565b652218b8614fbd610184565b6101fd610395565b6101fd6102a63660046109d2565b610425565b670de2988e9358d1ff19610184565b6000806102c784846104e0565b90506000816102d98660000151610565565b6102e39190610a11565b905061030a600082136102f7576000610300565b610300826105e8565b866040015161063a565b95945050505050565b600061031f83836104e0565b9392505050565b600061031f8383610652565b61033a6106cf565b6103446000610729565b565b6000806103538484610652565b90506000816103658660000151610565565b61036f9190610a11565b9050600081131561038c57610383816105e8565b9250505061038f565b50505b92915050565b60015460408051808201909152600881527f49504f525f3030370000000000000000000000000000000000000000000000006020820152906001600160a01b031633146103fe5760405162461bcd60e51b81526004016103f59190610a51565b60405180910390fd5b506001805473ffffffffffffffffffffffffffffffffffffffff1916905561034433610729565b61042d6106cf565b60408051808201909152600881527f49504f525f30303000000000000000000000000000000000000000000000000060208201526001600160a01b0382166104885760405162461bcd60e51b81526004016103f59190610a51565b506001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f3ec7bb1d452f3c36260fa8ef678a597fd97574d8ec42f6dc98ffce3dbc91228f90600090a250565b6000808260400151116040518060400160405280600881526020016749504f525f33323360c01b815250906105285760405162461bcd60e51b81526004016103f59190610a51565b5060006105388460400151610565565b845161054390610565565b61054d9190610aa6565b905061055d846060015182610786565b949350505050565b60006001600160ff1b038211156105e45760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e7432353600000000000000000000000000000000000000000000000060648201526084016103f5565b5090565b6000808212156105e45760405162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f73697469766560448201526064016103f5565b60008183101561064b57508161038f565b508061038f565b6000808260400151116040518060400160405280600881526020016749504f525f33323360c01b8152509061069a5760405162461bcd60e51b81526004016103f59190610a51565b5060006106aa8460400151610565565b84516106b590610565565b6106bf9190610aa6565b905061055d8460600151826107bb565b6000546001600160a01b031633146103445760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103f5565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008061079384846107f0565b905060006107a18585610852565b90508082126107b357915061038f9050565b50905061038f565b6000806107c8848461088e565b905060006107d685856108ca565b90508082126107e75750905061038f565b915061038f9050565b600061083f61080883670e83ba3a50d209ff19610ae5565b61081185610565565b6805bf1741961500ffff195b6108279190610ae5565b6108319190610a11565b670de0b6b3a7640000610906565b656fa6ee8c3d99195b61031f9190610a11565b6000610881610868836617d7093b8afd89610ae5565b61087185610565565b6805fecda063edfa7fff1961081d565b65907d4d16636019610848565b60006108be6108a683670de2988e9358d1ff19610ae5565b6108af85610565565b6801b169ad6566fd800061081d565b65227f71ccfa40610848565b60006108fa6108e283670de43ecfab899bff19610ae5565b6108eb85610565565b68019266be13de5b600061081d565b652218b8614fbd610848565b600081610914600282610b6c565b61091e9085610a11565b61031f9190610b6c565b60006080828403121561093a57600080fd5b6040516080810181811067ffffffffffffffff8211171561096b57634e487b7160e01b600052604160045260246000fd5b8060405250809150823581526020830135602082015260408301356040820152606083013560608201525092915050565b60008061010083850312156109b057600080fd5b6109ba8484610928565b91506109c98460808501610928565b90509250929050565b6000602082840312156109e457600080fd5b81356001600160a01b038116811461031f57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000808212826001600160ff1b0303841381151615610a3257610a326109fb565b600160ff1b8390038412811615610a4b57610a4b6109fb565b50500190565b600060208083528351808285015260005b81811015610a7e57858101830151858201604001528201610a62565b81811115610a90576000604083870101525b50601f01601f1916929092016040019392505050565b60008083128015600160ff1b850184121615610ac457610ac46109fb565b836001600160ff1b03018313811615610adf57610adf6109fb565b50500390565b60006001600160ff1b03600084136000841385830485118282161615610b0d57610b0d6109fb565b600160ff1b6000871282811687830589121615610b2c57610b2c6109fb565b60008712925087820587128484161615610b4857610b486109fb565b87850587128184161615610b5e57610b5e6109fb565b505050929093029392505050565b600082610b8957634e487b7160e01b600052601260045260246000fd5b600160ff1b821460001984141615610ba357610ba36109fb565b50059056fea26469706673582212200b563a73ab7113364a76a35c37f9848ad2c7d4b0bef3bba8fc11bbce53e884b064736f6c634300080f0033
Deployed ByteCode Sourcemap
71142:2250:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;64639:613;;;;;;:::i;:::-;;:::i;:::-;;;1244:25:1;;;1232:2;1217:18;64639:613:0;;;;;;;;65568:308;;;;;;:::i;:::-;;:::i;50623:137::-;-1:-1:-1;;50623:137:0;;50768:165;-1:-1:-1;;50768:165:0;50623:137;49749:157;72043:20;49749:157;50623:137;65260:300;;;;;;:::i;:::-;;:::i;49139:129::-;71304:14;49139:129;50623:137;7849:103;;;:::i;:::-;;7201:87;7247:7;7274:6;7201:87;;-1:-1:-1;;;;;7274:6:0;;;1606:74:1;;1594:2;1579:18;7201:87:0;1460:226:1;50941:212:0;73365:16;50941:212;50623:137;49276:157;71501:20;49276:157;50623:137;49914:163;-1:-1:-1;;49914:163:0;50623:137;50403:212;-1:-1:-1;;50403:212:0;50623:137;50085;-1:-1:-1;;50085:137:0;50623;64142:489;;;;;;:::i;:::-;;:::i;50230:165::-;-1:-1:-1;;50230:165:0;50623:137;49612:129;71846:14;49612:129;50623:137;9170:154;;;:::i;8900:262::-;;;;;;:::i;:::-;;:::i;49441:163::-;-1:-1:-1;;49441:163:0;50623:137;64639:613;64828:18;64859:21;64883:65;64920:11;64933:14;64883:36;:65::i;:::-;64859:89;;64961:28;65028:14;64992:33;:11;:22;;;:31;:33::i;:::-;:50;;;;:::i;:::-;64961:81;;65068:176;65141:1;65117:21;:25;:65;;65181:1;65117:65;;;65145:33;:21;:31;:33::i;:::-;65197:11;:36;;;65068:34;:176::i;:::-;65055:189;64639:613;-1:-1:-1;;;;;64639:613:0:o;65568:308::-;65758:18;65803:65;65840:11;65853:14;65803:36;:65::i;:::-;65789:79;65568:308;-1:-1:-1;;;65568:308:0:o;65260:300::-;65446:18;65491:61;65524:11;65537:14;65491:32;:61::i;7849:103::-;7087:13;:11;:13::i;:::-;7914:30:::1;7941:1;7914:18;:30::i;:::-;7849:103::o:0;64142:489::-;64327:18;64358:21;64382:61;64415:11;64428:14;64382:32;:61::i;:::-;64358:85;;64456:20;64515:14;64479:33;:11;:22;;;:31;:33::i;:::-;:50;;;;:::i;:::-;64456:73;;64562:1;64546:13;:17;64542:82;;;64587:25;:13;:23;:25::i;:::-;64580:32;;;;;;64542:82;64347:284;;64142:489;;;;;:::o;9170:154::-;9381:15;;9414:37;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;9381:15:0;5832:10;9381:31;9373:79;;;;-1:-1:-1;;;9373:79:0;;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;9245:15:0::1;:28:::0;;-1:-1:-1;;9245:28:0::1;::::0;;9284:32:::1;5832:10:::0;9284:18:::1;:32::i;8900:262::-:0;7087:13;:11;:13::i;:::-;9026:24:::1;::::0;;;;::::1;::::0;;;::::1;::::0;;::::1;;::::0;::::1;::::0;-1:-1:-1;;;;;8996:28:0;::::1;8988:63;;;;-1:-1:-1::0;;;8988:63:0::1;;;;;;;;:::i;:::-;-1:-1:-1::0;9062:15:0::1;:32:::0;;-1:-1:-1;;9062:32:0::1;-1:-1:-1::0;;;;;9062:32:0;::::1;::::0;;::::1;::::0;;;9110:44:::1;::::0;::::1;::::0;-1:-1:-1;;9110:44:0::1;8900:262:::0;:::o;66560:676::-;66750:21;66837:1;66806:14;:28;;;:32;66853:49;;;;;;;;;;;;;-1:-1:-1;;;66853:49:0;;;66784:129;;;;;-1:-1:-1;;;66784:129:0;;;;;;;;:::i;:::-;;66926:23;67001:47;:11;:36;;;:45;:47::i;:::-;66952:22;;:33;;:31;:33::i;:::-;:96;;;;:::i;:::-;66926:122;;67078:150;67141:11;:45;;;67201:16;67078:48;:150::i;:::-;67061:167;66560:676;-1:-1:-1;;;;66560:676:0:o;48583:301::-;48639:6;-1:-1:-1;;;;;48766:5:0;:34;;48758:87;;;;-1:-1:-1;;;48758:87:0;;3577:2:1;48758:87:0;;;3559:21:1;3616:2;3596:18;;;3589:30;3655:34;3635:18;;;3628:62;3726:10;3706:18;;;3699:38;3754:19;;48758:87:0;3375:404:1;48758:87:0;-1:-1:-1;48870:5:0;48583:301::o;29885:171::-;29941:7;29978:1;29969:5;:10;;29961:55;;;;-1:-1:-1;;;29961:55:0;;3986:2:1;29961:55:0;;;3968:21:1;;;4005:18;;;3998:30;4064:34;4044:18;;;4037:62;4116:18;;29961:55:0;3784:356:1;70703:336:0;70853:7;70894:24;70877:14;:41;70873:159;;;-1:-1:-1;70942:14:0;70935:21;;70873:159;-1:-1:-1;70996:24:0;70989:31;;65884:668;66070:21;66157:1;66126:14;:28;;;:32;66173:49;;;;;;;;;;;;;-1:-1:-1;;;66173:49:0;;;66104:129;;;;;-1:-1:-1;;;66104:129:0;;;;;;;;:::i;:::-;;66246:23;66321:47;:11;:36;;;:45;:47::i;:::-;66272:22;;:33;;:31;:33::i;:::-;:96;;;;:::i;:::-;66246:122;;66398:146;66457:11;:45;;;66517:16;66398:44;:146::i;7366:132::-;7247:7;7274:6;-1:-1:-1;;;;;7274:6:0;5832:10;7430:23;7422:68;;;;-1:-1:-1;;;7422:68:0;;4347:2:1;7422:68:0;;;4329:21:1;;;4366:18;;;4359:30;4425:34;4405:18;;;4398:62;4477:18;;7422:68:0;4145:356:1;8468:191:0;8542:16;8561:6;;-1:-1:-1;;;;;8578:17:0;;;-1:-1:-1;;8578:17:0;;;;;;8611:40;;8561:6;;;;;;;8611:40;;8542:16;8611:40;8531:128;8468:191;:::o;67988:577::-;68135:6;68154:16;68173:111;68236:6;68257:16;68173:48;:111::i;:::-;68154:130;;68295:16;68314:111;68377:6;68398:16;68314:48;:111::i;:::-;68295:130;;68455:9;68442;:22;68438:120;;68488:9;-1:-1:-1;68481:16:0;;-1:-1:-1;68481:16:0;68438:120;-1:-1:-1;68537:9:0;-1:-1:-1;68530:16:0;;67364:496;67509:6;67533:16;67552:70;67597:6;67605:16;67552:44;:70::i;:::-;67533:89;;67633:16;67652:70;67697:6;67705:16;67652:44;:70::i;:::-;67633:89;;67750:9;67737;:22;67733:120;;-1:-1:-1;67783:9:0;-1:-1:-1;67776:16:0;;67733:120;67832:9;-1:-1:-1;67825:16:0;;-1:-1:-1;67825:16:0;69629:529;69776:6;69862:288;70011:88;70083:16;-1:-1:-1;;70011:88:0;:::i;:::-;69970:17;:6;:15;:17::i;:::-;-1:-1:-1;;69901:45:0;:86;;;;:::i;:::-;:198;;;;:::i;:::-;11487:4;69862:20;:288::i;:::-;-1:-1:-1;;69815:31:0;:335;;;;:::i;70166:529::-;70313:6;70399:288;70548:88;70620:16;73365;70548:88;:::i;:::-;70507:17;:6;:15;:17::i;:::-;-1:-1:-1;;70438:45:0;72982:201;70399:288;-1:-1:-1;;70352:31:0;72843:131;68573:520;68718:6;68805:280;68950:84;69018:16;-1:-1:-1;;68950:84:0;:::i;:::-;68909:17;:6;:15;:17::i;:::-;71501:20;68844:41;71334:195;68805:280;71304:14;68762:27;71201:125;69101:520;69246:6;69333:280;69478:84;69546:16;-1:-1:-1;;69478:84:0;:::i;:::-;69437:17;:6;:15;:17::i;:::-;72043:20;69372:41;71876:195;69333:280;71846:14;69290:27;71743:125;9783:114;9847:8;9888:1;9878:5;9882:1;9888;9878:5;:::i;:::-;9873:11;;:1;:11;:::i;:::-;9872:17;;;;:::i;14:705:1:-;72:5;120:4;108:9;103:3;99:19;95:30;92:50;;;138:1;135;128:12;92:50;171:2;165:9;213:4;205:6;201:17;284:6;272:10;269:22;248:18;236:10;233:34;230:62;227:185;;;334:10;329:3;325:20;322:1;315:31;369:4;366:1;359:15;397:4;394:1;387:15;227:185;432:10;428:2;421:22;;461:6;452:15;;504:9;491:23;483:6;476:39;576:2;565:9;561:18;548:32;543:2;535:6;531:15;524:57;642:2;631:9;627:18;614:32;609:2;601:6;597:15;590:57;708:2;697:9;693:18;680:32;675:2;667:6;663:15;656:57;;14:705;;;;:::o;724:369::-;859:6;867;920:3;908:9;899:7;895:23;891:33;888:53;;;937:1;934;927:12;888:53;960:49;1001:7;990:9;960:49;:::i;:::-;950:59;;1028;1079:7;1073:3;1062:9;1058:19;1028:59;:::i;:::-;1018:69;;724:369;;;;;:::o;1691:309::-;1750:6;1803:2;1791:9;1782:7;1778:23;1774:32;1771:52;;;1819:1;1816;1809:12;1771:52;1858:9;1845:23;-1:-1:-1;;;;;1901:5:1;1897:54;1890:5;1887:65;1877:93;;1966:1;1963;1956:12;2005:127;2066:10;2061:3;2057:20;2054:1;2047:31;2097:4;2094:1;2087:15;2121:4;2118:1;2111:15;2137:312;2176:3;2211:1;2208;2204:9;2320:1;-1:-1:-1;;;;;2248:74:1;2245:1;2241:82;2236:2;2229:10;2225:99;2222:125;;;2327:18;;:::i;:::-;-1:-1:-1;;;2374:19:1;;;2367:27;;2359:36;;2356:62;;;2398:18;;:::i;:::-;-1:-1:-1;;2434:9:1;;2137:312::o;2454:597::-;2566:4;2595:2;2624;2613:9;2606:21;2656:6;2650:13;2699:6;2694:2;2683:9;2679:18;2672:34;2724:1;2734:140;2748:6;2745:1;2742:13;2734:140;;;2843:14;;;2839:23;;2833:30;2809:17;;;2828:2;2805:26;2798:66;2763:10;;2734:140;;;2892:6;2889:1;2886:13;2883:91;;;2962:1;2957:2;2948:6;2937:9;2933:22;2929:31;2922:42;2883:91;-1:-1:-1;3035:2:1;3014:15;-1:-1:-1;;3010:29:1;2995:45;;;;3042:2;2991:54;;2454:597;-1:-1:-1;;;2454:597:1:o;3056:314::-;3095:4;3124:9;;;3149:10;;-1:-1:-1;;;3168:19:1;;3161:27;;3145:44;3142:70;;;3192:18;;:::i;:::-;3311:1;-1:-1:-1;;;;;3239:74:1;3236:1;3232:82;3228:2;3224:91;3221:117;;;3318:18;;:::i;:::-;-1:-1:-1;;3355:9:1;;3056:314::o;4506:600::-;4545:7;-1:-1:-1;;;;;4669:1:1;4666;4662:9;4697:1;4694;4690:9;4742:1;4738:2;4734:10;4731:1;4728:17;4723:2;4719;4715:11;4711:35;4708:61;;;4749:18;;:::i;:::-;-1:-1:-1;;;4825:1:1;4818:9;;4843:11;;;4863;;;4856:19;;4839:37;4836:63;;;4879:18;;:::i;:::-;4925:1;4922;4918:9;4908:19;;4972:1;4968:2;4963:11;4960:1;4956:19;4951:2;4947;4943:11;4939:37;4936:63;;;4979:18;;:::i;:::-;5044:1;5040:2;5035:11;5032:1;5028:19;5023:2;5019;5015:11;5011:37;5008:63;;;5051:18;;:::i;:::-;-1:-1:-1;;;5091:9:1;;;;;4506:600;-1:-1:-1;;;4506:600:1:o;5111:290::-;5150:1;5176;5166:132;;5220:10;5215:3;5211:20;5208:1;5201:31;5255:4;5252:1;5245:15;5283:4;5280:1;5273:15;5166:132;-1:-1:-1;;;5314:18:1;;-1:-1:-1;;5334:13:1;;5310:38;5307:64;;;5351:18;;:::i;:::-;-1:-1:-1;5385:10:1;;5111:290::o
Swarm Source
ipfs://0b563a73ab7113364a76a35c37f9848ad2c7d4b0bef3bba8fc11bbce53e884b0
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
[ 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.