Contract 0x5854694204828385ED3d5B9d0FF912794D78cdaE 1

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x77d55bb119f2ae52dcf6d1349e025efa6f626884981d5f78b3d29de6a113436a0x6080604061064122022-02-15 13:15:36833 days 16 hrs ago0xd8166138eda6defd2bf2403d7637f41ce01c4bbe IN  Create: Core0 ETH0.036557352661 ETH0.547283602
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x995e809942d7f590bca5f8380f94e0bedca4624848a7bfaf4264296410c0c60f710283122023-03-18 8:20:22437 days 20 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x8aa0bef11ef224e6923cb19b128422b5486d176c622c59f199368b693c9b75de710182402023-03-18 7:38:18437 days 21 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x4eeedcc33c50e09fc421cebd73d5b21b4f685c6ff0860994defafad765aec51f672780312023-03-06 11:55:44449 days 17 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0xa966550349668ceacadeb74bc25f2e0d2e0aa388ca5589cb312d9404317f9954602374552023-02-12 11:20:18471 days 17 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x27d55f1c3a66238fa1eba90336e02198688c46f45f053849376771e4ffca5841586952012023-02-07 5:07:51477 days 12 mins ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0xa93efb873727f9aa2148f96ca57d44db4ab1df6caf460d1adaa2021229d0759a553936922023-01-25 15:47:00489 days 13 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x6634f0f0c87d8eb75bafa8ba485be7c0b92c0b0f6977288b4cfa330d4f80542d553895812023-01-25 15:23:49489 days 13 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x8cd869d9886256703f4857fa590cabd1d039a1fe454025a3e7028af59b302821463750632022-12-15 12:58:29530 days 16 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x0924af06daa3b10b165fc19b81ab95186a910044f36b4b5b2b883b1cc3c50f3e448569612022-12-09 13:42:55536 days 15 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x018fbfaef9bf7a2a4c37020ccf3f2165945a99f424191709c7fa6e7026be404b418563132022-11-28 10:51:17547 days 18 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x8b064c8da6386dbebe0825f22e1926b2341b335405ed55fb87d37c47a5729fb7418560902022-11-28 10:50:10547 days 18 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x810dddab315117cb46835b1576590376600d0c1d3c0825695c4edc2a1c9ad8e3418061102022-11-28 6:22:01547 days 22 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x40350aef6ed8d1014ebfee0a7a3568864d02129b5387fa18c8021ad4b8e0f28a418054462022-11-28 6:17:54547 days 23 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x516402a289455921464386d09f998daa3432742406ecc3bec6306ea96da09d62329432122022-10-27 5:06:34580 days 13 mins ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0xdf2769acb22db3ef7be581145fbca3ff0d0fabf5f7914936d91851dc2e279159329362542022-10-27 4:30:59580 days 49 mins ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0xb4fff2ea21249f786f25dc68178cde16696c09a1311bc537e48d65708da84356281066042022-10-03 5:26:52603 days 23 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0xc1c143c74ffa729eb429712aed6e6bb46b20eeaf513f82cde7f4e2c0145bdebd247273212022-09-15 10:04:48621 days 19 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x624d387326f7b247b40f62d47367b28ba6780181ee17f170476dca0cfc8f9d0c220898762022-08-31 2:45:45637 days 2 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x84dd1d321945c9958c29389e87383ee10b75bc8c811f0cfa97b91841d1112691219422292022-08-30 6:47:25637 days 22 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0xf18887eb95a8aacd72c9aed11dd7801a6a9b631e7071d8fabfe2681f39bab7c1193548432022-08-04 8:02:44663 days 21 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0xf3af204428dc10a57a2416959b5ef00005f38c4e37a4a0e380c8153dd6fbe597192860752022-08-03 13:36:09664 days 15 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x76e09a418c833ac27de7d18de451133b0c0ef787c3a5d2c43031bec0b22c2bae191957182022-08-02 13:02:02665 days 16 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x29e7d2dcb64aa1c1481f50cb70c8ccd301b4bace5d460420261510f9f3af642c185998272022-07-26 8:40:22672 days 20 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x52c8cb6ad1dc0c10399c7e8fa21e4f4f62b18c0a56284ce7e47ee532ef320845185445562022-07-25 16:40:13673 days 12 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
0x0bd450c1af2b2a93afe570284aee1ec53ffe66d14009c9adf72164068278b7bf185438742022-07-25 16:28:11673 days 12 hrs ago Opium Network: Core 0x5854694204828385ed3d5b9d0ff912794d78cdae0 ETH
[ Download CSV Export 
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
Core

Compiler Version
v0.8.5+commit.a4f2e591

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 20 : Core.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./registry/RegistryEntities.sol";
import "./base/RegistryManager.sol";
import "../libs/LibDerivative.sol";
import "../libs/LibPosition.sol";
import "../libs/LibCalculator.sol";
import "../interfaces/IOpiumProxyFactory.sol";
import "../interfaces/ISyntheticAggregator.sol";
import "../interfaces/IOracleAggregator.sol";
import "../interfaces/ITokenSpender.sol";
import "../interfaces/IRegistry.sol";
import "../interfaces/IOpiumPositionToken.sol";
import "../interfaces/IDerivativeLogic.sol";

/**
    Error codes:
    - C1 = ERROR_CORE_POSITION_ADDRESSES_AND_AMOUNTS_DO_NOT_MATCH
    - C2 = ERROR_CORE_WRONG_HASH
    - C3 = ERROR_CORE_WRONG_POSITION_TYPE
    - C4 = ERROR_CORE_NOT_ENOUGH_POSITIONS
    - C5 = ERROR_CORE_WRONG_MOD
    - C6 = ERROR_CORE_CANT_CANCEL_DUMMY_ORACLE_ID
    - C7 = ERROR_CORE_TICKER_WAS_CANCELLED
    - C8 = ERROR_CORE_SYNTHETIC_VALIDATION_ERROR
    - C9 = ERROR_CORE_INSUFFICIENT_P2P_BALANCE
    - C10 = ERROR_CORE_EXECUTION_BEFORE_MATURITY_NOT_ALLOWED
    - C11 = ERROR_CORE_SYNTHETIC_EXECUTION_WAS_NOT_ALLOWED
    - C12 = ERROR_CORE_NOT_ENOUGH_TOKEN_ALLOWANCE
    - C13 = ERROR_CORE_CANCELLATION_IS_NOT_ALLOWED
    - C14 = ERROR_CORE_NOT_OPIUM_FACTORY_POSITIONS
    - C15 = ERROR_CORE_RESERVE_AMOUNT_GREATER_THAN_BALANCE
    - C16 = ERROR_CORE_NO_DERIVATIVE_CREATION_IN_THE_PAST
    - C17 = ERROR_CORE_PROTOCOL_POSITION_CREATION_PAUSED
    - C18 = ERROR_CORE_PROTOCOL_POSITION_MINT_PAUSED
    - C19 = ERROR_CORE_PROTOCOL_POSITION_REDEMPTION_PAUSED
    - C20 = ERROR_CORE_PROTOCOL_POSITION_EXECUTION_PAUSED
    - C21 = ERROR_CORE_PROTOCOL_POSITION_CANCELLATION_PAUSED
    - C22 = ERROR_CORE_PROTOCOL_RESERVE_CLAIM_PAUSED
    - C23 = ERROR_CORE_MISMATCHING_DERIVATIVES
 */

/// @title Opium.Core contract creates positions, holds and distributes margin at the maturity
contract Core is ReentrancyGuardUpgradeable, RegistryManager {
    using LibDerivative for LibDerivative.Derivative;
    using LibCalculator for uint256;
    using LibPosition for bytes32;
    using SafeERC20Upgradeable for IERC20Upgradeable;

    // Emitted when Core creates a new LONG/SHORT position pair
    event LogCreated(address indexed _buyer, address indexed _seller, bytes32 indexed _derivativeHash, uint256 _amount);
    // Emitted when Core mints an amount of LONG/SHORT positions
    event LogMinted(address indexed _buyer, address indexed _seller, bytes32 indexed _derivativeHash, uint256 _amount);
    // Emitted when Core executes positions
    event LogExecuted(address indexed _positionsOwner, address indexed _positionAddress, uint256 _amount);
    // Emitted when Core cancels ticker for the first time
    event LogDerivativeHashCancelled(address indexed _positionOwner, bytes32 indexed _derivativeHash);
    // Emitted when Core cancels a position of a previously cancelled Derivative.derivativeHash
    event LogCancelled(address indexed _positionOwner, bytes32 indexed _derivativeHash, uint256 _amount);
    // Emitted when Core redeems an amount of market neutral positions
    event LogRedeemed(address indexed _positionOwner, bytes32 indexed _derivativeHash, uint256 _amount);

    RegistryEntities.ProtocolParametersArgs private protocolParametersArgs;
    RegistryEntities.ProtocolAddressesArgs private protocolAddressesArgs;

    // Key-value entity that maps a derivativeHash representing an existing derivative to its available balance (i.e: the amount of collateral that has not been claimed yet)
    mapping(bytes32 => uint256) private p2pVaults;

    // Key-value entity that maps a derivativeHash representing an existing derivative to a boolean representing whether a given derivative has been cancelled
    mapping(bytes32 => bool) private cancelledDerivatives;

    /// Key-value entity that maps a derivativeHash representing an existing derivative to its respective buyer's and seller's payouts.
    /// Both the buyer's and seller's are cached when a derivative's position is successfully executed for the first time
    /// derivativePayouts[derivativeHash][0] => buyer's payout
    /// derivativePayouts[derivativeHash][1] => seller's payout
    mapping(bytes32 => uint256[2]) private derivativePayouts;

    /// Reseves vault
    /// Key-value entity that maps an address representing a reserve recipient to a token address and the balance associated to the token address. It keeps tracks of the balances of reserve recipients (i.e: derivative authors)
    mapping(address => mapping(address => uint256)) private reservesVault;

    /// @notice It is called only once upon deployment of the contract. It sets the current Opium.Registry address and assigns the current protocol parameters stored in the Opium.Registry to the Core.protocolParametersArgs private variable {see RegistryEntities.sol for a description of the ProtocolParametersArgs struct}
    function initialize(address _registry) external initializer {
        __RegistryManager__init(_registry);
        __ReentrancyGuard_init();
        protocolParametersArgs = IRegistry(_registry).getProtocolParameters();
    }

    // ****************** EXTERNAL FUNCTIONS ******************

    // ***** GETTERS *****

    /// @notice It returns Opium.Core's internal state of the protocol parameters fetched from the Opium.Registry
    /// @dev {see RegistryEntities.sol for a description of the ProtocolParametersArgs struct}
    /// @return ProtocolParametersArgs struct including the protocol's main parameters
    function getProtocolParametersArgs() external view returns (RegistryEntities.ProtocolParametersArgs memory) {
        return protocolParametersArgs;
    }

    /// @notice It returns Opium.Core's internal state of the protocol contracts' and recipients' addresses fetched from the Opium.Registry
    /// @dev {see RegistryEntities.sol for a description of the protocolAddressesArgs struct}
    /// @return ProtocolAddressesArgs struct including the protocol's main addresses - contracts and reseves recipients
    function getProtocolAddresses() external view returns (RegistryEntities.ProtocolAddressesArgs memory) {
        return protocolAddressesArgs;
    }

    /// @notice It returns the accrued reseves of a given address denominated in a specified token
    /// @param _reseveRecipient address of the reseve recipient
    /// @param _token address of a token used as a reseve compensation
    /// @return uint256 amount of the accrued reseves denominated in the provided token
    function getReservesVaultBalance(address _reseveRecipient, address _token) external view returns (uint256) {
        return reservesVault[_reseveRecipient][_token];
    }

    /// @notice It queries the buyer's and seller's payouts for a given derivative
    /// @notice if it returns [0, 0] then the derivative has not been executed yet
    /// @param _derivativeHash bytes32 unique derivative identifier
    /// @return uint256[2] tuple containing LONG and SHORT payouts
    function getDerivativePayouts(bytes32 _derivativeHash) external view returns (uint256[2] memory) {
        return derivativePayouts[_derivativeHash];
    }

    /// @notice It queries the amount of funds allocated for a given derivative
    /// @param _derivativeHash bytes32 unique derivative identifier
    /// @return uint256 representing the remaining derivative's funds
    function getP2pDerivativeVaultFunds(bytes32 _derivativeHash) external view returns (uint256) {
        return p2pVaults[_derivativeHash];
    }

    /// @notice It checks whether a given derivative has been cancelled
    /// @param _derivativeHash bytes32 unique derivative identifier
    /// @return bool true if derivative has been cancelled, false if derivative has not been cancelled
    function isDerivativeCancelled(bytes32 _derivativeHash) external view returns (bool) {
        return cancelledDerivatives[_derivativeHash];
    }

    // ***** SETTERS *****

    /// @notice It allows to update the Opium Protocol parameters according to the current state of the Opium.Registry
    /// @dev {see RegistryEntities.sol for a description of the ProtocolParametersArgs struct}
    /// @dev should be called immediately after the deployment of the contract
    /// @dev only accounts who have been assigned the CORE_CONFIGURATION_UPDATER_ROLE { See LibRoles.sol } should be able to call the function
    function updateProtocolParametersArgs() external onlyCoreConfigurationUpdater {
        protocolParametersArgs = registry.getProtocolParameters();
    }

    /// @notice Allows to sync the Core protocol's addresses with the Registry protocol's addresses in case the registry updates at least one of them
    /// @dev {see RegistryEntities.sol for a description of the protocolAddressesArgs struct}
    /// @dev should be called immediately after the deployment of the contract
    /// @dev only accounts who have been assigned the CORE_CONFIGURATION_UPDATER_ROLE { See LibRoles.sol } should be able to call the function
    function updateProtocolAddresses() external onlyCoreConfigurationUpdater {
        protocolAddressesArgs = registry.getProtocolAddresses();
    }

    /// @notice It allows a reseve recipient to claim their entire accrued reserves
    /// @param _tokenAddress address of the ERC20 token to withdraw
    function claimReserves(address _tokenAddress) external nonReentrant {
        require(!registry.isProtocolReserveClaimPaused(), "C22");
        uint256 balance = reservesVault[msg.sender][_tokenAddress];
        reservesVault[msg.sender][_tokenAddress] = 0;
        IERC20Upgradeable(_tokenAddress).safeTransfer(msg.sender, balance);
    }

    /// @notice It allows a reserves recipient to to claim the desired amount of accrued reserves
    /// @param _tokenAddress address of the ERC20 token to withdraw
    /// @param _amount uint256 amount of reserves to withdraw
    function claimReserves(address _tokenAddress, uint256 _amount) external nonReentrant {
        require(!registry.isProtocolReserveClaimPaused(), "C22");
        uint256 balance = reservesVault[msg.sender][_tokenAddress];
        require(balance >= _amount, "C15");
        reservesVault[msg.sender][_tokenAddress] -= _amount;
        IERC20Upgradeable(_tokenAddress).safeTransfer(msg.sender, _amount);
    }

    /// @notice It deploys and mints the two erc20 contracts representing a derivative's LONG and SHORT positions { see Core._create for the business logic description }
    /// @param _derivative LibDerivative.Derivative Derivative definition
    /// @param _amount uint256 Amount of positions to create
    /// @param _positionsOwners address[2] Addresses of buyer and seller
    /// [0] - buyer address
    /// [1] - seller address
    function create(
        LibDerivative.Derivative calldata _derivative,
        uint256 _amount,
        address[2] calldata _positionsOwners
    ) external nonReentrant {
        _create(_derivative, _derivative.getDerivativeHash(), _amount, _positionsOwners);
    }

    /// @notice It can either 1) deploy AND mint 2) only mint.
    /// @notice It checks whether the ERC20 contracts representing the LONG and SHORT positions of the provided `LibDerivative.Derivative` have been deployed. If not, then it deploys the respective ERC20 contracts and mints the supplied _amount respectively to the provided buyer's and seller's accounts. If they have already been deployed, it only mints the provided _amount to the provided buyer's and seller's accounts.
    /// @dev if the position contracts have been deployed, it uses Core._create()
    /// @dev if the position contracts have deployed, it uses Core._mint()
    /// @param _derivative LibDerivative.Derivative Derivative definition
    /// @param _amount uint256 Amount of LONG and SHORT positions create and/or mint
    /// @param _positionsOwners address[2] Addresses of buyer and seller
    /// _positionsOwners[0] - buyer address -> receives LONG position
    /// _positionsOwners[1] - seller address -> receives SHORT position
    function createAndMint(
        LibDerivative.Derivative calldata _derivative,
        uint256 _amount,
        address[2] calldata _positionsOwners
    ) external nonReentrant {
        bytes32 derivativeHash = _derivative.getDerivativeHash();
        address implementationAddress = IOpiumProxyFactory(protocolAddressesArgs.opiumProxyFactory)
            .getImplementationAddress();
        (address longPositionTokenAddress, bool isLongDeployed) = derivativeHash.predictAndCheckDeterministicAddress(
            true,
            implementationAddress,
            address(protocolAddressesArgs.opiumProxyFactory)
        );
        (address shortPositionTokenAddress, bool isShortDeployed) = derivativeHash.predictAndCheckDeterministicAddress(
            false,
            implementationAddress,
            protocolAddressesArgs.opiumProxyFactory
        );
        // both erc20 positions have not been deployed
        require(isLongDeployed == isShortDeployed, "C23");
        if (!isLongDeployed) {
            _create(_derivative, derivativeHash, _amount, _positionsOwners);
        } else {
            _mint(_amount, [longPositionTokenAddress, shortPositionTokenAddress], _positionsOwners);
        }
    }

    /// @notice This function mints the provided amount of LONG/SHORT positions to msg.sender for a previously deployed pair of LONG/SHORT ERC20 contracts { see Core._mint for the business logic description }
    /// @param _amount uint256 Amount of positions to create
    /// @param _positionsAddresses address[2] Addresses of buyer and seller
    /// [0] - LONG erc20 position address
    /// [1] - SHORT erc20 position address
    /// @param _positionsOwners address[2] Addresses of buyer and seller
    /// _positionsOwners[0] - buyer address
    /// _positionsOwners[1] - seller address
    function mint(
        uint256 _amount,
        address[2] calldata _positionsAddresses,
        address[2] calldata _positionsOwners
    ) external nonReentrant {
        _mint(_amount, _positionsAddresses, _positionsOwners);
    }

    /// @notice Executes a single position of `msg.sender` with specified `positionAddress` { see Core._execute for the business logic description }
    /// @param _positionAddress address `positionAddress` of position that needs to be executed
    /// @param _amount uint256 Amount of positions to execute
    function execute(address _positionAddress, uint256 _amount) external nonReentrant {
        _execute(msg.sender, _positionAddress, _amount);
    }

    /// @notice Executes a single position of `_positionsOwner` with specified `positionAddress` { see Core._execute for the business logic description }
    /// @param _positionOwner address Address of the owner of positions
    /// @param _positionAddress address `positionAddress` of positions that needs to be executed
    /// @param _amount uint256 Amount of positions to execute
    function execute(
        address _positionOwner,
        address _positionAddress,
        uint256 _amount
    ) external nonReentrant {
        _execute(_positionOwner, _positionAddress, _amount);
    }

    /// @notice Executes several positions of `msg.sender` with different `positionAddresses` { see Core._execute for the business logic description }
    /// @param _positionsAddresses address[] `positionAddresses` of positions that need to be executed
    /// @param _amounts uint256[] Amount of positions to execute for each `positionAddress`
    function execute(address[] calldata _positionsAddresses, uint256[] calldata _amounts) external nonReentrant {
        require(_positionsAddresses.length == _amounts.length, "C1");
        for (uint256 i; i < _positionsAddresses.length; i++) {
            _execute(msg.sender, _positionsAddresses[i], _amounts[i]);
        }
    }

    /// @notice Executes several positions of `_positionsOwner` with different `positionAddresses` { see Core._execute for the business logic description }
    /// @param _positionsOwner address Address of the owner of positions
    /// @param _positionsAddresses address[] `positionAddresses` of positions that need to be executed
    /// @param _amounts uint256[] Amount of positions to execute for each `positionAddresses`
    function execute(
        address _positionsOwner,
        address[] calldata _positionsAddresses,
        uint256[] calldata _amounts
    ) external nonReentrant {
        require(_positionsAddresses.length == _amounts.length, "C1");
        for (uint256 i; i < _positionsAddresses.length; i++) {
            _execute(_positionsOwner, _positionsAddresses[i], _amounts[i]);
        }
    }

    /// @notice Redeems a single market neutral position pair { see Core._redeem for the business logic description }
    /// @param _positionsAddresses address[2] `_positionsAddresses` of the positions that need to be redeemed
    /// @param _amount uint256 Amount of tokens to redeem
    function redeem(address[2] calldata _positionsAddresses, uint256 _amount) external nonReentrant {
        _redeem(_positionsAddresses, _amount);
    }

    /// @notice Redeems several market neutral position pairs { see Core._redeem for the business logic description }
    /// @param _positionsAddresses address[2][] `_positionsAddresses` of the positions that need to be redeemed
    /// @param _amounts uint256[] Amount of tokens to redeem for each position pair
    function redeem(address[2][] calldata _positionsAddresses, uint256[] calldata _amounts) external nonReentrant {
        require(_positionsAddresses.length == _amounts.length, "C1");
        for (uint256 i = 0; i < _positionsAddresses.length; i++) {
            _redeem(_positionsAddresses[i], _amounts[i]);
        }
    }

    /// @notice It cancels the specified amount of a derivative's position { see Core._cancel for the business logic description }
    /// @param _positionAddress PositionType of positions to be canceled
    /// @param _amount uint256 Amount of positions to cancel
    function cancel(address _positionAddress, uint256 _amount) external nonReentrant {
        _cancel(_positionAddress, _amount);
    }

    /// @notice It cancels the specified amounts of a list of derivative's position { see Core._cancel for the business logic description }
    /// @param _positionsAddresses PositionTypes of positions to be cancelled
    /// @param _amounts uint256[] Amount of positions to cancel for each `positionAddress`
    function cancel(address[] calldata _positionsAddresses, uint256[] calldata _amounts) external nonReentrant {
        require(_positionsAddresses.length == _amounts.length, "C1");
        for (uint256 i; i < _positionsAddresses.length; i++) {
            _cancel(_positionsAddresses[i], _amounts[i]);
        }
    }

    // ****************** PRIVATE FUNCTIONS ******************

    // ***** SETTERS *****

    /// @notice It deploys two ERC20 contracts representing respectively the LONG and SHORT position of the provided `LibDerivative.Derivative` derivative and mints the provided amount of SHORT positions to a seller and LONG positions to a buyer
    /// @dev it can only be called if the ERC20 contracts for the derivative's positions have not yet been deployed
    /// @dev the uint256 _amount of positions to be minted can be 0 - which results in the deployment of the position contracts without any circulating supply
    /// @param _derivative LibDerivative.Derivative Derivative definition
    /// @param _derivativeHash unique identifier of a derivative which is used as a key in the p2pVaults mapping
    /// @param _amount uint256 Amount of positions to create
    /// @param _positionsOwners address[2] Addresses of buyer and seller
    /// [0] - buyer address -> receives LONG position
    /// [1] - seller address -> receives SHORT position
    function _create(
        LibDerivative.Derivative calldata _derivative,
        bytes32 _derivativeHash,
        uint256 _amount,
        address[2] calldata _positionsOwners
    ) private {
        require(block.timestamp < _derivative.endTime, "C16");
        require(!registry.isProtocolPositionCreationPaused(), "C17");

        // Validate input data against Derivative logic (`syntheticId`)
        require(IDerivativeLogic(_derivative.syntheticId).validateInput(_derivative), "C8");

        uint256[2] memory margins;
        // Get cached margin required according to logic from Opium.SyntheticAggregator
        // margins[0] - buyerMargin
        // margins[1] - sellerMargin
        (margins[0], margins[1]) = ISyntheticAggregator(protocolAddressesArgs.syntheticAggregator).getOrCacheMargin(
            _derivativeHash,
            _derivative
        );

        uint256 totalMargin = margins[0] + margins[1];
        require((totalMargin * _amount).modWithPrecisionFactor() == 0, "C5");
        uint256 totalMarginToE18 = totalMargin.mulWithPrecisionFactor(_amount);

        // Check ERC20 tokens allowance: (margins[0] + margins[1]) * amount
        // `msg.sender` must provide margin for position creation
        require(
            IERC20Upgradeable(_derivative.token).allowance(msg.sender, protocolAddressesArgs.tokenSpender) >=
                totalMarginToE18,
            "C12"
        );

        // Increment p2p positions balance by collected margin: vault += (margins[0] + margins[1]) * _amount
        _increaseP2PVault(_derivativeHash, totalMarginToE18);

        // Take ERC20 tokens from msg.sender, should never revert in correct ERC20 implementation
        ITokenSpender(protocolAddressesArgs.tokenSpender).claimTokens(
            IERC20Upgradeable(_derivative.token),
            msg.sender,
            address(this),
            totalMarginToE18
        );

        // Mint LONG and SHORT positions tokens
        IOpiumProxyFactory(protocolAddressesArgs.opiumProxyFactory).create(
            _positionsOwners[0],
            _positionsOwners[1],
            _amount,
            _derivativeHash,
            _derivative
        );

        emit LogCreated(_positionsOwners[0], _positionsOwners[1], _derivativeHash, _amount);
    }

    /// @notice It mints the provided amount of LONG and SHORT positions of a given derivative and it forwards them to the provided positions' owners
    /// @dev it can only be called if the ERC20 contracts for the derivative's positions have already been deployed
    /// @dev the uint256 _amount of positions to be minted can be 0
    /// @param _amount uint256 Amount of LONG and SHORT positions to mint
    /// @param _positionsAddresses address[2] tuple containing the addresses of the derivative's positions to be minted
    /// _positionsAddresses[0] -> erc20-based LONG position
    /// _positionsAddresses[1] - erc20-based SHORT position
    /// @param _positionsOwners address[2] Addresses of buyer and seller
    /// [0] - buyer address -> receives LONG position
    /// [1] - seller address -> receives SHORT position
    function _mint(
        uint256 _amount,
        address[2] memory _positionsAddresses,
        address[2] memory _positionsOwners
    ) private {
        require(!registry.isProtocolPositionMintingPaused(), "C18");
        IOpiumPositionToken.OpiumPositionTokenParams memory longOpiumPositionTokenParams = IOpiumPositionToken(
            _positionsAddresses[0]
        ).getPositionTokenData();
        IOpiumPositionToken.OpiumPositionTokenParams memory shortOpiumPositionTokenParams = IOpiumPositionToken(
            _positionsAddresses[1]
        ).getPositionTokenData();
        _onlyOpiumFactoryTokens(_positionsAddresses[0], longOpiumPositionTokenParams);
        _onlyOpiumFactoryTokens(_positionsAddresses[1], shortOpiumPositionTokenParams);
        require(shortOpiumPositionTokenParams.derivativeHash == longOpiumPositionTokenParams.derivativeHash, "C2");
        require(longOpiumPositionTokenParams.positionType == LibDerivative.PositionType.LONG, "C3");
        require(shortOpiumPositionTokenParams.positionType == LibDerivative.PositionType.SHORT, "C3");

        require(block.timestamp < longOpiumPositionTokenParams.derivative.endTime, "C16");

        uint256[2] memory margins;
        // Get cached margin required according to logic from Opium.SyntheticAggregator
        // margins[0] - buyerMargin
        // margins[1] - sellerMargin
        (margins[0], margins[1]) = ISyntheticAggregator(protocolAddressesArgs.syntheticAggregator).getOrCacheMargin(
            longOpiumPositionTokenParams.derivativeHash,
            longOpiumPositionTokenParams.derivative
        );

        uint256 totalMargin = margins[0] + margins[1];
        require((totalMargin * _amount).modWithPrecisionFactor() == 0, "C5");
        uint256 totalMarginToE18 = totalMargin.mulWithPrecisionFactor(_amount);

        // Check ERC20 tokens allowance: (margins[0] + margins[1]) * amount
        // `msg.sender` must provide margin for position creation
        require(
            IERC20Upgradeable(longOpiumPositionTokenParams.derivative.token).allowance(
                msg.sender,
                protocolAddressesArgs.tokenSpender
            ) >= totalMarginToE18,
            "C12"
        );

        // Increment p2p positions balance by collected margin: vault += (margins[0] + margins[1]) * _amount
        _increaseP2PVault(longOpiumPositionTokenParams.derivativeHash, totalMarginToE18);

        // Take ERC20 tokens from msg.sender, should never revert in correct ERC20 implementation
        ITokenSpender(protocolAddressesArgs.tokenSpender).claimTokens(
            IERC20Upgradeable(longOpiumPositionTokenParams.derivative.token),
            msg.sender,
            address(this),
            totalMarginToE18
        );

        // Mint LONG and SHORT positions tokens
        IOpiumProxyFactory(protocolAddressesArgs.opiumProxyFactory).mintPair(
            _positionsOwners[0],
            _positionsOwners[1],
            _positionsAddresses[0],
            _positionsAddresses[1],
            _amount
        );

        emit LogMinted(_positionsOwners[0], _positionsOwners[1], longOpiumPositionTokenParams.derivativeHash, _amount);
    }

    /// @notice It redeems the provided amount of a derivative's market neutral position pair (LONG/SHORT) owned by the msg.sender - redeeming a market neutral position pair results in an equal amount of LONG and SHORT positions being burned in exchange for their original collateral
    /// @param _positionsAddresses address[2] `positionAddresses` representing the tuple of market-neutral positions ordered in the following way:
    /// [0] LONG position
    /// [1] SHORT position
    /// @param _amount uint256 amount of the LONG and SHORT positions to be redeemed
    function _redeem(address[2] memory _positionsAddresses, uint256 _amount) private {
        require(!registry.isProtocolPositionRedemptionPaused(), "C19");
        IOpiumPositionToken.OpiumPositionTokenParams memory longOpiumPositionTokenParams = IOpiumPositionToken(
            _positionsAddresses[0]
        ).getPositionTokenData();
        IOpiumPositionToken.OpiumPositionTokenParams memory shortOpiumPositionTokenParams = IOpiumPositionToken(
            _positionsAddresses[1]
        ).getPositionTokenData();
        _onlyOpiumFactoryTokens(_positionsAddresses[0], longOpiumPositionTokenParams);
        _onlyOpiumFactoryTokens(_positionsAddresses[1], shortOpiumPositionTokenParams);
        require(shortOpiumPositionTokenParams.derivativeHash == longOpiumPositionTokenParams.derivativeHash, "C2");
        require(longOpiumPositionTokenParams.positionType == LibDerivative.PositionType.LONG, "C3");
        require(shortOpiumPositionTokenParams.positionType == LibDerivative.PositionType.SHORT, "C3");

        ISyntheticAggregator.SyntheticCache memory syntheticCache = ISyntheticAggregator(
            protocolAddressesArgs.syntheticAggregator
        ).getOrCacheSyntheticCache(
                shortOpiumPositionTokenParams.derivativeHash,
                shortOpiumPositionTokenParams.derivative
            );

        uint256 totalMargin = (syntheticCache.buyerMargin + syntheticCache.sellerMargin).mulWithPrecisionFactor(
            _amount
        );
        uint256 reserves = _computeReserves(
            syntheticCache.authorAddress,
            shortOpiumPositionTokenParams.derivative.token,
            protocolAddressesArgs.protocolRedemptionReserveClaimer,
            protocolParametersArgs.derivativeAuthorRedemptionReservePart,
            protocolParametersArgs.protocolRedemptionReservePart,
            totalMargin
        );

        _decreaseP2PVault(shortOpiumPositionTokenParams.derivativeHash, totalMargin);

        IOpiumProxyFactory(protocolAddressesArgs.opiumProxyFactory).burnPair(
            msg.sender,
            _positionsAddresses[0],
            _positionsAddresses[1],
            _amount
        );

        IERC20Upgradeable(shortOpiumPositionTokenParams.derivative.token).safeTransfer(
            msg.sender,
            totalMargin - reserves
        );

        emit LogRedeemed(msg.sender, shortOpiumPositionTokenParams.derivativeHash, _amount);
    }

    /// @notice It executes the provided amount of a derivative's position owned by a given position's owner - which results in the distribution of the position's payout and related reseves if the position is profitable and in the executed position's amount being burned regardless of its profitability
    /// @param _positionOwner address Address of the owner of positions
    /// @param _positionAddress address `_positionAddress` of the ERC20 OpiumPositionToken that needs to be executed
    /// @param _amount uint256 Amount of position to execute for the provided `positionAddress`
    function _execute(
        address _positionOwner,
        address _positionAddress,
        uint256 _amount
    ) private {
        require(!registry.isProtocolPositionExecutionPaused(), "C20");
        IOpiumPositionToken.OpiumPositionTokenParams memory opiumPositionTokenParams = IOpiumPositionToken(
            _positionAddress
        ).getPositionTokenData();
        _onlyOpiumFactoryTokens(_positionAddress, opiumPositionTokenParams);
        // Check if ticker was canceled
        require(!cancelledDerivatives[opiumPositionTokenParams.derivativeHash], "C7");
        // Check if execution is performed at a timestamp greater than or equal to the maturity date of the derivative
        require(block.timestamp >= opiumPositionTokenParams.derivative.endTime, "C10");

        // Checking whether execution is performed by `_positionsOwner` or `_positionsOwner` allowed third party executions on its behalf
        require(
            _positionOwner == msg.sender ||
                IDerivativeLogic(opiumPositionTokenParams.derivative.syntheticId).thirdpartyExecutionAllowed(
                    _positionOwner
                ),
            "C11"
        );

        // Burn executed position tokens
        IOpiumProxyFactory(protocolAddressesArgs.opiumProxyFactory).burn(_positionOwner, _positionAddress, _amount);

        // Returns payout for all positions
        uint256 payout = _computePayout(
            opiumPositionTokenParams,
            _amount,
            ISyntheticAggregator(protocolAddressesArgs.syntheticAggregator),
            IOracleAggregator(protocolAddressesArgs.oracleAggregator)
        );

        // Transfer payout
        if (payout > 0) {
            IERC20Upgradeable(opiumPositionTokenParams.derivative.token).safeTransfer(_positionOwner, payout);
        }

        emit LogExecuted(_positionOwner, _positionAddress, _amount);
    }

    /// @notice Cancels tickers, burns positions and returns margins to the position owner in case no data were provided within `protocolParametersArgs.noDataCancellationPeriod`
    /// @param _positionAddress PositionTypes of positions to be canceled
    /// @param _amount uint256[] Amount of positions to cancel for each `positionAddress`
    function _cancel(address _positionAddress, uint256 _amount) private {
        require(!registry.isProtocolPositionCancellationPaused(), "C21");
        IOpiumPositionToken.OpiumPositionTokenParams memory opiumPositionTokenParams = IOpiumPositionToken(
            _positionAddress
        ).getPositionTokenData();
        _onlyOpiumFactoryTokens(_positionAddress, opiumPositionTokenParams);

        // It's sufficient to perform all the sanity checks only if a derivative has not yet been canceled
        if (!cancelledDerivatives[opiumPositionTokenParams.derivativeHash]) {
            // Don't allow to cancel tickers with "dummy" oracleIds
            require(opiumPositionTokenParams.derivative.oracleId != address(0), "C6");

            // Check if cancellation is called after `protocolParametersArgs.noDataCancellationPeriod` and `oracleId` didn't provide the required data
            require(
                opiumPositionTokenParams.derivative.endTime + protocolParametersArgs.noDataCancellationPeriod <=
                    block.timestamp,
                "C13"
            );
            // Ensures that `Opium.OracleAggregator` has still not been provided with data after noDataCancellationperiod
            // The check needs to be performed only the first time a derivative is being canceled as to avoid preventing other parties from canceling their positions in case `Opium.OracleAggregator` receives data after the successful cancelation
            require(
                !IOracleAggregator(protocolAddressesArgs.oracleAggregator).hasData(
                    opiumPositionTokenParams.derivative.oracleId,
                    opiumPositionTokenParams.derivative.endTime
                ),
                "C13"
            );
            cancelledDerivatives[opiumPositionTokenParams.derivativeHash] = true;
            // Emit `LogDerivativeHashCancelled` event only once and mark ticker as canceled
            emit LogDerivativeHashCancelled(msg.sender, opiumPositionTokenParams.derivativeHash);
        }

        uint256 payout;
        // Check if `_positionsAddresses` is a LONG position
        if (opiumPositionTokenParams.positionType == LibDerivative.PositionType.LONG) {
            // Get cached margin required according to logic from Opium.SyntheticAggregator
            // (buyerMargin, sellerMargin) = syntheticAggregator.getMargin
            (uint256 buyerMargin, ) = ISyntheticAggregator(protocolAddressesArgs.syntheticAggregator).getOrCacheMargin(
                opiumPositionTokenParams.derivativeHash,
                opiumPositionTokenParams.derivative
            );
            // Set payout to buyerPayout
            payout = buyerMargin.mulWithPrecisionFactor(_amount);

            // Check if `positionAddress` is a SHORT position
        } else {
            // Get cached margin required according to logic from Opium.SyntheticAggregator
            // (buyerMargin, sellerMargin) = syntheticAggregator.getMargin
            (, uint256 sellerMargin) = ISyntheticAggregator(protocolAddressesArgs.syntheticAggregator).getOrCacheMargin(
                opiumPositionTokenParams.derivativeHash,
                opiumPositionTokenParams.derivative
            );
            // Set payout to sellerPayout
            payout = sellerMargin.mulWithPrecisionFactor(_amount);
        }

        _decreaseP2PVault(opiumPositionTokenParams.derivativeHash, payout);

        // Burn cancelled position tokens
        IOpiumProxyFactory(protocolAddressesArgs.opiumProxyFactory).burn(msg.sender, _positionAddress, _amount);

        // Transfer payout * _amounts[i]
        if (payout > 0) {
            IERC20Upgradeable(opiumPositionTokenParams.derivative.token).safeTransfer(msg.sender, payout);
        }

        emit LogCancelled(msg.sender, opiumPositionTokenParams.derivativeHash, _amount);
    }

    /// @notice Helper function consumed by `Core._execute` to calculate the execution's payout of a settled derivative's position
    /// @param _opiumPositionTokenParams it includes information about the derivative whose position is being executed { see OpiumPositionToken.sol for the implementation }
    /// @param _amount uint256 amount of positions of the same type (either LONG or SHORT) whose payout is being calculated
    /// @param _syntheticAggregator interface/address of `Opium SyntheticAggregator.sol`
    /// @param _oracleAggregator interface/address of `Opium OracleAggregator.sol`
    /// @return payout uint256 representing the net payout (gross payout - reserves) of the executed amount of positions
    function _computePayout(
        IOpiumPositionToken.OpiumPositionTokenParams memory _opiumPositionTokenParams,
        uint256 _amount,
        ISyntheticAggregator _syntheticAggregator,
        IOracleAggregator _oracleAggregator
    ) private returns (uint256 payout) {
        /// if the derivativePayout tuple's items (buyer payout and seller payout) are 0, it assumes it's the first time the _computePayout function is being executed, hence it fetches the payouts from the syntheticId and caches them.
        (uint256 buyerPayoutRatio, uint256 sellerPayoutRatio) = _getDerivativePayouts(
            _opiumPositionTokenParams.derivativeHash
        ); // gas saving
        if (buyerPayoutRatio == 0 && sellerPayoutRatio == 0) {
            /// fetches the derivative's data from the related oracleId
            /// opium allows the usage of "dummy" oracleIds - oracleIds whose address is null - in which case the data is set to 0
            uint256 data = _opiumPositionTokenParams.derivative.oracleId == address(0)
                ? 0
                : _oracleAggregator.getData(
                    _opiumPositionTokenParams.derivative.oracleId,
                    _opiumPositionTokenParams.derivative.endTime
                );
            // Get payout ratio from Derivative logic
            // payoutRatio[0] - buyerPayout
            // payoutRatio[1] - sellerPayout
            (buyerPayoutRatio, sellerPayoutRatio) = IDerivativeLogic(_opiumPositionTokenParams.derivative.syntheticId)
                .getExecutionPayout(_opiumPositionTokenParams.derivative, data);
            derivativePayouts[_opiumPositionTokenParams.derivativeHash] = [buyerPayoutRatio, sellerPayoutRatio]; // gas saving
        }

        ISyntheticAggregator.SyntheticCache memory syntheticCache = _syntheticAggregator.getOrCacheSyntheticCache(
            _opiumPositionTokenParams.derivativeHash,
            _opiumPositionTokenParams.derivative
        );

        uint256 positionMargin;

        // Check if `_positionType` is LONG
        if (_opiumPositionTokenParams.positionType == LibDerivative.PositionType.LONG) {
            // Calculates buyerPayout from ratio = (buyerMargin + sellerMargin) * buyerPayoutRatio / (buyerPayoutRatio + sellerPayoutRatio)
            // Set payout to buyerPayout multiplied by amount
            payout = (((syntheticCache.buyerMargin + syntheticCache.sellerMargin) * buyerPayoutRatio) /
                (buyerPayoutRatio + sellerPayoutRatio)).mulWithPrecisionFactor(_amount);
            // sets positionMargin to buyerMargin * amount
            positionMargin = syntheticCache.buyerMargin.mulWithPrecisionFactor(_amount);
            // Check if `_positionType` is a SHORT position
        } else {
            // Calculates sellerPayout from ratio = sellerPayout = (buyerMargin + sellerMargin) * sellerPayoutRatio / (buyerPayoutRatio + sellerPayoutRatio)
            // Set payout to sellerPayout multiplied by amount
            payout = (((syntheticCache.buyerMargin + syntheticCache.sellerMargin) * sellerPayoutRatio) /
                (buyerPayoutRatio + sellerPayoutRatio)).mulWithPrecisionFactor(_amount);
            // sets positionMargin to sellerMargin * amount
            positionMargin = syntheticCache.sellerMargin.mulWithPrecisionFactor(_amount);
        }

        _decreaseP2PVault(_opiumPositionTokenParams.derivativeHash, payout);

        // The reserves are deducted only from profitable positions: payout > positionMargin * amount
        if (payout > positionMargin) {
            payout =
                payout -
                _computeReserves(
                    syntheticCache.authorAddress,
                    _opiumPositionTokenParams.derivative.token,
                    protocolAddressesArgs.protocolExecutionReserveClaimer,
                    syntheticCache.authorCommission,
                    protocolParametersArgs.protocolExecutionReservePart,
                    payout - positionMargin
                );
        }
    }

    /// @notice It computes the total reserve to be distributed to the recipients provided as arguments
    /// @param _derivativeAuthorAddress address of the derivative author that receives a portion of the reserves being calculated
    /// @param _tokenAddress address of the token being used to distribute the reserves
    /// @param _protocolReserveReceiver  address of the designated recipient that receives a portion of the reserves being calculated
    /// @param _reservePercentage uint256 portion of the reserves that is being distributed from initial amount
    /// @param _protocolReservePercentage uint256 portion of the reserves that is being distributed to `_protocolReserveReceiver`
    /// @param _initialAmount uint256 the amount from which the reserves will be detracted
    /// @return totalReserve uint256 total reserves being calculated which corresponds to the sum of the reserves distributed to the derivative author and the designated recipient
    function _computeReserves(
        address _derivativeAuthorAddress,
        address _tokenAddress,
        address _protocolReserveReceiver,
        uint256 _reservePercentage,
        uint256 _protocolReservePercentage,
        uint256 _initialAmount
    ) private returns (uint256 totalReserve) {
        totalReserve = (_initialAmount * _reservePercentage) / LibCalculator.PERCENTAGE_BASE;

        // If totalReserve is zero, finish
        if (totalReserve == 0) {
            return 0;
        }

        uint256 protocolReserve = (totalReserve * _protocolReservePercentage) / LibCalculator.PERCENTAGE_BASE;

        // Update reservesVault for _protocolReserveReceiver
        reservesVault[_protocolReserveReceiver][_tokenAddress] += protocolReserve;

        // Update reservesVault for `syntheticId` author
        reservesVault[_derivativeAuthorAddress][_tokenAddress] += totalReserve - protocolReserve;
    }

    /// @notice It increases the balance associated to a given derivative stored in the p2pVaults mapping
    /// @param _derivativeHash unique identifier of a derivative which is used as a key in the p2pVaults mapping
    /// @param _amount uint256 representing how much the p2pVaults derivative's balance will increase
    function _increaseP2PVault(bytes32 _derivativeHash, uint256 _amount) private {
        p2pVaults[_derivativeHash] += _amount;
    }

    /// @notice It decreases the balance associated to a given derivative stored in the p2pVaults mapping
    /// @param _derivativeHash unique identifier of a derivative which is used as a key in the p2pVaults mapping
    /// @param _amount uint256 representing how much the p2pVaults derivative's balance will decrease
    function _decreaseP2PVault(bytes32 _derivativeHash, uint256 _amount) private {
        require(p2pVaults[_derivativeHash] >= _amount, "C9");
        p2pVaults[_derivativeHash] -= _amount;
    }

    // ***** GETTERS *****

    /// @notice ensures that a token was minted by the OpiumProxyFactory
    /// @dev usage of a private function rather than a modifier to avoid `stack too deep` error
    /// @param _tokenAddress address of the erc20 token to validate
    /// @param _opiumPositionTokenParams derivatives data of the token to validate
    function _onlyOpiumFactoryTokens(
        address _tokenAddress,
        IOpiumPositionToken.OpiumPositionTokenParams memory _opiumPositionTokenParams
    ) private view {
        address predicted = _opiumPositionTokenParams.derivativeHash.predictDeterministicAddress(
            _opiumPositionTokenParams.positionType == LibDerivative.PositionType.LONG,
            IOpiumProxyFactory(protocolAddressesArgs.opiumProxyFactory).getImplementationAddress(),
            address(protocolAddressesArgs.opiumProxyFactory)
        );
        require(_tokenAddress == predicted, "C14");
    }

    /// @notice private getter to destructure the derivativePayouts tuple. its only purpose is gas optimization
    /// @param _derivativeHash bytes32 identifier of the derivative whose payout is being fetched
    function _getDerivativePayouts(bytes32 _derivativeHash) private view returns (uint256, uint256) {
        return (derivativePayouts[_derivativeHash][0], derivativePayouts[_derivativeHash][1]);
    }

    // Reserved storage space to allow for layout changes in the future.
    uint256[50] private __gap;
}

File 2 of 20 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 3 of 20 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 20 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
    uint256[49] private __gap;
}

File 5 of 20 : RegistryEntities.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

library RegistryEntities {
    struct ProtocolParametersArgs {
        // Period of time after which ticker could be canceled if no data was provided to the `oracleId`
        uint32 noDataCancellationPeriod;
        // Max fee that derivative author can set
        // it works as an upper bound for when the derivative authors set their synthetic's fee
        uint32 derivativeAuthorExecutionFeeCap;
        // Fixed part (percentage) that the derivative author receives for each redemption of market neutral positions
        // It is not set by the derivative authors themselves
        uint32 derivativeAuthorRedemptionReservePart;
        // Represents which part of derivative author reserves originated from derivative executions go to the protocol reserves
        uint32 protocolExecutionReservePart;
        // Represents which part of derivative author reserves originated from redemption of market neutral positions go to the protocol reserves
        uint32 protocolRedemptionReservePart;
        /// Initially uninitialized variables to allow some flexibility in case of future changes and upgradeability
        uint32 __gapOne;
        uint32 __gapTwo;
        uint32 __gapThree;
    }

    struct ProtocolAddressesArgs {
        // Address of Opium.Core contract
        address core;
        // Address of Opium.OpiumProxyFactory contract
        address opiumProxyFactory;
        // Address of Opium.OracleAggregator contract
        address oracleAggregator;
        // Address of Opium.SyntheticAggregator contract
        address syntheticAggregator;
        // Address of Opium.TokenSpender contract
        address tokenSpender;
        // Address of the recipient of execution protocol reserves
        address protocolExecutionReserveClaimer;
        // Address of the recipient of redemption protocol reserves
        address protocolRedemptionReserveClaimer;
        /// Initially uninitialized variables to allow some flexibility in case of future changes and upgradeability
        uint32 __gapOne;
        uint32 __gapTwo;
    }

    struct ProtocolPausabilityArgs {
        // if true, all the protocol's entry-points are paused
        bool protocolGlobal;
        // if true, no new positions can be created
        bool protocolPositionCreation;
        // if true, no new positions can be minted
        bool protocolPositionMinting;
        // if true, no new positions can be redeemed
        bool protocolPositionRedemption;
        // if true, no new positions can be executed
        bool protocolPositionExecution;
        // if true, no new positions can be cancelled
        bool protocolPositionCancellation;
        // if true, no reserves can be claimed
        bool protocolReserveClaim;
        /// Initially uninitialized variables to allow some flexibility in case of future changes and upgradeability
        bool __gapOne;
        bool __gapTwo;
        bool __gapThree;
        bool __gapFour;
    }
}

File 6 of 20 : RegistryManager.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "../../interfaces/IRegistry.sol";

/**
    Error codes:
    - M1 = ERROR_REGISTRY_MANAGER_ONLY_REGISTRY_MANAGER_ROLE
    - M2 = ERROR_REGISTRY_MANAGER_ONLY_CORE_CONFIGURATION_UPDATER_ROLE
 */
contract RegistryManager is Initializable {
    event LogRegistryChanged(address indexed _changer, address indexed _newRegistryAddress);

    IRegistry internal registry;

    modifier onlyRegistryManager() {
        require(registry.isRegistryManager(msg.sender), "M1");
        _;
    }

    modifier onlyCoreConfigurationUpdater() {
        require(registry.isCoreConfigurationUpdater(msg.sender), "M2");
        _;
    }

    function __RegistryManager__init(address _registry) internal initializer {
        require(_registry != address(0));
        registry = IRegistry(_registry);
        emit LogRegistryChanged(msg.sender, _registry);
    }

    function setRegistry(address _registry) external onlyRegistryManager {
        registry = IRegistry(_registry);
        emit LogRegistryChanged(msg.sender, _registry);
    }

    function getRegistry() external view returns (address) {
        return address(registry);
    }

    // Reserved storage space to allow for layout changes in the future.
    uint256[50] private __gap;
}

File 7 of 20 : LibDerivative.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

/// @title Opium.Lib.LibDerivative contract should be inherited by contracts that use Derivative structure and calculate derivativeHash
library LibDerivative {
    enum PositionType {
        SHORT,
        LONG
    }

    // Opium derivative structure (ticker) definition
    struct Derivative {
        // Margin parameter for syntheticId
        uint256 margin;
        // Maturity of derivative
        uint256 endTime;
        // Additional parameters for syntheticId
        uint256[] params;
        // oracleId of derivative
        address oracleId;
        // Margin token address of derivative
        address token;
        // syntheticId of derivative
        address syntheticId;
    }

    /// @notice Calculates hash of provided Derivative
    /// @param _derivative Derivative Instance of derivative to hash
    /// @return derivativeHash bytes32 Derivative hash
    function getDerivativeHash(Derivative memory _derivative) internal pure returns (bytes32 derivativeHash) {
        derivativeHash = keccak256(
            abi.encodePacked(
                _derivative.margin,
                _derivative.endTime,
                _derivative.params,
                _derivative.oracleId,
                _derivative.token,
                _derivative.syntheticId
            )
        );
    }
}

File 8 of 20 : LibPosition.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.5;

import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol";

library LibPosition {
    function predictDeterministicAddress(
        bytes32 _derivativeHash,
        bool _isLong,
        address _positionImplementationAddress,
        address _factoryAddress
    ) internal pure returns (address) {
        return _predictDeterministicAddress(_derivativeHash, _isLong, _positionImplementationAddress, _factoryAddress);
    }

    function predictAndCheckDeterministicAddress(
        bytes32 _derivativeHash,
        bool _isLong,
        address _positionImplementationAddress,
        address _factoryAddress
    ) internal view returns (address, bool) {
        address predicted = _predictDeterministicAddress(
            _derivativeHash,
            _isLong,
            _positionImplementationAddress,
            _factoryAddress
        );
        bool isDeployed = _isContract(predicted);
        return (predicted, isDeployed);
    }

    function deployOpiumPosition(
        bytes32 _derivativeHash,
        bool _isLong,
        address _positionImplementationAddress
    ) internal returns (address) {
        bytes32 salt = keccak256(abi.encodePacked(_derivativeHash, _isLong ? "L" : "S"));
        return ClonesUpgradeable.cloneDeterministic(_positionImplementationAddress, salt);
    }

    function _predictDeterministicAddress(
        bytes32 _derivativeHash,
        bool _isLong,
        address _positionImplementationAddress,
        address _factoryAddress
    ) private pure returns (address) {
        bytes32 salt = keccak256(abi.encodePacked(_derivativeHash, _isLong ? "L" : "S"));
        return ClonesUpgradeable.predictDeterministicAddress(_positionImplementationAddress, salt, _factoryAddress);
    }

    /// @notice checks whether a contract has already been deployed at a specific address
    /// @return bool true if a contract has been deployed at a specific address and false otherwise
    function _isContract(address _address) private view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(_address)
        }
        return size > 0;
    }
}

File 9 of 20 : LibCalculator.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

library LibCalculator {
    uint256 internal constant PERCENTAGE_BASE = 10000; // Represents 100%
    uint256 internal constant MAX_REDEMPTION_PART = 100; // Represents 1%

    function mulWithPrecisionFactor(uint256 _x, uint256 _y) internal pure returns (uint256) {
        return (_x * _y) / 1e18;
    }

    function modWithPrecisionFactor(uint256 _x) internal pure returns (uint256) {
        return _x % 1e18;
    }
}

File 10 of 20 : IOpiumProxyFactory.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;
import "../libs/LibDerivative.sol";

interface IOpiumProxyFactory {
    function getImplementationAddress() external view returns (address);

    function initialize(address _registry) external;

    function create(
        address _buyer,
        address _seller,
        uint256 _amount,
        bytes32 _derivativeHash,
        LibDerivative.Derivative calldata _derivative
    ) external;

    function mintPair(
        address _buyer,
        address _seller,
        address _longPositionAddress,
        address _shortPositionAddress,
        uint256 _amount
    ) external;

    function burn(
        address _positionOwner,
        address _positionAddress,
        uint256 _amount
    ) external;

    function burnPair(
        address _positionOwner,
        address _longPositionAddress,
        address _shortPositionAddress,
        uint256 _amount
    ) external;
}

File 11 of 20 : ISyntheticAggregator.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;
import "../libs/LibDerivative.sol";

interface ISyntheticAggregator {
    struct SyntheticCache {
        uint256 buyerMargin;
        uint256 sellerMargin;
        uint256 authorCommission;
        address authorAddress;
        bool init;
    }

    function initialize(address _registry) external;

    function getOrCacheSyntheticCache(bytes32 _derivativeHash, LibDerivative.Derivative calldata _derivative)
        external
        returns (SyntheticCache memory);

    function getOrCacheMargin(bytes32 _derivativeHash, LibDerivative.Derivative calldata _derivative)
        external
        returns (uint256 buyerMargin, uint256 sellerMargin);
}

File 12 of 20 : IOracleAggregator.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

interface IOracleAggregator {
    function __callback(uint256 timestamp, uint256 data) external;

    function getData(address oracleId, uint256 timestamp) external view returns (uint256 dataResult);

    function hasData(address oracleId, uint256 timestamp) external view returns (bool);
}

File 13 of 20 : ITokenSpender.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface ITokenSpender {
    function claimTokens(
        IERC20Upgradeable _token,
        address _from,
        address _to,
        uint256 _amount
    ) external;
}

File 14 of 20 : IRegistry.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;
import "../core/registry/RegistryEntities.sol";

interface IRegistry {
    function initialize(address _governor) external;

    function setProtocolAddresses(
        address _opiumProxyFactory,
        address _core,
        address _oracleAggregator,
        address _syntheticAggregator,
        address _tokenSpender
    ) external;

    function setNoDataCancellationPeriod(uint32 _noDataCancellationPeriod) external;

    function addToWhitelist(address _whitelisted) external;

    function removeFromWhitelist(address _whitelisted) external;

    function setProtocolExecutionReserveClaimer(address _protocolExecutionReserveClaimer) external;

    function setProtocolRedemptionReserveClaimer(address _protocolRedemptionReserveClaimer) external;

    function setProtocolExecutionReservePart(uint32 _protocolExecutionReservePart) external;

    function setDerivativeAuthorExecutionFeeCap(uint32 _derivativeAuthorExecutionFeeCap) external;

    function setProtocolRedemptionReservePart(uint32 _protocolRedemptionReservePart) external;

    function setDerivativeAuthorRedemptionReservePart(uint32 _derivativeAuthorRedemptionReservePart) external;

    function pause() external;

    function pauseProtocolPositionCreation() external;

    function pauseProtocolPositionMinting() external;

    function pauseProtocolPositionRedemption() external;

    function pauseProtocolPositionExecution() external;

    function pauseProtocolPositionCancellation() external;

    function pauseProtocolReserveClaim() external;

    function unpause() external;

    function getProtocolParameters() external view returns (RegistryEntities.ProtocolParametersArgs memory);

    function getProtocolAddresses() external view returns (RegistryEntities.ProtocolAddressesArgs memory);

    function isRegistryManager(address _address) external view returns (bool);

    function isCoreConfigurationUpdater(address _address) external view returns (bool);

    function getCore() external view returns (address);

    function isCoreSpenderWhitelisted(address _address) external view returns (bool);

    function isProtocolPaused() external view returns (bool);

    function isProtocolPositionCreationPaused() external view returns (bool);

    function isProtocolPositionMintingPaused() external view returns (bool);

    function isProtocolPositionRedemptionPaused() external view returns (bool);

    function isProtocolPositionExecutionPaused() external view returns (bool);

    function isProtocolPositionCancellationPaused() external view returns (bool);

    function isProtocolReserveClaimPaused() external view returns (bool);
}

File 15 of 20 : IOpiumPositionToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../libs/LibDerivative.sol";

interface IOpiumPositionToken is IERC20PermitUpgradeable, IERC20Upgradeable {
    struct OpiumPositionTokenParams {
        LibDerivative.Derivative derivative;
        LibDerivative.PositionType positionType;
        bytes32 derivativeHash;
    }

    function initialize(
        bytes32 _derivativeHash,
        LibDerivative.PositionType _positionType,
        LibDerivative.Derivative calldata _derivative
    ) external;

    function mint(address _positionOwner, uint256 _amount) external;

    function burn(address _positionOwner, uint256 _amount) external;

    function getFactoryAddress() external view returns (address);

    function getPositionTokenData() external view returns (OpiumPositionTokenParams memory opiumPositionTokenParams);

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) external;

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) external;
}

File 16 of 20 : IDerivativeLogic.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.5;

import "../libs/LibDerivative.sol";

/// @title Opium.Interface.IDerivativeLogic is an interface that every syntheticId should implement
interface IDerivativeLogic {
    // Event with syntheticId metadata JSON string (for DIB.ONE derivative explorer)
    event LogMetadataSet(string metadata);

    /// @notice Validates ticker
    /// @param _derivative Derivative Instance of derivative to validate
    /// @return Returns boolean whether ticker is valid
    function validateInput(LibDerivative.Derivative memory _derivative) external view returns (bool);

    /// @return Returns the custom name of a derivative ticker which will be used as part of the name of its positions
    function getSyntheticIdName() external view returns (string memory);

    /// @notice Calculates margin required for derivative creation
    /// @param _derivative Derivative Instance of derivative
    /// @return buyerMargin uint256 Margin needed from buyer (LONG position)
    /// @return sellerMargin uint256 Margin needed from seller (SHORT position)
    function getMargin(LibDerivative.Derivative memory _derivative)
        external
        view
        returns (uint256 buyerMargin, uint256 sellerMargin);

    /// @notice Calculates payout for derivative execution
    /// @param _derivative Derivative Instance of derivative
    /// @param _result uint256 Data retrieved from oracleId on the maturity
    /// @return buyerPayout uint256 Payout in ratio for buyer (LONG position holder)
    /// @return sellerPayout uint256 Payout in ratio for seller (SHORT position holder)
    function getExecutionPayout(LibDerivative.Derivative memory _derivative, uint256 _result)
        external
        view
        returns (uint256 buyerPayout, uint256 sellerPayout);

    /// @notice Returns syntheticId author address for Opium commissions
    /// @return authorAddress address The address of syntheticId address
    function getAuthorAddress() external view returns (address authorAddress);

    /// @notice Returns syntheticId author commission in base of COMMISSION_BASE
    /// @return commission uint256 Author commission
    function getAuthorCommission() external view returns (uint256 commission);

    /// @notice Returns whether thirdparty could execute on derivative's owner's behalf
    /// @param _derivativeOwner address Derivative owner address
    /// @return Returns boolean whether _derivativeOwner allowed third party execution
    function thirdpartyExecutionAllowed(address _derivativeOwner) external view returns (bool);

    /// @notice Sets whether thirds parties are allowed or not to execute derivative's on msg.sender's behalf
    /// @param _allow bool Flag for execution allowance
    function allowThirdpartyExecution(bool _allow) external;
}

File 17 of 20 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 18 of 20 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 19 of 20 : ClonesUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol)

pragma solidity ^0.8.0;

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 *
 * _Available since v3.4._
 */
library ClonesUpgradeable {
    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create(0, ptr, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create2(0, ptr, 0x37, salt)
        }
        require(instance != address(0), "ERC1167: create2 failed");
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
            mstore(add(ptr, 0x38), shl(0x60, deployer))
            mstore(add(ptr, 0x4c), salt)
            mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))
            predicted := keccak256(add(ptr, 0x37), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(address implementation, bytes32 salt)
        internal
        view
        returns (address predicted)
    {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}

File 20 of 20 : draft-IERC20PermitUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20PermitUpgradeable {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_positionOwner","type":"address"},{"indexed":true,"internalType":"bytes32","name":"_derivativeHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"LogCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_buyer","type":"address"},{"indexed":true,"internalType":"address","name":"_seller","type":"address"},{"indexed":true,"internalType":"bytes32","name":"_derivativeHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"LogCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_positionOwner","type":"address"},{"indexed":true,"internalType":"bytes32","name":"_derivativeHash","type":"bytes32"}],"name":"LogDerivativeHashCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_positionsOwner","type":"address"},{"indexed":true,"internalType":"address","name":"_positionAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"LogExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_buyer","type":"address"},{"indexed":true,"internalType":"address","name":"_seller","type":"address"},{"indexed":true,"internalType":"bytes32","name":"_derivativeHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"LogMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_positionOwner","type":"address"},{"indexed":true,"internalType":"bytes32","name":"_derivativeHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"LogRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_changer","type":"address"},{"indexed":true,"internalType":"address","name":"_newRegistryAddress","type":"address"}],"name":"LogRegistryChanged","type":"event"},{"inputs":[{"internalType":"address[]","name":"_positionsAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_positionAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"claimReserves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"claimReserves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"margin","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256[]","name":"params","type":"uint256[]"},{"internalType":"address","name":"oracleId","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"syntheticId","type":"address"}],"internalType":"struct LibDerivative.Derivative","name":"_derivative","type":"tuple"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address[2]","name":"_positionsOwners","type":"address[2]"}],"name":"create","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"margin","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256[]","name":"params","type":"uint256[]"},{"internalType":"address","name":"oracleId","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"syntheticId","type":"address"}],"internalType":"struct LibDerivative.Derivative","name":"_derivative","type":"tuple"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address[2]","name":"_positionsOwners","type":"address[2]"}],"name":"createAndMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_positionAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_positionsAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_positionsOwner","type":"address"},{"internalType":"address[]","name":"_positionsAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_positionOwner","type":"address"},{"internalType":"address","name":"_positionAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_derivativeHash","type":"bytes32"}],"name":"getDerivativePayouts","outputs":[{"internalType":"uint256[2]","name":"","type":"uint256[2]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_derivativeHash","type":"bytes32"}],"name":"getP2pDerivativeVaultFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProtocolAddresses","outputs":[{"components":[{"internalType":"address","name":"core","type":"address"},{"internalType":"address","name":"opiumProxyFactory","type":"address"},{"internalType":"address","name":"oracleAggregator","type":"address"},{"internalType":"address","name":"syntheticAggregator","type":"address"},{"internalType":"address","name":"tokenSpender","type":"address"},{"internalType":"address","name":"protocolExecutionReserveClaimer","type":"address"},{"internalType":"address","name":"protocolRedemptionReserveClaimer","type":"address"},{"internalType":"uint32","name":"__gapOne","type":"uint32"},{"internalType":"uint32","name":"__gapTwo","type":"uint32"}],"internalType":"struct RegistryEntities.ProtocolAddressesArgs","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProtocolParametersArgs","outputs":[{"components":[{"internalType":"uint32","name":"noDataCancellationPeriod","type":"uint32"},{"internalType":"uint32","name":"derivativeAuthorExecutionFeeCap","type":"uint32"},{"internalType":"uint32","name":"derivativeAuthorRedemptionReservePart","type":"uint32"},{"internalType":"uint32","name":"protocolExecutionReservePart","type":"uint32"},{"internalType":"uint32","name":"protocolRedemptionReservePart","type":"uint32"},{"internalType":"uint32","name":"__gapOne","type":"uint32"},{"internalType":"uint32","name":"__gapTwo","type":"uint32"},{"internalType":"uint32","name":"__gapThree","type":"uint32"}],"internalType":"struct RegistryEntities.ProtocolParametersArgs","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reseveRecipient","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"getReservesVaultBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_derivativeHash","type":"bytes32"}],"name":"isDerivativeCancelled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address[2]","name":"_positionsAddresses","type":"address[2]"},{"internalType":"address[2]","name":"_positionsOwners","type":"address[2]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[2]","name":"_positionsAddresses","type":"address[2]"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[2][]","name":"_positionsAddresses","type":"address[2][]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateProtocolAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateProtocolParametersArgs","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50614c89806100206000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c8063a91ee0dc116100e3578063d7acb4481161008c578063e4a86da311610066578063e4a86da3146104fe578063e884c9d114610511578063eafaddfd1461052457600080fd5b8063d7acb448146104d0578063dca5a0b7146104e3578063df849d9c146104eb57600080fd5b8063c4d66de8116100bd578063c4d66de814610487578063ca6fd6cb1461049a578063cc15e2d2146104c857600080fd5b8063a91ee0dc14610389578063a95feeb61461039c578063ad9a9f4f1461047457600080fd5b80635d8228131161014557806398590ef91161011f57806398590ef9146102885780639aeea99d1461029b578063a1774da0146102ae57600080fd5b80635d8228131461024f57806372d33582146102625780637f2743c61461027557600080fd5b80634f937afc116101765780634f937afc146101ee578063553500b4146102215780635ab1bd531461023457600080fd5b80633b89bb861461019d57806346c22429146101b25780634ac77ac3146101c5575b600080fd5b6101b06101ab366004613f20565b610537565b005b6101b06101c0366004613f20565b610595565b6101d86101d336600461407f565b61073b565b6040516101e59190614762565b60405180910390f35b6102116101fc36600461407f565b6000908152606f602052604090205460ff1690565b60405190151581526020016101e5565b6101b061022f366004613f77565b610782565b6033546040516001600160a01b0390911681526020016101e5565b6101b061025d366004613e9d565b61086d565b6101b0610270366004613f77565b610926565b6101b0610283366004614098565b610a05565b6101b0610296366004613f20565b610be0565b6101b06102a9366004613de9565b610c30565b61037c6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101919091525060408051610120810182526067546001600160a01b03908116825260685481166020830152606954811692820192909252606a5482166060820152606b5482166080820152606c54821660a0820152606d5491821660c082015263ffffffff600160a01b8304811660e0830152600160c01b90920490911661010082015290565b6040516101e5919061482d565b6101b0610397366004613de9565b610d5b565b6104676040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915250604080516101008101825260665463ffffffff8082168352640100000000820481166020840152680100000000000000008204811693830193909352600160601b810483166060830152600160801b810483166080830152600160a01b8104831660a0830152600160c01b8104831660c0830152600160e01b900490911660e082015290565b6040516101e591906148b9565b6101b0610482366004614460565b610e60565b6101b0610495366004613de9565b610ef5565b6104ba6104a836600461407f565b6000908152606e602052604090205490565b6040519081526020016101e5565b6101b0611146565b6101b06104de366004614098565b61138f565b6101b06113ec565b6101b06104f9366004613f4c565b611636565b6101b061050c366004613fe3565b6116ab565b6104ba61051f366004613e23565b6117a5565b6101b0610532366004613e5c565b6117d2565b6002600154141561057d5760405162461bcd60e51b815260206004820152601f6024820152600080516020614c3483398151915260448201526064015b60405180910390fd5b600260015561058d33838361181f565b505060018055565b600260015414156105d65760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001556033546040805163f5e0f84760e01b815290516001600160a01b039092169163f5e0f84791600480820192602092909190829003018186803b15801561062057600080fd5b505afa158015610634573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106589190614064565b1561068b5760405162461bcd60e51b815260206004820152600360248201526221991960e91b6044820152606401610574565b3360009081526071602090815260408083206001600160a01b0386168452909152902054818110156106e55760405162461bcd60e51b815260206004820152600360248201526243313560e81b6044820152606401610574565b3360009081526071602090815260408083206001600160a01b038716845290915281208054849290610718908490614a50565b9091555061073290506001600160a01b0384163384611ba8565b50506001805550565b610743613ccd565b600082815260706020526040908190208151808301928390529160029082845b8154815260200190600101908083116107635750505050509050919050565b600260015414156107c35760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001558281146107fc5760405162461bcd60e51b8152602060048201526002602482015261433160f01b6044820152606401610574565b60005b83811015610862576108503386868481811061081d5761081d614bef565b90506020020160208101906108329190613de9565b85858581811061084457610844614bef565b9050602002013561181f565b8061085a81614b7e565b9150506107ff565b505060018055505050565b600260015414156108ae5760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001558281146108e75760405162461bcd60e51b8152602060048201526002602482015261433160f01b6044820152606401610574565b60005b8381101561091a576109088686868481811061081d5761081d614bef565b8061091281614b7e565b9150506108ea565b50506001805550505050565b600260015414156109675760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001558281146109a05760405162461bcd60e51b8152602060048201526002602482015261433160f01b6044820152606401610574565b60005b83811015610862576109f38585838181106109c0576109c0614bef565b90506020020160208101906109d59190613de9565b8484848181106109e7576109e7614bef565b90506020020135611bff565b806109fd81614b7e565b9150506109a3565b60026001541415610a465760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001556000610a5e610a5985614a67565b61212a565b90506000606760010160009054906101000a90046001600160a01b03166001600160a01b0316630cbcae706040518163ffffffff1660e01b815260040160206040518083038186803b158015610ab357600080fd5b505afa158015610ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aeb9190613e06565b6068549091506000908190610b0f90859060019086906001600160a01b0316612177565b60685491935091506000908190610b34908790839088906001600160a01b0316612177565b9150915080151583151514610b715760405162461bcd60e51b815260206004820152600360248201526243323360e81b6044820152606401610574565b82610b8757610b8289878a8a612198565b610bd1565b6040805180820182526001600160a01b0380871682528416602082015281518083018352610bd1928b9291908b9060029083908390808284376000920191909152506126bf915050565b50506001805550505050505050565b60026001541415610c215760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b600260015561058d8282611bff565b60026001541415610c715760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001556033546040805163f5e0f84760e01b815290516001600160a01b039092169163f5e0f84791600480820192602092909190829003018186803b158015610cbb57600080fd5b505afa158015610ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf39190614064565b15610d265760405162461bcd60e51b815260206004820152600360248201526221991960e91b6044820152606401610574565b3360008181526071602090815260408083206001600160a01b038616808552925282208054929055909161058d919083611ba8565b603354604051634048d90960e01b81523360048201526001600160a01b0390911690634048d9099060240160206040518083038186803b158015610d9e57600080fd5b505afa158015610db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd69190614064565b610e075760405162461bcd60e51b81526020600482015260026024820152614d3160f01b6044820152606401610574565b6033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03831690811790915560405133907fec10a16af385903532506d1567380fd8d93d880e8ed4bcacc42b0848e781406a90600090a350565b60026001541415610ea15760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b600260018190556040805180820182526107329286928691908390839080828437600092019190915250506040805180820182529150859060029083908390808284376000920191909152506126bf915050565b600054610100900460ff16610f105760005460ff1615610f14565b303b155b610f775760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610574565b600054610100900460ff16158015610f99576000805461ffff19166101011790555b610fa282612cd3565b610faa612df5565b816001600160a01b031663c58aad876040518163ffffffff1660e01b81526004016101006040518083038186803b158015610fe457600080fd5b505afa158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c9190614305565b805160668054602084015160408501516060860151608087015160a088015160c089015160e09099015163ffffffff908116600160e01b026001600160e01b039a8216600160c01b029a909a1677ffffffffffffffffffffffffffffffffffffffffffffffff928216600160a01b0263ffffffff60a01b19948316600160801b029490941667ffffffffffffffff60801b19958316600160601b026fffffffff000000000000000000000000199784166801000000000000000002979097166fffffffffffffffff0000000000000000199884166401000000000267ffffffffffffffff19909a1693909b16929092179790971795909516979097179290921716919091171792909216919091179190911790558015611142576000805461ff00191690555b5050565b60335460405163698ef99360e01b81523360048201526001600160a01b039091169063698ef9939060240160206040518083038186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c19190614064565b6111f25760405162461bcd60e51b8152602060048201526002602482015261269960f11b6044820152606401610574565b603360009054906101000a90046001600160a01b03166001600160a01b031663c58aad876040518163ffffffff1660e01b81526004016101006040518083038186803b15801561124157600080fd5b505afa158015611255573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112799190614305565b805160668054602084015160408501516060860151608087015160a088015160c089015160e09099015163ffffffff908116600160e01b026001600160e01b039a8216600160c01b029a909a1677ffffffffffffffffffffffffffffffffffffffffffffffff928216600160a01b0263ffffffff60a01b19948316600160801b029490941667ffffffffffffffff60801b19958316600160601b026fffffffff000000000000000000000000199784166801000000000000000002979097166fffffffffffffffff0000000000000000199884166401000000000267ffffffffffffffff19909a1693909b1692909217979097179590951697909717929092171691909117179290921691909117919091179055565b600260015414156113d05760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b6002600155610732836113e5610a5982614a67565b8484612198565b60335460405163698ef99360e01b81523360048201526001600160a01b039091169063698ef9939060240160206040518083038186803b15801561142f57600080fd5b505afa158015611443573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114679190614064565b6114985760405162461bcd60e51b8152602060048201526002602482015261269960f11b6044820152606401610574565b603360009054906101000a90046001600160a01b03166001600160a01b031663a1774da06040518163ffffffff1660e01b81526004016101206040518083038186803b1580156114e757600080fd5b505afa1580156114fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151f919061424f565b80516067805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b0393841617909155602083015160688054831691841691909117905560408301516069805483169184169190911790556060830151606a805483169184169190911790556080830151606b8054831691841691909117905560a0830151606c805490921690831617905560c0820151606d805460e085015161010090950151929093167fffffffffffffffff00000000000000000000000000000000000000000000000090931692909217600160a01b63ffffffff94851602177fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b9390911692909202919091179055565b600260015414156116775760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b6002600181905560408051808201825261058d9290918591908390839080828437600092019190915250849150612e6a9050565b600260015414156116ec5760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001558281146117255760405162461bcd60e51b8152602060048201526002602482015261433160f01b6044820152606401610574565b60005b838110156108625761179385858381811061174557611745614bef565b90506040020160028060200260405190810160405280929190826002602002808284376000920191909152508691508590508481811061178757611787614bef565b90506020020135612e6a565b8061179d81614b7e565b915050611728565b6001600160a01b038083166000908152607160209081526040808320938516835292905220545b92915050565b600260015414156118135760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001556107328383835b603360009054906101000a90046001600160a01b03166001600160a01b031663c823b5db6040518163ffffffff1660e01b815260040160206040518083038186803b15801561186d57600080fd5b505afa158015611881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a59190614064565b156118d85760405162461bcd60e51b815260206004820152600360248201526204332360ec1b6044820152606401610574565b6000826001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b15801561191357600080fd5b505afa158015611927573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261194f91908101906140f5565b905061195b83826132f1565b6040808201516000908152606f602052205460ff16156119a25760405162461bcd60e51b8152602060048201526002602482015261433760f01b6044820152606401610574565b8051602001514210156119dd5760405162461bcd60e51b815260206004820152600360248201526204331360ec1b6044820152606401610574565b6001600160a01b038416331480611a6f5750805160a00151604051631e44861d60e31b81526001600160a01b0386811660048301529091169063f22430e89060240160206040518083038186803b158015611a3757600080fd5b505afa158015611a4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6f9190614064565b611aa15760405162461bcd60e51b815260206004820152600360248201526243313160e81b6044820152606401610574565b606854604051633dae446f60e21b81526001600160a01b0386811660048301528581166024830152604482018590529091169063f6b911bc90606401600060405180830381600087803b158015611af757600080fd5b505af1158015611b0b573d6000803e3d6000fd5b5050606a5460695460009350611b329250849186916001600160a01b0391821691166133fa565b90508015611b5457815160800151611b54906001600160a01b03168683611ba8565b836001600160a01b0316856001600160a01b03167fe7f87f0b9d521ac925b66f1e1599d5389bf92e298a6cbf0750f68d5beffed1a685604051611b9991815260200190565b60405180910390a35050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611bfa90849061374b565b505050565b603360009054906101000a90046001600160a01b03166001600160a01b0316634e562cbb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4d57600080fd5b505afa158015611c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c859190614064565b15611cb85760405162461bcd60e51b815260206004820152600360248201526243323160e81b6044820152606401610574565b6000826001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b158015611cf357600080fd5b505afa158015611d07573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d2f91908101906140f5565b9050611d3b83826132f1565b6040808201516000908152606f602052205460ff16611ef2578051606001516001600160a01b0316611d945760405162461bcd60e51b8152602060048201526002602482015261219b60f11b6044820152606401610574565b6066548151602001514291611db19163ffffffff90911690614a05565b1115611de55760405162461bcd60e51b815260206004820152600360248201526243313360e81b6044820152606401610574565b6069548151606081015160209091015160405163c8384d2f60e01b81526001600160a01b039283166004820152602481019190915291169063c8384d2f9060440160206040518083038186803b158015611e3e57600080fd5b505afa158015611e52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e769190614064565b15611ea95760405162461bcd60e51b815260206004820152600360248201526243313360e81b6044820152606401610574565b604080820180516000908152606f602052828120805460ff191660011790559051915133917f0eebb9e336ae26031f3bedd462ffab2102cba74395b046ff8dcfc9ecbf1e7bca91a35b6000600182602001516001811115611f0c57611f0c614bd9565b1415611fb157606a54604080840151845191516308d52f0760e41b81526000936001600160a01b031692638d52f07092611f4b929091906004016147ac565b6040805180830381600087803b158015611f6457600080fd5b505af1158015611f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f9c9190614495565b509050611fa98185613830565b91505061204d565b606a54604080840151845191516308d52f0760e41b81526000936001600160a01b031692638d52f07092611fea929091906004016147ac565b6040805180830381600087803b15801561200357600080fd5b505af1158015612017573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203b9190614495565b915061204990508185613830565b9150505b61205b826040015182613856565b606854604051633dae446f60e21b81523360048201526001600160a01b038681166024830152604482018690529091169063f6b911bc90606401600060405180830381600087803b1580156120af57600080fd5b505af11580156120c3573d6000803e3d6000fd5b5050505060008111156120ea578151608001516120ea906001600160a01b03163383611ba8565b604080830151905184815233907fd07fdd78e4cc0e5509d86fabf263fbcd1113f9b43fd927f6631b0c13bd18a00c9060200160405180910390a350505050565b80516020808301516040808501516060860151608087015160a0880151935160009761215a9790969591016146b9565b604051602081830303815290604052805190602001209050919050565b6000806000612188878787876138c0565b97883b1515975095505050505050565b836020013542106121d15760405162461bcd60e51b815260206004820152600360248201526221989b60e91b6044820152606401610574565b603360009054906101000a90046001600160a01b03166001600160a01b031663fbc422f66040518163ffffffff1660e01b815260040160206040518083038186803b15801561221f57600080fd5b505afa158015612233573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122579190614064565b1561228a5760405162461bcd60e51b815260206004820152600360248201526243313760e81b6044820152606401610574565b61229a60c0850160a08601613de9565b6001600160a01b0316633a6f60a9856040518263ffffffff1660e01b81526004016122c591906147f8565b60206040518083038186803b1580156122dd57600080fd5b505afa1580156122f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123159190614064565b6123465760405162461bcd60e51b8152602060048201526002602482015261086760f31b6044820152606401610574565b61234e613ccd565b606a546040516308d52f0760e41b81526001600160a01b0390911690638d52f070906123809087908990600401614793565b6040805180830381600087803b15801561239957600080fd5b505af11580156123ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d19190614495565b602083018190528183526000916123e89190614a05565b90506123fc6123f78583614a31565b6139b0565b1561242e5760405162461bcd60e51b8152602060048201526002602482015261433560f01b6044820152606401610574565b600061243a8286613830565b90508061244d60a0890160808a01613de9565b606b54604051636eb1769f60e11b81523360048201526001600160a01b03918216602482015291169063dd62ed3e9060440160206040518083038186803b15801561249757600080fd5b505afa1580156124ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124cf9190614447565b10156125035760405162461bcd60e51b815260206004820152600360248201526221989960e91b6044820152606401610574565b61250d86826139c4565b606b546001600160a01b0316630a5ea46661252e60a08a0160808b01613de9565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015233602482015230604482015260648101849052608401600060405180830381600087803b15801561259a57600080fd5b505af11580156125ae573d6000803e3d6000fd5b50506068546001600160a01b03169150639873dba990506125d26020870187613de9565b6125e26040880160208901613de9565b888a8c6040518663ffffffff1660e01b815260040161260595949392919061472a565b600060405180830381600087803b15801561261f57600080fd5b505af1158015612633573d6000803e3d6000fd5b50505050858460016002811061264b5761264b614bef565b60200201602081019061265e9190613de9565b6001600160a01b03166126746020870187613de9565b6001600160a01b03167fed55db682403ff79a20059d95317cb2e4f4d322b5b4d062ca27c10de39bdcae4886040516126ae91815260200190565b60405180910390a450505050505050565b603360009054906101000a90046001600160a01b03166001600160a01b031663dd1eb52c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561270d57600080fd5b505afa158015612721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127459190614064565b156127785760405162461bcd60e51b815260206004820152600360248201526208662760eb1b6044820152606401610574565b6000828160200201516001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b1580156127b957600080fd5b505afa1580156127cd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127f591908101906140f5565b9050600083600160200201516001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b15801561283957600080fd5b505afa15801561284d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261287591908101906140f5565b90506128898460005b6020020151836132f1565b61289b8460015b6020020151826132f1565b81604001518160400151146128d75760405162461bcd60e51b8152602060048201526002602482015261219960f11b6044820152606401610574565b6001826020015160018111156128ef576128ef614bd9565b146129215760405162461bcd60e51b8152602060048201526002602482015261433360f01b6044820152606401610574565b60008160200151600181111561293957612939614bd9565b1461296b5760405162461bcd60e51b8152602060048201526002602482015261433360f01b6044820152606401610574565b81516020015142106129a55760405162461bcd60e51b815260206004820152600360248201526221989b60e91b6044820152606401610574565b6129ad613ccd565b606a54604080850151855191516308d52f0760e41b81526001600160a01b0390931692638d52f070926129e392916004016147ac565b6040805180830381600087803b1580156129fc57600080fd5b505af1158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a349190614495565b60208301819052818352600091612a4b9190614a05565b9050612a5a6123f78883614a31565b15612a8c5760405162461bcd60e51b8152602060048201526002602482015261433560f01b6044820152606401610574565b6000612a988289613830565b855160800151606b54604051636eb1769f60e11b81523360048201526001600160a01b039182166024820152929350839291169063dd62ed3e9060440160206040518083038186803b158015612aed57600080fd5b505afa158015612b01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b259190614447565b1015612b595760405162461bcd60e51b815260206004820152600360248201526221989960e91b6044820152606401610574565b612b678560400151826139c4565b606b5485516080015160405163052f523360e11b81526001600160a01b03918216600482015233602482015230604482015260648101849052911690630a5ea46690608401600060405180830381600087803b158015612bc657600080fd5b505af1158015612bda573d6000803e3d6000fd5b505060685488516020808b01518c51918d01516040516347704dbd60e01b81526001600160a01b039485166004820152918416602483015291831660448201529082166064820152608481018d9052911692506347704dbd915060a401600060405180830381600087803b158015612c5157600080fd5b505af1158015612c65573d6000803e3d6000fd5b50505050604085015186600160200201516001600160a01b031687600060200201516001600160a01b03167fa30ccd8346a5af0c1bc132bb36cd047e4aa428d028231aba6802e45bc4d172a58b604051612cc191815260200190565b60405180910390a45050505050505050565b600054610100900460ff16612cee5760005460ff1615612cf2565b303b155b612d555760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610574565b600054610100900460ff16158015612d77576000805461ffff19166101011790555b6001600160a01b038216612d8a57600080fd5b6033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915560405133907fec10a16af385903532506d1567380fd8d93d880e8ed4bcacc42b0848e781406a90600090a38015611142576000805461ff00191690555050565b600054610100900460ff16612e605760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610574565b612e686139e2565b565b603360009054906101000a90046001600160a01b03166001600160a01b031663f10827e06040518163ffffffff1660e01b815260040160206040518083038186803b158015612eb857600080fd5b505afa158015612ecc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ef09190614064565b15612f235760405162461bcd60e51b815260206004820152600360248201526243313960e81b6044820152606401610574565b6000828160200201516001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b158015612f6457600080fd5b505afa158015612f78573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612fa091908101906140f5565b9050600083600160200201516001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b158015612fe457600080fd5b505afa158015612ff8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261302091908101906140f5565b905061302d84600061287e565b613038846001612890565b81604001518160400151146130745760405162461bcd60e51b8152602060048201526002602482015261219960f11b6044820152606401610574565b60018260200151600181111561308c5761308c614bd9565b146130be5760405162461bcd60e51b8152602060048201526002602482015261433360f01b6044820152606401610574565b6000816020015160018111156130d6576130d6614bd9565b146131085760405162461bcd60e51b8152602060048201526002602482015261433360f01b6044820152606401610574565b606a546040808301518351915163a28702f160e01b81526000936001600160a01b03169263a28702f192613141929091906004016147ac565b60a060405180830381600087803b15801561315b57600080fd5b505af115801561316f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061319391906143ca565b905060006131b585836020015184600001516131af9190614a05565b90613830565b6060830151845160800151606d546066549394506000936131fe9392916001600160a01b03169063ffffffff680100000000000000008204811691600160801b90041687613a53565b905061320e846040015183613856565b60685487516020890151604051636ade6d1960e01b81523360048201526001600160a01b039283166024820152908216604482015260648101899052911690636ade6d1990608401600060405180830381600087803b15801561327057600080fd5b505af1158015613284573d6000803e3d6000fd5b505050506132ae3382846132989190614a50565b8651608001516001600160a01b03169190611ba8565b604080850151905187815233907f8f0329a95509d4de040892b232f60d694b862b6a18f929f332f3bf24d33cb69c9060200160405180910390a350505050505050565b60006133b160018360200151600181111561330e5761330e614bd9565b14606760010160009054906101000a90046001600160a01b03166001600160a01b0316630cbcae706040518163ffffffff1660e01b815260040160206040518083038186803b15801561336057600080fd5b505afa158015613374573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133989190613e06565b60685460408601519291906001600160a01b0316613b27565b9050806001600160a01b0316836001600160a01b031614611bfa5760405162461bcd60e51b815260206004820152600360248201526210cc4d60ea1b6044820152606401610574565b60008060006134218760400151600090815260706020526040902080546001909101549091565b91509150816000148015613433575080155b156135b1578651606001516000906001600160a01b0316156134ef5787516060810151602090910151604051632979d02560e01b81526001600160a01b03881692632979d0259261349a926004016001600160a01b03929092168252602082015260400190565b60206040518083038186803b1580156134b257600080fd5b505afa1580156134c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134ea9190614447565b6134f2565b60005b885160a081015160405163dd0060fd60e01b81529293506001600160a01b03169163dd0060fd9161352791859060040161480b565b604080518083038186803b15801561353e57600080fd5b505afa158015613552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135769190614495565b60408051808201825283815260208082018490528c83015160009081526070909152919091209295509093506135ae91906002613ceb565b50505b6040808801518851915163a28702f160e01b81526000926001600160a01b0389169263a28702f1926135e692906004016147ac565b60a060405180830381600087803b15801561360057600080fd5b505af1158015613614573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363891906143ca565b9050600060018960200151600181111561365457613654614bd9565b14156136a45761368e886136688587614a05565b60208501518551889161367a91614a05565b6136849190614a31565b6131af9190614a1d565b825190955061369d9089613830565b90506136d9565b6136c4886136b28587614a05565b60208501518551879161367a91614a05565b60208301519095506136d69089613830565b90505b6136e7896040015186613856565b8085111561373f576060820151895160800151606c5460408501516066546137329493926001600160a01b03169190600160601b900463ffffffff1661372d878c614a50565b613a53565b61373c9086614a50565b94505b50505050949350505050565b60006137a0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b3e9092919063ffffffff16565b805190915015611bfa57808060200190518101906137be9190614064565b611bfa5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610574565b6000670de0b6b3a76400006138458385614a31565b61384f9190614a1d565b9392505050565b6000828152606e60205260409020548111156138995760405162461bcd60e51b8152602060048201526002602482015261433960f01b6044820152606401610574565b6000828152606e6020526040812080548392906138b7908490614a50565b90915550505050565b60008085856138e857604051806040016040528060018152602001605360f81b815250613903565b604051806040016040528060018152602001601360fa1b8152505b604051602001613914929190614677565b6040516020818303038152906040528051906020012090506139a68482856040517f3d602d80600a3d3981f3363d3d373d3d3d363d730000000000000000000000008152606093841b60148201527f5af43d82803e903d91602b57fd5bf3ff000000000000000000000000000000006028820152921b6038830152604c8201526037808220606c830152605591012090565b9695505050505050565b60006117cc670de0b6b3a764000083614b99565b6000828152606e6020526040812080548392906138b7908490614a05565b600054610100900460ff16613a4d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610574565b60018055565b6000612710613a628584614a31565b613a6c9190614a1d565b905080613a7b575060006139a6565b6000612710613a8a8584614a31565b613a949190614a1d565b6001600160a01b038088166000908152607160209081526040808320938c16835292905290812080549293508392909190613ad0908490614a05565b90915550613ae090508183614a50565b6001600160a01b03808a166000908152607160209081526040808320938c1683529290529081208054909190613b17908490614a05565b9091555050509695505050505050565b6000613b35858585856138c0565b95945050505050565b6060613b4d8484600085613b55565b949350505050565b606082471015613bcd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610574565b843b613c1b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610574565b600080866001600160a01b03168587604051613c37919061469d565b60006040518083038185875af1925050503d8060008114613c74576040519150601f19603f3d011682016040523d82523d6000602084013e613c79565b606091505b5091509150613c89828286613c94565b979650505050505050565b60608315613ca357508161384f565b825115613cb35782518084602001fd5b8160405162461bcd60e51b815260040161057491906147c5565b60405180604001604052806002906020820280368337509192915050565b8260028101928215613d19579160200282015b82811115613d19578251825591602001919060010190613cfe565b50613d25929150613d29565b5090565b5b80821115613d255760008155600101613d2a565b8035613d4981614c1b565b919050565b8051613d4981614c1b565b80604081018310156117cc57600080fd5b60008083601f840112613d7c57600080fd5b50813567ffffffffffffffff811115613d9457600080fd5b6020830191508360208260051b8501011115613daf57600080fd5b9250929050565b80518015158114613d4957600080fd5b805160028110613d4957600080fd5b805163ffffffff81168114613d4957600080fd5b600060208284031215613dfb57600080fd5b813561384f81614c1b565b600060208284031215613e1857600080fd5b815161384f81614c1b565b60008060408385031215613e3657600080fd5b8235613e4181614c1b565b91506020830135613e5181614c1b565b809150509250929050565b600080600060608486031215613e7157600080fd5b8335613e7c81614c1b565b92506020840135613e8c81614c1b565b929592945050506040919091013590565b600080600080600060608688031215613eb557600080fd5b8535613ec081614c1b565b9450602086013567ffffffffffffffff80821115613edd57600080fd5b613ee989838a01613d6a565b90965094506040880135915080821115613f0257600080fd5b50613f0f88828901613d6a565b969995985093965092949392505050565b60008060408385031215613f3357600080fd5b8235613f3e81614c1b565b946020939093013593505050565b60008060608385031215613f5f57600080fd5b613f698484613d59565b946040939093013593505050565b60008060008060408587031215613f8d57600080fd5b843567ffffffffffffffff80821115613fa557600080fd5b613fb188838901613d6a565b90965094506020870135915080821115613fca57600080fd5b50613fd787828801613d6a565b95989497509550505050565b60008060008060408587031215613ff957600080fd5b843567ffffffffffffffff8082111561401157600080fd5b818701915087601f83011261402557600080fd5b81358181111561403457600080fd5b8860208260061b850101111561404957600080fd5b602092830196509450908601359080821115613fca57600080fd5b60006020828403121561407657600080fd5b61384f82613db6565b60006020828403121561409157600080fd5b5035919050565b6000806000608084860312156140ad57600080fd5b833567ffffffffffffffff8111156140c457600080fd5b840160c081870312156140d657600080fd5b9250602084013591506140ec8560408601613d59565b90509250925092565b6000602080838503121561410857600080fd5b825167ffffffffffffffff8082111561412057600080fd5b908401906060828703121561413457600080fd5b61413c614940565b82518281111561414b57600080fd5b830160c0818903121561415d57600080fd5b614165614969565b81518152858201518682015260408201518481111561418357600080fd5b82019350601f8401891361419657600080fd5b83516141a96141a4826149e1565b6149b0565b8082825288820191508887018c8a8560051b8a010111156141c957600080fd5b600097505b838810156141ec5780518352600197909701969189019189016141ce565b50604084015250614201905060608301613d4e565b606082015261421260808301613d4e565b608082015261422360a08301613d4e565b60a0820152825250614236838501613dc6565b9381019390935250604090810151908201529392505050565b6000610120828403121561426257600080fd5b61426a61498c565b61427383613d4e565b815261428160208401613d4e565b602082015261429260408401613d4e565b60408201526142a360608401613d4e565b60608201526142b460808401613d4e565b60808201526142c560a08401613d4e565b60a08201526142d660c08401613d4e565b60c08201526142e760e08401613dd5565b60e08201526101006142fa818501613dd5565b908201529392505050565b600061010080838503121561431957600080fd5b6040519081019067ffffffffffffffff8211818310171561433c5761433c614c05565b8160405261434984613dd5565b815261435760208501613dd5565b602082015261436860408501613dd5565b604082015261437960608501613dd5565b606082015261438a60808501613dd5565b608082015261439b60a08501613dd5565b60a08201526143ac60c08501613dd5565b60c08201526143bd60e08501613dd5565b60e0820152949350505050565b600060a082840312156143dc57600080fd5b60405160a0810181811067ffffffffffffffff821117156143ff576143ff614c05565b8060405250825181526020830151602082015260408301516040820152606083015161442a81614c1b565b606082015261443b60808401613db6565b60808201529392505050565b60006020828403121561445957600080fd5b5051919050565b600080600060a0848603121561447557600080fd5b833592506144868560208601613d59565b91506140ec8560608601613d59565b600080604083850312156144a857600080fd5b505080516020909101519092909150565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156144eb57600080fd5b8260051b8083602087013760009401602001938452509192915050565b803582526020810135602083015260006040820135601e1983360301811261452f57600080fd5b8201803567ffffffffffffffff81111561454857600080fd5b8060051b360384131561455a57600080fd5b60c0604086015261457260c0860182602085016144b9565b91505061458160608401613d3e565b6001600160a01b0316606085015261459b60808401613d3e565b6001600160a01b031660808501526145b560a08401613d3e565b6001600160a01b03811660a0860152509392505050565b600060c083018251845260208084015181860152604084015160c0604087015282815180855260e0880191508383019450600092505b808310156146225784518252938301936001929092019190830190614602565b506060860151935061463f60608801856001600160a01b03169052565b6080860151935061465b60808801856001600160a01b03169052565b60a086015193506139a660a08801856001600160a01b03169052565b8281526000825161468f816020850160208701614b4e565b919091016020019392505050565b600082516146af818460208701614b4e565b9190910192915050565b86815260006020878184015260408301875182890160005b828110156146ed578151845292840192908401906001016146d1565b5050506bffffffffffffffffffffffff19606097881b8116825295871b861660148201529390951b909316602883015250603c0195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613c8960a0830184614508565b60408101818360005b600281101561478a57815183526020928301929091019060010161476b565b50505092915050565b828152604060208201526000613b4d6040830184614508565b828152604060208201526000613b4d60408301846145cc565b60208152600082518060208401526147e4816040850160208701614b4e565b601f01601f19169190910160400192915050565b60208152600061384f6020830184614508565b60408152600061481e60408301856145cc565b90508260208301529392505050565b81516001600160a01b03908116825260208084015182169083015260408084015182169083015260608084015182169083015260808084015182169083015260a08084015182169083015260c080840151918216908301526101208201905060e08301516148a360e084018263ffffffff169052565b506101009283015163ffffffff16919092015290565b60006101008201905063ffffffff8084511683528060208501511660208401528060408501511660408401528060608501511660608401528060808501511660808401528060a08501511660a08401525060c083015161492160c084018263ffffffff169052565b5060e083015161493960e084018263ffffffff169052565b5092915050565b6040516060810167ffffffffffffffff8111828210171561496357614963614c05565b60405290565b60405160c0810167ffffffffffffffff8111828210171561496357614963614c05565b604051610120810167ffffffffffffffff8111828210171561496357614963614c05565b604051601f8201601f1916810167ffffffffffffffff811182821017156149d9576149d9614c05565b604052919050565b600067ffffffffffffffff8211156149fb576149fb614c05565b5060051b60200190565b60008219821115614a1857614a18614bad565b500190565b600082614a2c57614a2c614bc3565b500490565b6000816000190483118215151615614a4b57614a4b614bad565b500290565b600082821015614a6257614a62614bad565b500390565b600060c08236031215614a7957600080fd5b614a81614969565b8235815260208084013581830152604084013567ffffffffffffffff811115614aa957600080fd5b840136601f820112614aba57600080fd5b8035614ac86141a4826149e1565b8181528381019083850136600585901b860187011115614ae757600080fd5b600094505b83851015614b0a578035835260019490940193918501918501614aec565b50604086015250614b219250505060608401613d3e565b6060820152614b3260808401613d3e565b6080820152614b4360a08401613d3e565b60a082015292915050565b60005b83811015614b69578181015183820152602001614b51565b83811115614b78576000848401525b50505050565b6000600019821415614b9257614b92614bad565b5060010190565b600082614ba857614ba8614bc3565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114614c3057600080fd5b5056fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00a2646970667358221220b816041cc4b2257be0da28957defbc0a0968818ebda66c71d501b3cfc490e66564736f6c63430008050033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101985760003560e01c8063a91ee0dc116100e3578063d7acb4481161008c578063e4a86da311610066578063e4a86da3146104fe578063e884c9d114610511578063eafaddfd1461052457600080fd5b8063d7acb448146104d0578063dca5a0b7146104e3578063df849d9c146104eb57600080fd5b8063c4d66de8116100bd578063c4d66de814610487578063ca6fd6cb1461049a578063cc15e2d2146104c857600080fd5b8063a91ee0dc14610389578063a95feeb61461039c578063ad9a9f4f1461047457600080fd5b80635d8228131161014557806398590ef91161011f57806398590ef9146102885780639aeea99d1461029b578063a1774da0146102ae57600080fd5b80635d8228131461024f57806372d33582146102625780637f2743c61461027557600080fd5b80634f937afc116101765780634f937afc146101ee578063553500b4146102215780635ab1bd531461023457600080fd5b80633b89bb861461019d57806346c22429146101b25780634ac77ac3146101c5575b600080fd5b6101b06101ab366004613f20565b610537565b005b6101b06101c0366004613f20565b610595565b6101d86101d336600461407f565b61073b565b6040516101e59190614762565b60405180910390f35b6102116101fc36600461407f565b6000908152606f602052604090205460ff1690565b60405190151581526020016101e5565b6101b061022f366004613f77565b610782565b6033546040516001600160a01b0390911681526020016101e5565b6101b061025d366004613e9d565b61086d565b6101b0610270366004613f77565b610926565b6101b0610283366004614098565b610a05565b6101b0610296366004613f20565b610be0565b6101b06102a9366004613de9565b610c30565b61037c6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101919091525060408051610120810182526067546001600160a01b03908116825260685481166020830152606954811692820192909252606a5482166060820152606b5482166080820152606c54821660a0820152606d5491821660c082015263ffffffff600160a01b8304811660e0830152600160c01b90920490911661010082015290565b6040516101e5919061482d565b6101b0610397366004613de9565b610d5b565b6104676040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915250604080516101008101825260665463ffffffff8082168352640100000000820481166020840152680100000000000000008204811693830193909352600160601b810483166060830152600160801b810483166080830152600160a01b8104831660a0830152600160c01b8104831660c0830152600160e01b900490911660e082015290565b6040516101e591906148b9565b6101b0610482366004614460565b610e60565b6101b0610495366004613de9565b610ef5565b6104ba6104a836600461407f565b6000908152606e602052604090205490565b6040519081526020016101e5565b6101b0611146565b6101b06104de366004614098565b61138f565b6101b06113ec565b6101b06104f9366004613f4c565b611636565b6101b061050c366004613fe3565b6116ab565b6104ba61051f366004613e23565b6117a5565b6101b0610532366004613e5c565b6117d2565b6002600154141561057d5760405162461bcd60e51b815260206004820152601f6024820152600080516020614c3483398151915260448201526064015b60405180910390fd5b600260015561058d33838361181f565b505060018055565b600260015414156105d65760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001556033546040805163f5e0f84760e01b815290516001600160a01b039092169163f5e0f84791600480820192602092909190829003018186803b15801561062057600080fd5b505afa158015610634573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106589190614064565b1561068b5760405162461bcd60e51b815260206004820152600360248201526221991960e91b6044820152606401610574565b3360009081526071602090815260408083206001600160a01b0386168452909152902054818110156106e55760405162461bcd60e51b815260206004820152600360248201526243313560e81b6044820152606401610574565b3360009081526071602090815260408083206001600160a01b038716845290915281208054849290610718908490614a50565b9091555061073290506001600160a01b0384163384611ba8565b50506001805550565b610743613ccd565b600082815260706020526040908190208151808301928390529160029082845b8154815260200190600101908083116107635750505050509050919050565b600260015414156107c35760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001558281146107fc5760405162461bcd60e51b8152602060048201526002602482015261433160f01b6044820152606401610574565b60005b83811015610862576108503386868481811061081d5761081d614bef565b90506020020160208101906108329190613de9565b85858581811061084457610844614bef565b9050602002013561181f565b8061085a81614b7e565b9150506107ff565b505060018055505050565b600260015414156108ae5760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001558281146108e75760405162461bcd60e51b8152602060048201526002602482015261433160f01b6044820152606401610574565b60005b8381101561091a576109088686868481811061081d5761081d614bef565b8061091281614b7e565b9150506108ea565b50506001805550505050565b600260015414156109675760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001558281146109a05760405162461bcd60e51b8152602060048201526002602482015261433160f01b6044820152606401610574565b60005b83811015610862576109f38585838181106109c0576109c0614bef565b90506020020160208101906109d59190613de9565b8484848181106109e7576109e7614bef565b90506020020135611bff565b806109fd81614b7e565b9150506109a3565b60026001541415610a465760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001556000610a5e610a5985614a67565b61212a565b90506000606760010160009054906101000a90046001600160a01b03166001600160a01b0316630cbcae706040518163ffffffff1660e01b815260040160206040518083038186803b158015610ab357600080fd5b505afa158015610ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aeb9190613e06565b6068549091506000908190610b0f90859060019086906001600160a01b0316612177565b60685491935091506000908190610b34908790839088906001600160a01b0316612177565b9150915080151583151514610b715760405162461bcd60e51b815260206004820152600360248201526243323360e81b6044820152606401610574565b82610b8757610b8289878a8a612198565b610bd1565b6040805180820182526001600160a01b0380871682528416602082015281518083018352610bd1928b9291908b9060029083908390808284376000920191909152506126bf915050565b50506001805550505050505050565b60026001541415610c215760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b600260015561058d8282611bff565b60026001541415610c715760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001556033546040805163f5e0f84760e01b815290516001600160a01b039092169163f5e0f84791600480820192602092909190829003018186803b158015610cbb57600080fd5b505afa158015610ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf39190614064565b15610d265760405162461bcd60e51b815260206004820152600360248201526221991960e91b6044820152606401610574565b3360008181526071602090815260408083206001600160a01b038616808552925282208054929055909161058d919083611ba8565b603354604051634048d90960e01b81523360048201526001600160a01b0390911690634048d9099060240160206040518083038186803b158015610d9e57600080fd5b505afa158015610db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd69190614064565b610e075760405162461bcd60e51b81526020600482015260026024820152614d3160f01b6044820152606401610574565b6033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03831690811790915560405133907fec10a16af385903532506d1567380fd8d93d880e8ed4bcacc42b0848e781406a90600090a350565b60026001541415610ea15760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b600260018190556040805180820182526107329286928691908390839080828437600092019190915250506040805180820182529150859060029083908390808284376000920191909152506126bf915050565b600054610100900460ff16610f105760005460ff1615610f14565b303b155b610f775760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610574565b600054610100900460ff16158015610f99576000805461ffff19166101011790555b610fa282612cd3565b610faa612df5565b816001600160a01b031663c58aad876040518163ffffffff1660e01b81526004016101006040518083038186803b158015610fe457600080fd5b505afa158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c9190614305565b805160668054602084015160408501516060860151608087015160a088015160c089015160e09099015163ffffffff908116600160e01b026001600160e01b039a8216600160c01b029a909a1677ffffffffffffffffffffffffffffffffffffffffffffffff928216600160a01b0263ffffffff60a01b19948316600160801b029490941667ffffffffffffffff60801b19958316600160601b026fffffffff000000000000000000000000199784166801000000000000000002979097166fffffffffffffffff0000000000000000199884166401000000000267ffffffffffffffff19909a1693909b16929092179790971795909516979097179290921716919091171792909216919091179190911790558015611142576000805461ff00191690555b5050565b60335460405163698ef99360e01b81523360048201526001600160a01b039091169063698ef9939060240160206040518083038186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c19190614064565b6111f25760405162461bcd60e51b8152602060048201526002602482015261269960f11b6044820152606401610574565b603360009054906101000a90046001600160a01b03166001600160a01b031663c58aad876040518163ffffffff1660e01b81526004016101006040518083038186803b15801561124157600080fd5b505afa158015611255573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112799190614305565b805160668054602084015160408501516060860151608087015160a088015160c089015160e09099015163ffffffff908116600160e01b026001600160e01b039a8216600160c01b029a909a1677ffffffffffffffffffffffffffffffffffffffffffffffff928216600160a01b0263ffffffff60a01b19948316600160801b029490941667ffffffffffffffff60801b19958316600160601b026fffffffff000000000000000000000000199784166801000000000000000002979097166fffffffffffffffff0000000000000000199884166401000000000267ffffffffffffffff19909a1693909b1692909217979097179590951697909717929092171691909117179290921691909117919091179055565b600260015414156113d05760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b6002600155610732836113e5610a5982614a67565b8484612198565b60335460405163698ef99360e01b81523360048201526001600160a01b039091169063698ef9939060240160206040518083038186803b15801561142f57600080fd5b505afa158015611443573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114679190614064565b6114985760405162461bcd60e51b8152602060048201526002602482015261269960f11b6044820152606401610574565b603360009054906101000a90046001600160a01b03166001600160a01b031663a1774da06040518163ffffffff1660e01b81526004016101206040518083038186803b1580156114e757600080fd5b505afa1580156114fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151f919061424f565b80516067805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b0393841617909155602083015160688054831691841691909117905560408301516069805483169184169190911790556060830151606a805483169184169190911790556080830151606b8054831691841691909117905560a0830151606c805490921690831617905560c0820151606d805460e085015161010090950151929093167fffffffffffffffff00000000000000000000000000000000000000000000000090931692909217600160a01b63ffffffff94851602177fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b9390911692909202919091179055565b600260015414156116775760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b6002600181905560408051808201825261058d9290918591908390839080828437600092019190915250849150612e6a9050565b600260015414156116ec5760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001558281146117255760405162461bcd60e51b8152602060048201526002602482015261433160f01b6044820152606401610574565b60005b838110156108625761179385858381811061174557611745614bef565b90506040020160028060200260405190810160405280929190826002602002808284376000920191909152508691508590508481811061178757611787614bef565b90506020020135612e6a565b8061179d81614b7e565b915050611728565b6001600160a01b038083166000908152607160209081526040808320938516835292905220545b92915050565b600260015414156118135760405162461bcd60e51b815260206004820152601f6024820152600080516020614c348339815191526044820152606401610574565b60026001556107328383835b603360009054906101000a90046001600160a01b03166001600160a01b031663c823b5db6040518163ffffffff1660e01b815260040160206040518083038186803b15801561186d57600080fd5b505afa158015611881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a59190614064565b156118d85760405162461bcd60e51b815260206004820152600360248201526204332360ec1b6044820152606401610574565b6000826001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b15801561191357600080fd5b505afa158015611927573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261194f91908101906140f5565b905061195b83826132f1565b6040808201516000908152606f602052205460ff16156119a25760405162461bcd60e51b8152602060048201526002602482015261433760f01b6044820152606401610574565b8051602001514210156119dd5760405162461bcd60e51b815260206004820152600360248201526204331360ec1b6044820152606401610574565b6001600160a01b038416331480611a6f5750805160a00151604051631e44861d60e31b81526001600160a01b0386811660048301529091169063f22430e89060240160206040518083038186803b158015611a3757600080fd5b505afa158015611a4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6f9190614064565b611aa15760405162461bcd60e51b815260206004820152600360248201526243313160e81b6044820152606401610574565b606854604051633dae446f60e21b81526001600160a01b0386811660048301528581166024830152604482018590529091169063f6b911bc90606401600060405180830381600087803b158015611af757600080fd5b505af1158015611b0b573d6000803e3d6000fd5b5050606a5460695460009350611b329250849186916001600160a01b0391821691166133fa565b90508015611b5457815160800151611b54906001600160a01b03168683611ba8565b836001600160a01b0316856001600160a01b03167fe7f87f0b9d521ac925b66f1e1599d5389bf92e298a6cbf0750f68d5beffed1a685604051611b9991815260200190565b60405180910390a35050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611bfa90849061374b565b505050565b603360009054906101000a90046001600160a01b03166001600160a01b0316634e562cbb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4d57600080fd5b505afa158015611c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c859190614064565b15611cb85760405162461bcd60e51b815260206004820152600360248201526243323160e81b6044820152606401610574565b6000826001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b158015611cf357600080fd5b505afa158015611d07573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d2f91908101906140f5565b9050611d3b83826132f1565b6040808201516000908152606f602052205460ff16611ef2578051606001516001600160a01b0316611d945760405162461bcd60e51b8152602060048201526002602482015261219b60f11b6044820152606401610574565b6066548151602001514291611db19163ffffffff90911690614a05565b1115611de55760405162461bcd60e51b815260206004820152600360248201526243313360e81b6044820152606401610574565b6069548151606081015160209091015160405163c8384d2f60e01b81526001600160a01b039283166004820152602481019190915291169063c8384d2f9060440160206040518083038186803b158015611e3e57600080fd5b505afa158015611e52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e769190614064565b15611ea95760405162461bcd60e51b815260206004820152600360248201526243313360e81b6044820152606401610574565b604080820180516000908152606f602052828120805460ff191660011790559051915133917f0eebb9e336ae26031f3bedd462ffab2102cba74395b046ff8dcfc9ecbf1e7bca91a35b6000600182602001516001811115611f0c57611f0c614bd9565b1415611fb157606a54604080840151845191516308d52f0760e41b81526000936001600160a01b031692638d52f07092611f4b929091906004016147ac565b6040805180830381600087803b158015611f6457600080fd5b505af1158015611f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f9c9190614495565b509050611fa98185613830565b91505061204d565b606a54604080840151845191516308d52f0760e41b81526000936001600160a01b031692638d52f07092611fea929091906004016147ac565b6040805180830381600087803b15801561200357600080fd5b505af1158015612017573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203b9190614495565b915061204990508185613830565b9150505b61205b826040015182613856565b606854604051633dae446f60e21b81523360048201526001600160a01b038681166024830152604482018690529091169063f6b911bc90606401600060405180830381600087803b1580156120af57600080fd5b505af11580156120c3573d6000803e3d6000fd5b5050505060008111156120ea578151608001516120ea906001600160a01b03163383611ba8565b604080830151905184815233907fd07fdd78e4cc0e5509d86fabf263fbcd1113f9b43fd927f6631b0c13bd18a00c9060200160405180910390a350505050565b80516020808301516040808501516060860151608087015160a0880151935160009761215a9790969591016146b9565b604051602081830303815290604052805190602001209050919050565b6000806000612188878787876138c0565b97883b1515975095505050505050565b836020013542106121d15760405162461bcd60e51b815260206004820152600360248201526221989b60e91b6044820152606401610574565b603360009054906101000a90046001600160a01b03166001600160a01b031663fbc422f66040518163ffffffff1660e01b815260040160206040518083038186803b15801561221f57600080fd5b505afa158015612233573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122579190614064565b1561228a5760405162461bcd60e51b815260206004820152600360248201526243313760e81b6044820152606401610574565b61229a60c0850160a08601613de9565b6001600160a01b0316633a6f60a9856040518263ffffffff1660e01b81526004016122c591906147f8565b60206040518083038186803b1580156122dd57600080fd5b505afa1580156122f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123159190614064565b6123465760405162461bcd60e51b8152602060048201526002602482015261086760f31b6044820152606401610574565b61234e613ccd565b606a546040516308d52f0760e41b81526001600160a01b0390911690638d52f070906123809087908990600401614793565b6040805180830381600087803b15801561239957600080fd5b505af11580156123ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d19190614495565b602083018190528183526000916123e89190614a05565b90506123fc6123f78583614a31565b6139b0565b1561242e5760405162461bcd60e51b8152602060048201526002602482015261433560f01b6044820152606401610574565b600061243a8286613830565b90508061244d60a0890160808a01613de9565b606b54604051636eb1769f60e11b81523360048201526001600160a01b03918216602482015291169063dd62ed3e9060440160206040518083038186803b15801561249757600080fd5b505afa1580156124ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124cf9190614447565b10156125035760405162461bcd60e51b815260206004820152600360248201526221989960e91b6044820152606401610574565b61250d86826139c4565b606b546001600160a01b0316630a5ea46661252e60a08a0160808b01613de9565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015233602482015230604482015260648101849052608401600060405180830381600087803b15801561259a57600080fd5b505af11580156125ae573d6000803e3d6000fd5b50506068546001600160a01b03169150639873dba990506125d26020870187613de9565b6125e26040880160208901613de9565b888a8c6040518663ffffffff1660e01b815260040161260595949392919061472a565b600060405180830381600087803b15801561261f57600080fd5b505af1158015612633573d6000803e3d6000fd5b50505050858460016002811061264b5761264b614bef565b60200201602081019061265e9190613de9565b6001600160a01b03166126746020870187613de9565b6001600160a01b03167fed55db682403ff79a20059d95317cb2e4f4d322b5b4d062ca27c10de39bdcae4886040516126ae91815260200190565b60405180910390a450505050505050565b603360009054906101000a90046001600160a01b03166001600160a01b031663dd1eb52c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561270d57600080fd5b505afa158015612721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127459190614064565b156127785760405162461bcd60e51b815260206004820152600360248201526208662760eb1b6044820152606401610574565b6000828160200201516001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b1580156127b957600080fd5b505afa1580156127cd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127f591908101906140f5565b9050600083600160200201516001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b15801561283957600080fd5b505afa15801561284d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261287591908101906140f5565b90506128898460005b6020020151836132f1565b61289b8460015b6020020151826132f1565b81604001518160400151146128d75760405162461bcd60e51b8152602060048201526002602482015261219960f11b6044820152606401610574565b6001826020015160018111156128ef576128ef614bd9565b146129215760405162461bcd60e51b8152602060048201526002602482015261433360f01b6044820152606401610574565b60008160200151600181111561293957612939614bd9565b1461296b5760405162461bcd60e51b8152602060048201526002602482015261433360f01b6044820152606401610574565b81516020015142106129a55760405162461bcd60e51b815260206004820152600360248201526221989b60e91b6044820152606401610574565b6129ad613ccd565b606a54604080850151855191516308d52f0760e41b81526001600160a01b0390931692638d52f070926129e392916004016147ac565b6040805180830381600087803b1580156129fc57600080fd5b505af1158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a349190614495565b60208301819052818352600091612a4b9190614a05565b9050612a5a6123f78883614a31565b15612a8c5760405162461bcd60e51b8152602060048201526002602482015261433560f01b6044820152606401610574565b6000612a988289613830565b855160800151606b54604051636eb1769f60e11b81523360048201526001600160a01b039182166024820152929350839291169063dd62ed3e9060440160206040518083038186803b158015612aed57600080fd5b505afa158015612b01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b259190614447565b1015612b595760405162461bcd60e51b815260206004820152600360248201526221989960e91b6044820152606401610574565b612b678560400151826139c4565b606b5485516080015160405163052f523360e11b81526001600160a01b03918216600482015233602482015230604482015260648101849052911690630a5ea46690608401600060405180830381600087803b158015612bc657600080fd5b505af1158015612bda573d6000803e3d6000fd5b505060685488516020808b01518c51918d01516040516347704dbd60e01b81526001600160a01b039485166004820152918416602483015291831660448201529082166064820152608481018d9052911692506347704dbd915060a401600060405180830381600087803b158015612c5157600080fd5b505af1158015612c65573d6000803e3d6000fd5b50505050604085015186600160200201516001600160a01b031687600060200201516001600160a01b03167fa30ccd8346a5af0c1bc132bb36cd047e4aa428d028231aba6802e45bc4d172a58b604051612cc191815260200190565b60405180910390a45050505050505050565b600054610100900460ff16612cee5760005460ff1615612cf2565b303b155b612d555760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610574565b600054610100900460ff16158015612d77576000805461ffff19166101011790555b6001600160a01b038216612d8a57600080fd5b6033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915560405133907fec10a16af385903532506d1567380fd8d93d880e8ed4bcacc42b0848e781406a90600090a38015611142576000805461ff00191690555050565b600054610100900460ff16612e605760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610574565b612e686139e2565b565b603360009054906101000a90046001600160a01b03166001600160a01b031663f10827e06040518163ffffffff1660e01b815260040160206040518083038186803b158015612eb857600080fd5b505afa158015612ecc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ef09190614064565b15612f235760405162461bcd60e51b815260206004820152600360248201526243313960e81b6044820152606401610574565b6000828160200201516001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b158015612f6457600080fd5b505afa158015612f78573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612fa091908101906140f5565b9050600083600160200201516001600160a01b031663ce21286d6040518163ffffffff1660e01b815260040160006040518083038186803b158015612fe457600080fd5b505afa158015612ff8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261302091908101906140f5565b905061302d84600061287e565b613038846001612890565b81604001518160400151146130745760405162461bcd60e51b8152602060048201526002602482015261219960f11b6044820152606401610574565b60018260200151600181111561308c5761308c614bd9565b146130be5760405162461bcd60e51b8152602060048201526002602482015261433360f01b6044820152606401610574565b6000816020015160018111156130d6576130d6614bd9565b146131085760405162461bcd60e51b8152602060048201526002602482015261433360f01b6044820152606401610574565b606a546040808301518351915163a28702f160e01b81526000936001600160a01b03169263a28702f192613141929091906004016147ac565b60a060405180830381600087803b15801561315b57600080fd5b505af115801561316f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061319391906143ca565b905060006131b585836020015184600001516131af9190614a05565b90613830565b6060830151845160800151606d546066549394506000936131fe9392916001600160a01b03169063ffffffff680100000000000000008204811691600160801b90041687613a53565b905061320e846040015183613856565b60685487516020890151604051636ade6d1960e01b81523360048201526001600160a01b039283166024820152908216604482015260648101899052911690636ade6d1990608401600060405180830381600087803b15801561327057600080fd5b505af1158015613284573d6000803e3d6000fd5b505050506132ae3382846132989190614a50565b8651608001516001600160a01b03169190611ba8565b604080850151905187815233907f8f0329a95509d4de040892b232f60d694b862b6a18f929f332f3bf24d33cb69c9060200160405180910390a350505050505050565b60006133b160018360200151600181111561330e5761330e614bd9565b14606760010160009054906101000a90046001600160a01b03166001600160a01b0316630cbcae706040518163ffffffff1660e01b815260040160206040518083038186803b15801561336057600080fd5b505afa158015613374573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133989190613e06565b60685460408601519291906001600160a01b0316613b27565b9050806001600160a01b0316836001600160a01b031614611bfa5760405162461bcd60e51b815260206004820152600360248201526210cc4d60ea1b6044820152606401610574565b60008060006134218760400151600090815260706020526040902080546001909101549091565b91509150816000148015613433575080155b156135b1578651606001516000906001600160a01b0316156134ef5787516060810151602090910151604051632979d02560e01b81526001600160a01b03881692632979d0259261349a926004016001600160a01b03929092168252602082015260400190565b60206040518083038186803b1580156134b257600080fd5b505afa1580156134c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134ea9190614447565b6134f2565b60005b885160a081015160405163dd0060fd60e01b81529293506001600160a01b03169163dd0060fd9161352791859060040161480b565b604080518083038186803b15801561353e57600080fd5b505afa158015613552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135769190614495565b60408051808201825283815260208082018490528c83015160009081526070909152919091209295509093506135ae91906002613ceb565b50505b6040808801518851915163a28702f160e01b81526000926001600160a01b0389169263a28702f1926135e692906004016147ac565b60a060405180830381600087803b15801561360057600080fd5b505af1158015613614573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363891906143ca565b9050600060018960200151600181111561365457613654614bd9565b14156136a45761368e886136688587614a05565b60208501518551889161367a91614a05565b6136849190614a31565b6131af9190614a1d565b825190955061369d9089613830565b90506136d9565b6136c4886136b28587614a05565b60208501518551879161367a91614a05565b60208301519095506136d69089613830565b90505b6136e7896040015186613856565b8085111561373f576060820151895160800151606c5460408501516066546137329493926001600160a01b03169190600160601b900463ffffffff1661372d878c614a50565b613a53565b61373c9086614a50565b94505b50505050949350505050565b60006137a0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b3e9092919063ffffffff16565b805190915015611bfa57808060200190518101906137be9190614064565b611bfa5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610574565b6000670de0b6b3a76400006138458385614a31565b61384f9190614a1d565b9392505050565b6000828152606e60205260409020548111156138995760405162461bcd60e51b8152602060048201526002602482015261433960f01b6044820152606401610574565b6000828152606e6020526040812080548392906138b7908490614a50565b90915550505050565b60008085856138e857604051806040016040528060018152602001605360f81b815250613903565b604051806040016040528060018152602001601360fa1b8152505b604051602001613914929190614677565b6040516020818303038152906040528051906020012090506139a68482856040517f3d602d80600a3d3981f3363d3d373d3d3d363d730000000000000000000000008152606093841b60148201527f5af43d82803e903d91602b57fd5bf3ff000000000000000000000000000000006028820152921b6038830152604c8201526037808220606c830152605591012090565b9695505050505050565b60006117cc670de0b6b3a764000083614b99565b6000828152606e6020526040812080548392906138b7908490614a05565b600054610100900460ff16613a4d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610574565b60018055565b6000612710613a628584614a31565b613a6c9190614a1d565b905080613a7b575060006139a6565b6000612710613a8a8584614a31565b613a949190614a1d565b6001600160a01b038088166000908152607160209081526040808320938c16835292905290812080549293508392909190613ad0908490614a05565b90915550613ae090508183614a50565b6001600160a01b03808a166000908152607160209081526040808320938c1683529290529081208054909190613b17908490614a05565b9091555050509695505050505050565b6000613b35858585856138c0565b95945050505050565b6060613b4d8484600085613b55565b949350505050565b606082471015613bcd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610574565b843b613c1b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610574565b600080866001600160a01b03168587604051613c37919061469d565b60006040518083038185875af1925050503d8060008114613c74576040519150601f19603f3d011682016040523d82523d6000602084013e613c79565b606091505b5091509150613c89828286613c94565b979650505050505050565b60608315613ca357508161384f565b825115613cb35782518084602001fd5b8160405162461bcd60e51b815260040161057491906147c5565b60405180604001604052806002906020820280368337509192915050565b8260028101928215613d19579160200282015b82811115613d19578251825591602001919060010190613cfe565b50613d25929150613d29565b5090565b5b80821115613d255760008155600101613d2a565b8035613d4981614c1b565b919050565b8051613d4981614c1b565b80604081018310156117cc57600080fd5b60008083601f840112613d7c57600080fd5b50813567ffffffffffffffff811115613d9457600080fd5b6020830191508360208260051b8501011115613daf57600080fd5b9250929050565b80518015158114613d4957600080fd5b805160028110613d4957600080fd5b805163ffffffff81168114613d4957600080fd5b600060208284031215613dfb57600080fd5b813561384f81614c1b565b600060208284031215613e1857600080fd5b815161384f81614c1b565b60008060408385031215613e3657600080fd5b8235613e4181614c1b565b91506020830135613e5181614c1b565b809150509250929050565b600080600060608486031215613e7157600080fd5b8335613e7c81614c1b565b92506020840135613e8c81614c1b565b929592945050506040919091013590565b600080600080600060608688031215613eb557600080fd5b8535613ec081614c1b565b9450602086013567ffffffffffffffff80821115613edd57600080fd5b613ee989838a01613d6a565b90965094506040880135915080821115613f0257600080fd5b50613f0f88828901613d6a565b969995985093965092949392505050565b60008060408385031215613f3357600080fd5b8235613f3e81614c1b565b946020939093013593505050565b60008060608385031215613f5f57600080fd5b613f698484613d59565b946040939093013593505050565b60008060008060408587031215613f8d57600080fd5b843567ffffffffffffffff80821115613fa557600080fd5b613fb188838901613d6a565b90965094506020870135915080821115613fca57600080fd5b50613fd787828801613d6a565b95989497509550505050565b60008060008060408587031215613ff957600080fd5b843567ffffffffffffffff8082111561401157600080fd5b818701915087601f83011261402557600080fd5b81358181111561403457600080fd5b8860208260061b850101111561404957600080fd5b602092830196509450908601359080821115613fca57600080fd5b60006020828403121561407657600080fd5b61384f82613db6565b60006020828403121561409157600080fd5b5035919050565b6000806000608084860312156140ad57600080fd5b833567ffffffffffffffff8111156140c457600080fd5b840160c081870312156140d657600080fd5b9250602084013591506140ec8560408601613d59565b90509250925092565b6000602080838503121561410857600080fd5b825167ffffffffffffffff8082111561412057600080fd5b908401906060828703121561413457600080fd5b61413c614940565b82518281111561414b57600080fd5b830160c0818903121561415d57600080fd5b614165614969565b81518152858201518682015260408201518481111561418357600080fd5b82019350601f8401891361419657600080fd5b83516141a96141a4826149e1565b6149b0565b8082825288820191508887018c8a8560051b8a010111156141c957600080fd5b600097505b838810156141ec5780518352600197909701969189019189016141ce565b50604084015250614201905060608301613d4e565b606082015261421260808301613d4e565b608082015261422360a08301613d4e565b60a0820152825250614236838501613dc6565b9381019390935250604090810151908201529392505050565b6000610120828403121561426257600080fd5b61426a61498c565b61427383613d4e565b815261428160208401613d4e565b602082015261429260408401613d4e565b60408201526142a360608401613d4e565b60608201526142b460808401613d4e565b60808201526142c560a08401613d4e565b60a08201526142d660c08401613d4e565b60c08201526142e760e08401613dd5565b60e08201526101006142fa818501613dd5565b908201529392505050565b600061010080838503121561431957600080fd5b6040519081019067ffffffffffffffff8211818310171561433c5761433c614c05565b8160405261434984613dd5565b815261435760208501613dd5565b602082015261436860408501613dd5565b604082015261437960608501613dd5565b606082015261438a60808501613dd5565b608082015261439b60a08501613dd5565b60a08201526143ac60c08501613dd5565b60c08201526143bd60e08501613dd5565b60e0820152949350505050565b600060a082840312156143dc57600080fd5b60405160a0810181811067ffffffffffffffff821117156143ff576143ff614c05565b8060405250825181526020830151602082015260408301516040820152606083015161442a81614c1b565b606082015261443b60808401613db6565b60808201529392505050565b60006020828403121561445957600080fd5b5051919050565b600080600060a0848603121561447557600080fd5b833592506144868560208601613d59565b91506140ec8560608601613d59565b600080604083850312156144a857600080fd5b505080516020909101519092909150565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156144eb57600080fd5b8260051b8083602087013760009401602001938452509192915050565b803582526020810135602083015260006040820135601e1983360301811261452f57600080fd5b8201803567ffffffffffffffff81111561454857600080fd5b8060051b360384131561455a57600080fd5b60c0604086015261457260c0860182602085016144b9565b91505061458160608401613d3e565b6001600160a01b0316606085015261459b60808401613d3e565b6001600160a01b031660808501526145b560a08401613d3e565b6001600160a01b03811660a0860152509392505050565b600060c083018251845260208084015181860152604084015160c0604087015282815180855260e0880191508383019450600092505b808310156146225784518252938301936001929092019190830190614602565b506060860151935061463f60608801856001600160a01b03169052565b6080860151935061465b60808801856001600160a01b03169052565b60a086015193506139a660a08801856001600160a01b03169052565b8281526000825161468f816020850160208701614b4e565b919091016020019392505050565b600082516146af818460208701614b4e565b9190910192915050565b86815260006020878184015260408301875182890160005b828110156146ed578151845292840192908401906001016146d1565b5050506bffffffffffffffffffffffff19606097881b8116825295871b861660148201529390951b909316602883015250603c0195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613c8960a0830184614508565b60408101818360005b600281101561478a57815183526020928301929091019060010161476b565b50505092915050565b828152604060208201526000613b4d6040830184614508565b828152604060208201526000613b4d60408301846145cc565b60208152600082518060208401526147e4816040850160208701614b4e565b601f01601f19169190910160400192915050565b60208152600061384f6020830184614508565b60408152600061481e60408301856145cc565b90508260208301529392505050565b81516001600160a01b03908116825260208084015182169083015260408084015182169083015260608084015182169083015260808084015182169083015260a08084015182169083015260c080840151918216908301526101208201905060e08301516148a360e084018263ffffffff169052565b506101009283015163ffffffff16919092015290565b60006101008201905063ffffffff8084511683528060208501511660208401528060408501511660408401528060608501511660608401528060808501511660808401528060a08501511660a08401525060c083015161492160c084018263ffffffff169052565b5060e083015161493960e084018263ffffffff169052565b5092915050565b6040516060810167ffffffffffffffff8111828210171561496357614963614c05565b60405290565b60405160c0810167ffffffffffffffff8111828210171561496357614963614c05565b604051610120810167ffffffffffffffff8111828210171561496357614963614c05565b604051601f8201601f1916810167ffffffffffffffff811182821017156149d9576149d9614c05565b604052919050565b600067ffffffffffffffff8211156149fb576149fb614c05565b5060051b60200190565b60008219821115614a1857614a18614bad565b500190565b600082614a2c57614a2c614bc3565b500490565b6000816000190483118215151615614a4b57614a4b614bad565b500290565b600082821015614a6257614a62614bad565b500390565b600060c08236031215614a7957600080fd5b614a81614969565b8235815260208084013581830152604084013567ffffffffffffffff811115614aa957600080fd5b840136601f820112614aba57600080fd5b8035614ac86141a4826149e1565b8181528381019083850136600585901b860187011115614ae757600080fd5b600094505b83851015614b0a578035835260019490940193918501918501614aec565b50604086015250614b219250505060608401613d3e565b6060820152614b3260808401613d3e565b6080820152614b4360a08401613d3e565b60a082015292915050565b60005b83811015614b69578181015183820152602001614b51565b83811115614b78576000848401525b50505050565b6000600019821415614b9257614b92614bad565b5060010190565b600082614ba857614ba8614bc3565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114614c3057600080fd5b5056fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00a2646970667358221220b816041cc4b2257be0da28957defbc0a0968818ebda66c71d501b3cfc490e66564736f6c63430008050033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.