Contract 0x10Bd459b45fE083CB0bBE673066467BF7a760C43 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x77144258cca62be6983d0bccfc7603d6a0c28615ad9189ac6d0b594a7dece8c8Flash Close290050722022-01-25 12:35:373 days 22 hrs ago0x31fd484dad9f1217a47701f50b7f7caca82f1c53 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM1.669278701664
0x638bd6748c53d58c07c8e8f926928ca33da7b30200c84f761fc8eaab3f3ca856Flash Batch Liqu...289321442022-01-24 18:04:144 days 17 hrs ago0x5e0a4e608e136a81136ed5833148c29da0ea949f IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM2.6943053088
0x3b6037ea8207b5b2076c15d0af5c3636cbb50583a5d4f03149241c5788852e35Flash Close289047742022-01-24 10:56:455 days 28 mins ago0xa39ab56babaab264fec46614f745235678999f08 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM2.087655499776
0x40231bb62465259955c1b7a7c007bb063157625479162b85874f89a8c6963652Flash Batch Liqu...285925102022-01-21 0:19:208 days 11 hrs ago0x5e0a4e608e136a81136ed5833148c29da0ea949f IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM1.74723642225
0x9e0437465f5e775a025325a16625c8fd3541d80fb4b84fe6b47f8734243cc496Flash Close285577232022-01-20 16:00:518 days 19 hrs ago0xf0e69ceb3eee1081d6d91ee567462209afffce97 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM1.060206563165
0xd09e668d3463b4d683bc6c4f91d371cfb145cb1dc362669f755d4df85d88f5e5Flash Close285402952022-01-20 11:52:058 days 23 hrs ago0x2d96e1fe38ff45cc8910c617b3c5e0b6298a81f3 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.962171777808
0xf731b9adb7750bc149b228e6f292ef16c0e8df73b91ec69233b06019ab504e40Flash Close285374572022-01-20 11:09:159 days 15 mins ago0xba95c82ded96ed57cedfb6bfc8363b9fc23db0ce IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.86474506082
0xd566a13a3244f681239e0ec496c7887f83152c4d72c95de924d3ffcb4948fd08Flash Batch Liqu...284711372022-01-19 19:41:109 days 15 hrs ago0x5e0a4e608e136a81136ed5833148c29da0ea949f IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM2.0108724792
0x81cbb5d7eecbbd0eaa0327b4c662d3ad097133cbbc23431c45835abdbc7f8705Flash Close284538112022-01-19 15:22:089 days 20 hrs ago0x5e26f32454ef6219b48ae556ecc58279b033e506 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.891593568507
0x60dc29b08d6eaebeb2c4c8e1c051f73b928718968ca239e3f71d62b5daa4057eFlash Close283156012022-01-18 6:07:2111 days 5 hrs ago0xa9eb6d1aec46951a159d5420fad32711751464d4 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.981867810555
0x5d16bff5bbd1469e42c2695a5c6c9458072a9fd3f74ac82d50fe897af4f6a47eFlash Close282285582022-01-17 9:58:4012 days 1 hr ago0x759c8b56187374456d2e75e8d5b9e8c24e5dbb9c IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.855450280213
0x5d8be4d8adb21c10e08d0eb7d7623b53beab3bbb438a74c858e67abdfa8f7471Flash Close280657252022-01-15 19:31:3713 days 15 hrs ago0x83c313a675029a79055fe466f42876b9bb5b43d4 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.685043339842
0x63b653be82deccc734dbe8da27f50312b6cf1b15e8cf057563e28d02cfb1983bFlash Close280485442022-01-15 15:23:4213 days 20 hrs ago0x035ed71220695b039653848413714c071cb89fde IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.48937990846
0xf4e4cc3298ae0375e289315812c7013d2781553b9c6ed9e45db30e0bc86b2098Flash Close279988422022-01-15 3:49:5814 days 7 hrs ago0x8d0efe7db232fe95f9073d3a0abdb4b6bb7cc68e IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.495497561921
0xd380bd88e0dde650af981b859c8f313e5ff80c34ac8a490924f928db51f6484dFlash Close277201092022-01-12 6:54:0217 days 4 hrs ago0x2e4c1778f8f4d28f61f4676d9f4a75b37c88c26c IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.874089118375
0xa643d1e60ede09b1c318bf1b28f712490bcfd7f2ab9670db751ab0ce22c5bd8cFlash Close276583982022-01-11 15:07:3117 days 20 hrs ago0x7a3518fe642b11be76db809ac5df64a4ed0855ba IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM1.050478774581
0xa3e350eb74c64f19c76e3fc61608cc485d9abb2958af98f16e4f41b3f5dae441Flash Close275656692022-01-10 15:54:4818 days 19 hrs ago0xe53ab209a541c969cd979223d347f5000b6fa3d8 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM1.031370423675
0xdf3078223fd930b820cb07a7df9cc85a830f94876e0102226aea7f0ebd96f71eFlash Close274788362022-01-09 18:48:3719 days 16 hrs ago0x18c12986c2586ceeba256b99ea443c519d868cf2 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.635755577124
0x5a3122b6d3bc985789109f05c2254da1e6ff9108a5af2b3673ffa20110c87acfFlash Batch Liqu...273839612022-01-08 19:33:3520 days 15 hrs ago0x5e0a4e608e136a81136ed5833148c29da0ea949f IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM2.5478529804
0xd5124b88617dfc335c547ed6d4c5f0d50151b8ef7aa908c75add002085d0efd4Flash Close273831652022-01-08 19:20:5420 days 16 hrs ago0x71475f41e426d4f57d94b059f5e403a48a9c2152 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM1.627410910606
0x9d51feca5a9bb825c079744f940092a400515e08d39f27a080bd4f93e104d24eFlash Batch Liqu...273779022022-01-08 17:44:0420 days 17 hrs ago0x5e0a4e608e136a81136ed5833148c29da0ea949f IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM3.052332618
0xd40f7f86a7eb96a7d59f0bbe34e4a1d41570df1009e823d14c56436af4aaa5c7Flash Batch Liqu...273740202022-01-08 16:35:3520 days 18 hrs ago0x5e0a4e608e136a81136ed5833148c29da0ea949f IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM2.934307995
0x8e2b9870ee29e7f9a9ab5f61f6c45dc5033cf17e735582c8df5c2de3bef94a6aFlash Close273702592022-01-08 15:22:1420 days 20 hrs ago0x3455858cb3a49d427bdf24f10a83584afcdd68d3 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM0.869174074594
0xa0fc40790d558f838fdd42acfc7f85be19d9698aace8003e066794986c8cfc04Flash Close271977382022-01-06 21:23:0522 days 14 hrs ago0x2239ff85f256b0ad09502e6b757ad4c0a747a899 IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM1.312213688112
0xa8796fc1e2dc189544cb10ca3cefeae17e2ff139149d8de46b3da6ad096c24bdFlash Batch Liqu...270948462022-01-05 20:03:3823 days 15 hrs ago0x5e0a4e608e136a81136ed5833148c29da0ea949f IN  0x10bd459b45fe083cb0bbe673066467bf7a760c430 FTM4.57766631
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x77144258cca62be6983d0bccfc7603d6a0c28615ad9189ac6d0b594a7dece8c8290050722022-01-25 12:35:373 days 22 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router0.434527355111231725 FTM
0x77144258cca62be6983d0bccfc7603d6a0c28615ad9189ac6d0b594a7dece8c8290050722022-01-25 12:35:373 days 22 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c430x31fd484dad9f1217a47701f50b7f7caca82f1c532.56547757014364322 FTM
0x77144258cca62be6983d0bccfc7603d6a0c28615ad9189ac6d0b594a7dece8c8290050722022-01-25 12:35:373 days 22 hrs ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c433.000004925254874945 FTM
0x638bd6748c53d58c07c8e8f926928ca33da7b30200c84f761fc8eaab3f3ca856289321442022-01-24 18:04:144 days 17 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router96.559351628364993158 FTM
0x638bd6748c53d58c07c8e8f926928ca33da7b30200c84f761fc8eaab3f3ca856289321442022-01-24 18:04:144 days 17 hrs ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c4396.559351628364993158 FTM
0x3b6037ea8207b5b2076c15d0af5c3636cbb50583a5d4f03149241c5788852e35289047742022-01-24 10:56:455 days 28 mins ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router2.590170000338720256 FTM
0x3b6037ea8207b5b2076c15d0af5c3636cbb50583a5d4f03149241c5788852e35289047742022-01-24 10:56:455 days 28 mins ago 0x10bd459b45fe083cb0bbe673066467bf7a760c430xa39ab56babaab264fec46614f745235678999f087.40984843872796869 FTM
0x3b6037ea8207b5b2076c15d0af5c3636cbb50583a5d4f03149241c5788852e35289047742022-01-24 10:56:455 days 28 mins ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c4310.000018439066688946 FTM
0x40231bb62465259955c1b7a7c007bb063157625479162b85874f89a8c6963652285925102022-01-21 0:19:208 days 11 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router37.044011691843643648 FTM
0x40231bb62465259955c1b7a7c007bb063157625479162b85874f89a8c6963652285925102022-01-21 0:19:208 days 11 hrs ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c4337.044011691843643648 FTM
0x9e0437465f5e775a025325a16625c8fd3541d80fb4b84fe6b47f8734243cc496285577232022-01-20 16:00:518 days 19 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router3.384320540074265645 FTM
0x9e0437465f5e775a025325a16625c8fd3541d80fb4b84fe6b47f8734243cc496285577232022-01-20 16:00:518 days 19 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c430xf0e69ceb3eee1081d6d91ee567462209afffce97108.619513800139924025 FTM
0x9e0437465f5e775a025325a16625c8fd3541d80fb4b84fe6b47f8734243cc496285577232022-01-20 16:00:518 days 19 hrs ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c43112.00383434021418967 FTM
0xd09e668d3463b4d683bc6c4f91d371cfb145cb1dc362669f755d4df85d88f5e5285402952022-01-20 11:52:058 days 23 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router10.630051765911560547 FTM
0xd09e668d3463b4d683bc6c4f91d371cfb145cb1dc362669f755d4df85d88f5e5285402952022-01-20 11:52:058 days 23 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c430x2d96e1fe38ff45cc8910c617b3c5e0b6298a81f341.004258828915732658 FTM
0xd09e668d3463b4d683bc6c4f91d371cfb145cb1dc362669f755d4df85d88f5e5285402952022-01-20 11:52:058 days 23 hrs ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c4351.634310594827293205 FTM
0xf731b9adb7750bc149b228e6f292ef16c0e8df73b91ec69233b06019ab504e40285374572022-01-20 11:09:159 days 15 mins ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router106.176198756770777467 FTM
0xf731b9adb7750bc149b228e6f292ef16c0e8df73b91ec69233b06019ab504e40285374572022-01-20 11:09:159 days 15 mins ago 0x10bd459b45fe083cb0bbe673066467bf7a760c430xba95c82ded96ed57cedfb6bfc8363b9fc23db0ce394.592177956055895747 FTM
0xf731b9adb7750bc149b228e6f292ef16c0e8df73b91ec69233b06019ab504e40285374572022-01-20 11:09:159 days 15 mins ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c43500.768376712826673214 FTM
0x81cbb5d7eecbbd0eaa0327b4c662d3ad097133cbbc23431c45835abdbc7f8705284538112022-01-19 15:22:089 days 20 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router3,143.38392032220985226 FTM
0x81cbb5d7eecbbd0eaa0327b4c662d3ad097133cbbc23431c45835abdbc7f8705284538112022-01-19 15:22:089 days 20 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c430x5e26f32454ef6219b48ae556ecc58279b033e5064,929.55032799544606616 FTM
0x81cbb5d7eecbbd0eaa0327b4c662d3ad097133cbbc23431c45835abdbc7f8705284538112022-01-19 15:22:089 days 20 hrs ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c438,072.93424831765591842 FTM
0x60dc29b08d6eaebeb2c4c8e1c051f73b928718968ca239e3f71d62b5daa4057e283156012022-01-18 6:07:2111 days 5 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c43 SpookySwap: Router163.982281060460144802 FTM
0x60dc29b08d6eaebeb2c4c8e1c051f73b928718968ca239e3f71d62b5daa4057e283156012022-01-18 6:07:2111 days 5 hrs ago 0x10bd459b45fe083cb0bbe673066467bf7a760c430xa9eb6d1aec46951a159d5420fad32711751464d4549.316090546938046804 FTM
0x60dc29b08d6eaebeb2c4c8e1c051f73b928718968ca239e3f71d62b5daa4057e283156012022-01-18 6:07:2111 days 5 hrs ago 0x8513c2db99df213887f63300b23c6dd31f1d14b0 0x10bd459b45fe083cb0bbe673066467bf7a760c43713.298371607398191606 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FliquidatorFTM

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 21 : FliquidatorFTM.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "../abstracts/claimable/Claimable.sol";
import "../interfaces/IVault.sol";
import "../interfaces/IVaultControl.sol";
import "../interfaces/IFujiAdmin.sol";
import "../interfaces/IFujiOracle.sol";
import "../interfaces/IFujiERC1155.sol";
import "../interfaces/IERC20Extended.sol";
import "../interfaces/IFlasher.sol";
import "./libraries/LibUniversalERC20FTM.sol";
import "../libraries/FlashLoans.sol";
import "../libraries/Errors.sol";

contract FliquidatorFTM is Claimable, ReentrancyGuard {
  using SafeERC20 for IERC20;
  using LibUniversalERC20FTM for IERC20;

  address public constant FTM = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;

  // slippage limit to 2%
  uint256 public constant SLIPPAGE_LIMIT_NUMERATOR = 2;
  uint256 public constant SLIPPAGE_LIMIT_DENOMINATOR = 100;

  struct Factor {
    uint64 a;
    uint64 b;
  }

  // Flash Close Fee Factor
  Factor public flashCloseF;

  IFujiAdmin private _fujiAdmin;
  IFujiOracle private _oracle;
  IUniswapV2Router02 public swapper;

  // Log Liquidation
  event Liquidate(
    address indexed userAddr,
    address indexed vault,
    uint256 amount,
    address liquidator
  );
  // Log FlashClose
  event FlashClose(address indexed userAddr, address indexed vault, uint256 amount);

  modifier isAuthorized() {
    require(msg.sender == owner(), Errors.VL_NOT_AUTHORIZED);
    _;
  }

  modifier onlyFlash() {
    require(msg.sender == _fujiAdmin.getFlasher(), Errors.VL_NOT_AUTHORIZED);
    _;
  }

  modifier isValidVault(address _vaultAddr) {
    require(_fujiAdmin.validVault(_vaultAddr), "Invalid vault!");
    _;
  }

  constructor() {
    // 0.01
    flashCloseF.a = 1;
    flashCloseF.b = 100;
  }

  receive() external payable {}

  // FLiquidator Core Functions

  /**
   * @dev Liquidate an undercollaterized debt and get bonus (bonusL in Vault)
   * @param _addrs: Address array of users whose position is liquidatable
   * @param _vault: Address of the vault in where liquidation will occur
   * Emits a {Liquidate} event.
   */
  function batchLiquidate(address[] calldata _addrs, address _vault)
    external
    payable
    nonReentrant
    isValidVault(_vault)
  {
    IVaultControl.VaultAssets memory vAssets = IVaultControl(_vault).vAssets();
    address f1155 = IVault(_vault).fujiERC1155();

    IVault(_vault).updateF1155Balances();

    (address[] memory addrs, uint256[] memory borrowBals, uint256 debtTotal) = _constructParams(
      _addrs,
      vAssets,
      _vault,
      f1155
    );

    // Check there is at least one user liquidatable
    require(debtTotal > 0, Errors.VL_USER_NOT_LIQUIDATABLE);

    if (vAssets.borrowAsset == FTM) {
      require(msg.value >= debtTotal, Errors.VL_AMOUNT_ERROR);
    } else {
      // Check Liquidator Allowance
      require(
        IERC20(vAssets.borrowAsset).allowance(msg.sender, address(this)) >= debtTotal,
        Errors.VL_MISSING_ERC20_ALLOWANCE
      );

      // Transfer borrowAsset funds from the Liquidator to Vault
      IERC20(vAssets.borrowAsset).safeTransferFrom(msg.sender, _vault, debtTotal);
    }

    // Repay BaseProtocol debt
    uint256 _value = vAssets.borrowAsset == FTM ? debtTotal : 0;
    IVault(_vault).paybackLiq{ value: _value }(addrs, debtTotal);

    // Compute liquidator's bonus: bonusL
    uint256 bonus = IVault(_vault).getLiquidationBonusFor(debtTotal);
    // Compute how much collateral needs to be swapt
    uint256 collateralInPlay = _getCollateralInPlay(
      vAssets.collateralAsset,
      vAssets.borrowAsset,
      debtTotal + bonus
    );

    // Burn f1155
    _burnMulti(addrs, borrowBals, vAssets, _vault, f1155);

    // Withdraw collateral
    IVault(_vault).withdrawLiq(int256(collateralInPlay));

    // Swap Collateral
    _swap(vAssets.collateralAsset, vAssets.borrowAsset, debtTotal + bonus, collateralInPlay, true);

    // Transfer to Liquidator the debtBalance + bonus
    IERC20(vAssets.borrowAsset).univTransfer(payable(msg.sender), debtTotal + bonus);

    // Emit liquidation event for each liquidated user
    for (uint256 i = 0; i < addrs.length; i += 1) {
      if (addrs[i] != address(0)) {
        emit Liquidate(addrs[i], _vault, borrowBals[i], msg.sender);
      }
    }
  }

  /**
   * @dev Initiates a flashloan to liquidate array of undercollaterized debt positions,
   * gets bonus (bonusFlashL in Vault)
   * @param _addrs: Array of Address whose position is liquidatable
   * @param _vault: The vault address where the debt position exist.
   * @param _flashnum: integer identifier of flashloan provider
   * Emits a {Liquidate} event.
   */
  function flashBatchLiquidate(
    address[] calldata _addrs,
    address _vault,
    uint8 _flashnum
  ) external isValidVault(_vault) nonReentrant {
    IVaultControl.VaultAssets memory vAssets = IVaultControl(_vault).vAssets();
    address f1155 = IVault(_vault).fujiERC1155();

    IVault(_vault).updateF1155Balances();

    (address[] memory addrs, uint256[] memory borrowBals, uint256 debtTotal) = _constructParams(
      _addrs,
      vAssets,
      _vault,
      f1155
    );

    // Check there is at least one user liquidatable
    require(debtTotal > 0, Errors.VL_USER_NOT_LIQUIDATABLE);

    FlashLoan.Info memory info = FlashLoan.Info({
      callType: FlashLoan.CallType.BatchLiquidate,
      asset: vAssets.borrowAsset,
      amount: debtTotal,
      vault: _vault,
      newProvider: address(0),
      userAddrs: addrs,
      userBalances: borrowBals,
      userliquidator: msg.sender,
      fliquidator: address(this)
    });

    IFlasher(payable(_fujiAdmin.getFlasher())).initiateFlashloan(info, _flashnum);
  }

  /**
   * @dev Liquidate a debt position by using a flashloan
   * @param _addrs: array **See addrs construction in 'function flashBatchLiquidate'
   * @param _borrowBals: array **See construction in 'function flashBatchLiquidate'
   * @param _liquidator: liquidator address
   * @param _vault: Vault address
   * @param _amount: amount of debt to be repaid
   * @param _flashloanFee: amount extra charged by flashloan provider
   * Emits a {Liquidate} event.
   */
  function executeFlashBatchLiquidation(
    address[] calldata _addrs,
    uint256[] calldata _borrowBals,
    address _liquidator,
    address _vault,
    uint256 _amount,
    uint256 _flashloanFee
  ) external payable onlyFlash {
    address f1155 = IVault(_vault).fujiERC1155();
    IVaultControl.VaultAssets memory vAssets = IVaultControl(_vault).vAssets();

    // Repay BaseProtocol debt to release collateral
    uint256 _value = vAssets.borrowAsset == FTM ? _amount : 0;
    IVault(_vault).paybackLiq{ value: _value }(_addrs, _amount);

    // Compute liquidator's bonus
    uint256 bonus = IVault(_vault).getLiquidationBonusFor(_amount);

    // Compute how much collateral needs to be swapt for all liquidated users
    uint256 collateralInPlay = _getCollateralInPlay(
      vAssets.collateralAsset,
      vAssets.borrowAsset,
      _amount + _flashloanFee + bonus
    );

    // Burn f1155
    _burnMulti(_addrs, _borrowBals, vAssets, _vault, f1155);

    // Withdraw collateral
    IVault(_vault).withdrawLiq(int256(collateralInPlay));

    _swap(
      vAssets.collateralAsset,
      vAssets.borrowAsset,
      _amount + _flashloanFee + bonus,
      collateralInPlay,
      true
    );

    // Send flasher the underlying to repay Flashloan
    IERC20(vAssets.borrowAsset).univTransfer(
      payable(_fujiAdmin.getFlasher()),
      _amount + _flashloanFee
    );

    // Liquidator's bonus gets reduced by 20% as a protocol fee
    uint256 fujiFee = bonus / 5;

    // Transfer liquidator's bonus, minus fujiFee
    IERC20(vAssets.borrowAsset).univTransfer(payable(_liquidator), bonus - fujiFee);

    // Transfer fee to Fuji Treasury
    IERC20(vAssets.borrowAsset).univTransfer(_fujiAdmin.getTreasury(), fujiFee);

    // Emit liquidation event for each liquidated user
    for (uint256 i = 0; i < _addrs.length; i += 1) {
      if (_addrs[i] != address(0)) {
        emit Liquidate(_addrs[i], _vault, _borrowBals[i], _liquidator);
      }
    }
  }

  /**
   * @dev Initiates a flashloan used to repay partially or fully the debt position of msg.sender
   * @param _amount: Pass -1 to fully close debt position, otherwise Amount to be repaid with a flashloan
   * @param _vault: The vault address where the debt position exist.
   * @param _flashnum: integer identifier of flashloan provider
   */
  function flashClose(
    int256 _amount,
    address _vault,
    uint8 _flashnum
  ) external nonReentrant isValidVault(_vault) {
    // Update Balances at FujiERC1155
    IVault(_vault).updateF1155Balances();

    // Create Instance of FujiERC1155
    IFujiERC1155 f1155 = IFujiERC1155(IVault(_vault).fujiERC1155());

    // Struct Instance to get Vault Asset IDs in f1155
    IVaultControl.VaultAssets memory vAssets = IVaultControl(_vault).vAssets();

    // Get user  Balances
    uint256 userCollateral = f1155.balanceOf(msg.sender, vAssets.collateralID);
    uint256 debtTotal = IVault(_vault).userDebtBalance(msg.sender);

    require(debtTotal > 0, Errors.VL_NO_DEBT_TO_PAYBACK);

    uint256 amount = _amount < 0 ? debtTotal : uint256(_amount);

    uint256 neededCollateral = IVault(_vault).getNeededCollateralFor(amount, false);
    require(userCollateral >= neededCollateral, Errors.VL_UNDERCOLLATERIZED_ERROR);

    address[] memory userAddressArray = new address[](1);
    userAddressArray[0] = msg.sender;

    FlashLoan.Info memory info = FlashLoan.Info({
      callType: FlashLoan.CallType.Close,
      asset: vAssets.borrowAsset,
      amount: amount,
      vault: _vault,
      newProvider: address(0),
      userAddrs: userAddressArray,
      userBalances: new uint256[](0),
      userliquidator: address(0),
      fliquidator: address(this)
    });

    IFlasher(payable(_fujiAdmin.getFlasher())).initiateFlashloan(info, _flashnum);
  }

  /**
   * @dev Close user's debt position by using a flashloan
   * @param _userAddr: user addr to be liquidated
   * @param _vault: Vault address
   * @param _amount: amount received by Flashloan
   * @param _flashloanFee: amount extra charged by flashloan provider
   * Emits a {FlashClose} event.
   */
  function executeFlashClose(
    address payable _userAddr,
    address _vault,
    uint256 _amount,
    uint256 _flashloanFee
  ) external payable onlyFlash {
    // Create Instance of FujiERC1155
    IFujiERC1155 f1155 = IFujiERC1155(IVault(_vault).fujiERC1155());

    // Struct Instance to get Vault Asset IDs in f1155
    IVaultControl.VaultAssets memory vAssets = IVaultControl(_vault).vAssets();
    uint256 flashCloseFee = (_amount * flashCloseF.a) / flashCloseF.b;

    uint256 protocolFee = IVault(_vault).userProtocolFee(_userAddr);
    uint256 totalDebt = f1155.balanceOf(_userAddr, vAssets.borrowID) + protocolFee;

    uint256 collateralInPlay = _getCollateralInPlay(
      vAssets.collateralAsset,
      vAssets.borrowAsset,
      _amount + _flashloanFee + flashCloseFee
    );

    // Repay BaseProtocol debt
    uint256 _value = vAssets.borrowAsset == FTM ? _amount : 0;
    address[] memory _addrs = new address[](1);
    _addrs[0] = _userAddr;
    IVault(_vault).paybackLiq{ value: _value }(_addrs, _amount);

    // Full close
    if (_amount == totalDebt) {
      uint256 userCollateral = f1155.balanceOf(_userAddr, vAssets.collateralID);

      f1155.burn(_userAddr, vAssets.collateralID, userCollateral);

      // Withdraw full collateral
      IVault(_vault).withdrawLiq(int256(userCollateral));

      // Send remaining collateral to user
      IERC20(vAssets.collateralAsset).univTransfer(_userAddr, userCollateral - collateralInPlay);
    } else {
      f1155.burn(_userAddr, vAssets.collateralID, collateralInPlay);

      // Withdraw collateral in play only
      IVault(_vault).withdrawLiq(int256(collateralInPlay));
    }

    // Swap collateral for underlying to repay flashloan
    _swap(
      vAssets.collateralAsset,
      vAssets.borrowAsset,
      _amount + _flashloanFee + flashCloseFee,
      collateralInPlay,
      false
    );

    // Send flashClose fee to Fuji Treasury
    IERC20(vAssets.borrowAsset).univTransfer(_fujiAdmin.getTreasury(), flashCloseFee);

    // Send flasher the underlying to repay flashloan
    IERC20(vAssets.borrowAsset).univTransfer(
      payable(_fujiAdmin.getFlasher()),
      _amount + _flashloanFee
    );

    // Burn Debt f1155 tokens
    f1155.burn(_userAddr, vAssets.borrowID, _amount - protocolFee);

    emit FlashClose(_userAddr, _vault, _amount);
  }

  /**
   * @dev Swap an amount of underlying
   * @param _collateralAsset: Address of vault collateralAsset
   * @param _borrowAsset: Address of vault borrowAsset
   * @param _amountToReceive: amount of underlying to receive
   * @param _collateralAmount: collateral Amount sent for swap
   */
  function _swap(
    address _collateralAsset,
    address _borrowAsset,
    uint256 _amountToReceive,
    uint256 _collateralAmount,
    bool _checkSlippage
  ) internal returns (uint256) {
    if (_checkSlippage) {
      uint8 _collateralAssetDecimals;
      uint8 _borrowAssetDecimals;
      if (_collateralAsset == FTM) {
        _collateralAssetDecimals = 18;
      } else {
        _collateralAssetDecimals = IERC20Extended(_collateralAsset).decimals();
      }
      if (_borrowAsset == FTM) {
        _borrowAssetDecimals = 18;
      } else {
        _borrowAssetDecimals = IERC20Extended(_borrowAsset).decimals();
      }

      uint256 priceFromSwapper = (_collateralAmount * (10**uint256(_borrowAssetDecimals))) /
        _amountToReceive;
      uint256 priceFromOracle = _oracle.getPriceOf(
        _collateralAsset,
        _borrowAsset,
        _collateralAssetDecimals
      );
      uint256 priceDelta = priceFromSwapper > priceFromOracle
        ? priceFromSwapper - priceFromOracle
        : priceFromOracle - priceFromSwapper;

      require(
        (priceDelta * SLIPPAGE_LIMIT_DENOMINATOR) / priceFromOracle < SLIPPAGE_LIMIT_NUMERATOR,
        Errors.VL_SWAP_SLIPPAGE_LIMIT_EXCEED
      );
    }

    // Swap Collateral Asset to Borrow Asset
    address weth = swapper.WETH();
    address[] memory path;
    uint256[] memory swapperAmounts;

    if (_collateralAsset == FTM) {
      path = new address[](2);
      path[0] = weth;
      path[1] = _borrowAsset;

      swapperAmounts = swapper.swapETHForExactTokens{ value: _collateralAmount }(
        _amountToReceive,
        path,
        address(this),
        // solhint-disable-next-line
        block.timestamp
      );
    } else if (_borrowAsset == FTM) {
      path = new address[](2);
      path[0] = _collateralAsset;
      path[1] = weth;

      IERC20(_collateralAsset).univApprove(address(swapper), _collateralAmount);
      swapperAmounts = swapper.swapTokensForExactETH(
        _amountToReceive,
        _collateralAmount,
        path,
        address(this),
        // solhint-disable-next-line
        block.timestamp
      );
    } else {
      if (_collateralAsset == weth || _borrowAsset == weth) {
        path = new address[](2);
        path[0] = _collateralAsset;
        path[1] = _borrowAsset;
      } else {
        path = new address[](3);
        path[0] = _collateralAsset;
        path[1] = weth;
        path[2] = _borrowAsset;
      }

      IERC20(_collateralAsset).univApprove(address(swapper), _collateralAmount);
      swapperAmounts = swapper.swapTokensForExactTokens(
        _amountToReceive,
        _collateralAmount,
        path,
        address(this),
        // solhint-disable-next-line
        block.timestamp
      );
    }

    return _collateralAmount - swapperAmounts[0];
  }

  /**
   * @dev Get exact amount of collateral to be swapt
   * @param _collateralAsset: Address of vault collateralAsset
   * @param _borrowAsset: Address of vault borrowAsset
   * @param _amountToReceive: amount of underlying to receive
   */
  function _getCollateralInPlay(
    address _collateralAsset,
    address _borrowAsset,
    uint256 _amountToReceive
  ) internal view returns (uint256) {
    address weth = swapper.WETH();
    address[] memory path;
    if (_collateralAsset == FTM || _collateralAsset == weth) {
      path = new address[](2);
      path[0] = weth;
      path[1] = _borrowAsset;
    } else if (_borrowAsset == FTM || _borrowAsset == weth) {
      path = new address[](2);
      path[0] = _collateralAsset;
      path[1] = weth;
    } else {
      path = new address[](3);
      path[0] = _collateralAsset;
      path[1] = weth;
      path[2] = _borrowAsset;
    }

    uint256[] memory amounts = swapper.getAmountsIn(_amountToReceive, path);

    return amounts[0];
  }

  function _constructParams(
    address[] memory _userAddrs,
    IVaultControl.VaultAssets memory _vAssets,
    address _vault,
    address _f1155
  )
    internal
    view
    returns (
      address[] memory addrs,
      uint256[] memory borrowBals,
      uint256 debtTotal
    )
  {
    addrs = new address[](_userAddrs.length);

    uint256[] memory borrowIds = new uint256[](_userAddrs.length);
    uint256[] memory collateralIds = new uint256[](_userAddrs.length);

    // Build the required Arrays to query balanceOfBatch from f1155
    for (uint256 i = 0; i < _userAddrs.length; i += 1) {
      collateralIds[i] = _vAssets.collateralID;
      borrowIds[i] = _vAssets.borrowID;
    }

    // Get user collateral and debt balances
    borrowBals = IERC1155(_f1155).balanceOfBatch(_userAddrs, borrowIds);
    uint256[] memory collateralBals = IERC1155(_f1155).balanceOfBatch(_userAddrs, collateralIds);

    uint256 neededCollateral;

    for (uint256 i = 0; i < _userAddrs.length; i += 1) {
      // Compute amount of min collateral required including factors
      neededCollateral = IVault(_vault).getNeededCollateralFor(borrowBals[i], true);

      // Check if User is liquidatable
      if (collateralBals[i] < neededCollateral) {
        // If true, add User debt balance to the total balance to be liquidated
        addrs[i] = _userAddrs[i];
        debtTotal += borrowBals[i] + IVault(_vault).userProtocolFee(addrs[i]);
      } else {
        // set user that is not liquidatable to Zero Address
        addrs[i] = address(0);
      }
    }
  }

  /**
   * @dev Perform multi-batch burn of collateral
   * checking bonus paid to liquidator by each
   */
  function _burnMulti(
    address[] memory _addrs,
    uint256[] memory _borrowBals,
    IVaultControl.VaultAssets memory _vAssets,
    address _vault,
    address _f1155
  ) internal {
    uint256 bonusPerUser;
    uint256 collateralInPlayPerUser;

    for (uint256 i = 0; i < _addrs.length; i += 1) {
      if (_addrs[i] != address(0)) {
        bonusPerUser = IVault(_vault).getLiquidationBonusFor(_borrowBals[i]);

        collateralInPlayPerUser = _getCollateralInPlay(
          _vAssets.collateralAsset,
          _vAssets.borrowAsset,
          _borrowBals[i] + bonusPerUser
        );

        IFujiERC1155(_f1155).burn(_addrs[i], _vAssets.borrowID, _borrowBals[i]);
        IFujiERC1155(_f1155).burn(_addrs[i], _vAssets.collateralID, collateralInPlayPerUser);
      }
    }
  }

  // Administrative functions

  /**
   * @dev Set Factors "a" and "b" for a Struct Factor flashcloseF
   * @param _newFactorA: Nominator
   * @param _newFactorB: Denominator
   */
  function setFlashCloseFee(uint64 _newFactorA, uint64 _newFactorB) external isAuthorized {
    flashCloseF.a = _newFactorA;
    flashCloseF.b = _newFactorB;
  }

  /**
   * @dev Sets the fujiAdmin Address
   * @param _newFujiAdmin: FujiAdmin Contract Address
   */
  function setFujiAdmin(address _newFujiAdmin) external isAuthorized {
    require(_newFujiAdmin != address(0), Errors.VL_ZERO_ADDR);
    _fujiAdmin = IFujiAdmin(_newFujiAdmin);
  }

  /**
   * @dev Changes the Swapper contract address
   * @param _newSwapper: address of new swapper contract
   */
  function setSwapper(address _newSwapper) external isAuthorized {
    require(_newSwapper != address(0), Errors.VL_ZERO_ADDR);
    swapper = IUniswapV2Router02(_newSwapper);
  }

  /**
   * @dev Changes the Oracle contract address
   * @param _newFujiOracle: address of new oracle contract
   */
  function setFujiOracle(address _newFujiOracle) external isAuthorized {
    require(_newFujiOracle != address(0), Errors.VL_ZERO_ADDR);
    _oracle = IFujiOracle(_newFujiOracle);
  }
}

File 2 of 21 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 3 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using 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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 5 of 21 : IERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 6 of 21 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 7 of 21 : Claimable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/Context.sol";

abstract contract Claimable is Context {
  address private _owner;
  address public pendingOwner;

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

  constructor() {
    address msgSender = _msgSender();
    _owner = msgSender;
    emit OwnershipTransferred(address(0), msgSender);
  }

  function owner() public view virtual returns (address) {
    return _owner;
  }

  modifier onlyOwner() {
    require(_msgSender() == owner(), "Ownable: caller is not the owner");
    _;
  }

  modifier onlyPendingOwner() {
    require(_msgSender() == pendingOwner);
    _;
  }

  function renounceOwnership() public virtual onlyOwner {
    emit OwnershipTransferred(owner(), address(0));
    _owner = address(0);
  }

  function transferOwnership(address newOwner) public virtual onlyOwner {
    require(pendingOwner == address(0));
    pendingOwner = newOwner;
    emit NewPendingOwner(newOwner);
  }

  function cancelTransferOwnership() public onlyOwner {
    require(pendingOwner != address(0));
    delete pendingOwner;
    emit NewPendingOwner(address(0));
  }

  function claimOwnership() public onlyPendingOwner {
    emit OwnershipTransferred(owner(), pendingOwner);
    _owner = pendingOwner;
    delete pendingOwner;
  }
}

File 8 of 21 : IVault.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IVault {
  // Events

  // Log Users Deposit
  event Deposit(address indexed userAddrs, address indexed asset, uint256 amount);
  // Log Users withdraw
  event Withdraw(address indexed userAddrs, address indexed asset, uint256 amount);
  // Log Users borrow
  event Borrow(address indexed userAddrs, address indexed asset, uint256 amount);
  // Log Users debt repay
  event Payback(address indexed userAddrs, address indexed asset, uint256 amount);

  // Log New active provider
  event SetActiveProvider(address providerAddr);
  // Log Switch providers
  event Switch(
    address fromProviderAddrs,
    address toProviderAddr,
    uint256 debtamount,
    uint256 collattamount
  );

  // Core Vault Functions

  function deposit(uint256 _collateralAmount) external payable;

  function withdraw(int256 _withdrawAmount) external;

  function withdrawLiq(int256 _withdrawAmount) external;

  function borrow(uint256 _borrowAmount) external;

  function payback(int256 _repayAmount) external payable;

  function paybackLiq(address[] memory _users, uint256 _repayAmount) external payable;

  function executeSwitch(
    address _newProvider,
    uint256 _flashLoanDebt,
    uint256 _fee
  ) external payable;

  //Getter Functions

  function activeProvider() external view returns (address);

  function borrowBalance(address _provider) external view returns (uint256);

  function depositBalance(address _provider) external view returns (uint256);

  function userDebtBalance(address _user) external view returns (uint256);

  function userProtocolFee(address _user) external view returns (uint256);

  function userDepositBalance(address _user) external view returns (uint256);

  function getNeededCollateralFor(uint256 _amount, bool _withFactors)
    external
    view
    returns (uint256);

  function getLiquidationBonusFor(uint256 _amount) external view returns (uint256);

  function getProviders() external view returns (address[] memory);

  function fujiERC1155() external view returns (address);

  //Setter Functions

  function setActiveProvider(address _provider) external;

  function updateF1155Balances() external;

  function protocolFee() external view returns (uint64, uint64);
}

File 9 of 21 : IVaultControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IVaultControl {
  struct VaultAssets {
    address collateralAsset;
    address borrowAsset;
    uint64 collateralID;
    uint64 borrowID;
  }

  function vAssets() external view returns (VaultAssets memory);
}

File 10 of 21 : IFujiAdmin.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IFujiAdmin {
  function validVault(address _vaultAddr) external view returns (bool);

  function getFlasher() external view returns (address);

  function getFliquidator() external view returns (address);

  function getController() external view returns (address);

  function getTreasury() external view returns (address payable);

  function getVaultHarvester() external view returns (address);

  function getSwapper() external view returns (address);
}

File 11 of 21 : IFujiOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IFujiOracle {
  function getPriceOf(
    address _collateralAsset,
    address _borrowAsset,
    uint8 _decimals
  ) external view returns (uint256);
}

File 12 of 21 : IFujiERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IFujiERC1155 {
  //Asset Types
  enum AssetType {
    //uint8 = 0
    collateralToken,
    //uint8 = 1
    debtToken
  }

  //General Getter Functions

  function getAssetID(AssetType _type, address _assetAddr) external view returns (uint256);

  function qtyOfManagedAssets() external view returns (uint64);

  function balanceOf(address _account, uint256 _id) external view returns (uint256);

  // function splitBalanceOf(address account,uint256 _AssetID) external view  returns (uint256,uint256);

  // function balanceOfBatchType(address account, AssetType _Type) external view returns (uint256);

  //Permit Controlled  Functions
  function mint(
    address _account,
    uint256 _id,
    uint256 _amount,
    bytes memory _data
  ) external;

  function burn(
    address _account,
    uint256 _id,
    uint256 _amount
  ) external;

  function updateState(uint256 _assetID, uint256 _newBalance) external;

  function addInitializeAsset(AssetType _type, address _addr) external returns (uint64);
}

File 13 of 21 : IERC20Extended.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC20Extended {
  function symbol() external view returns (string memory);

  function decimals() external view returns (uint8);
}

File 14 of 21 : IFlasher.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../libraries/FlashLoans.sol";

interface IFlasher {
  function initiateFlashloan(FlashLoan.Info calldata info, uint8 amount) external;
}

File 15 of 21 : LibUniversalERC20FTM.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

library LibUniversalERC20FTM {
  using SafeERC20 for IERC20;

  IERC20 private constant _FTM_ADDRESS = IERC20(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF);
  IERC20 private constant _ZERO_ADDRESS = IERC20(0x0000000000000000000000000000000000000000);

  function isFTM(IERC20 token) internal pure returns (bool) {
    return (token == _ZERO_ADDRESS || token == _FTM_ADDRESS);
  }

  function univBalanceOf(IERC20 token, address account) internal view returns (uint256) {
    if (isFTM(token)) {
      return account.balance;
    } else {
      return token.balanceOf(account);
    }
  }

  function univTransfer(
    IERC20 token,
    address payable to,
    uint256 amount
  ) internal {
    if (amount > 0) {
      if (isFTM(token)) {
        (bool sent, ) = to.call{ value: amount }("");
        require(sent, "Failed to send Ether");
      } else {
        token.safeTransfer(to, amount);
      }
    }
  }

  function univApprove(
    IERC20 token,
    address to,
    uint256 amount
  ) internal {
    require(!isFTM(token), "Approve called on ETH");

    if (amount == 0) {
      token.safeApprove(to, 0);
    } else {
      uint256 allowance = token.allowance(address(this), to);
      if (allowance < amount) {
        if (allowance > 0) {
          token.safeApprove(to, 0);
        }
        token.safeApprove(to, amount);
      }
    }
  }
}

File 16 of 21 : FlashLoans.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library Account {
  enum Status {
    Normal,
    Liquid,
    Vapor
  }
  struct Info {
    address owner; // The address that owns the account
    uint256 number; // A nonce that allows a single address to control many accounts
  }
}

library Actions {
  enum ActionType {
    Deposit, // supply tokens
    Withdraw, // borrow tokens
    Transfer, // transfer balance between accounts
    Buy, // buy an amount of some token (publicly)
    Sell, // sell an amount of some token (publicly)
    Trade, // trade tokens against another account
    Liquidate, // liquidate an undercollateralized or expiring account
    Vaporize, // use excess tokens to zero-out a completely negative account
    Call // send arbitrary data to an address
  }

  struct ActionArgs {
    ActionType actionType;
    uint256 accountId;
    Types.AssetAmount amount;
    uint256 primaryMarketId;
    uint256 secondaryMarketId;
    address otherAddress;
    uint256 otherAccountId;
    bytes data;
  }
}

library Types {
  enum AssetDenomination {
    Wei, // the amount is denominated in wei
    Par // the amount is denominated in par
  }

  enum AssetReference {
    Delta, // the amount is given as a delta from the current value
    Target // the amount is given as an exact number to end up at
  }

  struct AssetAmount {
    bool sign; // true if positive
    AssetDenomination denomination;
    AssetReference ref;
    uint256 value;
  }
}

library FlashLoan {
  /**
   * @dev Used to determine which vault's function to call post-flashloan:
   * - Switch for executeSwitch(...)
   * - Close for executeFlashClose(...)
   * - Liquidate for executeFlashLiquidation(...)
   * - BatchLiquidate for executeFlashBatchLiquidation(...)
   */
  enum CallType {
    Switch,
    Close,
    BatchLiquidate
  }

  /**
   * @dev Struct of params to be passed between functions executing flashloan logic
   * @param asset: Address of asset to be borrowed with flashloan
   * @param amount: Amount of asset to be borrowed with flashloan
   * @param vault: Vault's address on which the flashloan logic to be executed
   * @param newProvider: New provider's address. Used when callType is Switch
   * @param userAddrs: User's address array Used when callType is BatchLiquidate
   * @param userBals:  Array of user's balances, Used when callType is BatchLiquidate
   * @param userliquidator: The user's address who is  performing liquidation. Used when callType is Liquidate
   * @param fliquidator: Fujis Liquidator's address.
   */
  struct Info {
    CallType callType;
    address asset;
    uint256 amount;
    address vault;
    address newProvider;
    address[] userAddrs;
    uint256[] userBalances;
    address userliquidator;
    address fliquidator;
  }
}

File 17 of 21 : Errors.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.0;

/**
 * @title Errors library
 * @author Fuji
 * @notice Defines the error messages emitted by the different contracts of the Aave protocol
 * @dev Error messages prefix glossary:
 *  - VL = Validation Logic 100 series
 *  - MATH = Math libraries 200 series
 *  - RF = Refinancing 300 series
 *  - VLT = vault 400 series
 *  - SP = Special 900 series
 */
library Errors {
  //Errors
  string public constant VL_INDEX_OVERFLOW = "100"; // index overflows uint128
  string public constant VL_INVALID_MINT_AMOUNT = "101"; //invalid amount to mint
  string public constant VL_INVALID_BURN_AMOUNT = "102"; //invalid amount to burn
  string public constant VL_AMOUNT_ERROR = "103"; //Input value >0, and for ETH msg.value and amount shall match
  string public constant VL_INVALID_WITHDRAW_AMOUNT = "104"; //Withdraw amount exceeds provided collateral, or falls undercollaterized
  string public constant VL_INVALID_BORROW_AMOUNT = "105"; //Borrow amount does not meet collaterization
  string public constant VL_NO_DEBT_TO_PAYBACK = "106"; //Msg sender has no debt amount to be payback
  string public constant VL_MISSING_ERC20_ALLOWANCE = "107"; //Msg sender has not approved ERC20 full amount to transfer
  string public constant VL_USER_NOT_LIQUIDATABLE = "108"; //User debt position is not liquidatable
  string public constant VL_DEBT_LESS_THAN_AMOUNT = "109"; //User debt is less than amount to partial close
  string public constant VL_PROVIDER_ALREADY_ADDED = "110"; // Provider is already added in Provider Array
  string public constant VL_NOT_AUTHORIZED = "111"; //Not authorized
  string public constant VL_INVALID_COLLATERAL = "112"; //There is no Collateral, or Collateral is not in active in vault
  string public constant VL_NO_ERC20_BALANCE = "113"; //User does not have ERC20 balance
  string public constant VL_INPUT_ERROR = "114"; //Check inputs. For ERC1155 batch functions, array sizes should match.
  string public constant VL_ASSET_EXISTS = "115"; //Asset intended to be added already exists in FujiERC1155
  string public constant VL_ZERO_ADDR_1155 = "116"; //ERC1155: balance/transfer for zero address
  string public constant VL_NOT_A_CONTRACT = "117"; //Address is not a contract.
  string public constant VL_INVALID_ASSETID_1155 = "118"; //ERC1155 Asset ID is invalid.
  string public constant VL_NO_ERC1155_BALANCE = "119"; //ERC1155: insufficient balance for transfer.
  string public constant VL_MISSING_ERC1155_APPROVAL = "120"; //ERC1155: transfer caller is not owner nor approved.
  string public constant VL_RECEIVER_REJECT_1155 = "121"; //ERC1155Receiver rejected tokens
  string public constant VL_RECEIVER_CONTRACT_NON_1155 = "122"; //ERC1155: transfer to non ERC1155Receiver implementer
  string public constant VL_OPTIMIZER_FEE_SMALL = "123"; //Fuji OptimizerFee has to be > 1 RAY (1e27)
  string public constant VL_UNDERCOLLATERIZED_ERROR = "124"; // Flashloan-Flashclose cannot be used when User's collateral is worth less than intended debt position to close.
  string public constant VL_MINIMUM_PAYBACK_ERROR = "125"; // Minimum Amount payback should be at least Fuji Optimizerfee accrued interest.
  string public constant VL_HARVESTING_FAILED = "126"; // Harvesting Function failed, check provided _farmProtocolNum or no claimable balance.
  string public constant VL_FLASHLOAN_FAILED = "127"; // Flashloan failed
  string public constant VL_ERC1155_NOT_TRANSFERABLE = "128"; // ERC1155: Not Transferable
  string public constant VL_SWAP_SLIPPAGE_LIMIT_EXCEED = "129"; // ERC1155: Not Transferable
  string public constant VL_ZERO_ADDR = "130"; // Zero Address

  string public constant MATH_DIVISION_BY_ZERO = "201";
  string public constant MATH_ADDITION_OVERFLOW = "202";
  string public constant MATH_MULTIPLICATION_OVERFLOW = "203";

  string public constant RF_INVALID_RATIO_VALUES = "301"; // Ratio Value provided is invalid, _ratioA/_ratioB <= 1, and > 0, or activeProvider borrowBalance = 0

  string public constant VLT_CALLER_MUST_BE_VAULT = "401"; // The caller of this function must be a vault

  string public constant ORACLE_INVALID_LENGTH = "501"; // The assets length and price feeds length doesn't match
  string public constant ORACLE_NONE_PRICE_FEED = "502"; // The price feed is not found
}

File 18 of 21 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

File 19 of 21 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
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) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 20 of 21 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 21 of 21 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddr","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FlashClose","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddr","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"liquidator","type":"address"}],"name":"Liquidate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"NewPendingOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"FTM","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLIPPAGE_LIMIT_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLIPPAGE_LIMIT_NUMERATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addrs","type":"address[]"},{"internalType":"address","name":"_vault","type":"address"}],"name":"batchLiquidate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"cancelTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addrs","type":"address[]"},{"internalType":"uint256[]","name":"_borrowBals","type":"uint256[]"},{"internalType":"address","name":"_liquidator","type":"address"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_flashloanFee","type":"uint256"}],"name":"executeFlashBatchLiquidation","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_userAddr","type":"address"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_flashloanFee","type":"uint256"}],"name":"executeFlashClose","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addrs","type":"address[]"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"uint8","name":"_flashnum","type":"uint8"}],"name":"flashBatchLiquidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"_amount","type":"int256"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"uint8","name":"_flashnum","type":"uint8"}],"name":"flashClose","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flashCloseF","outputs":[{"internalType":"uint64","name":"a","type":"uint64"},{"internalType":"uint64","name":"b","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_newFactorA","type":"uint64"},{"internalType":"uint64","name":"_newFactorB","type":"uint64"}],"name":"setFlashCloseFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFujiAdmin","type":"address"}],"name":"setFujiAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFujiOracle","type":"address"}],"name":"setFujiOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newSwapper","type":"address"}],"name":"setSwapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapper","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b5060006200001e620000a0565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060016002819055600380546001600160401b031916909117600160401b600160801b03191668640000000000000000179055620000a4565b3390565b614f6e80620000b46000396000f3fe6080604052600436106101635760003560e01c806391c15432116100c05780639df97b0411610074578063e30c397811610059578063e30c397814610345578063f2fde38b1461035a578063fae5a8f01461037a5761016a565b80639df97b041461031d578063a10364d7146103305761016a565b806398e1fdb5116100a557806398e1fdb5146102ca5780639c6ce5aa146102ea5780639c82f2a4146102fd5761016a565b806391c154321461029557806392fede00146102b55761016a565b80635003d4b411610117578063715018a6116100fc578063715018a61461025657806377a7e77d1461026b5780638da5cb5b146102805761016a565b80635003d4b41461021657806356bae453146102365761016a565b806339221f501161014857806339221f50146101bd57806346be3413146101df5780634e71e0c8146102015761016a565b80630fd9be711461016f5780632b3297f91461019b5761016a565b3661016a57005b600080fd5b34801561017b57600080fd5b5061018461038d565b604051610192929190614cdc565b60405180910390f35b3480156101a757600080fd5b506101b06103ad565b604051610192919061473f565b3480156101c957600080fd5b506101d26103bc565b60405161019291906148c4565b3480156101eb57600080fd5b506101ff6101fa3660046142af565b6103c1565b005b34801561020d57600080fd5b506101ff610485565b34801561022257600080fd5b506101ff610231366004614552565b61051c565b34801561024257600080fd5b506101ff610251366004614381565b610b69565b34801561026257600080fd5b506101ff610f2c565b34801561027757600080fd5b506101b0610fbc565b34801561028c57600080fd5b506101b0610fc7565b3480156102a157600080fd5b506101ff6102b03660046142af565b610fd6565b3480156102c157600080fd5b506101ff611091565b3480156102d657600080fd5b506101ff6102e5366004614624565b611122565b6101ff6102f83660046143e7565b6111d0565b34801561030957600080fd5b506101ff6103183660046142af565b61185b565b6101ff61032b3660046142e7565b611916565b34801561033c57600080fd5b506101d261219b565b34801561035157600080fd5b506101b06121a0565b34801561036657600080fd5b506101ff6103753660046142af565b6121af565b6101ff61038836600461432c565b61224e565b60035467ffffffffffffffff808216916801000000000000000090041682565b6006546001600160a01b031681565b600281565b6103c9610fc7565b6001600160a01b0316336001600160a01b0316146040518060400160405280600381526020016231313160e81b815250906104205760405162461bcd60e51b815260040161041791906148cd565b60405180910390fd5b5060408051808201909152600381526203133360ec1b60208201526001600160a01b0382166104625760405162461bcd60e51b815260040161041791906148cd565b50600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031661049961291e565b6001600160a01b0316146104ac57600080fd5b6001546001600160a01b03166104c0610fc7565b6001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60028054141561053e5760405162461bcd60e51b815260040161041790614acb565b6002805560048054604051630f6ec81f60e01b815284926001600160a01b0390921691630f6ec81f916105739185910161473f565b60206040518083038186803b15801561058b57600080fd5b505afa15801561059f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c39190614532565b6105df5760405162461bcd60e51b815260040161041790614a37565b826001600160a01b03166367ac280a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561061a57600080fd5b505af115801561062e573d6000803e3d6000fd5b505050506000836001600160a01b031663acb2d4106040518163ffffffff1660e01b815260040160206040518083038186803b15801561066d57600080fd5b505afa158015610681573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a591906142cb565b90506000846001600160a01b031663d8df4ce76040518163ffffffff1660e01b815260040160806040518083038186803b1580156106e257600080fd5b505afa1580156106f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071a9190614588565b90506000826001600160a01b031662fdd58e3384604001516040518363ffffffff1660e01b815260040161074f929190614753565b60206040518083038186803b15801561076757600080fd5b505afa15801561077b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079f919061460c565b90506000866001600160a01b0316631714decd336040518263ffffffff1660e01b81526004016107cf919061473f565b60206040518083038186803b1580156107e757600080fd5b505afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f919061460c565b9050600081116040518060400160405280600381526020017f3130360000000000000000000000000000000000000000000000000000000000815250906108795760405162461bcd60e51b815260040161041791906148cd565b506000808912610889578861088b565b815b90506000886001600160a01b03166390d7bfae8360006040518363ffffffff1660e01b81526004016108be929190614c90565b60206040518083038186803b1580156108d657600080fd5b505afa1580156108ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090e919061460c565b9050808410156040518060400160405280600381526020017f3132340000000000000000000000000000000000000000000000000000000000815250906109685760405162461bcd60e51b815260040161041791906148cd565b506040805160018082528183019092526000916020808301908036833701905050905033816000815181106109ad57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152604080516101208101909152600090806001815260200188602001516001600160a01b031681526020018581526020018c6001600160a01b0316815260200160006001600160a01b03168152602001838152602001600067ffffffffffffffff811115610a4257634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610a6b578160200160208202803683370190505b508152600060208083019190915230604092830152600480548351637fabc90b60e01b815293519495506001600160a01b031693637fabc90b93808301939290829003018186803b158015610abf57600080fd5b505afa158015610ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af791906142cb565b6001600160a01b0316635ccd808c828c6040518363ffffffff1660e01b8152600401610b24929190614b5f565b600060405180830381600087803b158015610b3e57600080fd5b505af1158015610b52573d6000803e3d6000fd5b505060016002555050505050505050505050505050565b60048054604051630f6ec81f60e01b815284926001600160a01b0390921691630f6ec81f91610b9a9185910161473f565b60206040518083038186803b158015610bb257600080fd5b505afa158015610bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bea9190614532565b610c065760405162461bcd60e51b815260040161041790614a37565b600280541415610c285760405162461bcd60e51b815260040161041790614acb565b600280819055506000836001600160a01b031663d8df4ce76040518163ffffffff1660e01b815260040160806040518083038186803b158015610c6a57600080fd5b505afa158015610c7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca29190614588565b90506000846001600160a01b031663acb2d4106040518163ffffffff1660e01b815260040160206040518083038186803b158015610cdf57600080fd5b505afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1791906142cb565b9050846001600160a01b03166367ac280a6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610d5457600080fd5b505af1158015610d68573d6000803e3d6000fd5b505050506000806000610db28a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508992508c9150889050612922565b925092509250600081116040518060400160405280600381526020016206260760eb1b81525090610df65760405162461bcd60e51b815260040161041791906148cd565b506040805161012081018252600281526020878101516001600160a01b03908116828401528284018590528b811660608401526000608084015260a0830187905260c083018690523360e084015230610100840152600480548551637fabc90b60e01b815295519495921693637fabc90b9383830193909290829003018186803b158015610e8357600080fd5b505afa158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebb91906142cb565b6001600160a01b0316635ccd808c828a6040518363ffffffff1660e01b8152600401610ee8929190614b5f565b600060405180830381600087803b158015610f0257600080fd5b505af1158015610f16573d6000803e3d6000fd5b5050600160025550505050505050505050505050565b610f34610fc7565b6001600160a01b0316610f4561291e565b6001600160a01b031614610f6b5760405162461bcd60e51b8152600401610417906149cb565b6000610f75610fc7565b6001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600080546001600160a01b0319169055565b6001600160a01b0381565b6000546001600160a01b031690565b610fde610fc7565b6001600160a01b0316336001600160a01b0316146040518060400160405280600381526020016231313160e81b8152509061102c5760405162461bcd60e51b815260040161041791906148cd565b5060408051808201909152600381526203133360ec1b60208201526001600160a01b03821661106e5760405162461bcd60e51b815260040161041791906148cd565b50600480546001600160a01b0319166001600160a01b0392909216919091179055565b611099610fc7565b6001600160a01b03166110aa61291e565b6001600160a01b0316146110d05760405162461bcd60e51b8152600401610417906149cb565b6001546001600160a01b03166110e557600080fd5b600180546001600160a01b03191690556040516000907f69737d41162474a7ca514809b07d7becaecf72eae8c23bceb071f0e09af93ffc908290a2565b61112a610fc7565b6001600160a01b0316336001600160a01b0316146040518060400160405280600381526020016231313160e81b815250906111785760405162461bcd60e51b815260040161041791906148cd565b506003805467ffffffffffffffff92831668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff9490931667ffffffffffffffff199091161792909216179055565b6004805460408051637fabc90b60e01b815290516001600160a01b0390921692637fabc90b928282019260209290829003018186803b15801561121257600080fd5b505afa158015611226573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124a91906142cb565b6001600160a01b0316336001600160a01b0316146040518060400160405280600381526020016231313160e81b815250906112985760405162461bcd60e51b815260040161041791906148cd565b506000836001600160a01b031663acb2d4106040518163ffffffff1660e01b815260040160206040518083038186803b1580156112d457600080fd5b505afa1580156112e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130c91906142cb565b90506000846001600160a01b031663d8df4ce76040518163ffffffff1660e01b815260040160806040518083038186803b15801561134957600080fd5b505afa15801561135d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113819190614588565b905060006001600160a01b03801682602001516001600160a01b0316146113a95760006113ab565b845b9050856001600160a01b031663e5aa6d05828d8d896040518563ffffffff1660e01b81526004016113de9392919061481e565b6000604051808303818588803b1580156113f757600080fd5b505af115801561140b573d6000803e3d6000fd5b505060405163e897effb60e01b8152600093506001600160a01b038a16925063e897effb915061143f9089906004016148c4565b60206040518083038186803b15801561145757600080fd5b505afa15801561146b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148f919061460c565b905060006114bc8460000151856020015184898b6114ad9190614d21565b6114b79190614d21565b612e74565b90506115418d8d80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508c8c808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508992508d91508a9050613248565b60405162197ac760e01b81526001600160a01b0389169062197ac79061156b9084906004016148c4565b600060405180830381600087803b15801561158557600080fd5b505af1158015611599573d6000803e3d6000fd5b5050855160208701516115c79350909150846115b58a8c614d21565b6115bf9190614d21565b8460016134dd565b50611670600460009054906101000a90046001600160a01b03166001600160a01b0316637fabc90b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561161957600080fd5b505afa15801561162d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165191906142cb565b61165b888a614d21565b60208701516001600160a01b03169190613d80565b600061167d600584614d39565b90506116a28a61168d8386614e8c565b60208801516001600160a01b03169190613d80565b611740600460009054906101000a90046001600160a01b03166001600160a01b0316633b19e84a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116f357600080fd5b505afa158015611707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172b91906142cb565b60208701516001600160a01b03169083613d80565b60005b8d81101561184a5760008f8f8381811061176d57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061178291906142af565b6001600160a01b03161461183857896001600160a01b03168f8f838181106117ba57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906117cf91906142af565b6001600160a01b03167f60b8242c7715592d395c118b86e1c56e483030f45fab92e8694eda9f1a837f5e8f8f8581811061181957634e487b7160e01b600052603260045260246000fd5b905060200201358e60405161182f929190614c2b565b60405180910390a35b611843600182614d21565b9050611743565b505050505050505050505050505050565b611863610fc7565b6001600160a01b0316336001600160a01b0316146040518060400160405280600381526020016231313160e81b815250906118b15760405162461bcd60e51b815260040161041791906148cd565b5060408051808201909152600381526203133360ec1b60208201526001600160a01b0382166118f35760405162461bcd60e51b815260040161041791906148cd565b50600680546001600160a01b0319166001600160a01b0392909216919091179055565b6004805460408051637fabc90b60e01b815290516001600160a01b0390921692637fabc90b928282019260209290829003018186803b15801561195857600080fd5b505afa15801561196c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199091906142cb565b6001600160a01b0316336001600160a01b0316146040518060400160405280600381526020016231313160e81b815250906119de5760405162461bcd60e51b815260040161041791906148cd565b506000836001600160a01b031663acb2d4106040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1a57600080fd5b505afa158015611a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5291906142cb565b90506000846001600160a01b031663d8df4ce76040518163ffffffff1660e01b815260040160806040518083038186803b158015611a8f57600080fd5b505afa158015611aa3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac79190614588565b60035490915060009067ffffffffffffffff680100000000000000008204811691611af3911687614e6d565b611afd9190614d39565b90506000866001600160a01b031663df6360a6896040518263ffffffff1660e01b8152600401611b2d919061473f565b60206040518083038186803b158015611b4557600080fd5b505afa158015611b59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7d919061460c565b9050600081856001600160a01b031662fdd58e8b87606001516040518363ffffffff1660e01b8152600401611bb3929190614753565b60206040518083038186803b158015611bcb57600080fd5b505afa158015611bdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c03919061460c565b611c0d9190614d21565b90506000611c2b85600001518660200151868a8c6114ad9190614d21565b905060006001600160a01b03801686602001516001600160a01b031614611c53576000611c55565b885b60408051600180825281830190925291925060009190602080830190803683370190505090508b81600081518110611c9d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526040517fe5aa6d05000000000000000000000000000000000000000000000000000000008152908c169063e5aa6d05908490611cf59085908f906004016148a2565b6000604051808303818588803b158015611d0e57600080fd5b505af1158015611d22573d6000803e3d6000fd5b5050505050838a1415611e9e576000886001600160a01b031662fdd58e8e8a604001516040518363ffffffff1660e01b8152600401611d62929190614753565b60206040518083038186803b158015611d7a57600080fd5b505afa158015611d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db2919061460c565b9050886001600160a01b031663f5298aca8e8a60400151846040518463ffffffff1660e01b8152600401611de893929190614776565b600060405180830381600087803b158015611e0257600080fd5b505af1158015611e16573d6000803e3d6000fd5b505060405162197ac760e01b81526001600160a01b038f16925062197ac79150611e449084906004016148c4565b600060405180830381600087803b158015611e5e57600080fd5b505af1158015611e72573d6000803e3d6000fd5b50505050611e988d8583611e869190614e8c565b8a516001600160a01b03169190613d80565b50611f61565b876001600160a01b031663f5298aca8d8960400151866040518463ffffffff1660e01b8152600401611ed293929190614776565b600060405180830381600087803b158015611eec57600080fd5b505af1158015611f00573d6000803e3d6000fd5b505060405162197ac760e01b81526001600160a01b038e16925062197ac79150611f2e9086906004016148c4565b600060405180830381600087803b158015611f4857600080fd5b505af1158015611f5c573d6000803e3d6000fd5b505050505b86516020880151611f8a919088611f788d8f614d21565b611f829190614d21565b8660006134dd565b50612029600460009054906101000a90046001600160a01b03166001600160a01b0316633b19e84a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611fdc57600080fd5b505afa158015611ff0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201491906142cb565b60208901516001600160a01b03169088613d80565b6120d1600460009054906101000a90046001600160a01b03166001600160a01b0316637fabc90b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561207a57600080fd5b505afa15801561208e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120b291906142cb565b6120bc8b8d614d21565b60208a01516001600160a01b03169190613d80565b876001600160a01b031663f5298aca8d8960600151888e6120f29190614e8c565b6040518463ffffffff1660e01b815260040161211093929190614776565b600060405180830381600087803b15801561212a57600080fd5b505af115801561213e573d6000803e3d6000fd5b505050508a6001600160a01b03168c6001600160a01b03167f3eeeaba10d85fe3ba0708f01d644ff55bbdf227dd736ce68eba30cd119514c128c60405161218591906148c4565b60405180910390a3505050505050505050505050565b606481565b6001546001600160a01b031681565b6121b7610fc7565b6001600160a01b03166121c861291e565b6001600160a01b0316146121ee5760405162461bcd60e51b8152600401610417906149cb565b6001546001600160a01b03161561220457600080fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517f69737d41162474a7ca514809b07d7becaecf72eae8c23bceb071f0e09af93ffc90600090a250565b6002805414156122705760405162461bcd60e51b815260040161041790614acb565b6002805560048054604051630f6ec81f60e01b815283926001600160a01b0390921691630f6ec81f916122a59185910161473f565b60206040518083038186803b1580156122bd57600080fd5b505afa1580156122d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122f59190614532565b6123115760405162461bcd60e51b815260040161041790614a37565b6000826001600160a01b031663d8df4ce76040518163ffffffff1660e01b815260040160806040518083038186803b15801561234c57600080fd5b505afa158015612360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123849190614588565b90506000836001600160a01b031663acb2d4106040518163ffffffff1660e01b815260040160206040518083038186803b1580156123c157600080fd5b505afa1580156123d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f991906142cb565b9050836001600160a01b03166367ac280a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561243657600080fd5b505af115801561244a573d6000803e3d6000fd5b5050505060008060006124948989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508992508b9150889050612922565b925092509250600081116040518060400160405280600381526020016206260760eb1b815250906124d85760405162461bcd60e51b815260040161041791906148cd565b5060208501516001600160a01b03908116141561254d57803410156040518060400160405280600381526020017f3130330000000000000000000000000000000000000000000000000000000000815250906125475760405162461bcd60e51b815260040161041791906148cd565b50612642565b6020850151604051636eb1769f60e11b815282916001600160a01b03169063dd62ed3e9061258190339030906004016147a1565b60206040518083038186803b15801561259957600080fd5b505afa1580156125ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d1919061460c565b10156040518060400160405280600381526020017f3130370000000000000000000000000000000000000000000000000000000000815250906126275760405162461bcd60e51b815260040161041791906148cd565b506020850151612642906001600160a01b0316338984613e2f565b60006001600160a01b03801686602001516001600160a01b03161461266857600061266a565b815b9050876001600160a01b031663e5aa6d058286856040518463ffffffff1660e01b815260040161269b9291906148a2565b6000604051808303818588803b1580156126b457600080fd5b505af11580156126c8573d6000803e3d6000fd5b505060405163e897effb60e01b8152600093506001600160a01b038c16925063e897effb91506126fc9086906004016148c4565b60206040518083038186803b15801561271457600080fd5b505afa158015612728573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274c919061460c565b905060006127698860000151896020015184876114b79190614d21565b905061277886868a8d8b613248565b60405162197ac760e01b81526001600160a01b038b169062197ac7906127a29084906004016148c4565b600060405180830381600087803b1580156127bc57600080fd5b505af11580156127d0573d6000803e3d6000fd5b5050895160208b01516127eb93509091506115bf8588614d21565b5061280f336127fa8487614d21565b60208b01516001600160a01b03169190613d80565b60005b865181101561290a5760006001600160a01b031687828151811061284657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316146128f8578a6001600160a01b031687828151811061288657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03167f60b8242c7715592d395c118b86e1c56e483030f45fab92e8694eda9f1a837f5e8884815181106128d857634e487b7160e01b600052603260045260246000fd5b6020026020010151336040516128ef929190614c2b565b60405180910390a35b612903600182614d21565b9050612812565b505060016002555050505050505050505050565b3390565b6060806000865167ffffffffffffffff81111561294f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612978578160200160208202803683370190505b5092506000875167ffffffffffffffff8111156129a557634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156129ce578160200160208202803683370190505b5090506000885167ffffffffffffffff8111156129fb57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612a24578160200160208202803683370190505b50905060005b8951811015612aba57886040015167ffffffffffffffff16828281518110612a6257634e487b7160e01b600052603260045260246000fd5b602002602001018181525050886060015167ffffffffffffffff16838281518110612a9d57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152612ab3600182614d21565b9050612a2a565b506040517f4e1273f40000000000000000000000000000000000000000000000000000000081526001600160a01b03871690634e1273f490612b02908c908690600401614874565b60006040518083038186803b158015612b1a57600080fd5b505afa158015612b2e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612b56919081019061448b565b93506000866001600160a01b0316634e1273f48b846040518363ffffffff1660e01b8152600401612b88929190614874565b60006040518083038186803b158015612ba057600080fd5b505afa158015612bb4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612bdc919081019061448b565b90506000805b8b51811015612e6557896001600160a01b03166390d7bfae888381518110612c1a57634e487b7160e01b600052603260045260246000fd5b602002602001015160016040518363ffffffff1660e01b8152600401612c41929190614c90565b60206040518083038186803b158015612c5957600080fd5b505afa158015612c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c91919061460c565b915081838281518110612cb457634e487b7160e01b600052603260045260246000fd5b60200260200101511015612e10578b8181518110612ce257634e487b7160e01b600052603260045260246000fd5b6020026020010151888281518110612d0a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050896001600160a01b031663df6360a6898381518110612d5957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401612d7d919061473f565b60206040518083038186803b158015612d9557600080fd5b505afa158015612da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dcd919061460c565b878281518110612ded57634e487b7160e01b600052603260045260246000fd5b6020026020010151612dff9190614d21565b612e099087614d21565b9550612e53565b6000888281518110612e3257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250505b612e5e600182614d21565b9050612be2565b50505050509450945094915050565b600080600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612ec557600080fd5b505afa158015612ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612efd91906142cb565b905060606001600160a01b038681161480612f295750816001600160a01b0316866001600160a01b0316145b15612fd75760408051600280825260608201835290916020830190803683370190505090508181600081518110612f7057634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110612fb257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050613170565b6001600160a01b038581161480612fff5750816001600160a01b0316856001600160a01b0316145b15613088576040805160028082526060820183529091602083019080368337019050509050858160008151811061304657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508181600181518110612fb257634e487b7160e01b600052603260045260246000fd5b60408051600380825260808201909252906020820160608036833701905050905085816000815181106130cb57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050818160018151811061310d57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050848160028151811061314f57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250505b6006546040517f1f00ca740000000000000000000000000000000000000000000000000000000081526000916001600160a01b031690631f00ca74906131bc9088908690600401614c42565b60006040518083038186803b1580156131d457600080fd5b505afa1580156131e8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613210919081019061448b565b90508060008151811061323357634e487b7160e01b600052603260045260246000fd5b602002602001015193505050505b9392505050565b60008060005b87518110156134d35760006001600160a01b031688828151811061328257634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316146134c157846001600160a01b031663e897effb8883815181106132c757634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016132eb91906148c4565b60206040518083038186803b15801561330357600080fd5b505afa158015613317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061333b919061460c565b925061337d86600001518760200151858a858151811061336b57634e487b7160e01b600052603260045260246000fd5b60200260200101516114b79190614d21565b9150836001600160a01b031663f5298aca8983815181106133ae57634e487b7160e01b600052603260045260246000fd5b602002602001015188606001518a85815181106133db57634e487b7160e01b600052603260045260246000fd5b60200260200101516040518463ffffffff1660e01b815260040161340193929190614776565b600060405180830381600087803b15801561341b57600080fd5b505af115801561342f573d6000803e3d6000fd5b50505050836001600160a01b031663f5298aca89838151811061346257634e487b7160e01b600052603260045260246000fd5b60200260200101518860400151856040518463ffffffff1660e01b815260040161348e93929190614776565b600060405180830381600087803b1580156134a857600080fd5b505af11580156134bc573d6000803e3d6000fd5b505050505b6134cc600182614d21565b905061324e565b5050505050505050565b60008115613765576000806001600160a01b0388811614156135025760129150613576565b876001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561353b57600080fd5b505afa15801561354f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613573919061465c565b91505b6001600160a01b03878116141561358f57506012613603565b866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156135c857600080fd5b505afa1580156135dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613600919061465c565b90505b60008661361460ff8416600a614d9f565b61361e9088614e6d565b6136289190614d39565b6005546040517f721adea70000000000000000000000000000000000000000000000000000000081529192506000916001600160a01b039091169063721adea79061367b908d908d9089906004016147df565b60206040518083038186803b15801561369357600080fd5b505afa1580156136a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136cb919061460c565b905060008183116136e5576136e08383614e8c565b6136ef565b6136ef8284614e8c565b90506002826136ff606484614e6d565b6137099190614d39565b106040518060400160405280600381526020017f31323900000000000000000000000000000000000000000000000000000000008152509061375e5760405162461bcd60e51b815260040161041791906148cd565b5050505050505b600654604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163ad5c4648916004808301926020929190829003018186803b1580156137c357600080fd5b505afa1580156137d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137fb91906142cb565b90506060806001600160a01b038981161415613950576040805160028082526060820183529091602083019080368337019050509150828260008151811061385357634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050878260018151811061389557634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526006546040517ffb3bdb4100000000000000000000000000000000000000000000000000000000815291169063fb3bdb419088906138f3908b90879030904290600401614c5b565b6000604051808303818588803b15801561390c57600080fd5b505af1158015613920573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052613949919081019061448b565b9050613d3f565b6001600160a01b038881161415613ab457604080516002808252606082018352909160208301908036833701905050915088826000815181106139a357634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505082826001815181106139e557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600654613a0d918b8116911688613eba565b6006546040517f4a25d94a0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634a25d94a90613a5e908a908a90879030904290600401614ca0565b600060405180830381600087803b158015613a7857600080fd5b505af1158015613a8c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613949919081019061448b565b826001600160a01b0316896001600160a01b03161480613ae55750826001600160a01b0316886001600160a01b0316145b15613b935760408051600280825260608201835290916020830190803683370190505091508882600081518110613b2c57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508782600181518110613b6e57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050613c7b565b6040805160038082526080820190925290602082016060803683370190505091508882600081518110613bd657634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508282600181518110613c1857634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250508782600281518110613c5a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b0316815250505b600654613c95906001600160a01b038b8116911688613eba565b6006546040517f8803dbee0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690638803dbee90613ce6908a908a90879030904290600401614ca0565b600060405180830381600087803b158015613d0057600080fd5b505af1158015613d14573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613d3c919081019061448b565b90505b80600081518110613d6057634e487b7160e01b600052603260045260246000fd5b602002602001015186613d739190614e8c565b9998505050505050505050565b8015613e2a57613d8f83613fb9565b15613e16576000826001600160a01b031682604051613dad9061473c565b60006040518083038185875af1925050503d8060008114613dea576040519150601f19603f3d011682016040523d82523d6000602084013e613def565b606091505b5050905080613e105760405162461bcd60e51b815260040161041790614900565b50613e2a565b613e2a6001600160a01b0384168383613fdf565b505050565b613eb4846323b872dd60e01b858585604051602401613e50939291906147bb565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613ffe565b50505050565b613ec383613fb9565b15613ee05760405162461bcd60e51b815260040161041790614994565b80613eff57613efa6001600160a01b03841683600061408d565b613e2a565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e90613f3090309087906004016147a1565b60206040518083038186803b158015613f4857600080fd5b505afa158015613f5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f80919061460c565b905081811015613eb4578015613fa557613fa56001600160a01b03851684600061408d565b613eb46001600160a01b038516848461408d565b60006001600160a01b0382161580613fd957506001600160a01b03828116145b92915050565b613e2a8363a9059cbb60e01b8484604051602401613e50929190614805565b6000614053826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166141509092919063ffffffff16565b805190915015613e2a57808060200190518101906140719190614532565b613e2a5760405162461bcd60e51b815260040161041790614a6e565b8015806141155750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906140c390309086906004016147a1565b60206040518083038186803b1580156140db57600080fd5b505afa1580156140ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614113919061460c565b155b6141315760405162461bcd60e51b815260040161041790614b02565b613e2a8363095ea7b360e01b8484604051602401613e50929190614805565b606061415f8484600085614167565b949350505050565b6060824710156141895760405162461bcd60e51b815260040161041790614937565b61419285614227565b6141ae5760405162461bcd60e51b815260040161041790614a00565b600080866001600160a01b031685876040516141ca9190614720565b60006040518083038185875af1925050503d8060008114614207576040519150601f19603f3d011682016040523d82523d6000602084013e61420c565b606091505b509150915061421c82828661422d565b979650505050505050565b3b151590565b6060831561423c575081613241565b82511561424c5782518084602001fd5b8160405162461bcd60e51b815260040161041791906148cd565b60008083601f840112614277578182fd5b50813567ffffffffffffffff81111561428e578182fd5b60208301915083602080830285010111156142a857600080fd5b9250929050565b6000602082840312156142c0578081fd5b813561324181614efb565b6000602082840312156142dc578081fd5b815161324181614efb565b600080600080608085870312156142fc578283fd5b843561430781614efb565b9350602085013561431781614efb565b93969395505050506040820135916060013590565b600080600060408486031215614340578283fd5b833567ffffffffffffffff811115614356578384fd5b61436286828701614266565b909450925050602084013561437681614efb565b809150509250925092565b60008060008060608587031215614396578384fd5b843567ffffffffffffffff8111156143ac578485fd5b6143b887828801614266565b90955093505060208501356143cc81614efb565b915060408501356143dc81614f29565b939692955090935050565b60008060008060008060008060c0898b031215614402578384fd5b883567ffffffffffffffff80821115614419578586fd5b6144258c838d01614266565b909a50985060208b013591508082111561443d578586fd5b5061444a8b828c01614266565b909750955050604089013561445e81614efb565b9350606089013561446e81614efb565b979a969950949793969295929450505060808201359160a0013590565b6000602080838503121561449d578182fd5b825167ffffffffffffffff808211156144b4578384fd5b818501915085601f8301126144c7578384fd5b8151818111156144d9576144d9614ee5565b83810291506144e9848301614cf7565b8181528481019084860184860187018a1015614503578788fd5b8795505b83861015614525578051835260019590950194918601918601614507565b5098975050505050505050565b600060208284031215614543578081fd5b81518015158114613241578182fd5b600080600060608486031215614566578081fd5b83359250602084013561457881614efb565b9150604084013561437681614f29565b600060808284031215614599578081fd5b6040516080810181811067ffffffffffffffff821117156145bc576145bc614ee5565b60405282516145ca81614efb565b815260208301516145da81614efb565b602082015260408301516145ed81614f13565b6040820152606083015161460081614f13565b60608201529392505050565b60006020828403121561461d578081fd5b5051919050565b60008060408385031215614636578182fd5b823561464181614f13565b9150602083013561465181614f13565b809150509250929050565b60006020828403121561466d578081fd5b815161324181614f29565b6001600160a01b03169052565b6000815180845260208085019450808401835b838110156146bd5781516001600160a01b031687529582019590820190600101614698565b509495945050505050565b6000815180845260208085019450808401835b838110156146bd578151875295820195908201906001016146db565b6003811061471557634e487b7160e01b600052602160045260246000fd5b9052565b60ff169052565b60008251614732818460208701614ea3565b9190910192915050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b0392909216825267ffffffffffffffff16602082015260400190565b6001600160a01b0393909316835267ffffffffffffffff919091166020830152604082015260600190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03938416815291909216602082015260ff909116604082015260600190565b6001600160a01b03929092168252602082015260400190565b6040808252810183905260008460608301825b8681101561486157823561484481614efb565b6001600160a01b0316825260209283019290910190600101614831565b5060209390930193909352509392505050565b6000604082526148876040830185614685565b828103602084015261489981856146c8565b95945050505050565b6000604082526148b56040830185614685565b90508260208301529392505050565b90815260200190565b60006020825282518060208401526148ec816040850160208701614ea3565b601f01601f19169190910160400192915050565b60208082526014908201527f4661696c656420746f2073656e64204574686572000000000000000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526015908201527f417070726f76652063616c6c6564206f6e204554480000000000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600e908201527f496e76616c6964207661756c7421000000000000000000000000000000000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000606082015260800190565b600060408252614b736040830185516146f7565b6020840151614b856060840182614678565b50604084015160808301526060840151614ba260a0840182614678565b506080840151614bb560c0840182614678565b5060a08401516101208060e0850152614bd2610160850183614685565b915060c0860151610100603f198685030181870152614bf184836146c8565b935060e08801519150614c0683870183614678565b8701519150614c1b9050610140850182614678565b5090506132416020830184614719565b9182526001600160a01b0316602082015260400190565b60008382526040602083015261415f6040830184614685565b600085825260806020830152614c746080830186614685565b6001600160a01b03949094166040830152506060015292915050565b9182521515602082015260400190565b600086825285602083015260a06040830152614cbf60a0830186614685565b6001600160a01b0394909416606083015250608001529392505050565b67ffffffffffffffff92831681529116602082015260400190565b60405181810167ffffffffffffffff81118282101715614d1957614d19614ee5565b604052919050565b60008219821115614d3457614d34614ecf565b500190565b600082614d5457634e487b7160e01b81526012600452602481fd5b500490565b80825b6001808611614d6b5750614d96565b818704821115614d7d57614d7d614ecf565b80861615614d8a57918102915b9490941c938002614d5c565b94509492505050565b60006132416000198484600082614db857506001613241565b81614dc557506000613241565b8160018114614ddb5760028114614de557614e12565b6001915050613241565b60ff841115614df657614df6614ecf565b6001841b915084821115614e0c57614e0c614ecf565b50613241565b5060208310610133831016604e8410600b8410161715614e45575081810a83811115614e4057614e40614ecf565b613241565b614e528484846001614d59565b808604821115614e6457614e64614ecf565b02949350505050565b6000816000190483118215151615614e8757614e87614ecf565b500290565b600082821015614e9e57614e9e614ecf565b500390565b60005b83811015614ebe578181015183820152602001614ea6565b83811115613eb45750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114614f1057600080fd5b50565b67ffffffffffffffff81168114614f1057600080fd5b60ff81168114614f1057600080fdfea26469706673582212207f39a3a50c070c45c939b40a6d13253af2efb8326725e52ec4cae06034ca321364736f6c63430008000033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.