Contract 0x682E473FcA490B0adFA7EfE94083C1E63f28F034 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x63b4b195e1ff921f4b0dc6c5bb698bb3ce45efdb5ea415ea05767501a15b3de5Create Vault199825382021-10-24 19:00:446 hrs 46 mins ago0xe37b9b9c7b4424d92d2bc11461ab4b8a083b143a IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.038585006163
0x01cc759acdf066331b4b7103f8258001222e8b18b4f5946bbf564599422b15f5Create Vault199480162021-10-24 10:49:4314 hrs 58 mins ago0xede59b173270c8e3dbf27f37030b5261a59c78a5 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.035386254273
0x0c97063348c6a4aa0335d3347b875f9d6dd8b56f08bd560a4eff0662ad50b46bCreate Vault199373042021-10-24 8:12:1917 hrs 35 mins ago0x09fa38eba245bb68354b8950fa2fe71f02863393 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.02090499891
0x2c02c3724b649a221f6c1e85892d542bc9129ac7a0e7c9a99f2abf6b57906aa3Create Vault199245932021-10-24 5:09:3220 hrs 38 mins ago0x2704389cd4c9c4c5865a3ee4b76977b480480004 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.019605090163
0x4d65aec2eeedceb9c5ed07dccbc9c27c43819bf044fabb43ed726c2c75d18f81Deposit Collater...199128392021-10-24 2:21:1223 hrs 26 mins ago0x5585d5365f37671eecc0fdcac5a06bd1d176408e IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.005785882025
0xa9832eed7aae3c40b235f4a55fde9169a85ac3a5dc86e13426ecba52dff198c0Withdraw Collate...198929002021-10-23 21:36:551 day 4 hrs ago0xbfe24b4d8b1e421ca8794f6416946db505d6dbd7 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.015093468664
0x279d0a3cb7da952ae35d490d0c9c4d955c6fa9ad4adbb442ac166a72b77c038dWithdraw Collate...198909752021-10-23 21:10:191 day 4 hrs ago0x6df216f81cb9a6e6eb2978dd2efa08d6e37a4a93 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.012710764757
0x3162cd11d4eac6adb0b4de0a5b62cb0b35e4bce740bd0b4fe2010e2fd7ba9739Deposit Collater...198898222021-10-23 20:54:141 day 4 hrs ago0x6df216f81cb9a6e6eb2978dd2efa08d6e37a4a93 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.01128281231
0xcc88f97e44bd028692f4cff000fbbffba3e144d92b66c8d5136d7d9ea56e1255Create Vault198893682021-10-23 20:48:051 day 4 hrs ago0x6df216f81cb9a6e6eb2978dd2efa08d6e37a4a93 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.042016432381
0xb350d4ff272f48640d7b880ac6b3fee9d78af1dd69174270777dc30e10f0f616Deposit Collater...198891002021-10-23 20:44:141 day 5 hrs ago0xbfe24b4d8b1e421ca8794f6416946db505d6dbd7 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.013527588158
0xe9949820e54dc5197c9c14b0fe6e5e03170334e65105f037c66a9d4bbd19e7bfCreate Vault198889282021-10-23 20:41:591 day 5 hrs ago0xbfe24b4d8b1e421ca8794f6416946db505d6dbd7 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.04352080811
0x54e0c7b1abd2fbf6a02c8aba03976308c27ddeb9f283e81cf965a83e9e908225Deposit Collater...198710032021-10-23 16:31:591 day 9 hrs ago0xae1692d8d045716c948b707550e91dbd2c55169a IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.014075682113
0x1ceface195a0482ea6fb2863fa325dc6f52773cc092e452fa28954b567acf23aCreate Vault198700872021-10-23 16:19:101 day 9 hrs ago0xae1692d8d045716c948b707550e91dbd2c55169a IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.035589027845
0x0383af70cb7ce10dfa5dc8c619b5c31c4274d88a0112967914e162cbd06b4db9Create Vault198641182021-10-23 14:53:591 day 10 hrs ago0x5a6f97c60745fa3bafb00ab45dd4055d7b8fdb1b IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.033340907103
0x07420636ccd259fd5c6342cd56d45c5cae685ca68a7e1cd06f85e533c02c228aCreate Vault198516462021-10-23 11:54:471 day 13 hrs ago0xb76e8c455a1d6c752ead7080c63e81d74d90c9af IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.033236206075
0x0709a41a95ca82e37ad64f2abf4d41c4e25f06b8b7bd265cefef3fa4eae8bb60Deposit Collater...198232122021-10-23 4:55:541 day 20 hrs ago0x965f609467e8021f7a01ae5ef5eb76ce1d36a5b0 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.010459160694
0x53b439b20abdd614d421dce537bd2090de883fb9023e019f7f357f58e4e3413aCreate Vault198230962021-10-23 4:54:171 day 20 hrs ago0x965f609467e8021f7a01ae5ef5eb76ce1d36a5b0 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.034209141833
0xa09d97681c52d6d50d4de82399ba966bd170800e4d79d120844d89720fe59f7dDeposit Collater...197889942021-10-22 20:39:502 days 5 hrs ago0x5d3216afeefef0a5c51494d27992e146b5186edb IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.017197600723
0xe850e34c0e395aa390857c8ff9e45211ffd6a698faac15419226da045852f02dCreate Vault197614522021-10-22 13:11:572 days 12 hrs ago0x212eb33a82cb576f5ef6f1f5dc5b2ba69454482e IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.03403273705
0x3730070f3a0594f07e36ca4f7cafcc3d994b7d1e023343f19b74fe1f31672901Borrow Token197565582021-10-22 11:48:532 days 13 hrs ago0x5d3216afeefef0a5c51494d27992e146b5186edb IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.0162429
0x43f92845b57cbfc508d22c6e65c90779231a911e2990999735eccd9cdb798394Deposit Collater...197554052021-10-22 11:29:172 days 14 hrs ago0x5d3216afeefef0a5c51494d27992e146b5186edb IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.01061603346
0xcfbc426b1443c0c4ca603f890a28900fc0ac1e111d53619c69f2fc1effc01a65Create Vault197551932021-10-22 11:25:402 days 14 hrs ago0x5d3216afeefef0a5c51494d27992e146b5186edb IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.029838986709
0x2238fb594612a7f1411c22954cf323c4d4f0b71595408eb3dcfe6e4a72d6fcaeCreate Vault197487622021-10-22 9:27:192 days 16 hrs ago0x10d9a810aab5e155d1e82bde6bb7bb508bce2d81 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.023555473512
0xb71d8d628c9ddfc70a81ff37aeab91ba3f7ddb50897758a71b17050b26bb7f7fBorrow Token197431922021-10-22 7:38:432 days 18 hrs ago0x83a76d3d563a57b3ee7689232c3789e64ba71772 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.022010095185
0xbec34b2fb60f2c0bb2f7d5d71ba2eb0048aa0ae7d0dfe83b2856062a83e0af75Deposit Collater...197431252021-10-22 7:37:412 days 18 hrs ago0x83a76d3d563a57b3ee7689232c3789e64ba71772 IN  0x682e473fca490b0adfa7efe94083c1e63f28f0340 FTM0.005097864371
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x302c57653241e8d83381113bb2dfbace0d0c0c8d9c4f0e11c33a62b6fc8a05e6190906142021-10-14 17:08:1010 days 8 hrs ago 0xe00eaa2787a8830a485153b7bf508bc781e4a220  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
crosschainQiStablecoin

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 24 : crosschainQiStablecoin.sol
pragma solidity 0.5.16;

import "@openzeppelin/contracts/ownership/Ownable.sol";
import "./crosschainStablecoin.sol";

contract crosschainQiStablecoin is crosschainStablecoin, Ownable {

    constructor(
        address ethPriceSourceAddress,
        uint256 minimumCollateralPercentage,
        string memory name,
        string memory symbol,
        address _mai,
        address _collateral,
        string memory baseURI
    ) crosschainStablecoin(
        ethPriceSourceAddress,
        minimumCollateralPercentage,
        name,
        symbol,
        _mai,
        _collateral,
        baseURI
    ) public {
        treasury=0;
    }

    function setGainRatio(uint256 _gainRatio) external onlyOwner() {
        gainRatio=_gainRatio;
    }

    function setDebtRatio(uint256 _debtRatio) external onlyOwner() {
        debtRatio=_debtRatio;
    }

    function changeEthPriceSource(address ethPriceSourceAddress) external onlyOwner() {
        ethPriceSource = PriceSource(ethPriceSourceAddress);
    }

    function setStabilityPool(address _pool) external onlyOwner() {
        stabilityPool = _pool;
    }

    function setMinCollateralRatio(uint256 minimumCollateralPercentage) external onlyOwner() {
        _minimumCollateralPercentage = minimumCollateralPercentage;
    }

    function setClosingFee(uint256 amount) external onlyOwner() {
        closingFee = amount;
    }

    function setOpeningFee(uint256 amount) external onlyOwner() {
        openingFee = amount;
    }

    function setTreasury(uint256 _treasury) external onlyOwner() {
        require(_exists(_treasury), "Vault does not exist");
        treasury = _treasury;
    }

    function burn(uint256 amountToken) public onlyOwner() {
        // Burn 
        mai.transfer(address(0), amountToken);
    }

    function setTokenURI(string memory _uri) public onlyOwner() {
        uri = _uri;
    }
}

File 2 of 24 : Ownable.sol
pragma solidity ^0.5.0;

import "../GSN/Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 3 of 24 : crosschainStablecoin.sol
pragma solidity 0.5.16;

import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";

import "../PriceSource.sol";

import "../MyVaultV4.sol";

contract crosschainStablecoin is ReentrancyGuard, VaultNFTv4 {
    PriceSource public ethPriceSource;
    
    using SafeMath for uint256;
    using SafeERC20 for ERC20Detailed;

    uint256 public _minimumCollateralPercentage;

    uint256 public vaultCount;
    uint256 public closingFee;
    uint256 public openingFee;

    uint256 public treasury;
    uint256 public tokenPeg;

    mapping(uint256 => uint256) public vaultCollateral;
    mapping(uint256 => uint256) public vaultDebt;

    uint256 public debtRatio;
    uint256 public gainRatio;

    address public stabilityPool;

    ERC20Detailed public collateral;

    ERC20Detailed public mai;

    uint256 public priceSourceDecimals;
    uint256 public totalBorrowed;

    event CreateVault(uint256 vaultID, address creator);
    event DestroyVault(uint256 vaultID);
    event TransferVault(uint256 vaultID, address from, address to);
    event DepositCollateral(uint256 vaultID, uint256 amount);
    event WithdrawCollateral(uint256 vaultID, uint256 amount);
    event BorrowToken(uint256 vaultID, uint256 amount);
    event PayBackToken(uint256 vaultID, uint256 amount, uint256 closingFee);
    event LiquidateVault(uint256 vaultID, address owner, address buyer, uint256 debtRepaid, uint256 collateralLiquidated, uint256 closingFee);

    mapping(address => uint256) public maticDebt;

    constructor(
        address ethPriceSourceAddress,
        uint256 minimumCollateralPercentage,
        string memory name,
        string memory symbol,
        address _mai,
        address _collateral,
        string memory baseURI
    ) VaultNFTv4(name, symbol, baseURI) public {
        assert(ethPriceSourceAddress != address(0));
        assert(minimumCollateralPercentage != 0);
                        //  | decimals start here
        closingFee=50; // 0.5%
        openingFee=0; // 0.0%
        ethPriceSource = PriceSource(ethPriceSourceAddress);
        stabilityPool = address(0);
        tokenPeg = 100000000; // $1

        debtRatio = 2; // 1/2, pay back 50%
        gainRatio = 1100;// /10 so 1.1

        _minimumCollateralPercentage = minimumCollateralPercentage;

        collateral = ERC20Detailed(_collateral);
        mai = ERC20Detailed(_mai);
        priceSourceDecimals = 8;
    }

    modifier onlyVaultOwner(uint256 vaultID) {
        require(_exists(vaultID), "Vault does not exist");
        require(ownerOf(vaultID) == msg.sender, "Vault is not owned by you");
        _;
    }

    function getDebtCeiling() public view returns (uint256){
        return mai.balanceOf(address(this));
    }

    function exists(uint256 vaultID) external view returns (bool){
        return _exists(vaultID);
    }

    function getClosingFee() external view returns (uint256){
        return closingFee;
    }

    function getOpeningFee() external view returns (uint256){
        return openingFee;
    }

    function getTokenPriceSource() public view returns (uint256){
        return tokenPeg;
    }

    function getEthPriceSource() public view returns (uint256){
        (,int256 price,,,) = ethPriceSource.latestRoundData();
        return uint256(price);
    }

    function calculateCollateralProperties(uint256 _collateral, uint256 _debt) private view returns (uint256, uint256) {

        assert(getEthPriceSource() != 0);
        assert(getTokenPriceSource() != 0);

        uint256 collateralValue = _collateral.mul(getEthPriceSource()).mul(10**(uint256(mai.decimals()).sub(uint256(collateral.decimals()))));

        assert(collateralValue >= _collateral);

        uint256 debtValue = _debt.mul(getTokenPriceSource());

        assert(debtValue >= _debt);

        uint256 collateralValueTimes100 = collateralValue.mul(100);

        assert(collateralValueTimes100 > collateralValue);

        return (collateralValueTimes100, debtValue);
    }

    function isValidCollateral(uint256 collateral, uint256 debt) private view returns (bool) {
        (uint256 collateralValueTimes100, uint256 debtValue) = calculateCollateralProperties(collateral, debt);

        uint256 collateralPercentage = collateralValueTimes100.div(debtValue);

        return collateralPercentage >= _minimumCollateralPercentage;
    }

    function createVault() external returns (uint256) {
        uint256 id = vaultCount;
        vaultCount = vaultCount.add(1);

        assert(vaultCount >= id);

        _mint(msg.sender,id);

        emit CreateVault(id, msg.sender);

        return id;
    }

    function destroyVault(uint256 vaultID) external onlyVaultOwner(vaultID) nonReentrant {
        require(vaultDebt[vaultID] == 0, "Vault has outstanding debt");

        if(vaultCollateral[vaultID]!=0) {
            // withdraw leftover collateral
            collateral.safeTransfer(ownerOf(vaultID), vaultCollateral[vaultID]);
        }

        _burn(vaultID);

        delete vaultCollateral[vaultID];
        delete vaultDebt[vaultID];

        emit DestroyVault(vaultID);
    }

    function depositCollateral(uint256 vaultID, uint256 amount) external {

        collateral.safeTransferFrom(msg.sender, address(this), amount);

        uint256 newCollateral = vaultCollateral[vaultID].add(amount);

        assert(newCollateral >= vaultCollateral[vaultID]);

        vaultCollateral[vaultID] = newCollateral;

        emit DepositCollateral(vaultID, amount);
    }

    function withdrawCollateral(uint256 vaultID, uint256 amount) external onlyVaultOwner(vaultID) nonReentrant {
        require(vaultCollateral[vaultID] >= amount, "Vault does not have enough collateral");

        uint256 newCollateral = vaultCollateral[vaultID].sub(amount);

        if(vaultDebt[vaultID] != 0) {
            require(isValidCollateral(newCollateral, vaultDebt[vaultID]), "Withdrawal would put vault below minimum collateral percentage");
        }

        vaultCollateral[vaultID] = newCollateral;
        collateral.safeTransfer(msg.sender, amount);

        emit WithdrawCollateral(vaultID, amount);
    }

    function borrowToken(uint256 vaultID, uint256 amount) external onlyVaultOwner(vaultID) {
        require(amount > 0, "Must borrow non-zero amount");
        require(amount <= getDebtCeiling(), "borrowToken: Cannot mint over available supply.");

        uint256 newDebt = vaultDebt[vaultID].add(amount);

        assert(newDebt > vaultDebt[vaultID]);

        require(isValidCollateral(vaultCollateral[vaultID], newDebt), "Borrow would put vault below minimum collateral percentage");

        vaultDebt[vaultID] = newDebt;

        // mai
        mai.safeTransfer(msg.sender, amount);
        totalBorrowed=totalBorrowed.add(newDebt);
        emit BorrowToken(vaultID, amount);
    }

    function payBackToken(uint256 vaultID, uint256 amount) external {
        require(mai.balanceOf(msg.sender) >= amount, "Token balance too low");
        require(vaultDebt[vaultID] >= amount, "Vault debt less than amount to pay back");

        uint256 _closingFee = (amount.mul(closingFee).mul(getTokenPriceSource())).div(getEthPriceSource().mul(10000));

        //mai
        mai.safeTransferFrom(msg.sender, address(this), amount);

        vaultDebt[vaultID] = vaultDebt[vaultID].sub(amount);
        vaultCollateral[vaultID]=vaultCollateral[vaultID].sub(_closingFee);
        vaultCollateral[treasury]=vaultCollateral[treasury].add(_closingFee);

        totalBorrowed=totalBorrowed.sub(amount);
        emit PayBackToken(vaultID, amount, _closingFee);
    }

    function getPaid() public nonReentrant {
        require(maticDebt[msg.sender]!=0, "Don't have anything for you.");
        uint256 amount = maticDebt[msg.sender];
        maticDebt[msg.sender]=0;
        collateral.safeTransfer(msg.sender, amount);
    }

    function checkCost(uint256 vaultID) public view returns (uint256) {

        if(vaultCollateral[vaultID] == 0 || vaultDebt[vaultID]==0 || !checkLiquidation(vaultID) ){
            return 0;
        }

        (uint256 collateralValueTimes100, uint256 debtValue) = calculateCollateralProperties(vaultCollateral[vaultID], vaultDebt[vaultID]);

        if(debtValue==0){
            return 0;
        }
        
        uint256 collateralPercentage = collateralValueTimes100.div(debtValue);

        debtValue = debtValue.div(10 ** priceSourceDecimals);

        uint256 halfDebt = debtValue.div(debtRatio); //debtRatio (2)

        return(halfDebt);
    }

    function checkExtract(uint256 vaultID) public view returns (uint256) {

        if(vaultCollateral[vaultID] == 0|| !checkLiquidation(vaultID) ) {
            return 0;
        }

        (uint256 collateralValueTimes100, uint256 debtValue) = calculateCollateralProperties(vaultCollateral[vaultID], vaultDebt[vaultID]);

        uint256 halfDebt = debtValue.div(debtRatio); //debtRatio (2)

        if(halfDebt==0){
            return 0;
        }
        return halfDebt.mul(gainRatio).div(1000).div(getEthPriceSource());
    }

    function checkCollateralPercentage(uint256 vaultID) public view returns(uint256){
        require(_exists(vaultID), "Vault does not exist");

        if(vaultCollateral[vaultID] == 0 || vaultDebt[vaultID]==0){
            return 0;
        }
        (uint256 collateralValueTimes100, uint256 debtValue) = calculateCollateralProperties(vaultCollateral[vaultID], vaultDebt[vaultID]);

        return collateralValueTimes100.div(debtValue);
    }

    function checkLiquidation(uint256 vaultID) public view returns (bool) {
        require(_exists(vaultID), "Vault does not exist");
        
        if(vaultCollateral[vaultID] == 0 || vaultDebt[vaultID]==0){
            return false;
        }

        (uint256 collateralValueTimes100, uint256 debtValue) = calculateCollateralProperties(vaultCollateral[vaultID], vaultDebt[vaultID]);

        uint256 collateralPercentage = collateralValueTimes100.div(debtValue);

        if(collateralPercentage < _minimumCollateralPercentage){
            return true;
        } else{
            return false;
        }
    }

    function liquidateVault(uint256 vaultID) external {
        require(_exists(vaultID), "Vault does not exist");
        require(stabilityPool==address(0) || msg.sender ==  stabilityPool, "liquidation is disabled for public");

        (uint256 collateralValueTimes100, uint256 debtValue) = calculateCollateralProperties(vaultCollateral[vaultID], vaultDebt[vaultID]);

        uint256 collateralPercentage = collateralValueTimes100.div(debtValue);

        require(collateralPercentage < _minimumCollateralPercentage, "Vault is not below minimum collateral percentage");

        debtValue = debtValue.div(10 ** priceSourceDecimals);

        uint256 halfDebt = debtValue.div(debtRatio); //debtRatio (2)

        require(mai.balanceOf(msg.sender) >= halfDebt, "Token balance too low to pay off outstanding debt");

        //mai
        mai.safeTransferFrom(msg.sender, address(this), halfDebt);
        totalBorrowed=totalBorrowed.sub(halfDebt);

        uint256 maticExtract = checkExtract(vaultID);

        vaultDebt[vaultID] = vaultDebt[vaultID].sub(halfDebt); // we paid back half of its debt.

        uint256 _closingFee = (halfDebt.mul(closingFee).mul(getTokenPriceSource()) ).div(getEthPriceSource().mul(10000));
     
        vaultCollateral[vaultID]=vaultCollateral[vaultID].sub(_closingFee);
        vaultCollateral[treasury]=vaultCollateral[treasury].add(_closingFee);

        // deduct the amount from the vault's collateral
        vaultCollateral[vaultID] = vaultCollateral[vaultID].sub(maticExtract);

        // let liquidator take the collateral
        maticDebt[msg.sender] = maticDebt[msg.sender].add(maticExtract);

        emit LiquidateVault(vaultID, ownerOf(vaultID), msg.sender, halfDebt, maticExtract, _closingFee);
    }
}

File 4 of 24 : Context.sol
pragma solidity ^0.5.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 GSN 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.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 5 of 24 : SafeERC20.sol
pragma solidity ^0.5.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

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

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

    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 6 of 24 : ERC20.sol
pragma solidity ^0.5.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20Mintable}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20};
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for `sender`'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal {
        require(account != address(0), "ERC20: mint to the zero address");

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal {
        require(account != address(0), "ERC20: burn from the zero address");

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
     *
     * This is internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`.`amount` is then deducted
     * from the caller's allowance.
     *
     * See {_burn} and {_approve}.
     */
    function _burnFrom(address account, uint256 amount) internal {
        _burn(account, amount);
        _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
    }
}

File 7 of 24 : ERC20Detailed.sol
pragma solidity ^0.5.0;

import "./IERC20.sol";

/**
 * @dev Optional functions from the ERC20 standard.
 */
contract ERC20Detailed is IERC20 {
    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
     * these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name, string memory symbol, uint8 decimals) public {
        _name = name;
        _symbol = symbol;
        _decimals = decimals;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view returns (uint8) {
        return _decimals;
    }
}

File 8 of 24 : ReentrancyGuard.sol
pragma solidity ^0.5.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].
 *
 * _Since v2.5.0:_ this module is now much more gas efficient, given net gas
 * metering changes introduced in the Istanbul hardfork.
 */
contract ReentrancyGuard {
    bool private _notEntered;

    constructor () internal {
        // Storing an initial 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 percetange 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.
        _notEntered = true;
    }

    /**
     * @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(_notEntered, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _notEntered = false;

        _;

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

File 9 of 24 : SafeMath.sol
pragma solidity ^0.5.0;

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

File 10 of 24 : PriceSource.sol
pragma solidity ^0.5.0;

interface PriceSource {
	function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
	function decimals() external view returns (uint8);
// source: https://polygonscan.com/address/0xab594600376ec9fd91f8e885dadf0ce036862de0#code
}

File 11 of 24 : MyVaultV4.sol
// contracts/MyVaultNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.5.16;

import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";

contract VaultNFTv4 is ERC721Full {

    string public uri;

    constructor(string memory name, string memory symbol, string memory _uri)
        public
        ERC721Full(name, symbol)
    {
        uri = _uri;
    }

    function tokenURI(uint256 tokenId) public view returns (string memory) {
        require(_exists(tokenId));

        return uri;
    }
}

File 12 of 24 : IERC20.sol
pragma solidity ^0.5.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see {ERC20Detailed}.
 */
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 13 of 24 : Address.sol
pragma solidity ^0.5.5;

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

    /**
     * @dev Converts an `address` into `address payable`. Note that this is
     * simply a type cast: the actual underlying value is not changed.
     *
     * _Available since v2.4.0._
     */
    function toPayable(address account) internal pure returns (address payable) {
        return address(uint160(account));
    }

    /**
     * @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].
     *
     * _Available since v2.4.0._
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-call-value
        (bool success, ) = recipient.call.value(amount)("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }
}

File 14 of 24 : ERC721Full.sol
pragma solidity ^0.5.0;

import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./ERC721Metadata.sol";

/**
 * @title Full ERC721 Token
 * @dev This implementation includes all the required and some optional functionality of the ERC721 standard
 * Moreover, it includes approve all functionality using operator terminology.
 *
 * See https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
    constructor (string memory name, string memory symbol) public ERC721Metadata(name, symbol) {
        // solhint-disable-previous-line no-empty-blocks
    }
}

File 15 of 24 : ERC721.sol
pragma solidity ^0.5.0;

import "../../GSN/Context.sol";
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../drafts/Counters.sol";
import "../../introspection/ERC165.sol";

/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721 {
    using SafeMath for uint256;
    using Address for address;
    using Counters for Counters.Counter;

    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    // Mapping from token ID to owner
    mapping (uint256 => address) private _tokenOwner;

    // Mapping from token ID to approved address
    mapping (uint256 => address) private _tokenApprovals;

    // Mapping from owner to number of owned token
    mapping (address => Counters.Counter) private _ownedTokensCount;

    // Mapping from owner to operator approvals
    mapping (address => mapping (address => bool)) private _operatorApprovals;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    constructor () public {
        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
    }

    /**
     * @dev Gets the balance of the specified address.
     * @param owner address to query the balance of
     * @return uint256 representing the amount owned by the passed address
     */
    function balanceOf(address owner) public view returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");

        return _ownedTokensCount[owner].current();
    }

    /**
     * @dev Gets the owner of the specified token ID.
     * @param tokenId uint256 ID of the token to query the owner of
     * @return address currently marked as the owner of the given token ID
     */
    function ownerOf(uint256 tokenId) public view returns (address) {
        address owner = _tokenOwner[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");

        return owner;
    }

    /**
     * @dev Approves another address to transfer the given token ID
     * The zero address indicates there is no approved address.
     * There can only be one approved address per token at a given time.
     * Can only be called by the token owner or an approved operator.
     * @param to address to be approved for the given token ID
     * @param tokenId uint256 ID of the token to be approved
     */
    function approve(address to, uint256 tokenId) public {
        address owner = ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @dev Gets the approved address for a token ID, or zero if no address set
     * Reverts if the token ID does not exist.
     * @param tokenId uint256 ID of the token to query the approval of
     * @return address currently approved for the given token ID
     */
    function getApproved(uint256 tokenId) public view returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev Sets or unsets the approval of a given operator
     * An operator is allowed to transfer all tokens of the sender on their behalf.
     * @param to operator address to set the approval
     * @param approved representing the status of the approval to be set
     */
    function setApprovalForAll(address to, bool approved) public {
        require(to != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][to] = approved;
        emit ApprovalForAll(_msgSender(), to, approved);
    }

    /**
     * @dev Tells whether an operator is approved by a given owner.
     * @param owner owner address which you want to query the approval of
     * @param operator operator address which you want to query the approval of
     * @return bool whether the given operator is approved by the given owner
     */
    function isApprovedForAll(address owner, address operator) public view returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev Transfers the ownership of a given token ID to another address.
     * Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     * Requires the msg.sender to be the owner, approved, or operator.
     * @param from current owner of the token
     * @param to address to receive the ownership of the given token ID
     * @param tokenId uint256 ID of the token to be transferred
     */
    function transferFrom(address from, address to, uint256 tokenId) public {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transferFrom(from, to, tokenId);
    }

    /**
     * @dev Safely transfers the ownership of a given token ID to another address
     * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},
     * which is called upon a safe transfer, and return the magic value
     * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
     * the transfer is reverted.
     * Requires the msg.sender to be the owner, approved, or operator
     * @param from current owner of the token
     * @param to address to receive the ownership of the given token ID
     * @param tokenId uint256 ID of the token to be transferred
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev Safely transfers the ownership of a given token ID to another address
     * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},
     * which is called upon a safe transfer, and return the magic value
     * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
     * the transfer is reverted.
     * Requires the _msgSender() to be the owner, approved, or operator
     * @param from current owner of the token
     * @param to address to receive the ownership of the given token ID
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes data to send along with a safe transfer check
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransferFrom(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers the ownership of a given token ID to another address
     * If the target address is a contract, it must implement `onERC721Received`,
     * which is called upon a safe transfer, and return the magic value
     * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
     * the transfer is reverted.
     * Requires the msg.sender to be the owner, approved, or operator
     * @param from current owner of the token
     * @param to address to receive the ownership of the given token ID
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes data to send along with a safe transfer check
     */
    function _safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) internal {
        _transferFrom(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether the specified token exists.
     * @param tokenId uint256 ID of the token to query the existence of
     * @return bool whether the token exists
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        address owner = _tokenOwner[tokenId];
        return owner != address(0);
    }

    /**
     * @dev Returns whether the given spender can transfer a given token ID.
     * @param spender address of the spender to query
     * @param tokenId uint256 ID of the token to be transferred
     * @return bool whether the msg.sender is approved for the given token ID,
     * is an operator of the owner, or is the owner of the token
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Internal function to safely mint a new token.
     * Reverts if the given token ID already exists.
     * If the target address is a contract, it must implement `onERC721Received`,
     * which is called upon a safe transfer, and return the magic value
     * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
     * the transfer is reverted.
     * @param to The address that will own the minted token
     * @param tokenId uint256 ID of the token to be minted
     */
    function _safeMint(address to, uint256 tokenId) internal {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Internal function to safely mint a new token.
     * Reverts if the given token ID already exists.
     * If the target address is a contract, it must implement `onERC721Received`,
     * which is called upon a safe transfer, and return the magic value
     * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
     * the transfer is reverted.
     * @param to The address that will own the minted token
     * @param tokenId uint256 ID of the token to be minted
     * @param _data bytes data to send along with a safe transfer check
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Internal function to mint a new token.
     * Reverts if the given token ID already exists.
     * @param to The address that will own the minted token
     * @param tokenId uint256 ID of the token to be minted
     */
    function _mint(address to, uint256 tokenId) internal {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _tokenOwner[tokenId] = to;
        _ownedTokensCount[to].increment();

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Internal function to burn a specific token.
     * Reverts if the token does not exist.
     * Deprecated, use {_burn} instead.
     * @param owner owner of the token to burn
     * @param tokenId uint256 ID of the token being burned
     */
    function _burn(address owner, uint256 tokenId) internal {
        require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own");

        _clearApproval(tokenId);

        _ownedTokensCount[owner].decrement();
        _tokenOwner[tokenId] = address(0);

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Internal function to burn a specific token.
     * Reverts if the token does not exist.
     * @param tokenId uint256 ID of the token being burned
     */
    function _burn(uint256 tokenId) internal {
        _burn(ownerOf(tokenId), tokenId);
    }

    /**
     * @dev Internal function to transfer ownership of a given token ID to another address.
     * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     * @param from current owner of the token
     * @param to address to receive the ownership of the given token ID
     * @param tokenId uint256 ID of the token to be transferred
     */
    function _transferFrom(address from, address to, uint256 tokenId) internal {
        require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _clearApproval(tokenId);

        _ownedTokensCount[from].decrement();
        _ownedTokensCount[to].increment();

        _tokenOwner[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * This is an internal detail of the `ERC721` contract and its use is deprecated.
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        internal returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = to.call(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ));
        if (!success) {
            if (returndata.length > 0) {
                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert("ERC721: transfer to non ERC721Receiver implementer");
            }
        } else {
            bytes4 retval = abi.decode(returndata, (bytes4));
            return (retval == _ERC721_RECEIVED);
        }
    }

    /**
     * @dev Private function to clear current approval of a given token ID.
     * @param tokenId uint256 ID of the token to be transferred
     */
    function _clearApproval(uint256 tokenId) private {
        if (_tokenApprovals[tokenId] != address(0)) {
            _tokenApprovals[tokenId] = address(0);
        }
    }
}

File 16 of 24 : ERC721Enumerable.sol
pragma solidity ^0.5.0;

import "../../GSN/Context.sol";
import "./IERC721Enumerable.sol";
import "./ERC721.sol";
import "../../introspection/ERC165.sol";

/**
 * @title ERC-721 Non-Fungible Token with optional enumeration extension logic
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721Enumerable is Context, ERC165, ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => uint256[]) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

    /**
     * @dev Constructor function.
     */
    constructor () public {
        // register the supported interface to conform to ERC721Enumerable via ERC165
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

    /**
     * @dev Gets the token ID at a given index of the tokens list of the requested owner.
     * @param owner address owning the tokens list to be accessed
     * @param index uint256 representing the index to be accessed of the requested tokens list
     * @return uint256 token ID at the given index of the tokens list owned by the requested address
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
        require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev Gets the total amount of tokens stored by the contract.
     * @return uint256 representing the total amount of tokens
     */
    function totalSupply() public view returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev Gets the token ID at a given index of all the tokens in this contract
     * Reverts if the index is greater or equal to the total number of tokens.
     * @param index uint256 representing the index to be accessed of the tokens list
     * @return uint256 token ID at the given index of the tokens list
     */
    function tokenByIndex(uint256 index) public view returns (uint256) {
        require(index < totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Internal function to transfer ownership of a given token ID to another address.
     * As opposed to transferFrom, this imposes no restrictions on msg.sender.
     * @param from current owner of the token
     * @param to address to receive the ownership of the given token ID
     * @param tokenId uint256 ID of the token to be transferred
     */
    function _transferFrom(address from, address to, uint256 tokenId) internal {
        super._transferFrom(from, to, tokenId);

        _removeTokenFromOwnerEnumeration(from, tokenId);

        _addTokenToOwnerEnumeration(to, tokenId);
    }

    /**
     * @dev Internal function to mint a new token.
     * Reverts if the given token ID already exists.
     * @param to address the beneficiary that will own the minted token
     * @param tokenId uint256 ID of the token to be minted
     */
    function _mint(address to, uint256 tokenId) internal {
        super._mint(to, tokenId);

        _addTokenToOwnerEnumeration(to, tokenId);

        _addTokenToAllTokensEnumeration(tokenId);
    }

    /**
     * @dev Internal function to burn a specific token.
     * Reverts if the token does not exist.
     * Deprecated, use {ERC721-_burn} instead.
     * @param owner owner of the token to burn
     * @param tokenId uint256 ID of the token being burned
     */
    function _burn(address owner, uint256 tokenId) internal {
        super._burn(owner, tokenId);

        _removeTokenFromOwnerEnumeration(owner, tokenId);
        // Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund
        _ownedTokensIndex[tokenId] = 0;

        _removeTokenFromAllTokensEnumeration(tokenId);
    }

    /**
     * @dev Gets the list of token IDs of the requested owner.
     * @param owner address owning the tokens
     * @return uint256[] List of token IDs owned by the requested address
     */
    function _tokensOfOwner(address owner) internal view returns (uint256[] storage) {
        return _ownedTokens[owner];
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        _ownedTokensIndex[tokenId] = _ownedTokens[to].length;
        _ownedTokens[to].push(tokenId);
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        _ownedTokens[from].length--;

        // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by
        // lastTokenId, or just over the end of the array if the token was the last one).
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length.sub(1);
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        _allTokens.length--;
        _allTokensIndex[tokenId] = 0;
    }
}

File 17 of 24 : ERC721Metadata.sol
pragma solidity ^0.5.0;

import "../../GSN/Context.sol";
import "./ERC721.sol";
import "./IERC721Metadata.sol";
import "../../introspection/ERC165.sol";

contract ERC721Metadata is Context, ERC165, ERC721, IERC721Metadata {
    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Base URI
    string private _baseURI;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

    /**
     * @dev Constructor function
     */
    constructor (string memory name, string memory symbol) public {
        _name = name;
        _symbol = symbol;

        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
    }

    /**
     * @dev Gets the token name.
     * @return string representing the token name
     */
    function name() external view returns (string memory) {
        return _name;
    }

    /**
     * @dev Gets the token symbol.
     * @return string representing the token symbol
     */
    function symbol() external view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the URI for a given token ID. May return an empty string.
     *
     * If the token's URI is non-empty and a base URI was set (via
     * {_setBaseURI}), it will be added to the token ID's URI as a prefix.
     *
     * Reverts if the token ID does not exist.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];

        // Even if there is a base URI, it is only appended to non-empty token-specific URIs
        if (bytes(_tokenURI).length == 0) {
            return "";
        } else {
            // abi.encodePacked is being used to concatenate strings
            return string(abi.encodePacked(_baseURI, _tokenURI));
        }
    }

    /**
     * @dev Internal function to set the token URI for a given token.
     *
     * Reverts if the token ID does not exist.
     *
     * TIP: if all token IDs share a prefix (e.g. if your URIs look like
     * `http://api.myproject.com/token/<id>`), use {_setBaseURI} to store
     * it and save gas.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI}.
     *
     * _Available since v2.5.0._
     */
    function _setBaseURI(string memory baseURI) internal {
        _baseURI = baseURI;
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a preffix in {tokenURI} to each token's URI, when
    * they are non-empty.
    *
    * _Available since v2.5.0._
    */
    function baseURI() external view returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev Internal function to burn a specific token.
     * Reverts if the token does not exist.
     * Deprecated, use _burn(uint256) instead.
     * @param owner owner of the token to burn
     * @param tokenId uint256 ID of the token being burned by the msg.sender
     */
    function _burn(address owner, uint256 tokenId) internal {
        super._burn(owner, tokenId);

        // Clear metadata (if any)
        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
    }
}

File 18 of 24 : IERC721.sol
pragma solidity ^0.5.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
contract IERC721 is IERC165 {
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of NFTs in `owner`'s account.
     */
    function balanceOf(address owner) public view returns (uint256 balance);

    /**
     * @dev Returns the owner of the NFT specified by `tokenId`.
     */
    function ownerOf(uint256 tokenId) public view returns (address owner);

    /**
     * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
     * another (`to`).
     *
     *
     *
     * Requirements:
     * - `from`, `to` cannot be zero.
     * - `tokenId` must be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this
     * NFT by either {approve} or {setApprovalForAll}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public;
    /**
     * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
     * another (`to`).
     *
     * Requirements:
     * - If the caller is not `from`, it must be approved to move this NFT by
     * either {approve} or {setApprovalForAll}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public;
    function approve(address to, uint256 tokenId) public;
    function getApproved(uint256 tokenId) public view returns (address operator);

    function setApprovalForAll(address operator, bool _approved) public;
    function isApprovedForAll(address owner, address operator) public view returns (bool);


    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
}

File 19 of 24 : IERC721Receiver.sol
pragma solidity ^0.5.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
contract IERC721Receiver {
    /**
     * @notice Handle the receipt of an NFT
     * @dev The ERC721 smart contract calls this function on the recipient
     * after a {IERC721-safeTransferFrom}. This function MUST return the function selector,
     * otherwise the caller will revert the transaction. The selector to be
     * returned can be obtained as `this.onERC721Received.selector`. This
     * function MAY throw to revert and reject the transfer.
     * Note: the ERC721 contract address is always the message sender.
     * @param operator The address which called `safeTransferFrom` function
     * @param from The address which previously owned the token
     * @param tokenId The NFT identifier which is being transferred
     * @param data Additional data with no specified format
     * @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
    public returns (bytes4);
}

File 20 of 24 : Counters.sol
pragma solidity ^0.5.0;

import "../math/SafeMath.sol";

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}

File 21 of 24 : ERC165.sol
pragma solidity ^0.5.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

File 22 of 24 : IERC165.sol
pragma solidity ^0.5.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 23 of 24 : IERC721Enumerable.sol
pragma solidity ^0.5.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
contract IERC721Enumerable is IERC721 {
    function totalSupply() public view returns (uint256);
    function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId);

    function tokenByIndex(uint256 index) public view returns (uint256);
}

File 24 of 24 : IERC721Metadata.sol
pragma solidity ^0.5.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
contract IERC721Metadata is IERC721 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"ethPriceSourceAddress","type":"address"},{"internalType":"uint256","name":"minimumCollateralPercentage","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"_mai","type":"address"},{"internalType":"address","name":"_collateral","type":"address"},{"internalType":"string","name":"baseURI","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BorrowToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultID","type":"uint256"},{"indexed":false,"internalType":"address","name":"creator","type":"address"}],"name":"CreateVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultID","type":"uint256"}],"name":"DestroyVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultID","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"debtRepaid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collateralLiquidated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"closingFee","type":"uint256"}],"name":"LiquidateVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"closingFee","type":"uint256"}],"name":"PayBackToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultID","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"TransferVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"vaultID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawCollateral","type":"event"},{"constant":true,"inputs":[],"name":"_minimumCollateralPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"borrowToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"ethPriceSourceAddress","type":"address"}],"name":"changeEthPriceSource","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"}],"name":"checkCollateralPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"}],"name":"checkCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"}],"name":"checkExtract","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"}],"name":"checkLiquidation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"closingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"collateral","outputs":[{"internalType":"contract ERC20Detailed","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"createVault","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"debtRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositCollateral","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"}],"name":"destroyVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ethPriceSource","outputs":[{"internalType":"contract PriceSource","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gainRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getClosingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getDebtCeiling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getEthPriceSource","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getOpeningFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"getPaid","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getTokenPriceSource","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"}],"name":"liquidateVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"mai","outputs":[{"internalType":"contract ERC20Detailed","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maticDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"openingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"payBackToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"priceSourceDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setClosingFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_debtRatio","type":"uint256"}],"name":"setDebtRatio","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_gainRatio","type":"uint256"}],"name":"setGainRatio","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"minimumCollateralPercentage","type":"uint256"}],"name":"setMinCollateralRatio","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setOpeningFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"setStabilityPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setTokenURI","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_treasury","type":"uint256"}],"name":"setTreasury","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"stabilityPool","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenPeg","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"treasury","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vaultCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vaultCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vaultDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"vaultID","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawCollateral","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162004bb838038062004bb8833981810160405260e08110156200003757600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200006357600080fd5b9083019060208201858111156200007957600080fd5b82516401000000008111828201881017156200009457600080fd5b82525081516020918201929091019080838360005b83811015620000c3578181015183820152602001620000a9565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b9083019060208201858111156200012b57600080fd5b82516401000000008111828201881017156200014657600080fd5b82525081516020918201929091019080838360005b83811015620001755781810151838201526020016200015b565b50505050905090810190601f168015620001a35780820380516001836020036101000a031916815260200191505b50604081815260208301519083015160609093018051919593949293929184640100000000821115620001d557600080fd5b908301906020820185811115620001eb57600080fd5b82516401000000008111828201881017156200020657600080fd5b82525081516020918201929091019080838360005b83811015620002355781810151838201526020016200021b565b50505050905090810190601f168015620002635780820380516001836020036101000a031916815260200191505b5060405250506000805460ff19166001179055508686868686868684848282828181620002a06301ffc9a760e01b6001600160e01b036200043116565b620002bb6380ac58cd60e01b6001600160e01b036200043116565b620002d663780e9d6360e01b6001600160e01b036200043116565b8151620002eb90600a906020850190620004be565b5080516200030190600b906020840190620004be565b506200031d635b5e139f60e01b6001600160e01b036200043116565b50508251620003369250600e91506020840190620004be565b505050506001600160a01b0387166200034b57fe5b856200035357fe5b50603260125560006013819055600f80546001600160a01b03199081166001600160a01b03998a1617909155601a8054821690556305f5e100601555600260185561044c601955601096909655601b8054871692881692909217909155601c8054909516919095161790925550506008601d55620003d0620004b9565b602080546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3505060006014555062000560945050505050565b6001600160e01b0319808216141562000491576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b335b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200050157805160ff191683800117855562000531565b8280016001018555821562000531579182015b828111156200053157825182559160200191906001019062000514565b506200053f92915062000543565b5090565b620004bb91905b808211156200053f57600081556001016200054a565b61464880620005706000396000f3fe608060405234801561001057600080fd5b50600436106104215760003560e01c806385e290a311610235578063c87b56dd11610135578063df987846116100c8578063eac989f811610097578063ece137321161007c578063ece1373214610bba578063f2fde38b14610bdd578063ffc73da714610c0357610421565b8063eac989f814610b95578063eb6a887d14610b9d57610421565b8063df98784614610a9c578063e0df5b6f14610ab9578063e5f4dc9214610b5f578063e985e9c514610b6757610421565b8063cf41d6f811610104578063cf41d6f814610a52578063d310f49b14610a5a578063d4a9b2c514610a77578063d8dfeb4514610a9457610421565b8063c87b56dd14610a1d578063cd44db1b14610a3a578063cdfedd6314610a42578063cea55f5714610a4a57610421565b806398d721e0116101c8578063ab806f1511610197578063b86f6aef1161017c578063b86f6aef14610932578063b88d4fde1461094f578063c71abb3214610a1557610421565b8063ab806f1514610904578063b165ff0b1461090c57610421565b806398d721e0146108a0578063a22cb465146108c6578063a5e98837146108f4578063a7c6a100146108fc57610421565b806390cf0bba1161020457806390cf0bba1461086b57806394cd4ba71461088857806395d89b411461089057806398c3f2db1461089857610421565b806385e290a314610821578063863759941461083e5780638da5cb5b1461085b5780638f32d59b1461086357610421565b806342966c681161034057806361d027b3116102d35780637139c929116102a2578063728bbbb511610287578063728bbbb5146107d3578063767a7b05146107db57806385af3c16146107fe57610421565b80637139c929146107ae578063715018a6146107cb57610421565b806361d027b31461075b5780636352211e146107635780636c0360eb1461078057806370a082311461078857610421565b80634f6ccce71161030f5780634f6ccce71461071157806356572ac01461072e578063570b2b841461074b5780635d12928b1461075357610421565b806342966c68146106c757806342f371c6146106e45780634c19386c146106ec5780634f558e79146106f457610421565b806318160ddd116103b8578063311f392a11610387578063311f392a1461064f57806338536275146106575780633db991771461067457806342842e0e1461069157610421565b806318160ddd146105dd5780631c883e7b146105e557806323b872dd146105ed5780632f745c591461062357610421565b8063081812fc116103f4578063081812fc1461054257806308ec59271461055f578063095ea7b31461058257806311b4a832146105ae57610421565b806301ffc9a714610426578063048c661d1461047957806306fdde031461049d578063079605321461051a575b600080fd5b6104656004803603602081101561043c57600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610c20565b604080519115158252519081900360200190f35b610481610c5b565b604080516001600160a01b039092168252519081900360200190f35b6104a5610c6a565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104df5781810151838201526020016104c7565b50505050905090810190601f16801561050c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105406004803603602081101561053057600080fd5b50356001600160a01b0316610d01565b005b6104816004803603602081101561055857600080fd5b5035610d89565b6105406004803603604081101561057557600080fd5b5080359060200135610deb565b6105406004803603604081101561059857600080fd5b506001600160a01b03813516906020013561104f565b6105cb600480360360208110156105c457600080fd5b5035611184565b60408051918252519081900360200190f35b6105cb611255565b6105cb61125b565b6105406004803603606081101561060357600080fd5b506001600160a01b03813581169160208101359091169060400135611261565b6105cb6004803603604081101561063957600080fd5b506001600160a01b0381351690602001356112bd565b6105cb61133d565b6105406004803603602081101561066d57600080fd5b5035611343565b6105406004803603602081101561068a57600080fd5b50356113a1565b610540600480360360608110156106a757600080fd5b506001600160a01b038135811691602081013590911690604001356113ff565b610540600480360360208110156106dd57600080fd5b503561141a565b61048161150e565b6105cb61151d565b6104656004803603602081101561070a57600080fd5b5035611523565b6105cb6004803603602081101561072757600080fd5b503561152e565b6105cb6004803603602081101561074457600080fd5b5035611594565b610481611650565b6105cb61165f565b6105cb6116cd565b6104816004803603602081101561077957600080fd5b50356116d3565b6104a5611727565b6105cb6004803603602081101561079e57600080fd5b50356001600160a01b0316611788565b610540600480360360208110156107c457600080fd5b50356117f0565b61054061189f565b6105cb61194f565b610540600480360360408110156107f157600080fd5b5080359060200135611955565b6105406004803603604081101561081457600080fd5b5080359060200135611bbf565b6105406004803603602081101561083757600080fd5b5035611e15565b6105406004803603602081101561085457600080fd5b503561203e565b61048161209c565b6104656120ab565b6105406004803603602081101561088157600080fd5b50356120d1565b6105cb6124ad565b6104a5612529565b6105cb61258a565b610540600480360360208110156108b657600080fd5b50356001600160a01b0316612610565b610540600480360360408110156108dc57600080fd5b506001600160a01b0381351690602001351515612698565b6105cb61279d565b6105cb6127a3565b6105cb6127a9565b6105cb6004803603602081101561092257600080fd5b50356001600160a01b03166127af565b6104656004803603602081101561094857600080fd5b50356127c1565b6105406004803603608081101561096557600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156109a057600080fd5b8201836020820111156109b257600080fd5b803590602001918460018302840111640100000000831117156109d457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506128a8945050505050565b6105cb612906565b6104a560048036036020811015610a3357600080fd5b503561290c565b6105cb6129b2565b6105cb6129b8565b6105cb6129be565b6105406129c4565b6105cb60048036036020811015610a7057600080fd5b5035612ac6565b6105cb60048036036020811015610a8d57600080fd5b5035612ad8565b610481612aea565b6105cb60048036036020811015610ab257600080fd5b5035612af9565b61054060048036036020811015610acf57600080fd5b810190602081018135640100000000811115610aea57600080fd5b820183602082011115610afc57600080fd5b80359060200191846001830284011164010000000083111715610b1e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612bc2945050505050565b6105cb612c32565b61046560048036036040811015610b7d57600080fd5b506001600160a01b0381358116916020013516612c38565b6104a5612c66565b61054060048036036020811015610bb357600080fd5b5035612cf4565b61054060048036036040811015610bd057600080fd5b5080359060200135612d52565b61054060048036036020811015610bf357600080fd5b50356001600160a01b0316612dfc565b61054060048036036020811015610c1957600080fd5b5035612e61565b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526001602052604090205460ff165b919050565b601a546001600160a01b031681565b600a8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b820191906000526020600020905b815481529060010190602001808311610cd957829003601f168201915b505050505090505b90565b610d096120ab565b610d5a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000610d9482612ebf565b610dcf5760405162461bcd60e51b815260040180806020018281038252602c815260200180614466602c913960400191505060405180910390fd5b506000908152600360205260409020546001600160a01b031690565b81610df581612ebf565b610e3d576040805162461bcd60e51b815260206004820152601460248201527315985d5b1d08191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b33610e47826116d3565b6001600160a01b031614610ea2576040805162461bcd60e51b815260206004820152601960248201527f5661756c74206973206e6f74206f776e656420627920796f7500000000000000604482015290519081900360640190fd5b60008211610ef7576040805162461bcd60e51b815260206004820152601b60248201527f4d75737420626f72726f77206e6f6e2d7a65726f20616d6f756e740000000000604482015290519081900360640190fd5b610eff6124ad565b821115610f3d5760405162461bcd60e51b815260040180806020018281038252602f8152602001806142f5602f913960400191505060405180910390fd5b600083815260176020526040812054610f5c908463ffffffff612edc16565b6000858152601760205260409020549091508111610f7657fe5b600084815260166020526040902054610f8f9082612f3d565b610fca5760405162461bcd60e51b815260040180806020018281038252603a8152602001806144bb603a913960400191505060405180910390fd5b6000848152601760205260409020819055601c54610ff8906001600160a01b0316338563ffffffff612f7216565b601e5461100b908263ffffffff612edc16565b601e55604080518581526020810185905281517f3e08df88d8e28f37df9bf227d3142ac506a364403445661a60891a49ed6792ca929181900390910190a150505050565b600061105a826116d3565b9050806001600160a01b0316836001600160a01b031614156110ad5760405162461bcd60e51b81526004018080602001828103825260218152602001806144f56021913960400191505060405180910390fd5b806001600160a01b03166110bf612ff2565b6001600160a01b031614806110e057506110e0816110db612ff2565b612c38565b61111b5760405162461bcd60e51b81526004018080602001828103825260388152602001806143556038913960400191505060405180910390fd5b600082815260036020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60008181526016602052604081205415806111ab5750600082815260176020526040902054155b806111bc57506111ba826127c1565b155b156111c957506000610c56565b600082815260166020908152604080832054601790925282205482916111ee91612ff6565b91509150806000141561120657600092505050610c56565b6000611218838363ffffffff6131ac16565b9050611232601d54600a0a836131ac90919063ffffffff16565b9150600061124b601854846131ac90919063ffffffff16565b9695505050505050565b60085490565b60125481565b61127261126c612ff2565b826131ee565b6112ad5760405162461bcd60e51b81526004018080602001828103825260318152602001806145466031913960400191505060405180910390fd5b6112b883838361328a565b505050565b60006112c883611788565b82106113055760405162461bcd60e51b815260040180806020018281038252602b8152602001806141fd602b913960400191505060405180910390fd5b6001600160a01b038316600090815260066020526040902080548390811061132957fe5b906000526020600020015490505b92915050565b60195481565b61134b6120ab565b61139c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601055565b6113a96120ab565b6113fa576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601255565b6112b8838383604051806020016040528060008152506128a8565b6114226120ab565b611473576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601c54604080517fa9059cbb0000000000000000000000000000000000000000000000000000000081526000600482018190526024820185905291516001600160a01b039093169263a9059cbb92604480840193602093929083900390910190829087803b1580156114e457600080fd5b505af11580156114f8573d6000803e3d6000fd5b505050506040513d60208110156112b857600080fd5b600f546001600160a01b031681565b601e5481565b600061133782612ebf565b6000611538611255565b82106115755760405162461bcd60e51b815260040180806020018281038252602c815260200180614577602c913960400191505060405180910390fd5b6008828154811061158257fe5b90600052602060002001549050919050565b60008181526016602052604081205415806115b557506115b3826127c1565b155b156115c257506000610c56565b600082815260166020908152604080832054601790925282205482916115e791612ff6565b915091506000611602601854836131ac90919063ffffffff16565b9050806116155760009350505050610c56565b61164761162061258a565b61163b6103e861163b601954866132a990919063ffffffff16565b9063ffffffff6131ac16565b95945050505050565b601c546001600160a01b031681565b60115460009061167681600163ffffffff612edc16565b601181905581111561168457fe5b61168e3382613302565b6040805182815233602082015281517f8b6c1d05c678fa59695e26465a85918ce0fc63a88f74af53d1daef8f0a9c7804929181900390910190a1905090565b60145481565b6000818152600260205260408120546001600160a01b0316806113375760405162461bcd60e51b81526004018080602001828103825260298152602001806143de6029913960400191505060405180910390fd5b600c8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b60006001600160a01b0382166117cf5760405162461bcd60e51b815260040180806020018281038252602a8152602001806143b4602a913960400191505060405180910390fd5b6001600160a01b03821660009081526004602052604090206113379061331f565b6117f86120ab565b611849576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61185281612ebf565b61189a576040805162461bcd60e51b815260206004820152601460248201527315985d5b1d08191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b601455565b6118a76120ab565b6118f8576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6020546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36020805473ffffffffffffffffffffffffffffffffffffffff19169055565b60135481565b8161195f81612ebf565b6119a7576040805162461bcd60e51b815260206004820152601460248201527315985d5b1d08191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b336119b1826116d3565b6001600160a01b031614611a0c576040805162461bcd60e51b815260206004820152601960248201527f5661756c74206973206e6f74206f776e656420627920796f7500000000000000604482015290519081900360640190fd5b60005460ff16611a63576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6000805460ff1916815583815260166020526040902054821115611ab85760405162461bcd60e51b81526004018080602001828103825260258152602001806142a46025913960400191505060405180910390fd5b600083815260166020526040812054611ad7908463ffffffff61332316565b60008581526017602052604090205490915015611b4357600084815260176020526040902054611b08908290612f3d565b611b435760405162461bcd60e51b815260040180806020018281038252603e815260200180614407603e913960400191505060405180910390fd5b6000848152601660205260409020819055601b54611b71906001600160a01b0316338563ffffffff612f7216565b604080518581526020810185905281517f6c0ea3bea9dd66afa8f9d39d6eb93d833466190330813b42835efc650dca4cb9929181900390910190a150506000805460ff191660011790555050565b601c54604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611c0957600080fd5b505afa158015611c1d573d6000803e3d6000fd5b505050506040513d6020811015611c3357600080fd5b50511015611c88576040805162461bcd60e51b815260206004820152601560248201527f546f6b656e2062616c616e636520746f6f206c6f770000000000000000000000604482015290519081900360640190fd5b600082815260176020526040902054811115611cd55760405162461bcd60e51b815260040180806020018281038252602781526020018061438d6027913960400191505060405180910390fd5b6000611d13611cf4612710611ce861258a565b9063ffffffff6132a916565b61163b611cff6129b2565b601254611ce890879063ffffffff6132a916565b601c54909150611d34906001600160a01b031633308563ffffffff61336516565b600083815260176020526040902054611d53908363ffffffff61332316565b600084815260176020908152604080832093909355601690522054611d7e908263ffffffff61332316565b6000848152601660205260408082209290925560145481522054611da8908263ffffffff612edc16565b601454600090815260166020526040902055601e54611dcd908363ffffffff61332316565b601e55604080518481526020810184905280820183905290517f31f96762af4051f367185773cc2f55bfb112a6c114b3407ded1f321a9eb199ac9181900360600190a1505050565b80611e1f81612ebf565b611e67576040805162461bcd60e51b815260206004820152601460248201527315985d5b1d08191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b33611e71826116d3565b6001600160a01b031614611ecc576040805162461bcd60e51b815260206004820152601960248201527f5661756c74206973206e6f74206f776e656420627920796f7500000000000000604482015290519081900360640190fd5b60005460ff16611f23576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6000805460ff191681558281526017602052604090205415611f8c576040805162461bcd60e51b815260206004820152601a60248201527f5661756c7420686173206f75747374616e64696e672064656274000000000000604482015290519081900360640190fd5b60008281526016602052604090205415611fd457611fd4611fac836116d3565b600084815260166020526040902054601b546001600160a01b0316919063ffffffff612f7216565b611fdd826133ed565b60008281526016602090815260408083208390556017825280832092909255815184815291517f4fe08624ee65b341c38ab9693d216b909d4ddee1bc8d3fe0fea14026c361b4659281900390910190a150506000805460ff19166001179055565b6120466120ab565b612097576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601355565b6020546001600160a01b031690565b6020546000906001600160a01b03166120c2612ff2565b6001600160a01b031614905090565b6120da81612ebf565b612122576040805162461bcd60e51b815260206004820152601460248201527315985d5b1d08191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b601a546001600160a01b031615806121445750601a546001600160a01b031633145b61217f5760405162461bcd60e51b81526004018080602001828103825260228152602001806145f26022913960400191505060405180910390fd5b600081815260166020908152604080832054601790925282205482916121a491612ff6565b909250905060006121bb838363ffffffff6131ac16565b905060105481106121fd5760405162461bcd60e51b81526004018080602001828103825260308152602001806145166030913960400191505060405180910390fd5b601d54612214908390600a0a63ffffffff6131ac16565b9150600061222d601854846131ac90919063ffffffff16565b601c54604080516370a0823160e01b8152336004820152905192935083926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561227d57600080fd5b505afa158015612291573d6000803e3d6000fd5b505050506040513d60208110156122a757600080fd5b505110156122e65760405162461bcd60e51b81526004018080602001828103825260318152602001806143246031913960400191505060405180910390fd5b601c54612304906001600160a01b031633308463ffffffff61336516565b601e54612317908263ffffffff61332316565b601e55600061232586611594565b600087815260176020526040902054909150612347908363ffffffff61332316565b60008781526017602052604081209190915561238961236a612710611ce861258a565b61163b6123756129b2565b601254611ce890889063ffffffff6132a916565b6000888152601660205260409020549091506123ab908263ffffffff61332316565b60008881526016602052604080822092909255601454815220546123d5908263ffffffff612edc16565b601454600090815260166020526040808220929092558881522054612400908363ffffffff61332316565b600088815260166020908152604080832093909355338252601f9052205461242e908363ffffffff612edc16565b336000908152601f60205260409020557f4d151d3a98b83151d51917640c221f8c8e3c054422ea1b48dcbbd57e3f4210d587612469816116d3565b604080519283526001600160a01b0390911660208301523382820152606082018690526080820185905260a08201849052519081900360c00190a150505050505050565b601c54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156124f857600080fd5b505afa15801561250c573d6000803e3d6000fd5b505050506040513d602081101561252257600080fd5b5051905090565b600b8054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610cf65780601f10610ccb57610100808354040283529160200191610cf6565b600080600f60009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156125db57600080fd5b505afa1580156125ef573d6000803e3d6000fd5b505050506040513d60a081101561260557600080fd5b506020015191505090565b6126186120ab565b612669576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601a805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6126a0612ff2565b6001600160a01b0316826001600160a01b03161415612706576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000612713612ff2565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155612757612ff2565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b60125490565b60115481565b60135490565b601f6020526000908152604090205481565b60006127cc82612ebf565b612814576040805162461bcd60e51b815260206004820152601460248201527315985d5b1d08191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b600082815260166020526040902054158061283b5750600082815260176020526040902054155b1561284857506000610c56565b6000828152601660209081526040808320546017909252822054829161286d91612ff6565b90925090506000612884838363ffffffff6131ac16565b905060105481101561289c5760019350505050610c56565b60009350505050610c56565b6128b96128b3612ff2565b836131ee565b6128f45760405162461bcd60e51b81526004018080602001828103825260318152602001806145466031913960400191505060405180910390fd5b612900848484846133ff565b50505050565b601d5481565b606061291782612ebf565b61292057600080fd5b600e805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156129a65780601f1061297b576101008083540402835291602001916129a6565b820191906000526020600020905b81548152906001019060200180831161298957829003601f168201915b50505050509050919050565b60155490565b60155481565b60185481565b60005460ff16612a1b576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6000805460ff19168155338152601f6020526040902054612a83576040805162461bcd60e51b815260206004820152601c60248201527f446f6e2774206861766520616e797468696e6720666f7220796f752e00000000604482015290519081900360640190fd5b336000818152601f602052604081208054919055601b549091612ab6916001600160a01b0316908363ffffffff612f7216565b506000805460ff19166001179055565b60176020526000908152604090205481565b60166020526000908152604090205481565b601b546001600160a01b031681565b6000612b0482612ebf565b612b4c576040805162461bcd60e51b815260206004820152601460248201527315985d5b1d08191bd95cc81b9bdd08195e1a5cdd60621b604482015290519081900360640190fd5b6000828152601660205260409020541580612b735750600082815260176020526040902054155b15612b8057506000610c56565b60008281526016602090815260408083205460179092528220548291612ba591612ff6565b9092509050612bba828263ffffffff6131ac16565b949350505050565b612bca6120ab565b612c1b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b8051612c2e90600e906020840190614100565b5050565b60105481565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600e805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015612cec5780601f10612cc157610100808354040283529160200191612cec565b820191906000526020600020905b815481529060010190602001808311612ccf57829003601f168201915b505050505081565b612cfc6120ab565b612d4d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601855565b601b54612d70906001600160a01b031633308463ffffffff61336516565b600082815260166020526040812054612d8f908363ffffffff612edc16565b600084815260166020526040902054909150811015612daa57fe5b600083815260166020908152604091829020839055815185815290810184905281517f52c4e7127ec34e8fc95f09ce2d06b4f00acca12ccbcdfb246ef67ee6aefe068d929181900390910190a1505050565b612e046120ab565b612e55576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b612e5e81613451565b50565b612e696120ab565b612eba576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601955565b6000908152600260205260409020546001600160a01b0316151590565b600082820183811015612f36576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000806000612f4c8585612ff6565b90925090506000612f63838363ffffffff6131ac16565b60105411159695505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526112b89084906134ff565b3390565b60008061300161258a565b61300757fe5b61300f6129b2565b61301557fe5b6000613151613136601b60009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561306b57600080fd5b505afa15801561307f573d6000803e3d6000fd5b505050506040513d602081101561309557600080fd5b5051601c54604080517f313ce567000000000000000000000000000000000000000000000000000000008152905160ff909316926001600160a01b039092169163313ce56791600480820192602092909190829003018186803b1580156130fb57600080fd5b505afa15801561310f573d6000803e3d6000fd5b505050506040513d602081101561312557600080fd5b505160ff169063ffffffff61332316565b600a0a611ce861314461258a565b889063ffffffff6132a916565b90508481101561315d57fe5b600061317761316a6129b2565b869063ffffffff6132a916565b90508481101561318357fe5b600061319683606463ffffffff6132a916565b90508281116131a157fe5b969095509350505050565b6000612f3683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506136b7565b60006131f982612ebf565b6132345760405162461bcd60e51b815260040180806020018281038252602c8152602001806142c9602c913960400191505060405180910390fd5b600061323f836116d3565b9050806001600160a01b0316846001600160a01b0316148061327a5750836001600160a01b031661326f84610d89565b6001600160a01b0316145b80612bba5750612bba8185612c38565b613295838383613759565b61329f83826138aa565b6112b8828261399f565b6000826132b857506000611337565b828202828482816132c557fe5b0414612f365760405162461bcd60e51b81526004018080602001828103825260218152602001806144456021913960400191505060405180910390fd5b61330c82826139dd565b613316828261399f565b612c2e81613b1b565b5490565b6000612f3683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613b5f565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526129009085906134ff565b612e5e6133f9826116d3565b82613bb9565b61340a84848461328a565b61341684848484613c01565b6129005760405162461bcd60e51b81526004018080602001828103825260328152602001806142286032913960400191505060405180910390fd5b6001600160a01b0381166134965760405162461bcd60e51b815260040180806020018281038252602681526020018061425a6026913960400191505060405180910390fd5b6020546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b613511826001600160a01b0316613eb3565b613562576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106135a05780518252601f199092019160209182019101613581565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613602576040519150601f19603f3d011682016040523d82523d6000602084013e613607565b606091505b50915091508161365e576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156129005780806020019051602081101561367a57600080fd5b50516129005760405162461bcd60e51b815260040180806020018281038252602a8152602001806145c8602a913960400191505060405180910390fd5b600081836137435760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156137085781810151838201526020016136f0565b50505050905090810190601f1680156137355780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161374f57fe5b0495945050505050565b826001600160a01b031661376c826116d3565b6001600160a01b0316146137b15760405162461bcd60e51b81526004018080602001828103825260298152602001806144926029913960400191505060405180910390fd5b6001600160a01b0382166137f65760405162461bcd60e51b81526004018080602001828103825260248152602001806142806024913960400191505060405180910390fd5b6137ff81613eec565b6001600160a01b038316600090815260046020526040902061382090613f34565b6001600160a01b038216600090815260046020526040902061384190613f4b565b600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b0382166000908152600660205260408120546138d490600163ffffffff61332316565b60008381526007602052604090205490915080821461396f576001600160a01b038416600090815260066020526040812080548490811061391157fe5b906000526020600020015490508060066000876001600160a01b03166001600160a01b03168152602001908152602001600020838154811061394f57fe5b600091825260208083209091019290925591825260079052604090208190555b6001600160a01b038416600090815260066020526040902080549061399890600019830161417e565b5050505050565b6001600160a01b0390911660009081526006602081815260408084208054868652600784529185208290559282526001810183559183529091200155565b6001600160a01b038216613a38576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b613a4181612ebf565b15613a93576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6000818152600260209081526040808320805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155835260049091529020613adf90613f4b565b60405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b60008184841115613bb15760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156137085781810151838201526020016136f0565b505050900390565b613bc38282613f54565b6000818152600d60205260409020546002600019610100600184161502019091160415612c2e576000818152600d60205260408120612c2e916141a2565b6000613c15846001600160a01b0316613eb3565b613c2157506001612bba565b600060606001600160a01b0386167f150b7a0200000000000000000000000000000000000000000000000000000000613c58612ff2565b89888860405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613cd1578181015183820152602001613cb9565b50505050905090810190601f168015613cfe5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909a16999099178952518151919890975087965094509250829150849050835b60208310613d935780518252601f199092019160209182019101613d74565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613df5576040519150601f19603f3d011682016040523d82523d6000602084013e613dfa565b606091505b509150915081613e4b57805115613e145780518082602001fd5b60405162461bcd60e51b81526004018080602001828103825260328152602001806142286032913960400191505060405180910390fd5b6000818060200190516020811015613e6257600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149350612bba92505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590612bba575050151592915050565b6000818152600360205260409020546001600160a01b031615612e5e576000908152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055565b8054613f4790600163ffffffff61332316565b9055565b80546001019055565b613f5e8282613f80565b613f6882826138aa565b600081815260076020526040812055612c2e81614064565b816001600160a01b0316613f93826116d3565b6001600160a01b031614613fd85760405162461bcd60e51b81526004018080602001828103825260258152602001806145a36025913960400191505060405180910390fd5b613fe181613eec565b6001600160a01b038216600090815260046020526040902061400290613f34565b600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055518291906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60085460009061407b90600163ffffffff61332316565b6000838152600960205260408120546008805493945090928490811061409d57fe5b9060005260206000200154905080600883815481106140b857fe5b600091825260208083209091019290925582815260099091526040902082905560088054906140eb90600019830161417e565b50505060009182525060096020526040812055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061414157805160ff191683800117855561416e565b8280016001018555821561416e579182015b8281111561416e578251825591602001919060010190614153565b5061417a9291506141e2565b5090565b8154818355818111156112b8576000838152602090206112b89181019083016141e2565b50805460018160011615610100020316600290046000825580601f106141c85750612e5e565b601f016020900490600052602060002090810190612e5e91905b610cfe91905b8082111561417a57600081556001016141e856fe455243373231456e756d657261626c653a206f776e657220696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573735661756c7420646f6573206e6f74206861766520656e6f75676820636f6c6c61746572616c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e626f72726f77546f6b656e3a2043616e6e6f74206d696e74206f76657220617661696c61626c6520737570706c792e546f6b656e2062616c616e636520746f6f206c6f7720746f20706179206f6666206f75747374616e64696e6720646562744552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c5661756c742064656274206c657373207468616e20616d6f756e7420746f20706179206261636b4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e5769746864726177616c20776f756c6420707574207661756c742062656c6f77206d696e696d756d20636f6c6c61746572616c2070657263656e74616765536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e426f72726f7720776f756c6420707574207661756c742062656c6f77206d696e696d756d20636f6c6c61746572616c2070657263656e746167654552433732313a20617070726f76616c20746f2063757272656e74206f776e65725661756c74206973206e6f742062656c6f77206d696e696d756d20636f6c6c61746572616c2070657263656e746167654552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243373231456e756d657261626c653a20676c6f62616c20696e646578206f7574206f6620626f756e64734552433732313a206275726e206f6620746f6b656e2074686174206973206e6f74206f776e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565646c69717569646174696f6e2069732064697361626c656420666f72207075626c6963a265627a7a723158209f4ab9fb778f3039581f075202fdb6eb02e9c05d3ba7170c6f8095928d42ed7664736f6c634300051000320000000000000000000000003667ab1ebc668a3456a84a8371db3f222eb4af89000000000000000000000000000000000000000000000000000000000000008700000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000fb98b335551a418cd0737375a2ea0ded62ea213b000000000000000000000000637ec617c86d24e421328e6caea1d921148924390000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000000f7976444149204d4149205661756c740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000879764441494d5654000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e516d5775424a4376366e465672747a5879613776616262787770655763414a4537334e6d314479786f3576676135000000000000000000000000000000000000

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

0000000000000000000000003667ab1ebc668a3456a84a8371db3f222eb4af89000000000000000000000000000000000000000000000000000000000000008700000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000fb98b335551a418cd0737375a2ea0ded62ea213b000000000000000000000000637ec617c86d24e421328e6caea1d921148924390000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000000f7976444149204d4149205661756c740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000879764441494d5654000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e516d5775424a4376366e465672747a5879613776616262787770655763414a4537334e6d314479786f3576676135000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : ethPriceSourceAddress (address): 0x3667ab1ebc668a3456a84a8371db3f222eb4af89
Arg [1] : minimumCollateralPercentage (uint256): 135
Arg [2] : name (string): yvDAI MAI Vault
Arg [3] : symbol (string): yvDAIMVT
Arg [4] : _mai (address): 0xfb98b335551a418cd0737375a2ea0ded62ea213b
Arg [5] : _collateral (address): 0x637ec617c86d24e421328e6caea1d92114892439
Arg [6] : baseURI (string): QmWuBJCv6nFVrtzXya7vabbxwpeWcAJE73Nm1Dyxo5vga5

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000003667ab1ebc668a3456a84a8371db3f222eb4af89
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000087
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [4] : 000000000000000000000000fb98b335551a418cd0737375a2ea0ded62ea213b
Arg [5] : 000000000000000000000000637ec617c86d24e421328e6caea1d92114892439
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [7] : 000000000000000000000000000000000000000000000000000000000000000f
Arg [8] : 7976444149204d4149205661756c740000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [10] : 79764441494d5654000000000000000000000000000000000000000000000000
Arg [11] : 000000000000000000000000000000000000000000000000000000000000002e
Arg [12] : 516d5775424a4376366e465672747a5879613776616262787770655763414a45
Arg [13] : 37334e6d314479786f3576676135000000000000000000000000000000000000


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.