false
true
0

Contract Address Details

0xb6886B2C3537673941E4EAd63b95EaCb47173f6A

Contract Name
Protocol
Creator
0xdd79dc–34f4b0 at 0x1e7d7b–6384ba
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
26354002
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
Protocol




Optimization enabled
true
Compiler version
v0.7.3+commit.9bfce1f6




Optimization runs
200
EVM Version
istanbul




Verified at
2026-04-23T00:56:32.092038Z

contracts/Protocol.sol

// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

import "./proxy/InitializableAdminUpgradeabilityProxy.sol";
import "./utils/Create2.sol";
import "./utils/Initializable.sol";
import "./utils/Ownable.sol";
import "./utils/SafeMath.sol";
import "./utils/SafeERC20.sol";
import "./utils/ReentrancyGuard.sol";
import "./interfaces/ICover.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IOwnable.sol";
import "./interfaces/IProtocol.sol";
import "./interfaces/IProtocolFactory.sol";

/**
 * @title Protocol contract
 * @author crypto-pumpkin@github
 */
contract Protocol is IProtocol, Initializable, ReentrancyGuard, Ownable {
  using SafeMath for uint256;
  using SafeERC20 for IERC20;

  struct ClaimDetails {
    uint16 payoutNumerator; // 0 to 65,535
    uint16 payoutDenominator; // 0 to 65,535
    uint48 incidentTimestamp;
    uint48 claimEnactedTimestamp;
  }

  struct ExpirationTimestampInfo {
    bytes32 name;
    uint8 status; // 0 never set; 1 active, 2 inactive
  }

  bytes4 private constant COVER_INIT_SIGNITURE = bytes4(keccak256("initialize(string,uint48,address,uint256)"));

  /// @notice only active (true) protocol allows adding more covers
  bool public override active;

  bytes32 public override name;

  // nonce of for the protocol's claim status, it also indicates count of accepted claim in the past
  uint256 public override claimNonce;

  // delay # of seconds for redeem with accepted claim, redeemCollateral is not affected
  uint256 public override claimRedeemDelay;
  // delay # of seconds for redeem without accepted claim, redeemCollateral is not affected
  uint256 public override noclaimRedeemDelay;

  // only active covers, once there is an accepted claim (enactClaim called successfully), this sets to [].
  address[] public override activeCovers;
  address[] private allCovers;

  /// @notice list of every supported expirationTimestamp, all may not be active.
  uint48[] public override expirationTimestamps;

  /// @notice list of every supported collateral, all may not be active.
  address[] public override collaterals;

  // [claimNonce] => accepted ClaimDetails
  ClaimDetails[] public override claimDetails;

  // @notice collateral => status. 0 never set; 1 active, 2 inactive
  mapping(address => uint8) public override collateralStatusMap;

  mapping(uint48 => ExpirationTimestampInfo) public override expirationTimestampMap;

  // collateral => timestamp => coverAddress, most recent cover created for the collateral and timestamp combination
  mapping(address => mapping(uint48 => address)) public override coverMap;

  modifier onlyActive() {
    require(active, "COVER: protocol not active");
    _;
  }

  modifier onlyDev() {
    require(msg.sender == _dev(), "COVER: caller not dev");
    _;
  }

  modifier onlyGovernance() {
    require(msg.sender == IProtocolFactory(owner()).governance(), "COVER: caller not governance");
    _;
  }

  /// @dev Initialize, called once
  function initialize (
    bytes32 _protocolName,
    bool _active,
    address _collateral,
    uint48[] calldata _expirationTimestamps,
    bytes32[] calldata _expirationTimestampNames
  )
    external initializer
  {
    name = _protocolName;
    collaterals.push(_collateral);
    active = _active;
    expirationTimestamps = _expirationTimestamps;

    collateralStatusMap[_collateral] = 1;

    for (uint i = 0; i < _expirationTimestamps.length; i++) {
      if (block.timestamp < _expirationTimestamps[i]) {
        expirationTimestampMap[_expirationTimestamps[i]] = ExpirationTimestampInfo(
          _expirationTimestampNames[i],
          1
        );
      }
    }

    // set default delay for redeem
    claimRedeemDelay = 2 days;
    noclaimRedeemDelay = 10 days;

    initializeOwner();
  }

  function getProtocolDetails()
    external view override returns (
      bytes32 _name,
      bool _active,
      uint256 _claimNonce,
      uint256 _claimRedeemDelay,
      uint256 _noclaimRedeemDelay,
      address[] memory _collaterals,
      uint48[] memory _expirationTimestamps,
      address[] memory _allCovers,
      address[] memory _allActiveCovers
    )
  {
    return (
      name,
      active,
      claimNonce,
      claimRedeemDelay,
      noclaimRedeemDelay,
      getCollaterals(),
      getExpirationTimestamps(),
      getAllCovers(),
      getAllActiveCovers()
    );
  }

  function collateralsLength() external view override returns (uint256) {
    return collaterals.length;
  }

  function expirationTimestampsLength() external view override returns (uint256) {
    return expirationTimestamps.length;
  }

  function activeCoversLength() external view override returns (uint256) {
    return activeCovers.length;
  }

  function claimsLength() external view override returns (uint256) {
    return claimDetails.length;
  }

  /**
   * @notice add cover for sender
   *  - transfer collateral from sender to cover contract
   *  - mint the same amount CLAIM covToken to sender
   *  - mint the same amount NOCLAIM covToken to sender
   */
  function addCover(address _collateral, uint48 _timestamp, uint256 _amount)
    external override onlyActive nonReentrant returns (bool)
  {
    require(_amount > 0, "COVER: amount <= 0");
    require(collateralStatusMap[_collateral] == 1, "COVER: invalid collateral");
    require(block.timestamp < _timestamp && expirationTimestampMap[_timestamp].status == 1, "COVER: invalid expiration date");

    // Validate sender collateral balance is > amount
    IERC20 collateral = IERC20(_collateral);
    require(collateral.balanceOf(msg.sender) >= _amount, "COVER: amount > collateral balance");

    address addr = coverMap[_collateral][_timestamp];

    // Deploy new cover contract if not exist or if claim accepted
    if (addr == address(0) || ICover(addr).claimNonce() != claimNonce) {
      string memory coverName = _generateCoverName(_timestamp, collateral.symbol());

      bytes memory bytecode = type(InitializableAdminUpgradeabilityProxy).creationCode;
      bytes32 salt = keccak256(abi.encodePacked(name, _timestamp, _collateral, claimNonce));
      addr = Create2.deploy(0, salt, bytecode);

      bytes memory initData = abi.encodeWithSelector(COVER_INIT_SIGNITURE, coverName, _timestamp, _collateral, claimNonce);
      address coverImplementation = IProtocolFactory(owner()).coverImplementation();
      InitializableAdminUpgradeabilityProxy(payable(addr)).initialize(
        coverImplementation,
        IOwnable(owner()).owner(),
        initData
      );

      activeCovers.push(addr);
      allCovers.push(addr);
      coverMap[_collateral][_timestamp] = addr;
    }

    // move collateral to the cover contract and mint CovTokens to sender
    uint256 coverBalanceBefore = collateral.balanceOf(addr);
    collateral.safeTransferFrom(msg.sender, addr, _amount);
    uint256 coverBalanceAfter = collateral.balanceOf(addr);
    require(coverBalanceAfter > coverBalanceBefore, "COVER: collateral transfer failed");
    ICover(addr).mint(coverBalanceAfter.sub(coverBalanceBefore), msg.sender);
    return true;
  }

  /// @notice update status or add new expiration timestamp
  function updateExpirationTimestamp(uint48 _expirationTimestamp, bytes32 _expirationTimestampName, uint8 _status) external override onlyDev returns (bool) {
    require(block.timestamp < _expirationTimestamp, "COVER: invalid expiration date");
    require(_status > 0 && _status < 3, "COVER: status not in (0, 2]");

    if (expirationTimestampMap[_expirationTimestamp].status == 0) {
      expirationTimestamps.push(_expirationTimestamp);
    }
    expirationTimestampMap[_expirationTimestamp] = ExpirationTimestampInfo(
      _expirationTimestampName,
      _status
    );
    return true;
  }

  /// @notice update status or add new collateral
  function updateCollateral(address _collateral, uint8 _status) external override onlyDev returns (bool) {
    require(_collateral != address(0), "COVER: address cannot be 0");
    require(_status > 0 && _status < 3, "COVER: status not in (0, 2]");

    if (collateralStatusMap[_collateral] == 0) {
      collaterals.push(_collateral);
    }
    collateralStatusMap[_collateral] = _status;
    return true;
  }

  /**
   * @dev enact accepted claim, all covers are to be paid out
   *  - increment claimNonce
   *  - delete activeCovers list
   *  - only COVER claim manager can call this function
   *
   * Emit ClaimAccepted
   */
  function enactClaim(
    uint16 _payoutNumerator,
    uint16 _payoutDenominator,
    uint48 _incidentTimestamp,
    uint256 _protocolNonce
  )
   external override returns (bool)
  {
    require(_protocolNonce == claimNonce, "COVER: nonces do not match");
    require(_payoutNumerator <= _payoutDenominator && _payoutNumerator > 0, "COVER: payout % is not in (0%, 100%]");
    require(msg.sender == IProtocolFactory(owner()).claimManager(), "COVER: caller not claimManager");

    claimNonce = claimNonce.add(1);
    delete activeCovers;
    claimDetails.push(ClaimDetails(
      _payoutNumerator,
      _payoutDenominator,
      _incidentTimestamp,
      uint48(block.timestamp)
    ));
    emit ClaimAccepted(_protocolNonce);
    return true;
  }

  // update status of protocol, if false, will pause new cover creation
  function setActive(bool _active) external override onlyDev returns (bool) {
    active = _active;
    return true;
  }

  function updateClaimRedeemDelay(uint256 _claimRedeemDelay)
   external override onlyGovernance returns (bool)
  {
    claimRedeemDelay = _claimRedeemDelay;
    return true;
  }

  function updateNoclaimRedeemDelay(uint256 _noclaimRedeemDelay)
   external override onlyGovernance returns (bool)
  {
    noclaimRedeemDelay = _noclaimRedeemDelay;
    return true;
  }

  function getAllCovers() private view returns (address[] memory) {
    return allCovers;
  }

  function getAllActiveCovers() private view returns (address[] memory) {
    return activeCovers;
  }

  function getCollaterals() private view returns (address[] memory) {
    return collaterals;
  }

  function getExpirationTimestamps() private view returns (uint48[] memory) {
    return expirationTimestamps;
  }

  /// @dev the owner of this contract is ProtocolFactory contract. The owner of ProtocolFactory is dev
  function _dev() private view returns (address) {
    return IOwnable(owner()).owner();
  }

  /// @dev generate the cover name. Example: COVER_CURVE_2020_12_31_DAI_0
  function _generateCoverName(uint48 _expirationTimestamp, string memory _collateralSymbol)
   internal view returns (string memory) 
  {
    return string(abi.encodePacked(
      "COVER",
      "_",
      bytes32ToString(name),
      "_",
      bytes32ToString(expirationTimestampMap[_expirationTimestamp].name),
      "_",
      _collateralSymbol,
      "_",
      uintToString(claimNonce)
    ));
  }

  // string helper
  function bytes32ToString(bytes32 _bytes32) internal pure returns (string memory) {
    uint8 i = 0;
    while(i < 32 && _bytes32[i] != 0) {
        i++;
    }
    bytes memory bytesArray = new bytes(i);
    for (i = 0; i < 32 && _bytes32[i] != 0; i++) {
        bytesArray[i] = _bytes32[i];
    }
    return string(bytesArray);
  }

  // string helper
  function uintToString(uint256 _i) internal pure returns (string memory _uintAsString) {
    if (_i == 0) {
      return "0";
    }
    uint256 j = _i;
    uint256 len;
    while (j != 0) {
      len++;
      j /= 10;
    }
    bytes memory bstr = new bytes(len);
    uint256 k = len - 1;
    while (_i != 0) {
      bstr[k--] = byte(uint8(48 + _i % 10));
      _i /= 10;
    }
    return string(bstr);
  }
}
        

/

// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

import "../interfaces/IOwnable.sol";
import "./Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 * @author crypto-pumpkin@github
 *
 * By initialization, the owner account will be the one that called initializeOwner. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Initializable {
    address private _owner;
    address private _newOwner;

    event OwnershipTransferInitiated(address indexed previousOwner, address indexed newOwner);
    event OwnershipTransferCompleted(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev COVER: Initializes the contract setting the deployer as the initial owner.
     */
    function initializeOwner() internal initializer {
        _owner = msg.sender;
        emit OwnershipTransferCompleted(address(0), _owner);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == msg.sender, "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferInitiated(_owner, newOwner);
        _newOwner = newOwner;
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function claimOwnership() public virtual {
        require(_newOwner == msg.sender, "Ownable: caller is not the owner");
        emit OwnershipTransferCompleted(_owner, _newOwner);
        _owner = _newOwner;
    }
}
          

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.3;

/**
 * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
 * `CREATE2` can be used to compute in advance the address where a smart
 * contract will be deployed, which allows for interesting new mechanisms known
 * as 'counterfactual interactions'.
 *
 * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
 * information.
 */
library Create2 {
    /**
     * @dev Deploys a contract using `CREATE2`. The address where the contract
     * will be deployed can be known in advance via {computeAddress}.
     *
     * The bytecode for a contract can be obtained from Solidity with
     * `type(contractName).creationCode`.
     *
     * Requirements:
     *
     * - `bytecode` must not be empty.
     * - `salt` must have not been used for `bytecode` already.
     * - the factory must have a balance of at least `amount`.
     * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
     */
    function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address payable) {
        address payable addr;
        require(address(this).balance >= amount, "Create2: insufficient balance");
        require(bytecode.length != 0, "Create2: bytecode length is zero");
        // solhint-disable-next-line no-inline-assembly
        assembly {
            addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
        }
        require(addr != address(0), "Create2: Failed on deploy");
        return addr;
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
     * `bytecodeHash` or `salt` will result in a new destination address.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
        return computeAddress(salt, bytecodeHash, address(this));
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
     * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address) {
        bytes32 _data = keccak256(
            abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash)
        );
        return address(uint256(_data));
    }
}
          

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.3;

library Address {
    /**
     * @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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

/

// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

import './BaseAdminUpgradeabilityProxy.sol';

/**
 * @title InitializableAdminUpgradeabilityProxy
 * @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for 
 * initializing the implementation, admin, and init data.
 */
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy {
  /**
   * Contract initializer.
   * @param _logic address of the initial implementation.
   * @param _admin Address of the proxy administrator.
   * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
   * It should include the signature and the parameters of the function to be called, as described in
   * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
   * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
   */
  function initialize(address _logic, address _admin, bytes memory _data) public payable {
    require(_implementation() == address(0));

    assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
    _setImplementation(_logic);
    if(_data.length > 0) {
      (bool success,) = _logic.delegatecall(_data);
      require(success);
    }

    assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
    _setAdmin(_admin);
  }
}
          

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.3;

import './BaseUpgradeabilityProxy.sol';

/**
 * @title BaseAdminUpgradeabilityProxy
 * @dev This contract combines an upgradeability proxy with an authorization
 * mechanism for administrative tasks.
 * All external functions in this contract must be guarded by the
 * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
 * feature proposal that would enable this to be done automatically.
 */
contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
  /**
   * @dev Emitted when the administration has been transferred.
   * @param previousAdmin Address of the previous admin.
   * @param newAdmin Address of the new admin.
   */
  event AdminChanged(address previousAdmin, address newAdmin);

  /**
   * @dev Storage slot with the admin of the contract.
   * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
   * validated in the constructor.
   */

  bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

  /**
   * @dev Modifier to check whether the `msg.sender` is the admin.
   * If it is, it will run the function. Otherwise, it will delegate the call
   * to the implementation.
   */
  modifier ifAdmin() {
    if (msg.sender == _admin()) {
      _;
    } else {
      _fallback();
    }
  }

  /**
   * @return The address of the proxy admin.
   */
  function admin() external ifAdmin returns (address) {
    return _admin();
  }

  /**
   * @return The address of the implementation.
   */
  function implementation() external ifAdmin returns (address) {
    return _implementation();
  }

  /**
   * @dev Changes the admin of the proxy.
   * Only the current admin can call this function.
   * @param newAdmin Address to transfer proxy administration to.
   */
  function changeAdmin(address newAdmin) external ifAdmin {
    require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
    emit AdminChanged(_admin(), newAdmin);
    _setAdmin(newAdmin);
  }

  /**
   * @dev Upgrade the backing implementation of the proxy.
   * Only the admin can call this function.
   * @param newImplementation Address of the new implementation.
   */
  function upgradeTo(address newImplementation) external ifAdmin {
    _upgradeTo(newImplementation);
  }

  /**
   * @dev Upgrade the backing implementation of the proxy and call a function
   * on the new implementation.
   * This is useful to initialize the proxied contract.
   * @param newImplementation Address of the new implementation.
   * @param data Data to send as msg.data in the low level call.
   * It should include the signature and the parameters of the function to be called, as described in
   * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
   */
  function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
    _upgradeTo(newImplementation);
    (bool success,) = newImplementation.delegatecall(data);
    require(success);
  }

  /**
   * @return adm The admin slot.
   */
  function _admin() internal view returns (address adm) {
    bytes32 slot = ADMIN_SLOT;
    assembly {
      adm := sload(slot)
    }
  }

  /**
   * @dev Sets the address of the proxy admin.
   * @param newAdmin Address of the new proxy admin.
   */
  function _setAdmin(address newAdmin) internal {
    bytes32 slot = ADMIN_SLOT;

    assembly {
      sstore(slot, newAdmin)
    }
  }
} 
          

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.3;

import "../utils/Address.sol";
import "./Proxy.sol";

/**
 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
 * implementation address that can be changed. This address is stored in storage in the location specified by
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
 * implementation behind the proxy.
 * 
 * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
 * {TransparentUpgradeableProxy}.
 */
contract BaseUpgradeabilityProxy is Proxy {

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _implementation() internal override view returns (address impl) {
        bytes32 slot = IMPLEMENTATION_SLOT;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            impl := sload(slot)
        }
    }

    /**
     * @dev Upgrades the proxy to a new implementation.
     * 
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) internal {
        require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");

        bytes32 slot = IMPLEMENTATION_SLOT;

        // solhint-disable-next-line no-inline-assembly
        assembly {
            sstore(slot, newImplementation)
        }
    }
}
          

/

// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

/**
 * @dev ProtocolFactory contract interface. See {ProtocolFactory}.
 * @author crypto-pumpkin@github
 */
interface IProtocolFactory {
  /// @notice emit when a new protocol is supported in COVER
  event ProtocolInitiation(address protocolAddress);

  function getAllProtocolAddresses() external view returns (address[] memory);
  function getRedeemFees() external view returns (uint16 _numerator, uint16 _denominator);
  function redeemFeeNumerator() external view returns (uint16);
  function redeemFeeDenominator() external view returns (uint16);
  function protocolImplementation() external view returns (address);
  function coverImplementation() external view returns (address);
  function coverERC20Implementation() external view returns (address);
  function treasury() external view returns (address);
  function governance() external view returns (address);
  function claimManager() external view returns (address);
  function protocols(bytes32 _protocolName) external view returns (address);

  function getProtocolsLength() external view returns (uint256);
  function getProtocolNameAndAddress(uint256 _index) external view returns (bytes32, address);
  /// @notice return contract address, the contract may not be deployed yet
  function getProtocolAddress(bytes32 _name) external view returns (address);
  /// @notice return contract address, the contract may not be deployed yet
  function getCoverAddress(bytes32 _protocolName, uint48 _timestamp, address _collateral, uint256 _claimNonce) external view returns (address);
  /// @notice return contract address, the contract may not be deployed yet
  function getCovTokenAddress(bytes32 _protocolName, uint48 _timestamp, address _collateral, uint256 _claimNonce, bool _isClaimCovToken) external view returns (address);

  /// @notice access restriction - owner (dev)
  /// @dev update this will only affect contracts deployed after
  function updateProtocolImplementation(address _newImplementation) external returns (bool);
  /// @dev update this will only affect contracts deployed after
  function updateCoverImplementation(address _newImplementation) external returns (bool);
  /// @dev update this will only affect contracts deployed after
  function updateCoverERC20Implementation(address _newImplementation) external returns (bool);
  function addProtocol(
    bytes32 _name,
    bool _active,
    address _collateral,
    uint48[] calldata _timestamps,
    bytes32[] calldata _timestampNames
  ) external returns (address);
  function updateTreasury(address _address) external returns (bool);
  function updateClaimManager(address _address) external returns (bool);

  /// @notice access restriction - governance
  function updateFees(uint16 _redeemFeeNumerator, uint16 _redeemFeeDenominator) external returns (bool);
  function updateGovernance(address _address) external returns (bool);
}  
          

/

// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

import "./IERC20.sol";

/**
 * @title CoverERC20 contract interface, implements {IERC20}. See {CoverERC20}.
 * @author crypto-pumpkin@github
 */
interface ICoverERC20 is IERC20 {
    function burn(uint256 _amount) external returns (bool);

    /// @notice access restriction - owner (Cover)
    function mint(address _account, uint256 _amount) external returns (bool);
    function setSymbol(string calldata _symbol) external returns (bool);
    function burnByCover(address _account, uint256 _amount) external returns (bool);
}
          

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @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 ReentrancyGuard {
    // 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;

    constructor () {
        _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 make 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;
    }
}
          

/

// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

/**
 * @dev Protocol contract interface. See {Protocol}.
 * @author crypto-pumpkin@github
 */
interface IProtocol {
  /// @notice emit when a claim against the protocol is accepted
  event ClaimAccepted(uint256 newClaimNonce);

  function getProtocolDetails()
    external view returns (
      bytes32 _name,
      bool _active,
      uint256 _claimNonce,
      uint256 _claimRedeemDelay,
      uint256 _noclaimRedeemDelay,
      address[] memory _collaterals,
      uint48[] memory _expirationTimestamps,
      address[] memory _allCovers,
      address[] memory _allActiveCovers
    );
  function active() external view returns (bool);
  function name() external view returns (bytes32);
  function claimNonce() external view returns (uint256);
  /// @notice delay # of seconds for redeem with accepted claim, redeemCollateral is not affected
  function claimRedeemDelay() external view returns (uint256);
  /// @notice delay # of seconds for redeem without accepted claim, redeemCollateral is not affected
  function noclaimRedeemDelay() external view returns (uint256);
  function activeCovers(uint256 _index) external view returns (address);
  function claimDetails(uint256 _claimNonce) external view returns (uint16 _payoutNumerator, uint16 _payoutDenominator, uint48 _incidentTimestamp, uint48 _timestamp);
  function collateralStatusMap(address _collateral) external view returns (uint8 _status);
  function expirationTimestampMap(uint48 _expirationTimestamp) external view returns (bytes32 _name, uint8 _status);
  function coverMap(address _collateral, uint48 _expirationTimestamp) external view returns (address);

  function collaterals(uint256 _index) external view returns (address);
  function collateralsLength() external view returns (uint256);
  function expirationTimestamps(uint256 _index) external view returns (uint48);
  function expirationTimestampsLength() external view returns (uint256);
  function activeCoversLength() external view returns (uint256);
  function claimsLength() external view returns (uint256);
  function addCover(address _collateral, uint48 _timestamp, uint256 _amount)
    external returns (bool);

  /// @notice access restriction - claimManager
  function enactClaim(uint16 _payoutNumerator, uint16 _payoutDenominator, uint48 _incidentTimestamp, uint256 _protocolNonce) external returns (bool);

  /// @notice access restriction - dev
  function setActive(bool _active) external returns (bool);
  function updateExpirationTimestamp(uint48 _expirationTimestamp, bytes32 _expirationTimestampName, uint8 _status) external returns (bool);
  function updateCollateral(address _collateral, uint8 _status) external returns (bool);

  /// @notice access restriction - governance
  function updateClaimRedeemDelay(uint256 _claimRedeemDelay) external returns (bool);
  function updateNoclaimRedeemDelay(uint256 _noclaimRedeemDelay) external returns (bool);
}
          

/

// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;


/**
 * @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 {UpgradeableProxy-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.
 */
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() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        // extcodesize checks the size of the code stored in an address, and
        // address returns the current address. Since the code is still not
        // deployed when running a constructor, any checks on its code size will
        // yield zero, making it an effective way to detect if a contract is
        // under construction or not.
        address self = address(this);
        uint256 cs;
        // solhint-disable-next-line no-inline-assembly
        assembly { cs := extcodesize(self) }
        return cs == 0;
    }
}
          

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.3;

/**
 * @title Interface of Ownable
 */
interface IOwnable {
    function owner() external view returns (address);
}
          

/

// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

/**
 * @title Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    function symbol() external view returns (string memory);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function approve(address spender, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    function totalSupply() external view returns (uint256);

    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
}
          

/

// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

import "./ICoverERC20.sol";

/**
 * @title Cover contract interface. See {Cover}.
 * @author crypto-pumpkin@github
 */
interface ICover {
  event NewCoverERC20(address);

  function getCoverDetails()
    external view returns (string memory _name, uint48 _expirationTimestamp, address _collateral, uint256 _claimNonce, ICoverERC20 _claimCovToken, ICoverERC20 _noclaimCovToken);
  function expirationTimestamp() external view returns (uint48);
  function collateral() external view returns (address);
  function claimCovToken() external view returns (ICoverERC20);
  function noclaimCovToken() external view returns (ICoverERC20);
  function name() external view returns (string memory);
  function claimNonce() external view returns (uint256);

  function redeemClaim() external;
  function redeemNoclaim() external;
  function redeemCollateral(uint256 _amount) external;

  /// @notice access restriction - owner (Protocol)
  function mint(uint256 _amount, address _receiver) external;

  /// @notice access restriction - dev
  function setCovTokenSymbol(string calldata _name) external;
}
          

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.3;

import "../interfaces/IERC20.sol";
import "./SafeMath.sol";
import "./Address.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 SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

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

    function safeTransferFrom(IERC20 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(IERC20 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'
        // solhint-disable-next-line max-line-length
        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(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _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(IERC20 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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
          

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.3;

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

        return c;
    }

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

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

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

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

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

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

        return c;
    }

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

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

/

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.3;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 * 
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 * 
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     * 
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }

    /**
     * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
     * and {_fallback} should delegate.
     */
    function _implementation() internal virtual view returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     * 
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _fallback() internal {
        _beforeFallback();
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback () payable external {
        _fallback();
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
     * is empty.
     */
    receive () payable external {
        _fallback();
    }

    /**
     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
     * call, or as part of the Solidity `fallback` or `receive` functions.
     * 
     * If overriden should call `super._beforeFallback()`.
     */
    function _beforeFallback() internal virtual {
    }
}
          

Compiler Settings

{"remappings":[],"optimizer":{"runs":200,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"contracts/Protocol.sol":"Protocol"}}
              

Contract ABI

[{"type":"event","name":"ClaimAccepted","inputs":[{"type":"uint256","name":"newClaimNonce","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferCompleted","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferInitiated","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"active","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"activeCovers","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"activeCoversLength","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addCover","inputs":[{"type":"address","name":"_collateral","internalType":"address"},{"type":"uint48","name":"_timestamp","internalType":"uint48"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16","name":"payoutNumerator","internalType":"uint16"},{"type":"uint16","name":"payoutDenominator","internalType":"uint16"},{"type":"uint48","name":"incidentTimestamp","internalType":"uint48"},{"type":"uint48","name":"claimEnactedTimestamp","internalType":"uint48"}],"name":"claimDetails","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimNonce","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimRedeemDelay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimsLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"collateralStatusMap","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"collaterals","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"collateralsLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"coverMap","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint48","name":"","internalType":"uint48"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"enactClaim","inputs":[{"type":"uint16","name":"_payoutNumerator","internalType":"uint16"},{"type":"uint16","name":"_payoutDenominator","internalType":"uint16"},{"type":"uint48","name":"_incidentTimestamp","internalType":"uint48"},{"type":"uint256","name":"_protocolNonce","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"name","internalType":"bytes32"},{"type":"uint8","name":"status","internalType":"uint8"}],"name":"expirationTimestampMap","inputs":[{"type":"uint48","name":"","internalType":"uint48"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint48","name":"","internalType":"uint48"}],"name":"expirationTimestamps","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"expirationTimestampsLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"_name","internalType":"bytes32"},{"type":"bool","name":"_active","internalType":"bool"},{"type":"uint256","name":"_claimNonce","internalType":"uint256"},{"type":"uint256","name":"_claimRedeemDelay","internalType":"uint256"},{"type":"uint256","name":"_noclaimRedeemDelay","internalType":"uint256"},{"type":"address[]","name":"_collaterals","internalType":"address[]"},{"type":"uint48[]","name":"_expirationTimestamps","internalType":"uint48[]"},{"type":"address[]","name":"_allCovers","internalType":"address[]"},{"type":"address[]","name":"_allActiveCovers","internalType":"address[]"}],"name":"getProtocolDetails","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"bytes32","name":"_protocolName","internalType":"bytes32"},{"type":"bool","name":"_active","internalType":"bool"},{"type":"address","name":"_collateral","internalType":"address"},{"type":"uint48[]","name":"_expirationTimestamps","internalType":"uint48[]"},{"type":"bytes32[]","name":"_expirationTimestampNames","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"noclaimRedeemDelay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setActive","inputs":[{"type":"bool","name":"_active","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"updateClaimRedeemDelay","inputs":[{"type":"uint256","name":"_claimRedeemDelay","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"updateCollateral","inputs":[{"type":"address","name":"_collateral","internalType":"address"},{"type":"uint8","name":"_status","internalType":"uint8"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"updateExpirationTimestamp","inputs":[{"type":"uint48","name":"_expirationTimestamp","internalType":"uint48"},{"type":"bytes32","name":"_expirationTimestampName","internalType":"bytes32"},{"type":"uint8","name":"_status","internalType":"uint8"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"updateNoclaimRedeemDelay","inputs":[{"type":"uint256","name":"_noclaimRedeemDelay","internalType":"uint256"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50600180556135a3806100246000396000f3fe608060405234801561001057600080fd5b50600436106101c35760003560e01c80637ddfe6b3116100f9578063aae7f44d11610097578063b2cfb94d11610071578063b2cfb94d146105f1578063c13b1b13146106cd578063ecd2bf9f14610705578063f2fde38b14610739576101c3565b8063aae7f44d1461058a578063ab70b003146105ca578063acec338a146105d2576101c3565b80638da5cb5b116100d35780638da5cb5b1461053e578063a320b36314610546578063a5212d9a1461057a578063aa23fddc14610582576101c3565b80637ddfe6b3146103a75780638080425b146103e657806381c4fb5b14610536576101c3565b80633666e8c411610166578063630a237611610140578063630a23761461032b57806366a50c131461034857806372c896c3146103655780637cd690d31461039f576101c3565b80633666e8c4146102b25780633d040c6c146102cf5780634e71e0c814610321576101c3565b80631e2dd23b116101a25780631e2dd23b1461022d57806324c1173b1461023557806329ad2fb21461026e5780632e09caf914610276576101c3565b806207fa19146101c857806302fb0c5e1461020b57806306fdde0314610213575b600080fd5b6101f7600480360360408110156101de57600080fd5b5080356001600160a01b0316906020013560ff1661075f565b604080519115158252519081900360200190f35b6101f7610924565b61021b610934565b60408051918252519081900360200190f35b61021b61093a565b6102526004803603602081101561024b57600080fd5b5035610940565b604080516001600160a01b039092168252519081900360200190f35b61021b610967565b61029c6004803603602081101561028c57600080fd5b50356001600160a01b031661096d565b6040805160ff9092168252519081900360200190f35b6101f7600480360360208110156102c857600080fd5b5035610982565b6102ec600480360360208110156102e557600080fd5b5035610a5a565b6040805161ffff958616815293909416602084015265ffffffffffff9182168385015216606082015290519081900360800190f35b610329610a9f565b005b6102526004803603602081101561034157600080fd5b5035610b61565b6101f76004803603602081101561035e57600080fd5b5035610b6e565b6101f76004803603606081101561037b57600080fd5b506001600160a01b038135169065ffffffffffff6020820135169060400135610c41565b61021b6116e2565b6101f7600480360360808110156103bd57600080fd5b5061ffff813581169160208101359091169065ffffffffffff60408201351690606001356116e8565b6103ee611989565b604051808a8152602001891515815260200188815260200187815260200186815260200180602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561045a578181015183820152602001610442565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015610499578181015183820152602001610481565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156104d85781810151838201526020016104c0565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156105175781810151838201526020016104ff565b505050509050019d505050505050505050505050505060405180910390f35b61021b6119f0565b6102526119f6565b6101f76004803603606081101561055c57600080fd5b50803565ffffffffffff16906020810135906040013560ff16611a05565b61021b611bfb565b61021b611c01565b6105af600480360360208110156105a057600080fd5b503565ffffffffffff16611c07565b6040805192835260ff90911660208301528051918290030190f35b61021b611c23565b6101f7600480360360208110156105e857600080fd5b50351515611c29565b610329600480360360a081101561060757600080fd5b81359160208101351515916001600160a01b036040830135169190810190608081016060820135600160201b81111561063f57600080fd5b82018360208201111561065157600080fd5b803590602001918460208302840111600160201b8311171561067257600080fd5b919390929091602081019035600160201b81111561068f57600080fd5b8201836020820111156106a157600080fd5b803590602001918460208302840111600160201b831117156106c257600080fd5b509092509050611cb1565b6106ea600480360360208110156106e357600080fd5b5035611ebe565b6040805165ffffffffffff9092168252519081900360200190f35b6102526004803603604081101561071b57600080fd5b5080356001600160a01b0316906020013565ffffffffffff16611ef7565b6103296004803603602081101561074f57600080fd5b50356001600160a01b0316611f1d565b600061076961201d565b6001600160a01b0316336001600160a01b0316146107c6576040805162461bcd60e51b815260206004820152601560248201527421a7ab22a91d1031b0b63632b9103737ba103232bb60591b604482015290519081900360640190fd5b6001600160a01b038316610821576040805162461bcd60e51b815260206004820152601a60248201527f434f5645523a20616464726573732063616e6e6f742062652030000000000000604482015290519081900360640190fd5b60008260ff16118015610837575060038260ff16105b610888576040805162461bcd60e51b815260206004820152601b60248201527f434f5645523a20737461747573206e6f7420696e2028302c20325d0000000000604482015290519081900360640190fd5b6001600160a01b0383166000908152600d602052604090205460ff166108f457600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b0319166001600160a01b0385161790555b506001600160a01b0382166000908152600d60205260409020805460ff831660ff19909116179055600192915050565b600354600160a01b900460ff1681565b60045481565b600a5490565b600b818154811061094d57fe5b6000918252602090912001546001600160a01b0316905081565b600b5490565b600d6020526000908152604090205460ff1681565b600061098c6119f6565b6001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c457600080fd5b505afa1580156109d8573d6000803e3d6000fd5b505050506040513d60208110156109ee57600080fd5b50516001600160a01b03163314610a4c576040805162461bcd60e51b815260206004820152601c60248201527f434f5645523a2063616c6c6572206e6f7420676f7665726e616e636500000000604482015290519081900360640190fd5b50600781905560015b919050565b600c8181548110610a6757fe5b60009182526020909120015461ffff8082169250620100008204169065ffffffffffff600160201b8204811691600160501b90041684565b6003546001600160a01b03163314610afe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6003546002546040516001600160a01b0392831692909116907fe9a5158ac7353c7c7322ececc080bc8e89334efa5795b6e21e40eb266b0003d690600090a3600354600280546001600160a01b0319166001600160a01b03909216919091179055565b6008818154811061094d57fe5b6000610b786119f6565b6001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb057600080fd5b505afa158015610bc4573d6000803e3d6000fd5b505050506040513d6020811015610bda57600080fd5b50516001600160a01b03163314610c38576040805162461bcd60e51b815260206004820152601c60248201527f434f5645523a2063616c6c6572206e6f7420676f7665726e616e636500000000604482015290519081900360640190fd5b50600655600190565b600354600090600160a01b900460ff16610ca2576040805162461bcd60e51b815260206004820152601a60248201527f434f5645523a2070726f746f636f6c206e6f7420616374697665000000000000604482015290519081900360640190fd5b60026001541415610cfa576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260015581610d46576040805162461bcd60e51b81526020600482015260126024820152710434f5645523a20616d6f756e74203c3d20360741b604482015290519081900360640190fd5b6001600160a01b0384166000908152600d602052604090205460ff16600114610db6576040805162461bcd60e51b815260206004820152601960248201527f434f5645523a20696e76616c696420636f6c6c61746572616c00000000000000604482015290519081900360640190fd5b8265ffffffffffff1642108015610dea575065ffffffffffff83166000908152600e6020526040902060019081015460ff16145b610e3b576040805162461bcd60e51b815260206004820152601e60248201527f434f5645523a20696e76616c69642065787069726174696f6e20646174650000604482015290519081900360640190fd5b604080516370a0823160e01b81523360048201529051859184916001600160a01b038416916370a08231916024808301926020929190829003018186803b158015610e8557600080fd5b505afa158015610e99573d6000803e3d6000fd5b505050506040513d6020811015610eaf57600080fd5b50511015610eee5760405162461bcd60e51b81526004018080602001828103825260228152602001806134d06022913960400191505060405180910390fd5b6001600160a01b038086166000908152600f6020908152604080832065ffffffffffff8916845290915290205416801580610f8f5750600554816001600160a01b031663a5212d9a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6057600080fd5b505afa158015610f74573d6000803e3d6000fd5b505050506040513d6020811015610f8a57600080fd5b505114155b1561150c5760606110c386846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015610fd357600080fd5b505afa158015610fe7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561101057600080fd5b8101908080516040519392919084600160201b82111561102f57600080fd5b90830190602082018581111561104457600080fd5b8251600160201b81118282018810171561105d57600080fd5b82525081516020918201929091019080838360005b8381101561108a578181015183820152602001611072565b50505050905090810190601f1680156110b75780820380516001836020036101000a031916815260200191505b50604052505050612090565b90506060604051806020016110d790612bee565b601f1982820381018352601f9091011660408181526004546005546020848101929092526001600160d01b031960d08d901b16838501526bffffffffffffffffffffffff1960608e901b166046850152605a8085019190915282518085039091018152607a909301909152815191012090915061115660008284612262565b935060607f1e45234e4529e32717c6a15fbcfc06e5b32392b766c88da8a2c388ed37e2cafa848a8c60055460405160240180806020018565ffffffffffff168152602001846001600160a01b03168152602001838152602001828103825286818151815260200191508051906020019080838360005b838110156111e45781810151838201526020016111cc565b50505050905090810190601f1680156112115780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006112586119f6565b6001600160a01b03166364bb44dc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561129057600080fd5b505afa1580156112a4573d6000803e3d6000fd5b505050506040513d60208110156112ba57600080fd5b505190506001600160a01b03861663cf7a1d77826112d66119f6565b6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561130e57600080fd5b505afa158015611322573d6000803e3d6000fd5b505050506040513d602081101561133857600080fd5b50516040516001600160e01b031960e085901b1681526001600160a01b03808416600483019081529083166024830152606060448301908152885160648401528851899360840190602085019080838360005b838110156113a357818101518382015260200161138b565b50505050905090810190601f1680156113d05780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156113f157600080fd5b505af1158015611405573d6000803e3d6000fd5b505050506008869080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055506009869080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555085600f60008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008c65ffffffffffff1665ffffffffffff16815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555050505050505b6000826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561155b57600080fd5b505afa15801561156f573d6000803e3d6000fd5b505050506040513d602081101561158557600080fd5b5051905061159e6001600160a01b038416338488612373565b6000836001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156115ed57600080fd5b505afa158015611601573d6000803e3d6000fd5b505050506040513d602081101561161757600080fd5b505190508181116116595760405162461bcd60e51b81526004018080602001828103825260218152602001806134896021913960400191505060405180910390fd5b6001600160a01b0383166394bf804d61167283856123d3565b336040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050600060405180830381600087803b1580156116b957600080fd5b505af11580156116cd573d6000803e3d6000fd5b505060018080559a9950505050505050505050565b60065481565b60006005548214611740576040805162461bcd60e51b815260206004820152601a60248201527f434f5645523a206e6f6e63657320646f206e6f74206d61746368000000000000604482015290519081900360640190fd5b8361ffff168561ffff161115801561175c575060008561ffff16115b6117975760405162461bcd60e51b81526004018080602001828103825260248152602001806135206024913960400191505060405180910390fd5b61179f6119f6565b6001600160a01b031663a9a36dcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117d757600080fd5b505afa1580156117eb573d6000803e3d6000fd5b505050506040513d602081101561180157600080fd5b50516001600160a01b0316331461185f576040805162461bcd60e51b815260206004820152601e60248201527f434f5645523a2063616c6c6572206e6f7420636c61696d4d616e616765720000604482015290519081900360640190fd5b60055461186d90600161241c565b60055561187c60086000612bfb565b6040805160808101825261ffff8088168252868116602080840191825265ffffffffffff80891685870190815242821660608701908152600c805460018101825560009190915296517fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c790970180549551925191518416600160501b0265ffffffffffff60501b1992909416600160201b0269ffffffffffff0000000019938816620100000263ffff0000199990981661ffff1990971696909617979097169590951716929092179290921617909155815184815291517f33fdae95d831d8c0458b459b6c07e107230687e8d6cc133c4c65204bf01629809281900390910190a15060015b949350505050565b6000806000806000606080606080600454600360149054906101000a900460ff166005546006546007546119bb612476565b6119c36124d8565b6119cb61255f565b6119d36125bf565b985098509850985098509850985098509850909192939495969798565b60075481565b6002546001600160a01b031690565b6000611a0f61201d565b6001600160a01b0316336001600160a01b031614611a6c576040805162461bcd60e51b815260206004820152601560248201527421a7ab22a91d1031b0b63632b9103737ba103232bb60591b604482015290519081900360640190fd5b8365ffffffffffff164210611ac8576040805162461bcd60e51b815260206004820152601e60248201527f434f5645523a20696e76616c69642065787069726174696f6e20646174650000604482015290519081900360640190fd5b60008260ff16118015611ade575060038260ff16105b611b2f576040805162461bcd60e51b815260206004820152601b60248201527f434f5645523a20737461747573206e6f7420696e2028302c20325d0000000000604482015290519081900360640190fd5b65ffffffffffff84166000908152600e602052604090206001015460ff16611bae57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a86005808304919091018054919092066006026101000a65ffffffffffff81810219909216918716021790555b5060408051808201825292835260ff918216602080850191825265ffffffffffff959095166000908152600e90955293209151825591516001918201805460ff1916919093161790915590565b60055481565b600c5490565b600e602052600090815260409020805460019091015460ff1682565b60085490565b6000611c3361201d565b6001600160a01b0316336001600160a01b031614611c90576040805162461bcd60e51b815260206004820152601560248201527421a7ab22a91d1031b0b63632b9103737ba103232bb60591b604482015290519081900360640190fd5b5060038054821515600160a01b0260ff60a01b199091161790556001919050565b600054610100900460ff1680611cca5750611cca61261f565b80611cd8575060005460ff16155b611d135760405162461bcd60e51b815260040180806020018281038252602e8152602001806134f2602e913960400191505060405180910390fd5b600054610100900460ff16158015611d3e576000805460ff1961ff0019909116610100171660011790555b6004889055600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b0319166001600160a01b0388161790556003805460ff60a01b1916600160a01b89151502179055611db1600a8686612c19565b506001600160a01b0386166000908152600d60205260408120805460ff191660011790555b84811015611e8b57858582818110611dea57fe5b9050602002013565ffffffffffff1665ffffffffffff16421015611e83576040518060400160405280858584818110611e1f57fe5b905060200201358152602001600160ff16815250600e6000888885818110611e4357fe5b6020908102929092013565ffffffffffff1683525081810192909252604001600020825181559101516001909101805460ff191660ff9092169190911790555b600101611dd6565b506202a300600655620d2f00600755611ea2612625565b8015611eb4576000805461ff00191690555b5050505050505050565b600a8181548110611ecb57fe5b9060005260206000209060059182820401919006600602915054906101000a900465ffffffffffff1681565b600f6020908152600092835260408084209091529082529020546001600160a01b031681565b6002546001600160a01b03163314611f7c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611fc15760405162461bcd60e51b81526004018080602001828103825260268152602001806134aa6026913960400191505060405180910390fd5b6002546040516001600160a01b038084169216907fb150023a879fd806e3599b6ca8ee3b60f0e360ab3846d128d67ebce1a391639a90600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006120276119f6565b6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561205f57600080fd5b505afa158015612073573d6000803e3d6000fd5b505050506040513d602081101561208957600080fd5b5051905090565b606061209d600454612713565b65ffffffffffff84166000908152600e60205260409020546120be90612713565b836120ca600554612819565b60405160200180806421a7ab22a960d91b81525060050180605f60f81b81525060010185805190602001908083835b602083106121185780518252601f1990920191602091820191016120f9565b6001836020036101000a03801982511681845116808217855250505050505090500180605f60f81b81525060010184805190602001908083835b602083106121715780518252601f199092019160209182019101612152565b6001836020036101000a03801982511681845116808217855250505050505090500180605f60f81b81525060010183805190602001908083835b602083106121ca5780518252601f1990920191602091820191016121ab565b6001836020036101000a03801982511681845116808217855250505050505090500180605f60f81b81525060010182805190602001908083835b602083106122235780518252601f199092019160209182019101612204565b6001836020036101000a038019825116818451168082178552505050505050905001945050505050604051602081830303815290604052905092915050565b600080844710156122ba576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b825161230d576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b038116611981576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526123cd9085906128f1565b50505050565b600061241583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506129a7565b9392505050565b600082820183811015612415576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6060600b8054806020026020016040519081016040528092919081815260200182805480156124ce57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116124b0575b5050505050905090565b6060600a8054806020026020016040519081016040528092919081815260200182805480156124ce57602002820191906000526020600020906000905b82829054906101000a900465ffffffffffff1665ffffffffffff16815260200190600601906020826005010492830192600103820291508084116125155790505050505050905090565b606060098054806020026020016040519081016040528092919081815260200182805480156124ce576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116124b0575050505050905090565b606060088054806020026020016040519081016040528092919081815260200182805480156124ce576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116124b0575050505050905090565b303b1590565b600054610100900460ff168061263e575061263e61261f565b8061264c575060005460ff16155b6126875760405162461bcd60e51b815260040180806020018281038252602e8152602001806134f2602e913960400191505060405180910390fd5b600054610100900460ff161580156126b2576000805460ff1961ff0019909116610100171660011790555b600280546001600160a01b0319163317908190556040516001600160a01b0391909116906000907fe9a5158ac7353c7c7322ececc080bc8e89334efa5795b6e21e40eb266b0003d6908290a38015612710576000805461ff00191690555b50565b606060005b60208160ff161080156127465750828160ff166020811061273557fe5b1a60f81b6001600160f81b03191615155b1561275357600101612718565b60608160ff1667ffffffffffffffff8111801561276f57600080fd5b506040519080825280601f01601f19166020018201604052801561279a576020820181803683370190505b509050600091505b60208260ff161080156127d05750838260ff16602081106127bf57fe5b1a60f81b6001600160f81b03191615155b1561241557838260ff16602081106127e457fe5b1a60f81b818360ff16815181106127f757fe5b60200101906001600160f81b031916908160001a9053506001909101906127a2565b60608161283e57506040805180820190915260018152600360fc1b6020820152610a55565b8160005b811561285657600101600a82049150612842565b60608167ffffffffffffffff8111801561286f57600080fd5b506040519080825280601f01601f19166020018201604052801561289a576020820181803683370190505b50905060001982015b85156128e857600a860660300160f81b828280600190039350815181106128c657fe5b60200101906001600160f81b031916908160001a905350600a860495506128a3565b50949350505050565b6060612946826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a3e9092919063ffffffff16565b8051909150156129a25780806020019051602081101561296557600080fd5b50516129a25760405162461bcd60e51b815260040180806020018281038252602a815260200180613544602a913960400191505060405180910390fd5b505050565b60008184841115612a365760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156129fb5781810151838201526020016129e3565b50505050905090810190601f168015612a285780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b606061198184846000856060612a5385612bb5565b612aa4576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612ae35780518252601f199092019160209182019101612ac4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612b45576040519150601f19603f3d011682016040523d82523d6000602084013e612b4a565b606091505b50915091508115612b5e5791506119819050565b805115612b6e5780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156129fb5781810151838201526020016129e3565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611981575050151592915050565b61079d80612cec83390190565b50805460008255906000526020600020908101906127109190612cd6565b82805482825590600052602060002090600401600590048101928215612cc65791602002820160005b83821115612c9257833565ffffffffffff1683826101000a81548165ffffffffffff021916908365ffffffffffff1602179055509260200192600601602081600501049283019260010302612c42565b8015612cc45782816101000a81549065ffffffffffff0219169055600601602081600501049283019260010302612c92565b505b50612cd2929150612cd6565b5090565b5b80821115612cd25760008155600101612cd756fe608060405234801561001057600080fd5b5061077d806100206000396000f3fe6080604052600436106100595760003560e01c80633659cfe6146100705780634f1ef286146100a35780635c60da1b146101235780638f28397014610154578063cf7a1d7714610187578063f851a4401461024657610068565b366100685761006661025b565b005b61006661025b565b34801561007c57600080fd5b506100666004803603602081101561009357600080fd5b50356001600160a01b0316610275565b610066600480360360408110156100b957600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100e457600080fd5b8201836020820111156100f657600080fd5b8035906020019184600183028401116401000000008311171561011857600080fd5b5090925090506102af565b34801561012f57600080fd5b5061013861035c565b604080516001600160a01b039092168252519081900360200190f35b34801561016057600080fd5b506100666004803603602081101561017757600080fd5b50356001600160a01b0316610399565b6100666004803603606081101561019d57600080fd5b6001600160a01b0382358116926020810135909116918101906060810160408201356401000000008111156101d157600080fd5b8201836020820111156101e357600080fd5b8035906020019184600183028401116401000000008311171561020557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610453945050505050565b34801561025257600080fd5b5061013861053a565b610263610273565b61027361026e610565565b61058a565b565b61027d6105ae565b6001600160a01b0316336001600160a01b031614156102a45761029f816105d3565b6102ac565b6102ac61025b565b50565b6102b76105ae565b6001600160a01b0316336001600160a01b0316141561034f576102d9836105d3565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610336576040519150601f19603f3d011682016040523d82523d6000602084013e61033b565b606091505b505090508061034957600080fd5b50610357565b61035761025b565b505050565b60006103666105ae565b6001600160a01b0316336001600160a01b0316141561038e57610387610565565b9050610396565b61039661025b565b90565b6103a16105ae565b6001600160a01b0316336001600160a01b031614156102a4576001600160a01b0381166103ff5760405162461bcd60e51b81526004018080602001828103825260368152602001806106dc6036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104286105ae565b604080516001600160a01b03928316815291841660208301528051918290030190a161029f81610613565b600061045d610565565b6001600160a01b03161461047057600080fd5b61047983610637565b805115610531576000836001600160a01b0316826040518082805190602001908083835b602083106104bc5780518252601f19909201916020918201910161049d565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461051c576040519150601f19603f3d011682016040523d82523d6000602084013e610521565b606091505b505090508061052f57600080fd5b505b61035782610613565b60006105446105ae565b6001600160a01b0316336001600160a01b0316141561038e576103876105ae565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105a9573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6105dc81610637565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6106408161069f565b61067b5760405162461bcd60e51b81526004018080602001828103825260368152602001806107126036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906106d357508115155b94935050505056fe43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a2646970667358221220bb1380c8baf572bad88171f2a9370ded98c1c442f5378d819a912f33b83f1bc964736f6c63430007030033434f5645523a20636f6c6c61746572616c207472616e73666572206661696c65644f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373434f5645523a20616d6f756e74203e20636f6c6c61746572616c2062616c616e6365496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564434f5645523a207061796f75742025206973206e6f7420696e202830252c20313030255d5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220b2df41fb2559e6092c6d3c20509fd269a46356daaf369be6cf5bc18444fbefd464736f6c63430007030033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101c35760003560e01c80637ddfe6b3116100f9578063aae7f44d11610097578063b2cfb94d11610071578063b2cfb94d146105f1578063c13b1b13146106cd578063ecd2bf9f14610705578063f2fde38b14610739576101c3565b8063aae7f44d1461058a578063ab70b003146105ca578063acec338a146105d2576101c3565b80638da5cb5b116100d35780638da5cb5b1461053e578063a320b36314610546578063a5212d9a1461057a578063aa23fddc14610582576101c3565b80637ddfe6b3146103a75780638080425b146103e657806381c4fb5b14610536576101c3565b80633666e8c411610166578063630a237611610140578063630a23761461032b57806366a50c131461034857806372c896c3146103655780637cd690d31461039f576101c3565b80633666e8c4146102b25780633d040c6c146102cf5780634e71e0c814610321576101c3565b80631e2dd23b116101a25780631e2dd23b1461022d57806324c1173b1461023557806329ad2fb21461026e5780632e09caf914610276576101c3565b806207fa19146101c857806302fb0c5e1461020b57806306fdde0314610213575b600080fd5b6101f7600480360360408110156101de57600080fd5b5080356001600160a01b0316906020013560ff1661075f565b604080519115158252519081900360200190f35b6101f7610924565b61021b610934565b60408051918252519081900360200190f35b61021b61093a565b6102526004803603602081101561024b57600080fd5b5035610940565b604080516001600160a01b039092168252519081900360200190f35b61021b610967565b61029c6004803603602081101561028c57600080fd5b50356001600160a01b031661096d565b6040805160ff9092168252519081900360200190f35b6101f7600480360360208110156102c857600080fd5b5035610982565b6102ec600480360360208110156102e557600080fd5b5035610a5a565b6040805161ffff958616815293909416602084015265ffffffffffff9182168385015216606082015290519081900360800190f35b610329610a9f565b005b6102526004803603602081101561034157600080fd5b5035610b61565b6101f76004803603602081101561035e57600080fd5b5035610b6e565b6101f76004803603606081101561037b57600080fd5b506001600160a01b038135169065ffffffffffff6020820135169060400135610c41565b61021b6116e2565b6101f7600480360360808110156103bd57600080fd5b5061ffff813581169160208101359091169065ffffffffffff60408201351690606001356116e8565b6103ee611989565b604051808a8152602001891515815260200188815260200187815260200186815260200180602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561045a578181015183820152602001610442565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015610499578181015183820152602001610481565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156104d85781810151838201526020016104c0565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156105175781810151838201526020016104ff565b505050509050019d505050505050505050505050505060405180910390f35b61021b6119f0565b6102526119f6565b6101f76004803603606081101561055c57600080fd5b50803565ffffffffffff16906020810135906040013560ff16611a05565b61021b611bfb565b61021b611c01565b6105af600480360360208110156105a057600080fd5b503565ffffffffffff16611c07565b6040805192835260ff90911660208301528051918290030190f35b61021b611c23565b6101f7600480360360208110156105e857600080fd5b50351515611c29565b610329600480360360a081101561060757600080fd5b81359160208101351515916001600160a01b036040830135169190810190608081016060820135600160201b81111561063f57600080fd5b82018360208201111561065157600080fd5b803590602001918460208302840111600160201b8311171561067257600080fd5b919390929091602081019035600160201b81111561068f57600080fd5b8201836020820111156106a157600080fd5b803590602001918460208302840111600160201b831117156106c257600080fd5b509092509050611cb1565b6106ea600480360360208110156106e357600080fd5b5035611ebe565b6040805165ffffffffffff9092168252519081900360200190f35b6102526004803603604081101561071b57600080fd5b5080356001600160a01b0316906020013565ffffffffffff16611ef7565b6103296004803603602081101561074f57600080fd5b50356001600160a01b0316611f1d565b600061076961201d565b6001600160a01b0316336001600160a01b0316146107c6576040805162461bcd60e51b815260206004820152601560248201527421a7ab22a91d1031b0b63632b9103737ba103232bb60591b604482015290519081900360640190fd5b6001600160a01b038316610821576040805162461bcd60e51b815260206004820152601a60248201527f434f5645523a20616464726573732063616e6e6f742062652030000000000000604482015290519081900360640190fd5b60008260ff16118015610837575060038260ff16105b610888576040805162461bcd60e51b815260206004820152601b60248201527f434f5645523a20737461747573206e6f7420696e2028302c20325d0000000000604482015290519081900360640190fd5b6001600160a01b0383166000908152600d602052604090205460ff166108f457600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b0319166001600160a01b0385161790555b506001600160a01b0382166000908152600d60205260409020805460ff831660ff19909116179055600192915050565b600354600160a01b900460ff1681565b60045481565b600a5490565b600b818154811061094d57fe5b6000918252602090912001546001600160a01b0316905081565b600b5490565b600d6020526000908152604090205460ff1681565b600061098c6119f6565b6001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c457600080fd5b505afa1580156109d8573d6000803e3d6000fd5b505050506040513d60208110156109ee57600080fd5b50516001600160a01b03163314610a4c576040805162461bcd60e51b815260206004820152601c60248201527f434f5645523a2063616c6c6572206e6f7420676f7665726e616e636500000000604482015290519081900360640190fd5b50600781905560015b919050565b600c8181548110610a6757fe5b60009182526020909120015461ffff8082169250620100008204169065ffffffffffff600160201b8204811691600160501b90041684565b6003546001600160a01b03163314610afe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6003546002546040516001600160a01b0392831692909116907fe9a5158ac7353c7c7322ececc080bc8e89334efa5795b6e21e40eb266b0003d690600090a3600354600280546001600160a01b0319166001600160a01b03909216919091179055565b6008818154811061094d57fe5b6000610b786119f6565b6001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb057600080fd5b505afa158015610bc4573d6000803e3d6000fd5b505050506040513d6020811015610bda57600080fd5b50516001600160a01b03163314610c38576040805162461bcd60e51b815260206004820152601c60248201527f434f5645523a2063616c6c6572206e6f7420676f7665726e616e636500000000604482015290519081900360640190fd5b50600655600190565b600354600090600160a01b900460ff16610ca2576040805162461bcd60e51b815260206004820152601a60248201527f434f5645523a2070726f746f636f6c206e6f7420616374697665000000000000604482015290519081900360640190fd5b60026001541415610cfa576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260015581610d46576040805162461bcd60e51b81526020600482015260126024820152710434f5645523a20616d6f756e74203c3d20360741b604482015290519081900360640190fd5b6001600160a01b0384166000908152600d602052604090205460ff16600114610db6576040805162461bcd60e51b815260206004820152601960248201527f434f5645523a20696e76616c696420636f6c6c61746572616c00000000000000604482015290519081900360640190fd5b8265ffffffffffff1642108015610dea575065ffffffffffff83166000908152600e6020526040902060019081015460ff16145b610e3b576040805162461bcd60e51b815260206004820152601e60248201527f434f5645523a20696e76616c69642065787069726174696f6e20646174650000604482015290519081900360640190fd5b604080516370a0823160e01b81523360048201529051859184916001600160a01b038416916370a08231916024808301926020929190829003018186803b158015610e8557600080fd5b505afa158015610e99573d6000803e3d6000fd5b505050506040513d6020811015610eaf57600080fd5b50511015610eee5760405162461bcd60e51b81526004018080602001828103825260228152602001806134d06022913960400191505060405180910390fd5b6001600160a01b038086166000908152600f6020908152604080832065ffffffffffff8916845290915290205416801580610f8f5750600554816001600160a01b031663a5212d9a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6057600080fd5b505afa158015610f74573d6000803e3d6000fd5b505050506040513d6020811015610f8a57600080fd5b505114155b1561150c5760606110c386846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015610fd357600080fd5b505afa158015610fe7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561101057600080fd5b8101908080516040519392919084600160201b82111561102f57600080fd5b90830190602082018581111561104457600080fd5b8251600160201b81118282018810171561105d57600080fd5b82525081516020918201929091019080838360005b8381101561108a578181015183820152602001611072565b50505050905090810190601f1680156110b75780820380516001836020036101000a031916815260200191505b50604052505050612090565b90506060604051806020016110d790612bee565b601f1982820381018352601f9091011660408181526004546005546020848101929092526001600160d01b031960d08d901b16838501526bffffffffffffffffffffffff1960608e901b166046850152605a8085019190915282518085039091018152607a909301909152815191012090915061115660008284612262565b935060607f1e45234e4529e32717c6a15fbcfc06e5b32392b766c88da8a2c388ed37e2cafa848a8c60055460405160240180806020018565ffffffffffff168152602001846001600160a01b03168152602001838152602001828103825286818151815260200191508051906020019080838360005b838110156111e45781810151838201526020016111cc565b50505050905090810190601f1680156112115780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006112586119f6565b6001600160a01b03166364bb44dc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561129057600080fd5b505afa1580156112a4573d6000803e3d6000fd5b505050506040513d60208110156112ba57600080fd5b505190506001600160a01b03861663cf7a1d77826112d66119f6565b6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561130e57600080fd5b505afa158015611322573d6000803e3d6000fd5b505050506040513d602081101561133857600080fd5b50516040516001600160e01b031960e085901b1681526001600160a01b03808416600483019081529083166024830152606060448301908152885160648401528851899360840190602085019080838360005b838110156113a357818101518382015260200161138b565b50505050905090810190601f1680156113d05780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156113f157600080fd5b505af1158015611405573d6000803e3d6000fd5b505050506008869080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055506009869080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555085600f60008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008c65ffffffffffff1665ffffffffffff16815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555050505050505b6000826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561155b57600080fd5b505afa15801561156f573d6000803e3d6000fd5b505050506040513d602081101561158557600080fd5b5051905061159e6001600160a01b038416338488612373565b6000836001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156115ed57600080fd5b505afa158015611601573d6000803e3d6000fd5b505050506040513d602081101561161757600080fd5b505190508181116116595760405162461bcd60e51b81526004018080602001828103825260218152602001806134896021913960400191505060405180910390fd5b6001600160a01b0383166394bf804d61167283856123d3565b336040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050600060405180830381600087803b1580156116b957600080fd5b505af11580156116cd573d6000803e3d6000fd5b505060018080559a9950505050505050505050565b60065481565b60006005548214611740576040805162461bcd60e51b815260206004820152601a60248201527f434f5645523a206e6f6e63657320646f206e6f74206d61746368000000000000604482015290519081900360640190fd5b8361ffff168561ffff161115801561175c575060008561ffff16115b6117975760405162461bcd60e51b81526004018080602001828103825260248152602001806135206024913960400191505060405180910390fd5b61179f6119f6565b6001600160a01b031663a9a36dcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117d757600080fd5b505afa1580156117eb573d6000803e3d6000fd5b505050506040513d602081101561180157600080fd5b50516001600160a01b0316331461185f576040805162461bcd60e51b815260206004820152601e60248201527f434f5645523a2063616c6c6572206e6f7420636c61696d4d616e616765720000604482015290519081900360640190fd5b60055461186d90600161241c565b60055561187c60086000612bfb565b6040805160808101825261ffff8088168252868116602080840191825265ffffffffffff80891685870190815242821660608701908152600c805460018101825560009190915296517fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c790970180549551925191518416600160501b0265ffffffffffff60501b1992909416600160201b0269ffffffffffff0000000019938816620100000263ffff0000199990981661ffff1990971696909617979097169590951716929092179290921617909155815184815291517f33fdae95d831d8c0458b459b6c07e107230687e8d6cc133c4c65204bf01629809281900390910190a15060015b949350505050565b6000806000806000606080606080600454600360149054906101000a900460ff166005546006546007546119bb612476565b6119c36124d8565b6119cb61255f565b6119d36125bf565b985098509850985098509850985098509850909192939495969798565b60075481565b6002546001600160a01b031690565b6000611a0f61201d565b6001600160a01b0316336001600160a01b031614611a6c576040805162461bcd60e51b815260206004820152601560248201527421a7ab22a91d1031b0b63632b9103737ba103232bb60591b604482015290519081900360640190fd5b8365ffffffffffff164210611ac8576040805162461bcd60e51b815260206004820152601e60248201527f434f5645523a20696e76616c69642065787069726174696f6e20646174650000604482015290519081900360640190fd5b60008260ff16118015611ade575060038260ff16105b611b2f576040805162461bcd60e51b815260206004820152601b60248201527f434f5645523a20737461747573206e6f7420696e2028302c20325d0000000000604482015290519081900360640190fd5b65ffffffffffff84166000908152600e602052604090206001015460ff16611bae57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a86005808304919091018054919092066006026101000a65ffffffffffff81810219909216918716021790555b5060408051808201825292835260ff918216602080850191825265ffffffffffff959095166000908152600e90955293209151825591516001918201805460ff1916919093161790915590565b60055481565b600c5490565b600e602052600090815260409020805460019091015460ff1682565b60085490565b6000611c3361201d565b6001600160a01b0316336001600160a01b031614611c90576040805162461bcd60e51b815260206004820152601560248201527421a7ab22a91d1031b0b63632b9103737ba103232bb60591b604482015290519081900360640190fd5b5060038054821515600160a01b0260ff60a01b199091161790556001919050565b600054610100900460ff1680611cca5750611cca61261f565b80611cd8575060005460ff16155b611d135760405162461bcd60e51b815260040180806020018281038252602e8152602001806134f2602e913960400191505060405180910390fd5b600054610100900460ff16158015611d3e576000805460ff1961ff0019909116610100171660011790555b6004889055600b80546001810182556000919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b0319166001600160a01b0388161790556003805460ff60a01b1916600160a01b89151502179055611db1600a8686612c19565b506001600160a01b0386166000908152600d60205260408120805460ff191660011790555b84811015611e8b57858582818110611dea57fe5b9050602002013565ffffffffffff1665ffffffffffff16421015611e83576040518060400160405280858584818110611e1f57fe5b905060200201358152602001600160ff16815250600e6000888885818110611e4357fe5b6020908102929092013565ffffffffffff1683525081810192909252604001600020825181559101516001909101805460ff191660ff9092169190911790555b600101611dd6565b506202a300600655620d2f00600755611ea2612625565b8015611eb4576000805461ff00191690555b5050505050505050565b600a8181548110611ecb57fe5b9060005260206000209060059182820401919006600602915054906101000a900465ffffffffffff1681565b600f6020908152600092835260408084209091529082529020546001600160a01b031681565b6002546001600160a01b03163314611f7c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611fc15760405162461bcd60e51b81526004018080602001828103825260268152602001806134aa6026913960400191505060405180910390fd5b6002546040516001600160a01b038084169216907fb150023a879fd806e3599b6ca8ee3b60f0e360ab3846d128d67ebce1a391639a90600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006120276119f6565b6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561205f57600080fd5b505afa158015612073573d6000803e3d6000fd5b505050506040513d602081101561208957600080fd5b5051905090565b606061209d600454612713565b65ffffffffffff84166000908152600e60205260409020546120be90612713565b836120ca600554612819565b60405160200180806421a7ab22a960d91b81525060050180605f60f81b81525060010185805190602001908083835b602083106121185780518252601f1990920191602091820191016120f9565b6001836020036101000a03801982511681845116808217855250505050505090500180605f60f81b81525060010184805190602001908083835b602083106121715780518252601f199092019160209182019101612152565b6001836020036101000a03801982511681845116808217855250505050505090500180605f60f81b81525060010183805190602001908083835b602083106121ca5780518252601f1990920191602091820191016121ab565b6001836020036101000a03801982511681845116808217855250505050505090500180605f60f81b81525060010182805190602001908083835b602083106122235780518252601f199092019160209182019101612204565b6001836020036101000a038019825116818451168082178552505050505050905001945050505050604051602081830303815290604052905092915050565b600080844710156122ba576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b825161230d576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b038116611981576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526123cd9085906128f1565b50505050565b600061241583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506129a7565b9392505050565b600082820183811015612415576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6060600b8054806020026020016040519081016040528092919081815260200182805480156124ce57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116124b0575b5050505050905090565b6060600a8054806020026020016040519081016040528092919081815260200182805480156124ce57602002820191906000526020600020906000905b82829054906101000a900465ffffffffffff1665ffffffffffff16815260200190600601906020826005010492830192600103820291508084116125155790505050505050905090565b606060098054806020026020016040519081016040528092919081815260200182805480156124ce576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116124b0575050505050905090565b606060088054806020026020016040519081016040528092919081815260200182805480156124ce576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116124b0575050505050905090565b303b1590565b600054610100900460ff168061263e575061263e61261f565b8061264c575060005460ff16155b6126875760405162461bcd60e51b815260040180806020018281038252602e8152602001806134f2602e913960400191505060405180910390fd5b600054610100900460ff161580156126b2576000805460ff1961ff0019909116610100171660011790555b600280546001600160a01b0319163317908190556040516001600160a01b0391909116906000907fe9a5158ac7353c7c7322ececc080bc8e89334efa5795b6e21e40eb266b0003d6908290a38015612710576000805461ff00191690555b50565b606060005b60208160ff161080156127465750828160ff166020811061273557fe5b1a60f81b6001600160f81b03191615155b1561275357600101612718565b60608160ff1667ffffffffffffffff8111801561276f57600080fd5b506040519080825280601f01601f19166020018201604052801561279a576020820181803683370190505b509050600091505b60208260ff161080156127d05750838260ff16602081106127bf57fe5b1a60f81b6001600160f81b03191615155b1561241557838260ff16602081106127e457fe5b1a60f81b818360ff16815181106127f757fe5b60200101906001600160f81b031916908160001a9053506001909101906127a2565b60608161283e57506040805180820190915260018152600360fc1b6020820152610a55565b8160005b811561285657600101600a82049150612842565b60608167ffffffffffffffff8111801561286f57600080fd5b506040519080825280601f01601f19166020018201604052801561289a576020820181803683370190505b50905060001982015b85156128e857600a860660300160f81b828280600190039350815181106128c657fe5b60200101906001600160f81b031916908160001a905350600a860495506128a3565b50949350505050565b6060612946826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a3e9092919063ffffffff16565b8051909150156129a25780806020019051602081101561296557600080fd5b50516129a25760405162461bcd60e51b815260040180806020018281038252602a815260200180613544602a913960400191505060405180910390fd5b505050565b60008184841115612a365760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156129fb5781810151838201526020016129e3565b50505050905090810190601f168015612a285780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b606061198184846000856060612a5385612bb5565b612aa4576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612ae35780518252601f199092019160209182019101612ac4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612b45576040519150601f19603f3d011682016040523d82523d6000602084013e612b4a565b606091505b50915091508115612b5e5791506119819050565b805115612b6e5780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156129fb5781810151838201526020016129e3565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611981575050151592915050565b61079d80612cec83390190565b50805460008255906000526020600020908101906127109190612cd6565b82805482825590600052602060002090600401600590048101928215612cc65791602002820160005b83821115612c9257833565ffffffffffff1683826101000a81548165ffffffffffff021916908365ffffffffffff1602179055509260200192600601602081600501049283019260010302612c42565b8015612cc45782816101000a81549065ffffffffffff0219169055600601602081600501049283019260010302612c92565b505b50612cd2929150612cd6565b5090565b5b80821115612cd25760008155600101612cd756fe608060405234801561001057600080fd5b5061077d806100206000396000f3fe6080604052600436106100595760003560e01c80633659cfe6146100705780634f1ef286146100a35780635c60da1b146101235780638f28397014610154578063cf7a1d7714610187578063f851a4401461024657610068565b366100685761006661025b565b005b61006661025b565b34801561007c57600080fd5b506100666004803603602081101561009357600080fd5b50356001600160a01b0316610275565b610066600480360360408110156100b957600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100e457600080fd5b8201836020820111156100f657600080fd5b8035906020019184600183028401116401000000008311171561011857600080fd5b5090925090506102af565b34801561012f57600080fd5b5061013861035c565b604080516001600160a01b039092168252519081900360200190f35b34801561016057600080fd5b506100666004803603602081101561017757600080fd5b50356001600160a01b0316610399565b6100666004803603606081101561019d57600080fd5b6001600160a01b0382358116926020810135909116918101906060810160408201356401000000008111156101d157600080fd5b8201836020820111156101e357600080fd5b8035906020019184600183028401116401000000008311171561020557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610453945050505050565b34801561025257600080fd5b5061013861053a565b610263610273565b61027361026e610565565b61058a565b565b61027d6105ae565b6001600160a01b0316336001600160a01b031614156102a45761029f816105d3565b6102ac565b6102ac61025b565b50565b6102b76105ae565b6001600160a01b0316336001600160a01b0316141561034f576102d9836105d3565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610336576040519150601f19603f3d011682016040523d82523d6000602084013e61033b565b606091505b505090508061034957600080fd5b50610357565b61035761025b565b505050565b60006103666105ae565b6001600160a01b0316336001600160a01b0316141561038e57610387610565565b9050610396565b61039661025b565b90565b6103a16105ae565b6001600160a01b0316336001600160a01b031614156102a4576001600160a01b0381166103ff5760405162461bcd60e51b81526004018080602001828103825260368152602001806106dc6036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104286105ae565b604080516001600160a01b03928316815291841660208301528051918290030190a161029f81610613565b600061045d610565565b6001600160a01b03161461047057600080fd5b61047983610637565b805115610531576000836001600160a01b0316826040518082805190602001908083835b602083106104bc5780518252601f19909201916020918201910161049d565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461051c576040519150601f19603f3d011682016040523d82523d6000602084013e610521565b606091505b505090508061052f57600080fd5b505b61035782610613565b60006105446105ae565b6001600160a01b0316336001600160a01b0316141561038e576103876105ae565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156105a9573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6105dc81610637565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6106408161069f565b61067b5760405162461bcd60e51b81526004018080602001828103825260368152602001806107126036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906106d357508115155b94935050505056fe43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f20616464726573735570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374a2646970667358221220bb1380c8baf572bad88171f2a9370ded98c1c442f5378d819a912f33b83f1bc964736f6c63430007030033434f5645523a20636f6c6c61746572616c207472616e73666572206661696c65644f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373434f5645523a20616d6f756e74203e20636f6c6c61746572616c2062616c616e6365496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564434f5645523a207061796f75742025206973206e6f7420696e202830252c20313030255d5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220b2df41fb2559e6092c6d3c20509fd269a46356daaf369be6cf5bc18444fbefd464736f6c63430007030033