Contract 0x2f7575eE23D8931Ab90a6D773b110Ddb95417a03

Contract Overview

Balance:
0 Ether
Txn Hash Method
Block
From
To
Value
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497eRemove Liquidity223986972020-12-03 2:28:40166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.00411619495622.813125
0x225daa0852125bb9570e9eae7faddc0f3f07897e4a96e996927c9f40c6c80f8bRemove Liquidity223986572020-12-03 2:25:04166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.0009464730
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315Add Cover And Ad...223986332020-12-03 2:23:00166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.0140742330
0x4e0e8751d7310cd0d642028b13d2483da2ecfc27c6ed4de004d4c6a2dc509027Add Cover And Cr...223986312020-12-03 2:22:48166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.0066545730
0x9f39c41156f3b49e7860cfa63286acdbf2fd55c3a405c685cc606ca0db75167fAdd Cover And Cr...223985952020-12-03 2:19:40166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.23848519209922.813125
0x0537db7a26e4fd2ea861a72768482e1a3f66d6163852b0ba86e5327ec3879213Add Cover And Cr...223985622020-12-03 2:16:44166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.00252080468622.813125
0x587bff8352726297946e8a300e354c6445d5a01cc57c70c35698e7031c50b196Add Cover And Cr...223985402020-12-03 2:14:48166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.19997665616
0x37d33f9529274670be3210097fe0acdae53cfca61fc1f1607a7e851859fcb93dAdd Cover And Cr...223985002020-12-03 2:11:24166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.22242426221117.813125
0x21307a7b5887cad68900fa825244642a732460f95b5f5697608fbbefb699c631Add Cover And Cr...223984802020-12-03 2:09:24166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.25939050108320.813125
0x50c592503505843340943f664512841df4024f6fcfabac3e2303659c4dd743d3Add Cover And Cr...223984692020-12-03 2:08:28166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.28431616708322.813125
0x66ec1d5db0e78b53f1811fafe078b83764d64e10fc5d391e132c96307c8d718bAdd Cover And Cr...223984302020-12-03 2:05:00166 days 17 hrs ago0xaa1d84279bdee1dbaee4072429a8a1c568cc2ff1 IN  0x2f7575ee23d8931ab90a6d773b110ddb95417a030 Ether0.00074213376922.813125
0x870d04021e9810cca657dfd7969e413bcd061e39379b7ba7acb8956672c7cc3f0x60806040223983812020-12-03 2:00:28166 days 17 hrs ago0xfe84a210846a21146a529c569f0059fe7f313fca IN  Contract Creation0 Ether0.08254682121
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497e223986972020-12-03 2:28:40166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497e223986972020-12-03 2:28:40166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497e223986972020-12-03 2:28:40166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xbd539876b721cb9ad6225d2669968a51787976c60 Ether
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497e223986972020-12-03 2:28:40166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xbd539876b721cb9ad6225d2669968a51787976c60 Ether
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497e223986972020-12-03 2:28:40166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x1381e2774d7aec06eaae42470044b4be5125aca40 Ether
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497e223986972020-12-03 2:28:40166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x1381e2774d7aec06eaae42470044b4be5125aca40 Ether
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497e223986972020-12-03 2:28:40166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x1381e2774d7aec06eaae42470044b4be5125aca40 Ether
0x1fed51c34ad8da8242cb0efa74834bd05f59916143b827910e110cc5f64d497e223986972020-12-03 2:28:40166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x1381e2774d7aec06eaae42470044b4be5125aca40 Ether
0x225daa0852125bb9570e9eae7faddc0f3f07897e4a96e996927c9f40c6c80f8b223986572020-12-03 2:25:04166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x1381e2774d7aec06eaae42470044b4be5125aca40 Ether
0x225daa0852125bb9570e9eae7faddc0f3f07897e4a96e996927c9f40c6c80f8b223986572020-12-03 2:25:04166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x1381e2774d7aec06eaae42470044b4be5125aca40 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x2bf77015853a1d0bc6c13fe443f9519b3e81879f0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x2bf77015853a1d0bc6c13fe443f9519b3e81879f0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xaa925d94b209e8462144d4fc086b62ae3a1af87a0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xaa925d94b209e8462144d4fc086b62ae3a1af87a0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xaa925d94b209e8462144d4fc086b62ae3a1af87a0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x2bf77015853a1d0bc6c13fe443f9519b3e81879f0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xaa925d94b209e8462144d4fc086b62ae3a1af87a0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xaa925d94b209e8462144d4fc086b62ae3a1af87a0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xaa925d94b209e8462144d4fc086b62ae3a1af87a0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xaa925d94b209e8462144d4fc086b62ae3a1af87a0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0xaa925d94b209e8462144d4fc086b62ae3a1af87a0 Ether
0x6ff1feb860acfc451c63a7c732f1292970e8b48e7f8dd1a40208a13dec99f315223986332020-12-03 2:23:00166 days 17 hrs ago 0x2f7575ee23d8931ab90a6d773b110ddb95417a03 0x2bf77015853a1d0bc6c13fe443f9519b3e81879f0 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CoverRouter

Compiler Version
v0.7.5+commit.eb77ed08

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 14 : CoverRouter.sol
// SPDX-License-Identifier: None
pragma solidity ^0.7.5;

import "./interfaces/IBFactory.sol";
import "./interfaces/IBPool.sol";
import "./interfaces/ICover.sol";
import "./interfaces/ICoverERC20.sol";
import "./interfaces/ICoverRouter.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IProtocol.sol";
import "./utils/Ownable.sol";
import "./utils/SafeERC20.sol";
import "./utils/SafeMath.sol";
import "./Rollover.sol";

/**
 * @title CoverRouter for Cover Protocol, handles balancer activities
 * @author [email protected]
 */
contract CoverRouter is ICoverRouter, Ownable, Rollover {
  using SafeERC20 for IBPool;
  using SafeERC20 for ICoverERC20;
  using SafeERC20 for IERC20;
  using SafeMath for uint256;

  address public protocolFactory;
  IBFactory public bFactory;
  uint256 public constant TOTAL_WEIGHT = 50 ether;
  uint256 public claimCovTokenWeight = 40 ether;
  uint256 public noclaimCovTokenWeight = 49 ether;
  uint256 public claimSwapFee = 0.02 ether;
  uint256 public noclaimSwapFee = 0.01 ether;
  mapping(bytes32 => address) private pools;

  constructor(address _protocolFactory, IBFactory _bFactory) {
    protocolFactory = _protocolFactory;
    bFactory = _bFactory;
  }

  function poolForPair(address _covToken, address _pairedToken) external override view returns (address) {
    bytes32 pairKey = _pairKeyForPair(_covToken, _pairedToken);
    return pools[pairKey];
  }

  function addCoverAndAddLiquidity(
    IProtocol _protocol,
    IERC20 _collateral,
    uint48 _timestamp,
    uint256 _amount,
    IERC20 _pairedToken,
    uint256 _claimPTAmt,
    uint256 _noclaimPTAmt,
    bool _addBuffer
  ) external override {
    require(_amount > 0 && _claimPTAmt > 0 && _noclaimPTAmt > 0, "CoverRouter: amount is 0");
    _collateral.safeTransferFrom(msg.sender, address(this), _amount);
    _addCover(_protocol, address(_collateral), _timestamp, _collateral.balanceOf(address(this)));

    ICover cover = ICover(_protocol.coverMap(address(_collateral), _timestamp));
    _addLiquidityForCover(msg.sender, cover, _pairedToken, _claimPTAmt, _noclaimPTAmt, _addBuffer);
  }

  /// @notice rollover for a different account (from sender)
  function rolloverAndAddLiquidityForAccount(
    address _account,
    ICover _cover,
    uint48 _newTimestamp,
    IERC20 _pairedToken,
    uint256 _claimPTAmt,
    uint256 _noclaimPTAmt,
    bool _addBuffer
  ) public override {
    _rolloverAccount(_account, address(_cover), _newTimestamp, false);

    IProtocol protocol = IProtocol(_cover.owner());
    ICover newCover = ICover(protocol.coverMap(_cover.collateral(), _newTimestamp));
    _addLiquidityForCover(_account, newCover, _pairedToken, _claimPTAmt, _noclaimPTAmt, _addBuffer);
  }

  /// @notice rollover for self
  function rolloverAndAddLiquidity(
    ICover _cover,
    uint48 _newTimestamp,
    IERC20 _pairedToken,
    uint256 _claimPTAmt,
    uint256 _noclaimPTAmt,
    bool _addBuffer
  ) external override {
    rolloverAndAddLiquidityForAccount(msg.sender, _cover, _newTimestamp, _pairedToken, _claimPTAmt, _noclaimPTAmt, _addBuffer);
  }

  /// @notice rollover for self
  function removeLiquidity(ICoverERC20 _covToken, IERC20 _pairedToken, uint256 _bptAmount) external override {
    require(_bptAmount > 0, "CoverRouter: insufficient covToken");
    bytes32 pairKey = _pairKeyForPair(address(_covToken), address(_pairedToken));
    IBPool pool = IBPool(pools[pairKey]);
    require(pool.balanceOf(msg.sender) >= _bptAmount, "CoverRouter: insufficient BPT");

    uint256[] memory minAmountsOut = new uint256[](2);
    minAmountsOut[0] = 0;
    minAmountsOut[1] = 0;

    pool.safeTransferFrom(msg.sender, address(this), _bptAmount);
    pool.exitPool(pool.balanceOf(address(this)), minAmountsOut);

    _covToken.safeTransfer(msg.sender, _covToken.balanceOf(address(this)));
    _pairedToken.safeTransfer(msg.sender, _pairedToken.balanceOf(address(this)));
    emit RemoveLiquidity(msg.sender, address(pool));
  }

  /// @notice add double sided liquidity, there maybe tokens left after for SELF
  function addLiquidity(
    ICoverERC20 _covToken,
    uint256 _covTokenAmount,
    IERC20 _pairedToken,
    uint256 _pairedTokenAmount,
    bool _addBuffer
  ) external override {
    require(_covToken.balanceOf(msg.sender) >= _covTokenAmount, "CoverRouter: insufficient covToken");
    require(_pairedToken.balanceOf(msg.sender) >= _pairedTokenAmount, "CoverRouter: insufficient pairedToken");

    _covToken.safeTransferFrom(msg.sender, address(this), _covTokenAmount);
    _pairedToken.safeTransferFrom(msg.sender, address(this), _pairedTokenAmount);
    _joinPool(msg.sender, _covToken, _pairedToken, _pairedToken.balanceOf(address(this)), _addBuffer);
    _transferRem(msg.sender, _pairedToken);
  }

  function addCoverAndCreatePools(
    IProtocol _protocol,
    IERC20 _collateral,
    uint48 _timestamp,
    uint256 _amount,
    IERC20 _pairedToken,
    uint256 _claimPTAmt,
    uint256 _noclaimPTAmt
  ) external override {
    require(_amount > 0 && _claimPTAmt > 0 && _noclaimPTAmt > 0, "CoverRouter: amount is 0");
    require(_collateral.balanceOf(msg.sender) > _amount, "CoverRouter: insufficient amount");
    _collateral.safeTransferFrom(msg.sender, address(this), _amount);
    _addCover(_protocol, address(_collateral), _timestamp, _collateral.balanceOf(address(this)));

    ICover cover = ICover(_protocol.coverMap(address(_collateral), _timestamp));
    ICoverERC20 claimCovToken = cover.claimCovToken();
    ICoverERC20 noclaimCovToken = cover.noclaimCovToken();

    (uint256 claimPTAmt, uint256 noclaimPTAmt) =  _receivePairdTokens(msg.sender, _pairedToken, _claimPTAmt, _noclaimPTAmt);
    bytes32 claimPairKey = _pairKeyForPair(address(claimCovToken), address(_pairedToken));
    if (pools[claimPairKey] == address(0)) {
      pools[claimPairKey] = _createBalPoolAndTransferBpt(msg.sender, claimCovToken, _pairedToken, claimPTAmt, true);
    }
    bytes32 noclaimPairKey = _pairKeyForPair(address(noclaimCovToken), address(_pairedToken));
    if (pools[noclaimPairKey] == address(0)) {
      pools[noclaimPairKey] = _createBalPoolAndTransferBpt(msg.sender, noclaimCovToken, _pairedToken, noclaimPTAmt, false);
    }
    _transferRem(msg.sender, _pairedToken);
  }

  function createNewPool(
    ICoverERC20 _covToken,
    uint256 _covTokenAmount,
    IERC20 _pairedToken,
    uint256 _pairedTokenAmount
  ) external override returns (address pool) {
    require(address(_pairedToken) != address(_covToken), "CoverRouter: same token");
    bytes32 pairKey = _pairKeyForPair(address(_covToken), address(_pairedToken));
    require(pools[pairKey] == address(0), "CoverRouter: pool already exists");
    _validCovToken(address(_covToken));

    // Get the Cover contract from the token to check if its the claim or noclaim.
    ICover cover = ICover(ICoverERC20(_covToken).owner());
    bool isClaimPair = cover.claimCovToken() == _covToken;

    _covToken.safeTransferFrom(msg.sender, address(this), _covTokenAmount);
    _pairedToken.safeTransferFrom(msg.sender, address(this), _pairedTokenAmount);
    pool = _createBalPoolAndTransferBpt(msg.sender, _covToken, _pairedToken, _pairedToken.balanceOf(address(this)), isClaimPair);
    pools[pairKey] = pool;
  }

  function setSwapFee(uint256 _claimSwapFees, uint256 _noclaimSwapFees) external override onlyOwner {
    require(_claimSwapFees > 0 && _noclaimSwapFees > 0, "CoverRouter: invalid fees");
    claimSwapFee = _claimSwapFees;
    noclaimSwapFee = _noclaimSwapFees;
  }

  function setCovTokenWeights(uint256 _claimCovTokenWeight, uint256 _noclaimCovTokenWeight) external override onlyOwner {
    require(_claimCovTokenWeight < TOTAL_WEIGHT, "CoverRouter: invalid claim weight");
    require(_noclaimCovTokenWeight < TOTAL_WEIGHT, "CoverRouter: invalid noclaim weight");
    claimCovTokenWeight = _claimCovTokenWeight;
    noclaimCovTokenWeight = _noclaimCovTokenWeight;
  }

  function setPoolForPair(address _covToken, address _pairedToken, address _newPool) public override onlyOwner {
    _validCovToken(_covToken);
    _validBalPoolTokens(_covToken, _pairedToken, IBPool(_newPool));

    bytes32 pairKey = _pairKeyForPair(_covToken, _pairedToken);
    pools[pairKey] = _newPool;
    emit PoolUpdate(_covToken, _pairedToken, _newPool);
  }

  function setPoolsForPairs(address[] memory _covTokens, address[] memory _pairedTokens, address[] memory _newPools) external override onlyOwner {
    require(_covTokens.length == _pairedTokens.length, "CoverRouter: Paired tokens length not equal");
    require(_covTokens.length == _newPools.length, "CoverRouter: Pools length not equal");

    for (uint256 i = 0; i < _covTokens.length; i++) {
      setPoolForPair(_covTokens[i], _pairedTokens[i], _newPools[i]);
    }
  }

  function _pairKeyForPair(address _covToken, address _pairedToken) internal view returns (bytes32 pairKey) {
    (address token0, address token1) = _covToken < _pairedToken ? (_covToken, _pairedToken) : (_pairedToken, _covToken);
    pairKey = keccak256(abi.encodePacked(
      protocolFactory,
      token0,
      token1
    ));
  }

  function _getBptAmountOut(
    IBPool pool,
    address _covToken,
    uint256 _covTokenAmount,
    address _pairedToken,
    uint256 _pairedTokenAmount,
    bool _addBuffer
  ) internal view returns (uint256 bptAmountOut, uint256[] memory maxAmountsIn) {
    uint256 poolAmountOutInCov = _covTokenAmount.mul(pool.totalSupply()).div(pool.getBalance(_covToken));
    uint256 poolAmountOutInPaired = _pairedTokenAmount.mul(pool.totalSupply()).div(pool.getBalance(_pairedToken));
    bptAmountOut = poolAmountOutInCov > poolAmountOutInPaired ? poolAmountOutInPaired : poolAmountOutInCov;
    bptAmountOut = _addBuffer ? bptAmountOut.mul(99).div(100) : bptAmountOut;

    address[] memory tokens = pool.getFinalTokens();
    maxAmountsIn = new uint256[](2);
    maxAmountsIn[0] =  _covTokenAmount;
    maxAmountsIn[1] = _pairedTokenAmount;
    if (tokens[1] == _covToken) {
      maxAmountsIn[0] =  _pairedTokenAmount;
      maxAmountsIn[1] = _covTokenAmount;
    }
  }

  /// @notice make covToken is from Cover Protocol Factory
  function _validCovToken(address _covToken) private view {
    require(_covToken != address(0), "CoverRouter: covToken is 0 address");

    ICover cover = ICover(ICoverERC20(_covToken).owner());
    address tokenProtocolFactory = IProtocol(cover.owner()).owner();
    require(tokenProtocolFactory == protocolFactory, "CoverRouter: wrong factory");
  }

  function _validBalPoolTokens(address _covToken, address _pairedToken, IBPool _pool) private view {
    require(_pairedToken != _covToken, "CoverRouter: same token");
    address[] memory tokens = _pool.getFinalTokens();
    require(tokens.length == 2, "CoverRouter: Too many tokens in pool");
    require((_covToken == tokens[0] && _pairedToken == tokens[1]) || (_pairedToken == tokens[0] && _covToken == tokens[1]), "CoverRouter: tokens don't match");
  }

  /// @dev add buffer support (1%) as suggested by balancer doc to help get tx through. https://docs.balancer.finance/smart-contracts/core-contracts/api#joinpool
  function _joinPool(
    address _account,
    IERC20 _covToken,
    IERC20 _pairedToken,
    uint256 _pairedTokenAmount,
    bool _addBuffer
  ) internal {
    address poolAddr = pools[_pairKeyForPair(address(_covToken), address(_pairedToken))];
    require(poolAddr != address(0), "CoverRouter: pool not found");

    IBPool pool = IBPool(poolAddr);
    uint256 covTokenAmount = _covToken.balanceOf(address(this));
    (uint256 bptAmountOut, uint256[] memory maxAmountsIn) = _getBptAmountOut(pool, address(_covToken), covTokenAmount, address(_pairedToken), _pairedTokenAmount, _addBuffer);
    _approve(_covToken, poolAddr, covTokenAmount);
    _approve(_pairedToken, poolAddr, _pairedTokenAmount);
    pool.joinPool(bptAmountOut, maxAmountsIn);

    pool.safeTransfer(_account, pool.balanceOf(address(this)));
    _transferRem(_account, _covToken);
    emit AddLiquidity(_account, poolAddr);
  }

  function _transferRem(address _account, IERC20 token) internal {
    uint256 rem = token.balanceOf(address(this));
    if (rem > 0) {
      token.safeTransfer(_account, rem);
    }
  }

  function _receivePairdTokens(
    address _account,
    IERC20 _pairedToken,
    uint256 _claimPTAmt,
    uint256 _noclaimPTAmt
  ) internal returns (uint256 receivedClaimPTAmt, uint256 receivedNoclaimPTAmt) {
    uint256 total = _claimPTAmt.add(_noclaimPTAmt);
    _pairedToken.safeTransferFrom(_account, address(this), total);
    uint256 bal = _pairedToken.balanceOf(address(this));
    receivedClaimPTAmt = bal.mul(_claimPTAmt).div(total);
    receivedNoclaimPTAmt = bal.mul(_noclaimPTAmt).div(total);
  }

  function _addLiquidityForCover(
    address _account,
    ICover _cover,
    IERC20 _pairedToken,
    uint256 _claimPTAmt,
    uint256 _noclaimPTAmt,
    bool _addBuffer
  ) private {
    IERC20 claimCovToken = _cover.claimCovToken();
    IERC20 noclaimCovToken = _cover.noclaimCovToken();
    (uint256 claimPTAmt, uint256 noclaimPTAmt) =  _receivePairdTokens(_account, _pairedToken, _claimPTAmt, _noclaimPTAmt);

    _joinPool(_account, claimCovToken, _pairedToken, claimPTAmt, _addBuffer);
    _joinPool(_account, noclaimCovToken, _pairedToken, noclaimPTAmt, _addBuffer);
    _transferRem(_account, _pairedToken);
  }

  function _createBalPoolAndTransferBpt(
    address _account,
    IERC20 _covToken,
    IERC20 _pairedToken,
    uint256 _pairedTokenAmount,
    bool _isClaimPair
  ) private returns (address poolAddr) {
    IBPool pool = bFactory.newBPool();
    poolAddr = address(pool);

    uint256 _covTokenSwapFee = claimSwapFee;
    uint256 _covTokenWeight = claimCovTokenWeight;
    if (!_isClaimPair) {
      _covTokenSwapFee = noclaimSwapFee;
      _covTokenWeight = noclaimCovTokenWeight;
    }
    pool.setSwapFee(_covTokenSwapFee);
    uint256 covTokenAmount = _covToken.balanceOf(address(this));
    _approve(_covToken, poolAddr, covTokenAmount);
    pool.bind(address(_covToken), covTokenAmount, _covTokenWeight);
    _approve(_pairedToken, poolAddr, _pairedTokenAmount);
    pool.bind(address(_pairedToken), _pairedTokenAmount, TOTAL_WEIGHT.sub(_covTokenWeight));

    pool.finalize();
    emit PoolUpdate(address(_covToken), address(_pairedToken), poolAddr);
    pool.safeTransfer(_account, pool.balanceOf(address(this)));
  }
}

File 2 of 14 : IBFactory.sol
// SPDX-License-Identifier: None

pragma solidity ^0.7.5;

import "./IBPool.sol";

interface IBFactory {
  function newBPool() external returns (IBPool);
}

File 3 of 14 : IBPool.sol
// SPDX-License-Identifier: None

pragma solidity ^0.7.5;

import "./IERC20.sol";

interface IBPool is IERC20 {
    function getFinalTokens() external view returns(address[] memory);
    function getDenormalizedWeight(address token) external view returns (uint256);
    function setSwapFee(uint256 swapFee) external;
    function setController(address controller) external;
    function finalize() external;
    function bind(address token, uint256 balance, uint256 denorm) external;
    function getBalance(address token) external view returns (uint);
    function joinPool(uint256 poolAmountOut, uint256[] calldata maxAmountsIn) external;
    function exitPool(uint256 poolAmountIn, uint256[] calldata minAmountsOut) external;
}

File 4 of 14 : ICover.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

import "./ICoverERC20.sol";

/**
 * @title Cover contract interface. See {Cover}.
 * @author [email protected]
 */
interface ICover {
  function owner() external view returns (address);
  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 claimNonce() external view returns (uint256);

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

File 5 of 14 : ICoverERC20.sol
// SPDX-License-Identifier: None

pragma solidity ^0.7.5;

import "./IERC20.sol";

interface ICoverERC20 is IERC20 {
  function owner() external view returns (address);
}

File 6 of 14 : ICoverRouter.sol
// SPDX-License-Identifier: None
pragma solidity ^0.7.5;

import "./ICover.sol";
import "./ICoverERC20.sol";
import "./IERC20.sol";
import "./IProtocol.sol";

/**
 * @title CoverRouter interface
 * @author [email protected]
 */
interface ICoverRouter {
  event PoolUpdate(address indexed covtoken, address indexed pairedToken, address indexed poolAddr);
  event AddLiquidity(address indexed account, address indexed poolAddr);
  event RemoveLiquidity(address indexed account, address indexed poolAddr);

  function poolForPair(address _covToken, address _pairedToken) external view returns (address);

  /// @notice _covTokenAmount + _pairedTokenAmount + XCovTokenWeight will set the initial price for the covToken
  function createNewPool(ICoverERC20 _covToken, uint256 _covAmount, IERC20 _pairedToken, uint256 _pairedAmount) external returns (address);
  /// @notice add double sided liquidity, there maybe token left after add liquidity
  function addLiquidity(ICoverERC20 _covToken,uint256 _covTokenAmount, IERC20 _pairedToken, uint256 _pairedTokenAmount, bool _addBuffer) external;
  function removeLiquidity(ICoverERC20 _covToken, IERC20 _pairedToken, uint256 _btpAmount) external;

  function addCoverAndAddLiquidity(
    IProtocol _protocol,
    IERC20 _collateral,
    uint48 _timestamp,
    uint256 _amount,
    IERC20 _pairedToken,
    uint256 _claimPairedTokenAmount,
    uint256 _noclaimPairedTokenAmount,
    bool _addBuffer
  ) external;
  function rolloverAndAddLiquidity(
    ICover _cover,
    uint48 _newTimestamp,
    IERC20 _pairedToken,
    uint256 _claimPairedTokenAmount,
    uint256 _noclaimPairedTokenAmount,
    bool _addBuffer
  ) external;
  function rolloverAndAddLiquidityForAccount(
    address _account,
    ICover _cover,
    uint48 _newTimestamp,
    IERC20 _pairedToken,
    uint256 _claimPairedTokenAmount,
    uint256 _noclaimPairedTokenAmount,
    bool _addBuffer
  ) external;
  function addCoverAndCreatePools(
    IProtocol _protocol,
    IERC20 _collateral,
    uint48 _timestamp,
    uint256 _amount,
    IERC20 _pairedToken,
    uint256 _claimPairedTokenAmount,
    uint256 _noclaimPairedTokenAmount
  ) external;

  // owner only
  function setPoolForPair(address _covToken, address _pairedToken, address _newPool) external;
  function setPoolsForPairs(address[] memory _covTokens, address[] memory _pairedTokens, address[] memory _newPools) external;
  function setCovTokenWeights(uint256 _claimCovTokenWeight, uint256 _noclaimCovTokenWeight) external;
  function setSwapFee(uint256 _claimSwapFees, uint256 _noclaimSwapFees) external;
}

File 7 of 14 : IERC20.sol
// SPDX-License-Identifier: None

pragma solidity ^0.7.4;

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

File 8 of 14 : IProtocol.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.7.3;

/**
 * @dev Protocol contract interface. See {Protocol}.
 * @author [email protected]
 */
interface IProtocol {
  function owner() external view returns (address);
  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);
}

File 9 of 14 : Ownable.sol
// SPDX-License-Identifier: None

pragma solidity ^0.7.4;

/**
 * @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 [email protected]
 *
 * 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 {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev COVER: Initializes the contract setting the deployer as the initial owner.
     */
    constructor () {
        _owner = msg.sender;
        emit OwnershipTransferred(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 OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 10 of 14 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.5;

import "./SafeMath.sol";
import "./Address.sol";
import "../interfaces/IERC20.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");
        }
    }
}

File 11 of 14 : SafeMath.sol
// SPDX-License-Identifier: None

pragma solidity ^0.7.4;

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

File 12 of 14 : Rollover.sol
// SPDX-License-Identifier: None
pragma solidity ^0.7.5;

import "./interfaces/ICover.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IProtocol.sol";
import "./interfaces/IRollover.sol";
import "./utils/SafeERC20.sol";
import "./utils/SafeMath.sol";

/**
 * @title Rollover zap for Cover Protocol that auto redeems and rollover the coverage to the next cover, it does not sell or buy tokens for sender
 * @author [email protected]
 */
contract Rollover is IRollover {
  using SafeERC20 for IERC20;
  using SafeMath for uint256;

  /// @notice rollover for sender
  function rollover(address _cover, uint48 _newTimestamp) external override {
    _rolloverAccount(msg.sender, _cover, _newTimestamp, true);
  }

  /// @notice rollover for a different account (from sender)
  function rolloverAccount(address _account, address _cover, uint48 _newTimestamp) public override {
    _rolloverAccount(_account, _cover, _newTimestamp, true);
  }

  function _rolloverAccount(
    address _account,
    address _cover,
    uint48 _newTimestamp,
    bool _isLastStep
  ) internal {
    ICover cover = ICover(_cover);
    uint48 expirationTimestamp = cover.expirationTimestamp();
    require(expirationTimestamp != _newTimestamp && block.timestamp < _newTimestamp, "Rollover: invalid expiry");

    IProtocol protocol = IProtocol(cover.owner());
    bool acceptedClaim = cover.claimNonce() != protocol.claimNonce();
    require(!acceptedClaim, "Rollover: there is an accepted claim");

    (, uint8 expirationStatus) = protocol.expirationTimestampMap(_newTimestamp);
    require(expirationStatus == 1, "Rollover: new timestamp is not active");

    if (block.timestamp < expirationTimestamp) {
      _redeemCollateral(cover, _account);
    } else {
      require(block.timestamp >= uint256(expirationTimestamp).add(protocol.noclaimRedeemDelay()), "Rollover: not ready");
      _redeemNoclaim(cover, _account);
    }
    IERC20 collateral = IERC20(cover.collateral());
    uint256 redeemedAmount = collateral.balanceOf(address(this));

    _addCover(protocol, address(collateral), _newTimestamp, redeemedAmount);
    emit RolloverCover(_account, address(protocol));
    if (_isLastStep) {
      _sendCovTokensToAccount(protocol, address(collateral), _newTimestamp, _account);
    }
  }

  function _approve(IERC20 _token, address _spender, uint256 _amount) internal {
    if (_token.allowance(address(this), _spender) < _amount) {
      _token.approve(_spender, uint256(-1));
    }
  }

  function _addCover(
    IProtocol _protocol,
    address _collateral,
    uint48 _timestamp,
    uint256 _amount
  ) internal {
    _approve(IERC20(_collateral), address(_protocol), _amount);
    _protocol.addCover(address(_collateral), _timestamp, _amount);
  }

  function _sendCovTokensToAccount(
    IProtocol protocol,
    address _collateral,
    uint48 _timestamp,
    address _account
  ) private {
    ICover newCover = ICover(protocol.coverMap(_collateral, _timestamp));

    IERC20 newClaimCovToken = newCover.claimCovToken();
    IERC20 newNoclaimCovToken = newCover.noclaimCovToken();

    newClaimCovToken.safeTransfer(_account, newClaimCovToken.balanceOf(address(this)));
    newNoclaimCovToken.safeTransfer(_account, newNoclaimCovToken.balanceOf(address(this)));
  }

  function _redeemCollateral(ICover cover, address _account) private {
    // transfer CLAIM and NOCLAIM to contract
    IERC20 claimCovToken = cover.claimCovToken();
    IERC20 noclaimCovToken = cover.noclaimCovToken();
    uint256 claimCovTokenBal = claimCovToken.balanceOf(_account);
    uint256 noclaimCovTokenBal = noclaimCovToken.balanceOf(_account);
    uint256 amount = (claimCovTokenBal > noclaimCovTokenBal) ? noclaimCovTokenBal : claimCovTokenBal;
    require(amount > 0, "Rollover: insufficient covTokens");

    claimCovToken.safeTransferFrom(_account, address(this), amount);
    noclaimCovToken.safeTransferFrom(_account, address(this), amount);

    // redeem collateral back to contract with CLAIM and NOCLAIM tokens
    cover.redeemCollateral(amount);
  }

  function _redeemNoclaim(ICover cover, address _account) private {
    // transfer CLAIM and NOCLAIM to contract
    IERC20 noclaimCovToken = cover.noclaimCovToken();
    uint256 amount = noclaimCovToken.balanceOf(_account);
    require(amount > 0, "Rollover: insufficient NOCLAIM covTokens");
    noclaimCovToken.safeTransferFrom(_account, address(this), amount);

    // redeem collateral back to contract with NOCLAIM tokens
    cover.redeemNoclaim();
  }
}

File 13 of 14 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.4;

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);
            }
        }
    }
}

File 14 of 14 : IRollover.sol
// SPDX-License-Identifier: None
pragma solidity ^0.7.5;

interface IRollover {
  event RolloverCover(address indexed _account, address _protocol);

  function rollover(address _cover, uint48 _newTimestamp) external;
  function rolloverAccount(address _account, address _cover, uint48 _newTimestamp) external;
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_protocolFactory","type":"address"},{"internalType":"contract IBFactory","name":"_bFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"poolAddr","type":"address"}],"name":"AddLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"covtoken","type":"address"},{"indexed":true,"internalType":"address","name":"pairedToken","type":"address"},{"indexed":true,"internalType":"address","name":"poolAddr","type":"address"}],"name":"PoolUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"poolAddr","type":"address"}],"name":"RemoveLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"},{"indexed":false,"internalType":"address","name":"_protocol","type":"address"}],"name":"RolloverCover","type":"event"},{"inputs":[],"name":"TOTAL_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IProtocol","name":"_protocol","type":"address"},{"internalType":"contract IERC20","name":"_collateral","type":"address"},{"internalType":"uint48","name":"_timestamp","type":"uint48"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"contract IERC20","name":"_pairedToken","type":"address"},{"internalType":"uint256","name":"_claimPTAmt","type":"uint256"},{"internalType":"uint256","name":"_noclaimPTAmt","type":"uint256"},{"internalType":"bool","name":"_addBuffer","type":"bool"}],"name":"addCoverAndAddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IProtocol","name":"_protocol","type":"address"},{"internalType":"contract IERC20","name":"_collateral","type":"address"},{"internalType":"uint48","name":"_timestamp","type":"uint48"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"contract IERC20","name":"_pairedToken","type":"address"},{"internalType":"uint256","name":"_claimPTAmt","type":"uint256"},{"internalType":"uint256","name":"_noclaimPTAmt","type":"uint256"}],"name":"addCoverAndCreatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ICoverERC20","name":"_covToken","type":"address"},{"internalType":"uint256","name":"_covTokenAmount","type":"uint256"},{"internalType":"contract IERC20","name":"_pairedToken","type":"address"},{"internalType":"uint256","name":"_pairedTokenAmount","type":"uint256"},{"internalType":"bool","name":"_addBuffer","type":"bool"}],"name":"addLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bFactory","outputs":[{"internalType":"contract IBFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimCovTokenWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimSwapFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ICoverERC20","name":"_covToken","type":"address"},{"internalType":"uint256","name":"_covTokenAmount","type":"uint256"},{"internalType":"contract IERC20","name":"_pairedToken","type":"address"},{"internalType":"uint256","name":"_pairedTokenAmount","type":"uint256"}],"name":"createNewPool","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"noclaimCovTokenWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"noclaimSwapFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_covToken","type":"address"},{"internalType":"address","name":"_pairedToken","type":"address"}],"name":"poolForPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ICoverERC20","name":"_covToken","type":"address"},{"internalType":"contract IERC20","name":"_pairedToken","type":"address"},{"internalType":"uint256","name":"_bptAmount","type":"uint256"}],"name":"removeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_cover","type":"address"},{"internalType":"uint48","name":"_newTimestamp","type":"uint48"}],"name":"rollover","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_cover","type":"address"},{"internalType":"uint48","name":"_newTimestamp","type":"uint48"}],"name":"rolloverAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ICover","name":"_cover","type":"address"},{"internalType":"uint48","name":"_newTimestamp","type":"uint48"},{"internalType":"contract IERC20","name":"_pairedToken","type":"address"},{"internalType":"uint256","name":"_claimPTAmt","type":"uint256"},{"internalType":"uint256","name":"_noclaimPTAmt","type":"uint256"},{"internalType":"bool","name":"_addBuffer","type":"bool"}],"name":"rolloverAndAddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"contract ICover","name":"_cover","type":"address"},{"internalType":"uint48","name":"_newTimestamp","type":"uint48"},{"internalType":"contract IERC20","name":"_pairedToken","type":"address"},{"internalType":"uint256","name":"_claimPTAmt","type":"uint256"},{"internalType":"uint256","name":"_noclaimPTAmt","type":"uint256"},{"internalType":"bool","name":"_addBuffer","type":"bool"}],"name":"rolloverAndAddLiquidityForAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimCovTokenWeight","type":"uint256"},{"internalType":"uint256","name":"_noclaimCovTokenWeight","type":"uint256"}],"name":"setCovTokenWeights","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_covToken","type":"address"},{"internalType":"address","name":"_pairedToken","type":"address"},{"internalType":"address","name":"_newPool","type":"address"}],"name":"setPoolForPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_covTokens","type":"address[]"},{"internalType":"address[]","name":"_pairedTokens","type":"address[]"},{"internalType":"address[]","name":"_newPools","type":"address[]"}],"name":"setPoolsForPairs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimSwapFees","type":"uint256"},{"internalType":"uint256","name":"_noclaimSwapFees","type":"uint256"}],"name":"setSwapFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405268022b1c8c1227a000006003556802a802f8630a24000060045566470de4df820000600555662386f26fc1000060065534801561004057600080fd5b506040516200446e3803806200446e8339818101604052604081101561006557600080fd5b508051602090910151600080546001600160a01b03191633178082556040516001600160a01b039190911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600180546001600160a01b039384166001600160a01b0319918216179091556002805492909316911617905561437b80620000f36000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80638da5cb5b116100c3578063d752fab21161007c578063d752fab2146105b9578063e17c0017146105ef578063ed2a2f9d14610631578063f2fde38b14610639578063f489048a1461065f578063ffa7eef0146106675761014d565b80638da5cb5b146104665780638e7faac61461046e578063983ae9f0146104cd578063a7a9744214610501578063c84df1e71461053b578063ce4a7e071461058b5761014d565b80631efaaed3116101155780631efaaed314610362578063335f5e231461036a578063371cae2d1461038d5780633b09bf9c146103e75780634be071b714610426578063826e468d1461045e5761014d565b806304803501146101525780630a165940146102f95780630a81ac031461031d5780630f4e9ef4146103375780631a610adf1461033f575b600080fd5b6102f76004803603606081101561016857600080fd5b810190602081018135600160201b81111561018257600080fd5b82018360208201111561019457600080fd5b803590602001918460208302840111600160201b831117156101b557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561020457600080fd5b82018360208201111561021657600080fd5b803590602001918460208302840111600160201b8311171561023757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561028657600080fd5b82018360208201111561029857600080fd5b803590602001918460208302840111600160201b831117156102b957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506106bd945050505050565b005b6103016107e8565b604080516001600160a01b039092168252519081900360200190f35b6103256107f7565b60408051918252519081900360200190f35b6103256107fd565b6102f76004803603604081101561035557600080fd5b5080359060200135610803565b6103256108bc565b6102f76004803603604081101561038057600080fd5b50803590602001356108c2565b6102f7600480360360e08110156103a357600080fd5b506001600160a01b038135811691602081013582169165ffffffffffff6040830135169160608101359091169060808101359060a08101359060c0013515156109a8565b6102f7600480360360608110156103fd57600080fd5b5080356001600160a01b03908116916020810135909116906040013565ffffffffffff16610b34565b6102f76004803603606081101561043c57600080fd5b506001600160a01b038135811691602081013582169160409091013516610b46565b610325610c17565b610301610c1d565b6102f7600480360361010081101561048557600080fd5b506001600160a01b038135811691602081013582169165ffffffffffff604083013516916060810135916080820135169060a08101359060c08101359060e001351515610c2c565b6102f7600480360360408110156104e357600080fd5b5080356001600160a01b0316906020013565ffffffffffff16610dc8565b6103016004803603608081101561051757600080fd5b506001600160a01b0381358116916020810135916040820135169060600135610dd9565b6102f7600480360360c081101561055157600080fd5b506001600160a01b03813581169165ffffffffffff602082013516916040820135169060608101359060808101359060a00135151561108a565b610301600480360360408110156105a157600080fd5b506001600160a01b03813581169160200135166110a1565b6102f7600480360360608110156105cf57600080fd5b506001600160a01b038135811691602081013590911690604001356110d0565b6102f7600480360360a081101561060557600080fd5b506001600160a01b038135811691602081013591604082013516906060810135906080013515156114c7565b6103256116f5565b6102f76004803603602081101561064f57600080fd5b50356001600160a01b0316611702565b6103016117ef565b6102f7600480360360e081101561067d57600080fd5b506001600160a01b038135811691602081013582169165ffffffffffff604083013516916060810135916080820135169060a08101359060c001356117fe565b6000546001600160a01b0316331461070a576040805162461bcd60e51b81526020600482018190526024820152600080516020614290833981519152604482015290519081900360640190fd5b815183511461074a5760405162461bcd60e51b815260040180806020018281038252602b815260200180614265602b913960400191505060405180910390fd5b805183511461078a5760405162461bcd60e51b81526004018080602001828103825260238152602001806141256023913960400191505060405180910390fd5b60005b83518110156107e2576107da8482815181106107a557fe5b60200260200101518483815181106107b957fe5b60200260200101518484815181106107cd57fe5b6020026020010151610b46565b60010161078d565b50505050565b6002546001600160a01b031681565b60045481565b60065481565b6000546001600160a01b03163314610850576040805162461bcd60e51b81526020600482018190526024820152600080516020614290833981519152604482015290519081900360640190fd5b6000821180156108605750600081115b6108b1576040805162461bcd60e51b815260206004820152601960248201527f436f766572526f757465723a20696e76616c6964206665657300000000000000604482015290519081900360640190fd5b600591909155600655565b60035481565b6000546001600160a01b0316331461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020614290833981519152604482015290519081900360640190fd5b6802b5e3af16b188000082106109565760405162461bcd60e51b815260040180806020018281038252602181526020018061421c6021913960400191505060405180910390fd5b6802b5e3af16b1880000811061099d5760405162461bcd60e51b81526004018080602001828103825260238152602001806141486023913960400191505060405180910390fd5b600391909155600455565b6109b58787876000611c04565b6000866001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109f057600080fd5b505afa158015610a04573d6000803e3d6000fd5b505050506040513d6020811015610a1a57600080fd5b50516040805163d8dfeb4560e01b815290519192506000916001600160a01b038085169263ecd2bf9f92918c169163d8dfeb4591600480820192602092909190829003018186803b158015610a6e57600080fd5b505afa158015610a82573d6000803e3d6000fd5b505050506040513d6020811015610a9857600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b03909216600483015265ffffffffffff8b166024830152516044808301926020929190829003018186803b158015610aed57600080fd5b505afa158015610b01573d6000803e3d6000fd5b505050506040513d6020811015610b1757600080fd5b50519050610b29898288888888612161565b505050505050505050565b610b418383836001611c04565b505050565b6000546001600160a01b03163314610b93576040805162461bcd60e51b81526020600482018190526024820152600080516020614290833981519152604482015290519081900360640190fd5b610b9c8361227f565b610ba7838383612470565b6000610bb38484612720565b60008181526007602052604080822080546001600160a01b0319166001600160a01b038781169182179092559151939450909286821692918816917f5fca47ff414ef8293a21309c713b121cde28499bcb7c8136c528933686d4889391a450505050565b60055481565b6000546001600160a01b031690565b600085118015610c3c5750600083115b8015610c485750600082115b610c94576040805162461bcd60e51b81526020600482015260186024820152770436f766572526f757465723a20616d6f756e7420697320360441b604482015290519081900360640190fd5b610ca96001600160a01b0388163330886127a3565b610d2d8888888a6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610cfc57600080fd5b505afa158015610d10573d6000803e3d6000fd5b505050506040513d6020811015610d2657600080fd5b50516127fd565b6000886001600160a01b031663ecd2bf9f89896040518363ffffffff1660e01b815260040180836001600160a01b031681526020018265ffffffffffff1681526020019250505060206040518083038186803b158015610d8c57600080fd5b505afa158015610da0573d6000803e3d6000fd5b505050506040513d6020811015610db657600080fd5b50519050610b29338287878787612161565b610dd53383836001611c04565b5050565b6000846001600160a01b0316836001600160a01b03161415610e3c576040805162461bcd60e51b815260206004820152601760248201527621b7bb32b92937baba32b91d1039b0b6b2903a37b5b2b760491b604482015290519081900360640190fd5b6000610e488685612720565b6000818152600760205260409020549091506001600160a01b031615610eb5576040805162461bcd60e51b815260206004820181905260248201527f436f766572526f757465723a20706f6f6c20616c726561647920657869737473604482015290519081900360640190fd5b610ebe8661227f565b6000866001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ef957600080fd5b505afa158015610f0d573d6000803e3d6000fd5b505050506040513d6020811015610f2357600080fd5b5051604080516320fc581560e21b815290519192506000916001600160a01b03808b1692908516916383f1605491600480820192602092909190829003018186803b158015610f7157600080fd5b505afa158015610f85573d6000803e3d6000fd5b505050506040513d6020811015610f9b57600080fd5b50516001600160a01b03908116919091149150610fbc90891633308a6127a3565b610fd16001600160a01b0387163330886127a3565b611056338988896001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561102457600080fd5b505afa158015611038573d6000803e3d6000fd5b505050506040513d602081101561104e57600080fd5b505185612899565b60009384526007602052604090932080546001600160a01b0319166001600160a01b03851617905550909695505050505050565b611099338787878787876109a8565b505050505050565b6000806110ae8484612720565b6000908152600760205260409020546001600160a01b03169150505b92915050565b6000811161110f5760405162461bcd60e51b81526004018080602001828103825260228152602001806141b56022913960400191505060405180910390fd5b600061111b8484612720565b6000818152600760209081526040918290205482516370a0823160e01b815233600482015292519394506001600160a01b031692859284926370a0823192602480840193829003018186803b15801561117357600080fd5b505afa158015611187573d6000803e3d6000fd5b505050506040513d602081101561119d57600080fd5b505110156111f2576040805162461bcd60e51b815260206004820152601d60248201527f436f766572526f757465723a20696e73756666696369656e7420425054000000604482015290519081900360640190fd5b604080516002808252606080830184529260208301908036833701905050905060008160008151811061122157fe5b60200260200101818152505060008160018151811061123c57fe5b602090810291909101015261125c6001600160a01b0383163330876127a3565b604080516370a0823160e01b815230600482015290516001600160a01b0384169163b02f0b739183916370a08231916024808301926020929190829003018186803b1580156112aa57600080fd5b505afa1580156112be573d6000803e3d6000fd5b505050506040513d60208110156112d457600080fd5b5051604080516001600160e01b031960e085901b168152600481018381526024820192835286516044830152865187939192606401906020858101910280838360005b8381101561132f578181015183820152602001611317565b505050509050019350505050600060405180830381600087803b15801561135557600080fd5b505af1158015611369573d6000803e3d6000fd5b505050506113fb33876001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156113be57600080fd5b505afa1580156113d2573d6000803e3d6000fd5b505050506040513d60208110156113e857600080fd5b50516001600160a01b0389169190612c5c565b61148933866001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561144c57600080fd5b505afa158015611460573d6000803e3d6000fd5b505050506040513d602081101561147657600080fd5b50516001600160a01b0388169190612c5c565b6040516001600160a01b0383169033907fafb871ca9e6b62bccb0296a89bb4c91df027b7c71658274b06a098739d5b7bd490600090a3505050505050565b83856001600160a01b03166370a08231336040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561151557600080fd5b505afa158015611529573d6000803e3d6000fd5b505050506040513d602081101561153f57600080fd5b5051101561157e5760405162461bcd60e51b81526004018080602001828103825260228152602001806141b56022913960400191505060405180910390fd5b81836001600160a01b03166370a08231336040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156115cc57600080fd5b505afa1580156115e0573d6000803e3d6000fd5b505050506040513d60208110156115f657600080fd5b505110156116355760405162461bcd60e51b81526004018080602001828103825260258152602001806142f76025913960400191505060405180910390fd5b61164a6001600160a01b0386163330876127a3565b61165f6001600160a01b0384163330856127a3565b6116e4338685866001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156116b257600080fd5b505afa1580156116c6573d6000803e3d6000fd5b505050506040513d60208110156116dc57600080fd5b505185612cae565b6116ee3384612f1c565b5050505050565b6802b5e3af16b188000081565b6000546001600160a01b0316331461174f576040805162461bcd60e51b81526020600482018190526024820152600080516020614290833981519152604482015290519081900360640190fd5b6001600160a01b0381166117945760405162461bcd60e51b815260040180806020018281038252602681526020018061418f6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031681565b60008411801561180e5750600082115b801561181a5750600081115b611866576040805162461bcd60e51b81526020600482015260186024820152770436f766572526f757465723a20616d6f756e7420697320360441b604482015290519081900360640190fd5b83866001600160a01b03166370a08231336040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156118b457600080fd5b505afa1580156118c8573d6000803e3d6000fd5b505050506040513d60208110156118de57600080fd5b505111611932576040805162461bcd60e51b815260206004820181905260248201527f436f766572526f757465723a20696e73756666696369656e7420616d6f756e74604482015290519081900360640190fd5b6119476001600160a01b0387163330876127a3565b61199a878787896001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610cfc57600080fd5b6000876001600160a01b031663ecd2bf9f88886040518363ffffffff1660e01b815260040180836001600160a01b031681526020018265ffffffffffff1681526020019250505060206040518083038186803b1580156119f957600080fd5b505afa158015611a0d573d6000803e3d6000fd5b505050506040513d6020811015611a2357600080fd5b5051604080516320fc581560e21b815290519192506000916001600160a01b038416916383f16054916004808301926020929190829003018186803b158015611a6b57600080fd5b505afa158015611a7f573d6000803e3d6000fd5b505050506040513d6020811015611a9557600080fd5b5051604080516391b0cd8160e01b815290519192506000916001600160a01b038516916391b0cd81916004808301926020929190829003018186803b158015611add57600080fd5b505afa158015611af1573d6000803e3d6000fd5b505050506040513d6020811015611b0757600080fd5b50519050600080611b1a33898989612fb3565b915091506000611b2a858a612720565b6000818152600760205260409020549091506001600160a01b0316611b8457611b5733868b866001612899565b600082815260076020526040902080546001600160a01b0319166001600160a01b03929092169190911790555b6000611b90858b612720565b6000818152600760205260409020549091506001600160a01b0316611bea57611bbd33868c866000612899565b600082815260076020526040902080546001600160a01b0319166001600160a01b03929092169190911790555b611bf4338b612f1c565b5050505050505050505050505050565b60008390506000816001600160a01b0316639f43ddd26040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4457600080fd5b505afa158015611c58573d6000803e3d6000fd5b505050506040513d6020811015611c6e57600080fd5b5051905065ffffffffffff80821690851614801590611c9457508365ffffffffffff1642105b611ce5576040805162461bcd60e51b815260206004820152601860248201527f526f6c6c6f7665723a20696e76616c6964206578706972790000000000000000604482015290519081900360640190fd5b6000826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015611d2057600080fd5b505afa158015611d34573d6000803e3d6000fd5b505050506040513d6020811015611d4a57600080fd5b50516040805163529096cd60e11b815290519192506000916001600160a01b0384169163a5212d9a916004808301926020929190829003018186803b158015611d9257600080fd5b505afa158015611da6573d6000803e3d6000fd5b505050506040513d6020811015611dbc57600080fd5b50516040805163529096cd60e11b815290516001600160a01b0387169163a5212d9a916004808301926020929190829003018186803b158015611dfe57600080fd5b505afa158015611e12573d6000803e3d6000fd5b505050506040513d6020811015611e2857600080fd5b50511480159150611e6a5760405162461bcd60e51b81526004018080602001828103825260248152602001806141d76024913960400191505060405180910390fd5b6040805163aae7f44d60e01b815265ffffffffffff8816600482015281516000926001600160a01b0386169263aae7f44d9260248083019392829003018186803b158015611eb757600080fd5b505afa158015611ecb573d6000803e3d6000fd5b505050506040513d6040811015611ee157600080fd5b50602001519050600160ff821614611f2a5760405162461bcd60e51b81526004018080602001828103825260258152602001806142d26025913960400191505060405180910390fd5b8365ffffffffffff16421015611f4957611f44858a613086565b612014565b611fc0836001600160a01b03166381c4fb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015611f8557600080fd5b505afa158015611f99573d6000803e3d6000fd5b505050506040513d6020811015611faf57600080fd5b505165ffffffffffff861690613345565b42101561200a576040805162461bcd60e51b8152602060048201526013602482015272526f6c6c6f7665723a206e6f7420726561647960681b604482015290519081900360640190fd5b612014858a6133a6565b6000856001600160a01b031663d8dfeb456040518163ffffffff1660e01b815260040160206040518083038186803b15801561204f57600080fd5b505afa158015612063573d6000803e3d6000fd5b505050506040513d602081101561207957600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156120c757600080fd5b505afa1580156120db573d6000803e3d6000fd5b505050506040513d60208110156120f157600080fd5b5051905061210185838b846127fd565b604080516001600160a01b0387811682529151918d16917f529945f1e4a9da7bf247c71ad6eb5d33dcefda12a2d82ca26995af3c6b67038c9181900360200190a287156121545761215485838b8e613535565b5050505050505050505050565b6000856001600160a01b03166383f160546040518163ffffffff1660e01b815260040160206040518083038186803b15801561219c57600080fd5b505afa1580156121b0573d6000803e3d6000fd5b505050506040513d60208110156121c657600080fd5b5051604080516391b0cd8160e01b815290519192506000916001600160a01b038916916391b0cd81916004808301926020929190829003018186803b15801561220e57600080fd5b505afa158015612222573d6000803e3d6000fd5b505050506040513d602081101561223857600080fd5b5051905060008061224b8a898989612fb3565b9150915061225c8a858a8589612cae565b6122698a848a8489612cae565b6122738a89612f1c565b50505050505050505050565b6001600160a01b0381166122c45760405162461bcd60e51b81526004018080602001828103825260228152602001806142b06022913960400191505060405180910390fd5b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156122ff57600080fd5b505afa158015612313573d6000803e3d6000fd5b505050506040513d602081101561232957600080fd5b505160408051638da5cb5b60e01b815290519192506000916001600160a01b03841691638da5cb5b916004808301926020929190829003018186803b15801561237157600080fd5b505afa158015612385573d6000803e3d6000fd5b505050506040513d602081101561239b57600080fd5b505160408051638da5cb5b60e01b815290516001600160a01b0390921691638da5cb5b91600480820192602092909190829003018186803b1580156123df57600080fd5b505afa1580156123f3573d6000803e3d6000fd5b505050506040513d602081101561240957600080fd5b50516001549091506001600160a01b03808316911614610b41576040805162461bcd60e51b815260206004820152601a60248201527f436f766572526f757465723a2077726f6e6720666163746f7279000000000000604482015290519081900360640190fd5b826001600160a01b0316826001600160a01b031614156124d1576040805162461bcd60e51b815260206004820152601760248201527621b7bb32b92937baba32b91d1039b0b6b2903a37b5b2b760491b604482015290519081900360640190fd5b6060816001600160a01b031663be3bbd2e6040518163ffffffff1660e01b815260040160006040518083038186803b15801561250c57600080fd5b505afa158015612520573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561254957600080fd5b8101908080516040519392919084600160201b82111561256857600080fd5b90830190602082018581111561257d57600080fd5b82518660208202830111600160201b8211171561259957600080fd5b82525081516020918201928201910280838360005b838110156125c65781810151838201526020016125ae565b50505050905001604052505050905080516002146126155760405162461bcd60e51b815260040180806020018281038252602481526020018061416b6024913960400191505060405180910390fd5b8060008151811061262257fe5b60200260200101516001600160a01b0316846001600160a01b031614801561266f57508060018151811061265257fe5b60200260200101516001600160a01b0316836001600160a01b0316145b806126cf57508060008151811061268257fe5b60200260200101516001600160a01b0316836001600160a01b03161480156126cf5750806001815181106126b257fe5b60200260200101516001600160a01b0316846001600160a01b0316145b6107e2576040805162461bcd60e51b815260206004820152601f60248201527f436f766572526f757465723a20746f6b656e7320646f6e2774206d6174636800604482015290519081900360640190fd5b6000806000836001600160a01b0316856001600160a01b031610612745578385612748565b84845b600154604080516bffffffffffffffffffffffff19606093841b811660208084019190915295841b811660348301529390921b90921660488201528151603c818303018152605c909101909152805191012095945050505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526107e29085906137c8565b612808838583613879565b836001600160a01b03166372c896c38484846040518463ffffffff1660e01b815260040180846001600160a01b031681526020018365ffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561286f57600080fd5b505af1158015612883573d6000803e3d6000fd5b505050506040513d602081101561109957600080fd5b600080600260009054906101000a90046001600160a01b03166001600160a01b031663d556c5dc6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156128ec57600080fd5b505af1158015612900573d6000803e3d6000fd5b505050506040513d602081101561291657600080fd5b505160055460035491935083925090846129335750506006546004545b826001600160a01b03166334e19907836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561297957600080fd5b505af115801561298d573d6000803e3d6000fd5b505050506000886001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156129e057600080fd5b505afa1580156129f4573d6000803e3d6000fd5b505050506040513d6020811015612a0a57600080fd5b50519050612a19898683613879565b836001600160a01b031663e4e1e5388a83856040518463ffffffff1660e01b815260040180846001600160a01b031681526020018381526020018281526020019350505050600060405180830381600087803b158015612a7857600080fd5b505af1158015612a8c573d6000803e3d6000fd5b50505050612a9b888689613879565b6001600160a01b03841663e4e1e5388989612abf6802b5e3af16b18800008761397e565b6040518463ffffffff1660e01b815260040180846001600160a01b031681526020018381526020018281526020019350505050600060405180830381600087803b158015612b0c57600080fd5b505af1158015612b20573d6000803e3d6000fd5b50505050836001600160a01b0316634bb278f36040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612b5f57600080fd5b505af1158015612b73573d6000803e3d6000fd5b50505050846001600160a01b0316886001600160a01b03168a6001600160a01b03167f5fca47ff414ef8293a21309c713b121cde28499bcb7c8136c528933686d4889360405160405180910390a4612c4f8a856001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612c1257600080fd5b505afa158015612c26573d6000803e3d6000fd5b505050506040513d6020811015612c3c57600080fd5b50516001600160a01b0387169190612c5c565b5050505095945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b419084906137c8565b600060076000612cbe8787612720565b81526020810191909152604001600020546001600160a01b0316905080612d2c576040805162461bcd60e51b815260206004820152601b60248201527f436f766572526f757465723a20706f6f6c206e6f7420666f756e640000000000604482015290519081900360640190fd5b604080516370a0823160e01b8152306004820152905182916000916001600160a01b038916916370a08231916024808301926020929190829003018186803b158015612d7757600080fd5b505afa158015612d8b573d6000803e3d6000fd5b505050506040513d6020811015612da157600080fd5b5051905060006060612db7848a858b8b8b6139c0565b91509150612dc6898685613879565b612dd1888689613879565b604080516313da703560e21b815260048101848152602482019283528351604483015283516001600160a01b03881693634f69c0d49387938793909291606401906020808601910280838360005b83811015612e37578181015183820152602001612e1f565b505050509050019350505050600060405180830381600087803b158015612e5d57600080fd5b505af1158015612e71573d6000803e3d6000fd5b50505050612ec68a856001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612c1257600080fd5b612ed08a8a612f1c565b846001600160a01b03168a6001600160a01b03167f195e7e4b5fb5e54d74151a03265cb8bfad9ba51c66836062351f7a8f5251e3d560405160405180910390a350505050505050505050565b6000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612f6b57600080fd5b505afa158015612f7f573d6000803e3d6000fd5b505050506040513d6020811015612f9557600080fd5b505190508015610b4157610b416001600160a01b0383168483612c5c565b60008080612fc18585613345565b9050612fd86001600160a01b0387168830846127a3565b6000866001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561302757600080fd5b505afa15801561303b573d6000803e3d6000fd5b505050506040513d602081101561305157600080fd5b50519050613069826130638389613dd0565b90613e29565b9350613079826130638388613dd0565b9250505094509492505050565b6000826001600160a01b03166383f160546040518163ffffffff1660e01b815260040160206040518083038186803b1580156130c157600080fd5b505afa1580156130d5573d6000803e3d6000fd5b505050506040513d60208110156130eb57600080fd5b5051604080516391b0cd8160e01b815290519192506000916001600160a01b038616916391b0cd81916004808301926020929190829003018186803b15801561313357600080fd5b505afa158015613147573d6000803e3d6000fd5b505050506040513d602081101561315d57600080fd5b5051604080516370a0823160e01b81526001600160a01b0386811660048301529151929350600092918516916370a0823191602480820192602092909190829003018186803b1580156131af57600080fd5b505afa1580156131c3573d6000803e3d6000fd5b505050506040513d60208110156131d957600080fd5b5051604080516370a0823160e01b81526001600160a01b0387811660048301529151929350600092918516916370a0823191602480820192602092909190829003018186803b15801561322b57600080fd5b505afa15801561323f573d6000803e3d6000fd5b505050506040513d602081101561325557600080fd5b505190506000818311613268578261326a565b815b9050600081116132c1576040805162461bcd60e51b815260206004820181905260248201527f526f6c6c6f7665723a20696e73756666696369656e7420636f76546f6b656e73604482015290519081900360640190fd5b6132d66001600160a01b0386168730846127a3565b6132eb6001600160a01b0385168730846127a3565b866001600160a01b031663bd37b775826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561333157600080fd5b505af1158015612154573d6000803e3d6000fd5b60008282018381101561339f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000826001600160a01b03166391b0cd816040518163ffffffff1660e01b815260040160206040518083038186803b1580156133e157600080fd5b505afa1580156133f5573d6000803e3d6000fd5b505050506040513d602081101561340b57600080fd5b5051604080516370a0823160e01b81526001600160a01b0385811660048301529151929350600092918416916370a0823191602480820192602092909190829003018186803b15801561345d57600080fd5b505afa158015613471573d6000803e3d6000fd5b505050506040513d602081101561348757600080fd5b50519050806134c75760405162461bcd60e51b815260040180806020018281038252602881526020018061423d6028913960400191505060405180910390fd5b6134dc6001600160a01b0383168430846127a3565b836001600160a01b0316631c75d8806040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561351757600080fd5b505af115801561352b573d6000803e3d6000fd5b5050505050505050565b6000846001600160a01b031663ecd2bf9f85856040518363ffffffff1660e01b815260040180836001600160a01b031681526020018265ffffffffffff1681526020019250505060206040518083038186803b15801561359457600080fd5b505afa1580156135a8573d6000803e3d6000fd5b505050506040513d60208110156135be57600080fd5b5051604080516320fc581560e21b815290519192506000916001600160a01b038416916383f16054916004808301926020929190829003018186803b15801561360657600080fd5b505afa15801561361a573d6000803e3d6000fd5b505050506040513d602081101561363057600080fd5b5051604080516391b0cd8160e01b815290519192506000916001600160a01b038516916391b0cd81916004808301926020929190829003018186803b15801561367857600080fd5b505afa15801561368c573d6000803e3d6000fd5b505050506040513d60208110156136a257600080fd5b5051604080516370a0823160e01b815230600482015290519192506137319186916001600160a01b038616916370a0823191602480820192602092909190829003018186803b1580156136f457600080fd5b505afa158015613708573d6000803e3d6000fd5b505050506040513d602081101561371e57600080fd5b50516001600160a01b0385169190612c5c565b6137bf84826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561378257600080fd5b505afa158015613796573d6000803e3d6000fd5b505050506040513d60208110156137ac57600080fd5b50516001600160a01b0384169190612c5c565b50505050505050565b606061381d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e6b9092919063ffffffff16565b805190915015610b415780806020019051602081101561383c57600080fd5b5051610b415760405162461bcd60e51b815260040180806020018281038252602a81526020018061431c602a913960400191505060405180910390fd5b60408051636eb1769f60e11b81523060048201526001600160a01b0384811660248301529151839286169163dd62ed3e916044808301926020929190829003018186803b1580156138c957600080fd5b505afa1580156138dd573d6000803e3d6000fd5b505050506040513d60208110156138f357600080fd5b50511015610b4157826001600160a01b031663095ea7b3836000196040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561395457600080fd5b505af1158015613968573d6000803e3d6000fd5b505050506040513d60208110156116ee57600080fd5b600061339f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613e82565b600060606000613aba896001600160a01b031663f8b2cb4f8a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613a1657600080fd5b505afa158015613a2a573d6000803e3d6000fd5b505050506040513d6020811015613a4057600080fd5b5051604080516318160ddd60e01b81529051613063916001600160a01b038e16916318160ddd91600480820192602092909190829003018186803b158015613a8757600080fd5b505afa158015613a9b573d6000803e3d6000fd5b505050506040513d6020811015613ab157600080fd5b50518a90613dd0565b90506000613bb28a6001600160a01b031663f8b2cb4f896040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613b0e57600080fd5b505afa158015613b22573d6000803e3d6000fd5b505050506040513d6020811015613b3857600080fd5b5051604080516318160ddd60e01b81529051613063916001600160a01b038f16916318160ddd91600480820192602092909190829003018186803b158015613b7f57600080fd5b505afa158015613b93573d6000803e3d6000fd5b505050506040513d6020811015613ba957600080fd5b50518990613dd0565b9050808211613bc15781613bc3565b805b935084613bd05783613be0565b613be06064613063866063613dd0565b935060608a6001600160a01b031663be3bbd2e6040518163ffffffff1660e01b815260040160006040518083038186803b158015613c1d57600080fd5b505afa158015613c31573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015613c5a57600080fd5b8101908080516040519392919084600160201b821115613c7957600080fd5b908301906020820185811115613c8e57600080fd5b82518660208202830111600160201b82111715613caa57600080fd5b82525081516020918201928201910280838360005b83811015613cd7578181015183820152602001613cbf565b505050509050016040525050509050600267ffffffffffffffff81118015613cfe57600080fd5b50604051908082528060200260200182016040528015613d28578160200160208202803683370190505b5093508884600081518110613d3957fe5b6020026020010181815250508684600181518110613d5357fe5b602002602001018181525050896001600160a01b031681600181518110613d7657fe5b60200260200101516001600160a01b03161415613dc2578684600081518110613d9b57fe5b6020026020010181815250508884600181518110613db557fe5b6020026020010181815250505b505050965096945050505050565b600082613ddf575060006110ca565b82820282848281613dec57fe5b041461339f5760405162461bcd60e51b81526004018080602001828103825260218152602001806141fb6021913960400191505060405180910390fd5b600061339f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613f19565b6060613e7a8484600085613f7e565b949350505050565b60008184841115613f115760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613ed6578181015183820152602001613ebe565b50505050905090810190601f168015613f035780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183613f685760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613ed6578181015183820152602001613ebe565b506000838581613f7457fe5b0495945050505050565b6060613f89856140eb565b613fda576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106140195780518252601f199092019160209182019101613ffa565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461407b576040519150601f19603f3d011682016040523d82523d6000602084013e614080565b606091505b50915091508115614094579150613e7a9050565b8051156140a45780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315613ed6578181015183820152602001613ebe565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590613e7a57505015159291505056fe436f766572526f757465723a20506f6f6c73206c656e677468206e6f7420657175616c436f766572526f757465723a20696e76616c6964206e6f636c61696d20776569676874436f766572526f757465723a20546f6f206d616e7920746f6b656e7320696e20706f6f6c4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373436f766572526f757465723a20696e73756666696369656e7420636f76546f6b656e526f6c6c6f7665723a20746865726520697320616e20616363657074656420636c61696d536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f766572526f757465723a20696e76616c696420636c61696d20776569676874526f6c6c6f7665723a20696e73756666696369656e74204e4f434c41494d20636f76546f6b656e73436f766572526f757465723a2050616972656420746f6b656e73206c656e677468206e6f7420657175616c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572436f766572526f757465723a20636f76546f6b656e20697320302061646472657373526f6c6c6f7665723a206e65772074696d657374616d70206973206e6f7420616374697665436f766572526f757465723a20696e73756666696369656e7420706169726564546f6b656e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220699f635871d88835684b999e5b0ad0f01eedadb497eb3ac684a87024ad8a9f4964736f6c63430007050033000000000000000000000000f4717129e0e19508dd4c3d0af8eb1ae69b66122e0000000000000000000000008f7f78080219d4066a8036ccd30d588b416a40db

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

000000000000000000000000f4717129e0e19508dd4c3d0af8eb1ae69b66122e0000000000000000000000008f7f78080219d4066a8036ccd30d588b416a40db

-----Decoded View---------------
Arg [0] : _protocolFactory (address): 0xf4717129e0e19508dd4c3d0af8eb1ae69b66122e
Arg [1] : _bFactory (address): 0x8f7f78080219d4066a8036ccd30d588b416a40db

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000f4717129e0e19508dd4c3d0af8eb1ae69b66122e
Arg [1] : 0000000000000000000000008f7f78080219d4066a8036ccd30d588b416a40db


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