Contract 0xD12d6082811709287AE8b6d899Ab841659075FC3 2

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x53ed9432d2bde68c68eb2b136f0f2e8554848a40a8d5cdb692ed5b9dcc2a0648Join_Eth422300532022-07-07 12:57:304 hrs 41 mins ago0x802f69c5ed76d5ed04466977fe69e0a918a9f621 IN  0xd12d6082811709287ae8b6d899ab841659075fc30.991428299884868 FTM0.001442925089
0x15a38b59a1f596545ef3799c3681a932fa1037e50eeee695d5896b458739ef38Join_Eth422207932022-07-07 10:08:077 hrs 30 mins ago0xad5f8b809dd0d95edeb9ee0c129b3ca53ae4a93f IN  0xd12d6082811709287ae8b6d899ab841659075fc30.943584383835698 FTM0.0011733225
0x1c18b37a8e0f48db395f5b96bb3722c302d7a3e97556f311dbb71835c9659510Join_Eth422143842022-07-07 8:16:049 hrs 22 mins ago0x9bde0836d9f7386446a455684571e7694f9d909c IN  0xd12d6082811709287ae8b6d899ab841659075fc31.82586421312809 FTM0.005219300646
0xcf88f36075cad7e8f4050eebc0e65e92776812175158ce5725afac8c57a10ddeJoin_Eth409452592022-06-20 16:06:1117 days 1 hr ago0x187aba5b6d699c7fd206e9a5b234cc822de6d622 IN  0xd12d6082811709287ae8b6d899ab841659075fc31 FTM0.009618322922
0xd00a82845f835f2c97be7c23b1656ce41fe9f2ea81505f29ba22cb151030eb66Join_Eth409452592022-06-20 16:06:1117 days 1 hr ago0x187aba5b6d699c7fd206e9a5b234cc822de6d622 IN  0xd12d6082811709287ae8b6d899ab841659075fc31 FTM0.009674286443
0x96f54205f6f2b0f3dc7c444e6052221efeff1c02de073238be4038a31e69fb04Join_Eth409452592022-06-20 16:06:1117 days 1 hr ago0x187aba5b6d699c7fd206e9a5b234cc822de6d622 IN  0xd12d6082811709287ae8b6d899ab841659075fc31 FTM0.306854424591
0x01e667f131839837acd3556f8a5a5b91905c062afbdc7a16f87a6b1518978a0fJoin_Eth409443742022-06-20 15:48:4417 days 1 hr ago0x187aba5b6d699c7fd206e9a5b234cc822de6d622 IN  0xd12d6082811709287ae8b6d899ab841659075fc36 FTM0.003772746043
0x1d9377d0f05e5b95ccac0c05c95d6664c72ba16b38b0a4e4b2cd7ba84dae7d03Trigger Liquidat...400124742022-06-07 19:57:4929 days 21 hrs ago0x8442e4fcbba519b4f4c1ea1fce57a5379c55906c IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.050259956453
0x96622296198cbb541ee85174c39c04c5eff94b07c517c2ef5f770486e8b267caTrigger Liquidat...400124742022-06-07 19:57:4929 days 21 hrs ago0x8442e4fcbba519b4f4c1ea1fce57a5379c55906c IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.054857493874
0x88600f6af9cea828c7381b94d27224a2a60a2ddbaf1a0a35b22f77ccc693ea21Join_Eth373942702022-05-02 13:25:5266 days 4 hrs ago0x8442e4fcbba519b4f4c1ea1fce57a5379c55906c IN  0xd12d6082811709287ae8b6d899ab841659075fc35 FTM0.167169055504
0xdbe91643058a7aa99bf6313f3f27aed45ae428977ac9e0552ca6dd26a8dad463Exit_Eth360703062022-04-14 22:19:3883 days 19 hrs ago0x5e680b21a29bc6c3ec18c279bf74e759e570d722 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.121693604811
0x6954ab7f89d15a1693e9cb3b627332e699eb05986dfd38695a025db81fd8a04cExit_Eth360676942022-04-14 21:28:3683 days 20 hrs ago0x5e680b21a29bc6c3ec18c279bf74e759e570d722 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.06175240766
0x1bf5aa9e6a9313d22af727bd461182b8be97b6a6119d450e58b2226bb1649275Exit_Eth360557652022-04-14 18:01:1283 days 23 hrs ago0x5e680b21a29bc6c3ec18c279bf74e759e570d722 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.073329280048
0xce3c630745f9a74e830197d1499c336700ad654a5d6dc06c508fa2a32739f7caJoin_Eth360551682022-04-14 17:50:4283 days 23 hrs ago0x5e680b21a29bc6c3ec18c279bf74e759e570d722 IN  0xd12d6082811709287ae8b6d899ab841659075fc3271.6949482356332 FTM0.170901769338
0x4e1edb6f49b04fb65c7fb5b531bd232083995c627ce91c59d7eb4918cdd54d32Join_Eth346510242022-03-28 21:36:10100 days 20 hrs ago0x1be537ff2cc291caf8331efcd3466fe7d1c80d4b IN  0xd12d6082811709287ae8b6d899ab841659075fc30.5 FTM0.147890507215
0x13eadd1528bfc915b3f06ee86a85b4beaa2041488b621fbd36917abfb8a9ff4dJoin343291702022-03-25 3:15:45104 days 14 hrs ago0xd2bb66a9ee6995f561c339389f7b28bd5533cf48 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.036975254596
0x2eee842853f5b94984b2e862399ddff5b4984a577c94bfcdb3221ef0b4f332a9Trigger Liquidat...330237982022-03-10 5:30:39119 days 12 hrs ago0x8442e4fcbba519b4f4c1ea1fce57a5379c55906c IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.244012215091
0x68f48c6ca392305754c84f170a2f3f14051ca6675e9a82e790dfbb08d39ba844Join_Eth324196162022-03-03 7:06:32126 days 10 hrs ago0x44de10c759c352cfaf79bdbea442065b3448e8f3 IN  0xd12d6082811709287ae8b6d899ab841659075fc30.5 FTM0.409012747745
0x8dd72d03a7b47f6aa4ab745c8e938c0fda2a13007c18b26629af624c38eaaeaeTrigger Liquidat...301820532022-02-06 15:17:10151 days 2 hrs ago0x8442e4fcbba519b4f4c1ea1fce57a5379c55906c IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.084700198074
0x0c277408dae2ce10699da7628bfdec01983d686dd71b26bf383d4d3d1390dd49Exit301028032022-02-05 19:36:55151 days 22 hrs ago0xbfb7435bb5ab1464934b39f024c53293e5310aa5 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.071144517957
0xdfa4bc317b29fa1c6f97d409dbb2e9079b94c5cad8d5a972b723ada359e7c969Join301026642022-02-05 19:35:04151 days 22 hrs ago0xbfb7435bb5ab1464934b39f024c53293e5310aa5 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.064772858516
0xe761112000c39e68726079d427135b57dddb8ca64518ca15d0e1a32ae51de100Exit301024202022-02-05 19:31:34151 days 22 hrs ago0xbfb7435bb5ab1464934b39f024c53293e5310aa5 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.040446324022
0x000b2f75f930a05834e338c49bb7994a652fac7ccd4a0162d278c96964669f8bExit301023822022-02-05 19:31:05151 days 22 hrs ago0xbfb7435bb5ab1464934b39f024c53293e5310aa5 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.07763013498
0x38e01535da670ae05c67398a6bfe705f927f06ad568e56620df7b349f817f3fcExit301023782022-02-05 19:31:02151 days 22 hrs ago0xbfb7435bb5ab1464934b39f024c53293e5310aa5 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.07763013498
0x8d6f65224a8ff06a6226949f8c367750b5b29bd5f41d906fefd002b3eb5ca471Exit301016102022-02-05 19:21:01151 days 22 hrs ago0xbfb7435bb5ab1464934b39f024c53293e5310aa5 IN  0xd12d6082811709287ae8b6d899ab841659075fc30 FTM0.084797482159
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x53ed9432d2bde68c68eb2b136f0f2e8554848a40a8d5cdb692ed5b9dcc2a0648422300532022-07-07 12:57:304 hrs 41 mins ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token0.991428299884868239 FTM
0x15a38b59a1f596545ef3799c3681a932fa1037e50eeee695d5896b458739ef38422207932022-07-07 10:08:077 hrs 30 mins ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token0.94358438383569814 FTM
0x1c18b37a8e0f48db395f5b96bb3722c302d7a3e97556f311dbb71835c9659510422143842022-07-07 8:16:049 hrs 22 mins ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token1.825864213128090713 FTM
0xcf88f36075cad7e8f4050eebc0e65e92776812175158ce5725afac8c57a10dde409452592022-06-20 16:06:1117 days 1 hr ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token1 FTM
0xd00a82845f835f2c97be7c23b1656ce41fe9f2ea81505f29ba22cb151030eb66409452592022-06-20 16:06:1117 days 1 hr ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token1 FTM
0x96f54205f6f2b0f3dc7c444e6052221efeff1c02de073238be4038a31e69fb04409452592022-06-20 16:06:1117 days 1 hr ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token1 FTM
0x01e667f131839837acd3556f8a5a5b91905c062afbdc7a16f87a6b1518978a0f409443742022-06-20 15:48:4417 days 1 hr ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token6 FTM
0x88600f6af9cea828c7381b94d27224a2a60a2ddbaf1a0a35b22f77ccc693ea21373942702022-05-02 13:25:5266 days 4 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token5 FTM
0xdbe91643058a7aa99bf6313f3f27aed45ae428977ac9e0552ca6dd26a8dad463360703062022-04-14 22:19:3883 days 19 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc30x5e680b21a29bc6c3ec18c279bf74e759e570d722269.249597838220388161 FTM
0xdbe91643058a7aa99bf6313f3f27aed45ae428977ac9e0552ca6dd26a8dad463360703062022-04-14 22:19:3883 days 19 hrs ago Fantom Finance: Wrapped Fantom Token 0xd12d6082811709287ae8b6d899ab841659075fc3269.249597838220388161 FTM
0xce3c630745f9a74e830197d1499c336700ad654a5d6dc06c508fa2a32739f7ca360551682022-04-14 17:50:4283 days 23 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token271.6949482356332 FTM
0xce3c630745f9a74e830197d1499c336700ad654a5d6dc06c508fa2a32739f7ca360551682022-04-14 17:50:4283 days 23 hrs ago 0x5e680b21a29bc6c3ec18c279bf74e759e570d722 0xd12d6082811709287ae8b6d899ab841659075fc3271.6949482356332 FTM
0x4e1edb6f49b04fb65c7fb5b531bd232083995c627ce91c59d7eb4918cdd54d32346510242022-03-28 21:36:10100 days 20 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token0.5 FTM
0x4e1edb6f49b04fb65c7fb5b531bd232083995c627ce91c59d7eb4918cdd54d32346510242022-03-28 21:36:10100 days 20 hrs ago 0x1be537ff2cc291caf8331efcd3466fe7d1c80d4b 0xd12d6082811709287ae8b6d899ab841659075fc30.5 FTM
0x68f48c6ca392305754c84f170a2f3f14051ca6675e9a82e790dfbb08d39ba844324196162022-03-03 7:06:32126 days 10 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token0.5 FTM
0x68f48c6ca392305754c84f170a2f3f14051ca6675e9a82e790dfbb08d39ba844324196162022-03-03 7:06:32126 days 10 hrs ago 0x44de10c759c352cfaf79bdbea442065b3448e8f3 0xd12d6082811709287ae8b6d899ab841659075fc30.5 FTM
0x23fe7466262dc1c77ec85edf42cc3a3fb72fe1e5ae0e0e40009346754ccba43d301001352022-02-05 19:01:15151 days 22 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token3 FTM
0x23fe7466262dc1c77ec85edf42cc3a3fb72fe1e5ae0e0e40009346754ccba43d301001352022-02-05 19:01:15151 days 22 hrs ago 0xbfb7435bb5ab1464934b39f024c53293e5310aa5 0xd12d6082811709287ae8b6d899ab841659075fc33 FTM
0xb68c7b556c48a78eb68851458200f659079b661f4f496d52366c907f041be49e299439822022-02-04 4:12:44153 days 13 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token10 FTM
0xb68c7b556c48a78eb68851458200f659079b661f4f496d52366c907f041be49e299439822022-02-04 4:12:44153 days 13 hrs ago 0x46d242f22a28cc398b63f861effcfaaa2e2e18ca 0xd12d6082811709287ae8b6d899ab841659075fc310 FTM
0x1ebe3de77ecfd05dc432af34d89b255c26e67e592be9bb4405e59bea12382025296694942022-02-01 9:39:48156 days 7 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc3 Fantom Finance: Wrapped Fantom Token1 FTM
0x1ebe3de77ecfd05dc432af34d89b255c26e67e592be9bb4405e59bea12382025296694942022-02-01 9:39:48156 days 7 hrs ago 0x44de10c759c352cfaf79bdbea442065b3448e8f3 0xd12d6082811709287ae8b6d899ab841659075fc31 FTM
0xeea49a00028e1c7fe66d32841f48b7ae49966bbbbcedf89c3da16312b16c472a294834062022-01-30 12:48:05158 days 4 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc30x44de10c759c352cfaf79bdbea442065b3448e8f36 FTM
0xeea49a00028e1c7fe66d32841f48b7ae49966bbbbcedf89c3da16312b16c472a294834062022-01-30 12:48:05158 days 4 hrs ago Fantom Finance: Wrapped Fantom Token 0xd12d6082811709287ae8b6d899ab841659075fc36 FTM
0x3b9d6ce0958a3ee5d61daeca519d9a0f18a10e6d963dc41829ce44b1d12cfaf3283369812022-01-18 11:03:13170 days 6 hrs ago 0xd12d6082811709287ae8b6d899ab841659075fc30x12f3b7e31b853c526e77d62b96b47d830af6b4c68.9 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CDPManager01

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : CDPManager01.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;

import './BaseCDPManager.sol';

import '../interfaces/IOracleRegistry.sol';
import '../interfaces/IOracleUsd.sol';
import '../interfaces/IWETH.sol';
import '../interfaces/IVault.sol';
import '../interfaces/ICDPRegistry.sol';
import '../interfaces/vault-managers/parameters/IVaultManagerParameters.sol';
import '../interfaces/IVaultParameters.sol';
import '../interfaces/IToken.sol';

import '../helpers/ReentrancyGuard.sol';
import '../helpers/SafeMath.sol';

/**
 * @title CDPManager01
 **/
contract CDPManager01 is BaseCDPManager {
    using SafeMath for uint;

    address payable public immutable WETH;

    /**
     * @param _vaultManagerParameters The address of the contract with Vault manager parameters
     * @param _oracleRegistry The address of the oracle registry
     * @param _cdpRegistry The address of the CDP registry
     * @param _vaultManagerBorrowFeeParameters The address of the vault manager borrow fee parameters
     **/
    constructor(address _vaultManagerParameters, address _oracleRegistry, address _cdpRegistry, address _vaultManagerBorrowFeeParameters)
        BaseCDPManager(_vaultManagerParameters, _oracleRegistry, _cdpRegistry, _vaultManagerBorrowFeeParameters)
    {
        WETH = IVault(IVaultParameters(IVaultManagerParameters(_vaultManagerParameters).vaultParameters()).vault()).weth();
    }

    // only accept ETH via fallback from the WETH contract
    receive() external payable {
        require(msg.sender == WETH, "Unit Protocol: RESTRICTED");
    }

    /**
      * @notice Depositing tokens must be pre-approved to Vault address
      * @notice Borrow fee in USDP tokens must be pre-approved to CDP manager address
      * @notice position actually considered as spawned only when debt > 0
      * @dev Deposits collateral and/or borrows USDP
      * @param asset The address of the collateral
      * @param assetAmount The amount of the collateral to deposit
      * @param usdpAmount The amount of USDP token to borrow
      **/
    function join(address asset, uint assetAmount, uint usdpAmount) public nonReentrant checkpoint(asset, msg.sender) {
        require(usdpAmount != 0 || assetAmount != 0, "Unit Protocol: USELESS_TX");

        require(IToken(asset).decimals() <= 18, "Unit Protocol: NOT_SUPPORTED_DECIMALS");

        if (usdpAmount == 0) {

            vault.depositMain(asset, msg.sender, assetAmount);

        } else {

            _ensureOracle(asset);

            bool spawned = vault.debts(asset, msg.sender) != 0;

            if (!spawned) {
                // spawn a position
                vault.spawn(asset, msg.sender, oracleRegistry.oracleTypeByAsset(asset));
            }

            if (assetAmount != 0) {
                vault.depositMain(asset, msg.sender, assetAmount);
            }

            // mint USDP to owner
            vault.borrow(asset, msg.sender, usdpAmount);
            _chargeBorrowFee(asset, msg.sender, usdpAmount);

            // check collateralization
            _ensurePositionCollateralization(asset, msg.sender);

        }

        // fire an event
        emit Join(asset, msg.sender, assetAmount, usdpAmount);
    }

    /**
      * @dev Deposits ETH and/or borrows USDP
      * @param usdpAmount The amount of USDP token to borrow
      **/
    function join_Eth(uint usdpAmount) external payable {

        if (msg.value != 0) {
            IWETH(WETH).deposit{value: msg.value}();
            require(IWETH(WETH).transfer(msg.sender, msg.value), "Unit Protocol: WETH_TRANSFER_FAILED");
        }

        join(WETH, msg.value, usdpAmount);
    }

    /**
      * @notice Tx sender must have a sufficient USDP balance to pay the debt
      * @dev Withdraws collateral and repays specified amount of debt
      * @param asset The address of the collateral
      * @param assetAmount The amount of the collateral to withdraw
      * @param usdpAmount The amount of USDP to repay
      **/
    function exit(address asset, uint assetAmount, uint usdpAmount) public nonReentrant checkpoint(asset, msg.sender) returns (uint) {

        // check usefulness of tx
        require(assetAmount != 0 || usdpAmount != 0, "Unit Protocol: USELESS_TX");

        uint debt = vault.getTotalDebt(asset, msg.sender);

        // catch full repayment
        if (usdpAmount > debt) { usdpAmount = debt; }

        if (assetAmount == 0) {
            _repay(asset, msg.sender, usdpAmount);
        } else {
            _ensureOracle(asset);

            // withdraw collateral to the owner address
            vault.withdrawMain(asset, msg.sender, assetAmount);

            if (usdpAmount != 0) {
                _repay(asset, msg.sender, usdpAmount);
            }

          if (usdpAmount != debt) {
            vault.update(asset, msg.sender);
            _ensurePositionCollateralization(asset, msg.sender);
          }
        }

        // fire an event
        emit Exit(asset, msg.sender, assetAmount, usdpAmount);

        return usdpAmount;
    }

    /**
      * @notice Tx sender must have a sufficient USDP balance to pay the debt
      * @dev Withdraws collateral and repays all the debt
      * @param asset The address of the collateral
      * @param withdraw Whether the collateral be withdrawn or not
      **/
    function repayAll(address asset, bool withdraw) public nonReentrant checkpoint(asset, msg.sender) returns (uint) {

        uint debt = vault.debts(asset, msg.sender);
        uint fee = vault.getFee(asset, msg.sender);

        // check usefulness of tx
        require(debt != 0 || fee != 0, "Unit Protocol: USELESS_TX");

        if (fee != 0) {
            vault.chargeFee(vault.usdp(), msg.sender, fee);
        }

        if (debt != 0) {
            vault.repay(asset, msg.sender, debt);
        }

        uint assetAmount;

        if (withdraw) {
            assetAmount = vault.collaterals(asset, msg.sender);
            vault.withdrawMain(asset, msg.sender, assetAmount);
        }

        vault.destroy(asset, msg.sender);

        // fire an event
        emit Exit(asset, msg.sender, assetAmount, debt.add(fee));

        return debt.add(fee);
    }

    /**
      * @notice Withdraws WETH and converts to ETH
      * @param ethAmount ETH amount to withdraw
      * @param usdpAmount The amount of USDP token to repay
      **/
    function exit_Eth(uint ethAmount, uint usdpAmount) public returns (uint) {
        usdpAmount = exit(WETH, ethAmount, usdpAmount);
        require(IWETH(WETH).transferFrom(msg.sender, address(this), ethAmount), "Unit Protocol: WETH_TRANSFER_FROM_FAILED");
        IWETH(WETH).withdraw(ethAmount);
        (bool success, ) = msg.sender.call{value:ethAmount}("");
        require(success, "Unit Protocol: ETH_TRANSFER_FAILED");
        return usdpAmount;
    }

    function _ensurePositionCollateralization(address asset, address owner) internal view {
        // collateral value of the position in USD
        uint usdValue_q112 = getCollateralUsdValue_q112(asset, owner);

        // USD limit of the position
        uint usdLimit = usdValue_q112 * vaultManagerParameters.initialCollateralRatio(asset) / Q112 / 100;

        // revert if collateralization is not enough
        require(vault.getTotalDebt(asset, owner) <= usdLimit, "Unit Protocol: UNDERCOLLATERALIZED");
    }

    // Liquidation Trigger

    /**
     * @dev Triggers liquidation of a position
     * @param asset The address of the collateral token of a position
     * @param owner The owner of the position
     **/
    function triggerLiquidation(address asset, address owner) external nonReentrant {

        _ensureOracle(asset);

        // USD value of the collateral
        uint usdValue_q112 = getCollateralUsdValue_q112(asset, owner);

        // reverts if a position is not liquidatable
        require(_isLiquidatablePosition(asset, owner, usdValue_q112), "Unit Protocol: SAFE_POSITION");

        uint liquidationDiscount_q112 = usdValue_q112.mul(
            vaultManagerParameters.liquidationDiscount(asset)
        ).div(DENOMINATOR_1E5);

        uint initialLiquidationPrice = usdValue_q112.sub(liquidationDiscount_q112).div(Q112);

        // sends liquidation command to the Vault
        vault.triggerLiquidation(asset, owner, initialLiquidationPrice);

        // fire an liquidation event
        emit LiquidationTriggered(asset, owner);
    }

    function getCollateralUsdValue_q112(address asset, address owner) public view returns (uint) {
        return IOracleUsd(oracleRegistry.oracleByAsset(asset)).assetToUsd(asset, vault.collaterals(asset, owner));
    }

    function _ensureOracle(address asset) internal view {
        uint oracleType = oracleRegistry.oracleTypeByAsset(asset);
        require(oracleType != 0, "Unit Protocol: INVALID_ORACLE_TYPE");
        address oracle = oracleRegistry.oracleByType(oracleType);
        require(oracle != address(0), "Unit Protocol: DISABLED_ORACLE");
    }

    /**
     * @dev Determines whether a position is liquidatable
     * @param asset The address of the collateral
     * @param owner The owner of the position
     * @return boolean value, whether a position is liquidatable
     **/
    function isLiquidatablePosition(
        address asset,
        address owner
    ) public view returns (bool) {
        uint usdValue_q112 = getCollateralUsdValue_q112(asset, owner);

        return _isLiquidatablePosition(asset, owner, usdValue_q112);
    }

    /**
     * @dev Calculates current utilization ratio
     * @param asset The address of the collateral
     * @param owner The owner of the position
     * @return utilization ratio
     **/
    function utilizationRatio(
        address asset,
        address owner
    ) public view returns (uint) {
        uint debt = vault.getTotalDebt(asset, owner);
        if (debt == 0) return 0;

        uint usdValue_q112 = getCollateralUsdValue_q112(asset, owner);

        return debt.mul(100).mul(Q112).div(usdValue_q112);
    }

}

File 2 of 15 : BaseCDPManager.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2021 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;

import "../interfaces/IVault.sol";
import '../interfaces/IVaultParameters.sol';
import "../interfaces/IOracleRegistry.sol";
import "../interfaces/ICDPRegistry.sol";
import '../interfaces/IToken.sol';
import "../interfaces/vault-managers/parameters/IVaultManagerParameters.sol";
import "../interfaces/vault-managers/parameters/IVaultManagerBorrowFeeParameters.sol";

import "../helpers/ReentrancyGuard.sol";
import '../helpers/TransferHelper.sol';
import "../helpers/SafeMath.sol";

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";


/**
 * @title BaseCDPManager
 * @dev all common logic should be moved here in future
 **/
abstract contract BaseCDPManager is ReentrancyGuard {
    using SafeMath for uint;

    IVault public immutable vault;
    IVaultManagerParameters public immutable vaultManagerParameters;
    IOracleRegistry public immutable oracleRegistry;
    ICDPRegistry public immutable cdpRegistry;
    IVaultManagerBorrowFeeParameters public immutable vaultManagerBorrowFeeParameters;
    IERC20 public immutable usdp;

    uint public constant Q112 = 2 ** 112;
    uint public constant DENOMINATOR_1E5 = 1e5;

    /**
     * @dev Trigger when joins are happened
    **/
    event Join(address indexed asset, address indexed owner, uint main, uint usdp);

    /**
     * @dev Trigger when exits are happened
    **/
    event Exit(address indexed asset, address indexed owner, uint main, uint usdp);

    /**
     * @dev Trigger when liquidations are initiated
    **/
    event LiquidationTriggered(address indexed asset, address indexed owner);

    modifier checkpoint(address asset, address owner) {
        _;
        cdpRegistry.checkpoint(asset, owner);
    }

    /**
     * @param _vaultManagerParameters The address of the contract with Vault manager parameters
     * @param _oracleRegistry The address of the oracle registry
     * @param _cdpRegistry The address of the CDP registry
     * @param _vaultManagerBorrowFeeParameters The address of the vault manager borrow fee parameters
     **/
    constructor(address _vaultManagerParameters, address _oracleRegistry, address _cdpRegistry, address _vaultManagerBorrowFeeParameters) {
        require(
            _vaultManagerParameters != address(0) &&
            _oracleRegistry != address(0) &&
            _cdpRegistry != address(0) &&
            _vaultManagerBorrowFeeParameters != address(0),
            "Unit Protocol: INVALID_ARGS"
        );
        vaultManagerParameters = IVaultManagerParameters(_vaultManagerParameters);
        IVault vaultLocal = IVault(IVaultParameters(IVaultManagerParameters(_vaultManagerParameters).vaultParameters()).vault());
        vault = vaultLocal;
        oracleRegistry = IOracleRegistry(_oracleRegistry);
        cdpRegistry = ICDPRegistry(_cdpRegistry);
        vaultManagerBorrowFeeParameters = IVaultManagerBorrowFeeParameters(_vaultManagerBorrowFeeParameters);
        usdp = IERC20(vaultLocal.usdp());
    }

    /**
     * @notice Charge borrow fee if needed
     */
    function _chargeBorrowFee(address asset, address user, uint usdpAmount) internal {
        uint borrowFee = vaultManagerBorrowFeeParameters.calcBorrowFeeAmount(asset, usdpAmount);
        if (borrowFee == 0) { // very small amount case
            return;
        }

        // to fail with concrete reason, not with TRANSFER_FROM_FAILED from safeTransferFrom
        require(usdp.allowance(user, address(this)) >= borrowFee, "Unit Protocol: BORROW_FEE_NOT_APPROVED");

        TransferHelper.safeTransferFrom(
            address(usdp),
            user,
            vaultManagerBorrowFeeParameters.feeReceiver(),
            borrowFee
        );
    }

    // decreases debt
    function _repay(address asset, address owner, uint usdpAmount) internal {
        uint fee = vault.getFee(asset, owner);

        if (fee > usdpAmount) {
            fee = usdpAmount;
        }

        usdpAmount = usdpAmount - fee;

        vault.chargeFee(vault.usdp(), owner, fee);
        vault.decreaseFee(asset, owner, fee);

        // burn USDP from the owner's balance
        uint debtAfter = vault.repay(asset, owner, usdpAmount);
        if (debtAfter == 0) {
            // clear unused storage
            vault.destroy(asset, owner);
        }
    }

    /**
     * @dev Calculates liquidation price
     * @param asset The address of the collateral
     * @param owner The owner of the position
     * @return Q112-encoded liquidation price
     **/
    function liquidationPrice_q112(
        address asset,
        address owner
    ) external view returns (uint) {
        uint debt = vault.getTotalDebt(asset, owner);
        if (debt == 0) return uint(-1);

        uint collateralLiqPrice = debt.mul(100).mul(Q112).div(vaultManagerParameters.liquidationRatio(asset));

        require(IToken(asset).decimals() <= 18, "Unit Protocol: NOT_SUPPORTED_DECIMALS");

        return collateralLiqPrice / vault.collaterals(asset, owner) / 10 ** (18 - IToken(asset).decimals());
    }

    /**
     * @dev Determines whether a position is liquidatable
     * @param asset The address of the collateral
     * @param owner The owner of the position
     * @param usdValue_q112 Q112-encoded USD value of the collateral
     * @return boolean value, whether a position is liquidatable
     **/
    function _isLiquidatablePosition(
        address asset,
        address owner,
        uint usdValue_q112
    ) internal view returns (bool) {
        uint debt = vault.getTotalDebt(asset, owner);

        // position is collateralized if there is no debt
        if (debt == 0) return false;

        return debt.mul(100).mul(Q112).div(usdValue_q112) >= vaultManagerParameters.liquidationRatio(asset);
    }
}

File 3 of 15 : IOracleRegistry.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;
pragma abicoder v2;

interface IOracleRegistry {

    struct Oracle {
        uint oracleType;
        address oracleAddress;
    }

    function WETH (  ) external view returns ( address );
    function getKeydonixOracleTypes (  ) external view returns ( uint256[] memory );
    function getOracles (  ) external view returns ( Oracle[] memory foundOracles );
    function keydonixOracleTypes ( uint256 ) external view returns ( uint256 );
    function maxOracleType (  ) external view returns ( uint256 );
    function oracleByAsset ( address asset ) external view returns ( address );
    function oracleByType ( uint256 ) external view returns ( address );
    function oracleTypeByAsset ( address ) external view returns ( uint256 );
    function oracleTypeByOracle ( address ) external view returns ( uint256 );
    function setKeydonixOracleTypes ( uint256[] memory _keydonixOracleTypes ) external;
    function setOracle ( uint256 oracleType, address oracle ) external;
    function setOracleTypeForAsset ( address asset, uint256 oracleType ) external;
    function setOracleTypeForAssets ( address[] memory assets, uint256 oracleType ) external;
    function unsetOracle ( uint256 oracleType ) external;
    function unsetOracleForAsset ( address asset ) external;
    function unsetOracleForAssets ( address[] memory assets ) external;
    function vaultParameters (  ) external view returns ( address );
}

File 4 of 15 : IOracleUsd.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;

interface IOracleUsd {

    // returns Q112-encoded value
    // returned value 10**18 * 2**112 is $1
    function assetToUsd(address asset, uint amount) external view returns (uint);
}

File 5 of 15 : IWETH.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

File 6 of 15 : IVault.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;

interface IVault {
    function DENOMINATOR_1E2 (  ) external view returns ( uint256 );
    function DENOMINATOR_1E5 (  ) external view returns ( uint256 );
    function borrow ( address asset, address user, uint256 amount ) external returns ( uint256 );
    function changeOracleType ( address asset, address user, uint256 newOracleType ) external;
    function chargeFee ( address asset, address user, uint256 amount ) external;
    function decreaseFee ( address asset, address user, uint amount ) external;
    function col (  ) external view returns ( address );
    function colToken ( address, address ) external view returns ( uint256 );
    function collaterals ( address, address ) external view returns ( uint256 );
    function debts ( address, address ) external view returns ( uint256 );
    function getFee ( address, address ) external view returns ( uint256 );
    function depositCol ( address asset, address user, uint256 amount ) external;
    function depositEth ( address user ) external payable;
    function depositMain ( address asset, address user, uint256 amount ) external;
    function destroy ( address asset, address user ) external;
    function getTotalDebt ( address asset, address user ) external view returns ( uint256 );
    function lastUpdate ( address, address ) external view returns ( uint256 );
    function liquidate ( address asset, address positionOwner, uint256 mainAssetToLiquidator, uint256 mainAssetToPositionOwner, uint256 repayment, uint256 penalty, address liquidator ) external;
    function liquidationBlock ( address, address ) external view returns ( uint256 );
    function liquidationFee ( address, address ) external view returns ( uint256 );
    function liquidationPrice ( address, address ) external view returns ( uint256 );
    function oracleType ( address, address ) external view returns ( uint256 );
    function repay ( address asset, address user, uint256 amount ) external returns ( uint256 );
    function spawn ( address asset, address user, uint256 _oracleType ) external;
    function stabilityFee ( address, address ) external view returns ( uint256 );
    function tokenDebts ( address ) external view returns ( uint256 );
    function triggerLiquidation ( address asset, address positionOwner, uint256 initialPrice ) external;
    function update ( address asset, address user ) external;
    function usdp (  ) external view returns ( address );
    function vaultParameters (  ) external view returns ( address );
    function weth (  ) external view returns ( address payable );
    function withdrawCol ( address asset, address user, uint256 amount ) external;
    function withdrawEth ( address user, uint256 amount ) external;
    function withdrawMain ( address asset, address user, uint256 amount ) external;
}

File 7 of 15 : ICDPRegistry.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

interface ICDPRegistry {

    struct CDP {
        address asset;
        address owner;
    }

    function batchCheckpoint ( address[] calldata assets, address[] calldata owners ) external;
    function batchCheckpointForAsset ( address asset, address[] calldata owners ) external;
    function checkpoint ( address asset, address owner ) external;
    function cr (  ) external view returns ( address );
    function getAllCdps (  ) external view returns ( CDP[] memory r );
    function getCdpsByCollateral ( address asset ) external view returns ( CDP[] memory cdps );
    function getCdpsByOwner ( address owner ) external view returns ( CDP[] memory r );
    function getCdpsCount (  ) external view returns ( uint256 totalCdpCount );
    function getCdpsCountForCollateral ( address asset ) external view returns ( uint256 );
    function isAlive ( address asset, address owner ) external view returns ( bool );
    function isListed ( address asset, address owner ) external view returns ( bool );
    function vault (  ) external view returns ( address );
}

File 8 of 15 : IVaultManagerParameters.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;

interface IVaultManagerParameters {
    function devaluationPeriod ( address ) external view returns ( uint256 );
    function initialCollateralRatio ( address ) external view returns ( uint256 );
    function liquidationDiscount ( address ) external view returns ( uint256 );
    function liquidationRatio ( address ) external view returns ( uint256 );
    function maxColPercent ( address ) external view returns ( uint256 );
    function minColPercent ( address ) external view returns ( uint256 );
    function setColPartRange ( address asset, uint256 min, uint256 max ) external;
    function setCollateral (
        address asset,
        uint256 stabilityFeeValue,
        uint256 liquidationFeeValue,
        uint256 initialCollateralRatioValue,
        uint256 liquidationRatioValue,
        uint256 liquidationDiscountValue,
        uint256 devaluationPeriodValue,
        uint256 usdpLimit,
        uint256[] calldata oracles,
        uint256 minColP,
        uint256 maxColP
    ) external;
    function setDevaluationPeriod ( address asset, uint256 newValue ) external;
    function setInitialCollateralRatio ( address asset, uint256 newValue ) external;
    function setLiquidationDiscount ( address asset, uint256 newValue ) external;
    function setLiquidationRatio ( address asset, uint256 newValue ) external;
    function vaultParameters (  ) external view returns ( address );
}

File 9 of 15 : IVaultParameters.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;

interface IVaultParameters {
    function canModifyVault ( address ) external view returns ( bool );
    function foundation (  ) external view returns ( address );
    function isManager ( address ) external view returns ( bool );
    function isOracleTypeEnabled ( uint256, address ) external view returns ( bool );
    function liquidationFee ( address ) external view returns ( uint256 );
    function setCollateral ( address asset, uint256 stabilityFeeValue, uint256 liquidationFeeValue, uint256 usdpLimit, uint256[] calldata oracles ) external;
    function setFoundation ( address newFoundation ) external;
    function setLiquidationFee ( address asset, uint256 newValue ) external;
    function setManager ( address who, bool permit ) external;
    function setOracleType ( uint256 _type, address asset, bool enabled ) external;
    function setStabilityFee ( address asset, uint256 newValue ) external;
    function setTokenDebtLimit ( address asset, uint256 limit ) external;
    function setVaultAccess ( address who, bool permit ) external;
    function stabilityFee ( address ) external view returns ( uint256 );
    function tokenDebtLimit ( address ) external view returns ( uint256 );
    function vault (  ) external view returns ( address );
    function vaultParameters (  ) external view returns ( address );
}

File 10 of 15 : IToken.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;

interface IToken {
    function decimals() external view returns (uint8);
}

File 11 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

/**
 * @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].
 */
contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

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

    uint256 private _status;

    constructor () {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 12 of 15 : SafeMath.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;


/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

    /**
    * @dev Multiplies two numbers, throws on overflow.
    */
    function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
        if (a == 0) {
            return 0;
        }
        c = a * b;
        assert(c / a == b);
        return c;
    }

    /**
    * @dev Integer division of two numbers, truncating the quotient.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
    * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    /**
    * @dev Adds two numbers, throws on overflow.
    */
    function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
        c = a + b;
        assert(c >= a);
        return c;
    }
}

File 13 of 15 : IVaultManagerBorrowFeeParameters.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2021 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;

interface IVaultManagerBorrowFeeParameters {

    /**
     * @notice 1 = 100% = 10000 basis points
     **/
    function BASIS_POINTS_IN_1() external view returns (uint);

    /**
     * @notice Borrow fee receiver
     **/
    function feeReceiver() external view returns (address);

    /**
     * @notice Sets the borrow fee receiver. Only manager is able to call this function
     * @param newFeeReceiver The address of fee receiver
     **/
    function setFeeReceiver(address newFeeReceiver) external;

    /**
     * @notice Sets the base borrow fee in basis points (1bp = 0.01% = 0.0001). Only manager is able to call this function
     * @param newBaseBorrowFeeBasisPoints The borrow fee in basis points
     **/
    function setBaseBorrowFee(uint16 newBaseBorrowFeeBasisPoints) external;

    /**
     * @notice Sets the borrow fee for a particular collateral in basis points (1bp = 0.01% = 0.0001). Only manager is able to call this function
     * @param asset The address of the main collateral token
     * @param newEnabled Is custom fee enabled for asset
     * @param newFeeBasisPoints The borrow fee in basis points
     **/
    function setAssetBorrowFee(address asset, bool newEnabled, uint16 newFeeBasisPoints) external;

    /**
     * @notice Returns borrow fee for particular collateral in basis points (1bp = 0.01% = 0.0001)
     * @param asset The address of the main collateral token
     * @return feeBasisPoints The borrow fee in basis points
     **/
    function getBorrowFee(address asset) external view returns (uint16 feeBasisPoints);

    /**
     * @notice Returns borrow fee for usdp amount for particular collateral
     * @param asset The address of the main collateral token
     * @return The borrow fee
     **/
    function calcBorrowFeeAmount(address asset, uint usdpAmount) external view returns (uint);
}

File 14 of 15 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address token, address from, address to, uint value) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vaultManagerParameters","type":"address"},{"internalType":"address","name":"_oracleRegistry","type":"address"},{"internalType":"address","name":"_cdpRegistry","type":"address"},{"internalType":"address","name":"_vaultManagerBorrowFeeParameters","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"main","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdp","type":"uint256"}],"name":"Exit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"main","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdp","type":"uint256"}],"name":"Join","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"LiquidationTriggered","type":"event"},{"inputs":[],"name":"DENOMINATOR_1E5","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"Q112","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cdpRegistry","outputs":[{"internalType":"contract ICDPRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"assetAmount","type":"uint256"},{"internalType":"uint256","name":"usdpAmount","type":"uint256"}],"name":"exit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"ethAmount","type":"uint256"},{"internalType":"uint256","name":"usdpAmount","type":"uint256"}],"name":"exit_Eth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"getCollateralUsdValue_q112","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"isLiquidatablePosition","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"assetAmount","type":"uint256"},{"internalType":"uint256","name":"usdpAmount","type":"uint256"}],"name":"join","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdpAmount","type":"uint256"}],"name":"join_Eth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"liquidationPrice_q112","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleRegistry","outputs":[{"internalType":"contract IOracleRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"bool","name":"withdraw","type":"bool"}],"name":"repayAll","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"triggerLiquidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdp","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"utilizationRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultManagerBorrowFeeParameters","outputs":[{"internalType":"contract IVaultManagerBorrowFeeParameters","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultManagerParameters","outputs":[{"internalType":"contract IVaultManagerParameters","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101606040523480156200001257600080fd5b50604051620036af380380620036af833981810160405260808110156200003857600080fd5b50805160208201516040830151606090930151600160005591929091838383836001600160a01b038416158015906200007957506001600160a01b03831615155b80156200008e57506001600160a01b03821615155b8015620000a357506001600160a01b03811615155b620000f5576040805162461bcd60e51b815260206004820152601b60248201527f556e69742050726f746f636f6c3a20494e56414c49445f415247530000000000604482015290519081900360640190fd5b836001600160a01b031660a0816001600160a01b031660601b815250506000846001600160a01b031663aca345ee6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200014e57600080fd5b505afa15801562000163573d6000803e3d6000fd5b505050506040513d60208110156200017a57600080fd5b50516040805163fbfa77cf60e01b815290516001600160a01b039092169163fbfa77cf91600480820192602092909190829003018186803b158015620001bf57600080fd5b505afa158015620001d4573d6000803e3d6000fd5b505050506040513d6020811015620001eb57600080fd5b50516001600160601b0319606082811b821660805286811b821660c05285811b821660e05284901b166101005260408051631d3981db60e21b815290519192506001600160a01b038316916374e6076c91600480820192602092909190829003018186803b1580156200025d57600080fd5b505afa15801562000272573d6000803e3d6000fd5b505050506040513d60208110156200028957600080fd5b505160601b6001600160601b03191661012052505060408051635651a2f760e11b815290516001600160a01b038916945063aca345ee935060048083019350602092829003018186803b158015620002e057600080fd5b505afa158015620002f5573d6000803e3d6000fd5b505050506040513d60208110156200030c57600080fd5b50516040805163fbfa77cf60e01b815290516001600160a01b039092169163fbfa77cf91600480820192602092909190829003018186803b1580156200035157600080fd5b505afa15801562000366573d6000803e3d6000fd5b505050506040513d60208110156200037d57600080fd5b505160408051633fc8cef360e01b815290516001600160a01b0390921691633fc8cef391600480820192602092909190829003018186803b158015620003c257600080fd5b505afa158015620003d7573d6000803e3d6000fd5b505050506040513d6020811015620003ee57600080fd5b50516001600160601b031960609190911b16610140525050505060805160601c60a05160601c60c05160601c60e05160601c6101005160601c6101205160601c6101405160601c61313f62000570600039806101285280610a335280610ac85280610b7d5280610d0f528061208352806120d9528061218b525080610cc05280612d135280612dc75250806108215280612c3d5280612de9525080610ceb528061107152806117345280611fda5250806108695280610c9c5280611d18528061289f52806129785250806105935280610d3352806118a452806124045280612a815250806104d2528061078e52806109365280610bb35280610e295280610ec95280610f83528061116c5280611242528061131b528061134a528061144152806114fe52806115d8528061163d528061195c5280611b935280611c6a5280611ce75280611e255280611ec65280612298528061234952806124c3528061257f52806125ae52806126a0528061274252806127fd5280612b2f525061313f6000f3fe6080604052600436106101185760003560e01c8063971182c6116100a0578063d12f0bc011610064578063d12f0bc0146103d3578063d4796d121461040e578063ea36380a14610449578063eb70d35814610488578063fbfa77cf146104b85761019c565b8063971182c614610340578063ab2a2a8214610355578063ad5c46481461036a578063b7ebdc0c1461037f578063bbdc9531146103945761019c565b806325df9058116100e757806325df9058146102a95780633bf7a83e146102c65780634265607c146102db5780634bb93ab11461031657806374e6076c1461032b5761019c565b806312dc1dcc146101a157806313084e15146101ee578063134a02dd1461021f578063252d040e1461026e5761019c565b3661019c57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461019a576040805162461bcd60e51b815260206004820152601960248201527f556e69742050726f746f636f6c3a205245535452494354454400000000000000604482015290519081900360640190fd5b005b600080fd5b3480156101ad57600080fd5b506101dc600480360360408110156101c457600080fd5b506001600160a01b03813581169160200135166104cd565b60408051918252519081900360200190f35b3480156101fa57600080fd5b5061020361081f565b604080516001600160a01b039092168252519081900360200190f35b34801561022b57600080fd5b5061025a6004803603604081101561024257600080fd5b506001600160a01b0381358116916020013516610843565b604080519115158252519081900360200190f35b34801561027a57600080fd5b506101dc6004803603604081101561029157600080fd5b506001600160a01b0381358116916020013516610865565b61019a600480360360208110156102bf57600080fd5b5035610a2b565b3480156102d257600080fd5b506101dc610ba6565b3480156102e757600080fd5b506101dc600480360360408110156102fe57600080fd5b506001600160a01b0381358116916020013516610bae565b34801561032257600080fd5b50610203610c9a565b34801561033757600080fd5b50610203610cbe565b34801561034c57600080fd5b506101dc610ce2565b34801561036157600080fd5b50610203610ce9565b34801561037657600080fd5b50610203610d0d565b34801561038b57600080fd5b50610203610d31565b3480156103a057600080fd5b506101dc600480360360608110156103b757600080fd5b506001600160a01b038135169060208101359060400135610d55565b3480156103df57600080fd5b506101dc600480360360408110156103f657600080fd5b506001600160a01b0381351690602001351515611116565b34801561041a57600080fd5b5061019a6004803603604081101561043157600080fd5b506001600160a01b03813581169160200135166117d8565b34801561045557600080fd5b5061019a6004803603606081101561046c57600080fd5b506001600160a01b038135169060208101359060400135611a3e565b34801561049457600080fd5b506101dc600480360360408110156104ab57600080fd5b508035906020013561207c565b3480156104c457600080fd5b50610203612296565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d6446d4385856040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561054e57600080fd5b505afa158015610562573d6000803e3d6000fd5b505050506040513d602081101561057857600080fd5b505190508061058c57600019915050610819565b60006106497f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bffbbe2876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156105fe57600080fd5b505afa158015610612573d6000803e3d6000fd5b505050506040513d602081101561062857600080fd5b5051610643600160701b61063d8660646122ba565b906122ba565b906122df565b90506012856001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561068657600080fd5b505afa15801561069a573d6000803e3d6000fd5b505050506040513d60208110156106b057600080fd5b505160ff1611156106f25760405162461bcd60e51b81526004018080602001828103825260258152602001806130e56025913960400191505060405180910390fd5b846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561072b57600080fd5b505afa15801561073f573d6000803e3d6000fd5b505050506040513d602081101561075557600080fd5b50516040805163728f08cf60e11b81526001600160a01b0388811660048301528781166024830152915160129390930360ff16600a0a927f00000000000000000000000000000000000000000000000000000000000000009092169163e51e119e91604480820192602092909190829003018186803b1580156107d757600080fd5b505afa1580156107eb573d6000803e3d6000fd5b505050506040513d602081101561080157600080fd5b5051828161080b57fe5b048161081357fe5b04925050505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806108508484610865565b905061085d848483612344565b949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166338163032846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156108d457600080fd5b505afa1580156108e8573d6000803e3d6000fd5b505050506040513d60208110156108fe57600080fd5b50516040805163728f08cf60e11b81526001600160a01b03868116600483015285811660248301529151928216926310e556989287927f00000000000000000000000000000000000000000000000000000000000000009091169163e51e119e91604480820192602092909190829003018186803b15801561097f57600080fd5b505afa158015610993573d6000803e3d6000fd5b505050506040513d60208110156109a957600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0390931660048401526024830191909152516044808301926020929190829003018186803b1580156109f857600080fd5b505afa158015610a0c573d6000803e3d6000fd5b505050506040513d6020811015610a2257600080fd5b50519392505050565b3415610b78577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a8c57600080fd5b505af1158015610aa0573d6000803e3d6000fd5b50506040805163a9059cbb60e01b815233600482015234602482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016945063a9059cbb9350604480830193506020928290030181600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b505050506040513d6020811015610b3b57600080fd5b5051610b785760405162461bcd60e51b81526004018080602001828103825260238152602001806130126023913960400191505060405180910390fd5b610ba37f00000000000000000000000000000000000000000000000000000000000000003483611a3e565b50565b600160701b81565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d6446d4385856040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b158015610c2f57600080fd5b505afa158015610c43573d6000803e3d6000fd5b505050506040513d6020811015610c5957600080fd5b5051905080610c6c576000915050610819565b6000610c788585610865565b9050610c9181610643600160701b61063d8660646122ba565b95945050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b620186a081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600060026000541415610d9d576040805162461bcd60e51b815260206004820152601f6024820152600080516020612fca833981519152604482015290519081900360640190fd5b6002600055833384151580610db157508315155b610dfe576040805162461bcd60e51b81526020600482015260196024820152780aadcd2e840a0e4dee8dec6ded87440aaa68a988aa6a6bea8b603b1b604482015290519081900360640190fd5b6040805163d6446d4360e01b81526001600160a01b03888116600483015233602483015291516000927f0000000000000000000000000000000000000000000000000000000000000000169163d6446d43916044808301926020929190829003018186803b158015610e6f57600080fd5b505afa158015610e83573d6000803e3d6000fd5b505050506040513d6020811015610e9957600080fd5b5051905080851115610ea9578094505b85610ebe57610eb98733876124bf565b611023565b610ec78761289b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638d7cad888833896040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015610f4f57600080fd5b505af1158015610f63573d6000803e3d6000fd5b5050505084600014610f7a57610f7a8733876124bf565b808514611023577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c640752d88336040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050600060405180830381600087803b15801561100157600080fd5b505af1158015611015573d6000803e3d6000fd5b505050506110238733612a68565b6040805187815260208101879052815133926001600160a01b038b16927fa702ae6024e8b4c2b0eb162b1453dacb93cf6922f5a2d7236faed898c21148f8929081900390910190a3849350507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bb55b7fc83836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050600060405180830381600087803b1580156110ef57600080fd5b505af1158015611103573d6000803e3d6000fd5b5050600160005550929695505050505050565b60006002600054141561115e576040805162461bcd60e51b815260206004820152601f6024820152600080516020612fca833981519152604482015290519081900360640190fd5b6002600081905550823360007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634ac1c33d87336040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b1580156111e857600080fd5b505afa1580156111fc573d6000803e3d6000fd5b505050506040513d602081101561121257600080fd5b505160408051631fdd331360e31b81526001600160a01b03898116600483015233602483015291519293506000927f00000000000000000000000000000000000000000000000000000000000000009092169163fee9989891604480820192602092909190829003018186803b15801561128b57600080fd5b505afa15801561129f573d6000803e3d6000fd5b505050506040513d60208110156112b557600080fd5b50519050811515806112c657508015155b611313576040805162461bcd60e51b81526020600482015260196024820152780aadcd2e840a0e4dee8dec6ded87440aaa68a988aa6a6bea8b603b1b604482015290519081900360640190fd5b8015611439577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633d1aa9637f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166374e6076c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156113a157600080fd5b505afa1580156113b5573d6000803e3d6000fd5b505050506040513d60208110156113cb57600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b0390921660048301523360248301526044820185905251606480830192600092919082900301818387803b15801561142057600080fd5b505af1158015611434573d6000803e3d6000fd5b505050505b81156114f4577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631da649cf8833856040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b1580156114c757600080fd5b505af11580156114db573d6000803e3d6000fd5b505050506040513d60208110156114f157600080fd5b50505b6000861561163b577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e51e119e89336040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561157a57600080fd5b505afa15801561158e573d6000803e3d6000fd5b505050506040513d60208110156115a457600080fd5b5051604080516311af95b160e31b81526001600160a01b038b811660048301523360248301526044820184905291519293507f000000000000000000000000000000000000000000000000000000000000000090911691638d7cad889160648082019260009290919082900301818387803b15801561162257600080fd5b505af1158015611636573d6000803e3d6000fd5b505050505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166362b40f9f89336040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050600060405180830381600087803b1580156116bb57600080fd5b505af11580156116cf573d6000803e3d6000fd5b5033925050506001600160a01b0389167fa702ae6024e8b4c2b0eb162b1453dacb93cf6922f5a2d7236faed898c21148f88361170b8787612c1a565b6040805192835260208301919091528051918290030190a361172d8383612c1a565b95505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bb55b7fc83836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050600060405180830381600087803b1580156117b257600080fd5b505af11580156117c6573d6000803e3d6000fd5b50506001600055509295945050505050565b6002600054141561181e576040805162461bcd60e51b815260206004820152601f6024820152600080516020612fca833981519152604482015290519081900360640190fd5b600260005561182c8261289b565b60006118388383610865565b9050611845838383612344565b611896576040805162461bcd60e51b815260206004820152601c60248201527f556e69742050726f746f636f6c3a20534146455f504f534954494f4e00000000604482015290519081900360640190fd5b6000611942620186a06106437f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166315a04ea2886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561190f57600080fd5b505afa158015611923573d6000803e3d6000fd5b505050506040513d602081101561193957600080fd5b505185906122ba565b90506000611958600160701b6106438585612c27565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663742a326e8686846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b1580156119e257600080fd5b505af11580156119f6573d6000803e3d6000fd5b50506040516001600160a01b038088169350881691507f5b79a897d30813a62a1f95ba180d3320d3701d96605708b81105e00719a069e490600090a350506001600055505050565b60026000541415611a84576040805162461bcd60e51b815260206004820152601f6024820152600080516020612fca833981519152604482015290519081900360640190fd5b6002600055823382151580611a9857508315155b611ae5576040805162461bcd60e51b81526020600482015260196024820152780aadcd2e840a0e4dee8dec6ded87440aaa68a988aa6a6bea8b603b1b604482015290519081900360640190fd5b6012856001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611b2057600080fd5b505afa158015611b34573d6000803e3d6000fd5b505050506040513d6020811015611b4a57600080fd5b505160ff161115611b8c5760405162461bcd60e51b81526004018080602001828103825260258152602001806130e56025913960400191505060405180910390fd5b82611c36577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ee18359e8633876040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015611c1957600080fd5b505af1158015611c2d573d6000803e3d6000fd5b50505050611f90565b611c3f8561289b565b60408051634ac1c33d60e01b81526001600160a01b03878116600483015233602483015291516000927f00000000000000000000000000000000000000000000000000000000000000001691634ac1c33d916044808301926020929190829003018186803b158015611cb057600080fd5b505afa158015611cc4573d6000803e3d6000fd5b505050506040513d6020811015611cda57600080fd5b50511515905080611e1d577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c6d894f087337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663fbcd55318b6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611d8357600080fd5b505afa158015611d97573d6000803e3d6000fd5b505050506040513d6020811015611dad57600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015292909316602483015260448201529051606480830192600092919082900301818387803b158015611e0457600080fd5b505af1158015611e18573d6000803e3d6000fd5b505050505b8415611ec4577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ee18359e8733886040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015611eab57600080fd5b505af1158015611ebf573d6000803e3d6000fd5b505050505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635224372c8733876040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b158015611f4c57600080fd5b505af1158015611f60573d6000803e3d6000fd5b505050506040513d6020811015611f7657600080fd5b50611f849050863386612c39565b611f8e8633612a68565b505b6040805185815260208101859052815133926001600160a01b038916927f6423b6056e64b3b29cb2d342362b47c26fa8d6877da27ea152354060df19b9bc929081900390910190a37f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bb55b7fc83836040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050600060405180830381600087803b15801561205857600080fd5b505af115801561206c573d6000803e3d6000fd5b5050600160005550505050505050565b60006120a97f00000000000000000000000000000000000000000000000000000000000000008484610d55565b604080516323b872dd60e01b81523360048201523060248201526044810186905290519193506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916323b872dd916064808201926020929091908290030181600087803b15801561212257600080fd5b505af1158015612136573d6000803e3d6000fd5b505050506040513d602081101561214c57600080fd5b50516121895760405162461bcd60e51b8152600401808060200182810382526028815260200180612fea6028913960400191505060405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d846040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156121ef57600080fd5b505af1158015612203573d6000803e3d6000fd5b50506040516000925033915085908381818185875af1925050503d8060008114612249576040519150601f19603f3d011682016040523d82523d6000602084013e61224e565b606091505b505090508061228e5760405162461bcd60e51b815260040180806020018281038252602281526020018061307d6022913960400191505060405180910390fd5b509092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000826122c957506000610819565b50818102818382816122d757fe5b041461081957fe5b600081612333576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161233c57fe5b049392505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d6446d4386866040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b1580156123c557600080fd5b505afa1580156123d9573d6000803e3d6000fd5b505050506040513d60208110156123ef57600080fd5b50519050806124025760009150506124b8565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633bffbbe2866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561246f57600080fd5b505afa158015612483573d6000803e3d6000fd5b505050506040513d602081101561249957600080fd5b50516124b284610643600160701b61063d8660646122ba565b10159150505b9392505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663fee9989885856040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561253f57600080fd5b505afa158015612553573d6000803e3d6000fd5b505050506040513d602081101561256957600080fd5b50519050818111156125785750805b80820391507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633d1aa9637f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166374e6076c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561260557600080fd5b505afa158015612619573d6000803e3d6000fd5b505050506040513d602081101561262f57600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b03928316600482015291871660248301526044820185905251606480830192600092919082900301818387803b15801561268657600080fd5b505af115801561269a573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166368c173748585846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b15801561272657600080fd5b505af115801561273a573d6000803e3d6000fd5b5050505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631da649cf8686866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b1580156127c857600080fd5b505af11580156127dc573d6000803e3d6000fd5b505050506040513d60208110156127f257600080fd5b5051905080612894577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166362b40f9f86866040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b0316815260200192505050600060405180830381600087803b15801561287b57600080fd5b505af115801561288f573d6000803e3d6000fd5b505050505b5050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663fbcd5531836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561290a57600080fd5b505afa15801561291e573d6000803e3d6000fd5b505050506040513d602081101561293457600080fd5b50519050806129745760405162461bcd60e51b815260040180806020018281038252602281526020018061305b6022913960400191505060405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c5807dc6836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156129da57600080fd5b505afa1580156129ee573d6000803e3d6000fd5b505050506040513d6020811015612a0457600080fd5b505190506001600160a01b038116612a63576040805162461bcd60e51b815260206004820152601e60248201527f556e69742050726f746f636f6c3a2044495341424c45445f4f5241434c450000604482015290519081900360640190fd5b505050565b6000612a748383610865565b905060006064600160701b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b85c4496876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612aec57600080fd5b505afa158015612b00573d6000803e3d6000fd5b505050506040513d6020811015612b1657600080fd5b5051840281612b2157fe5b0481612b2957fe5b049050807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d6446d4386866040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b158015612bab57600080fd5b505afa158015612bbf573d6000803e3d6000fd5b505050506040513d6020811015612bd557600080fd5b50511115612c145760405162461bcd60e51b81526004018080602001828103825260228152602001806130c36022913960400191505060405180910390fd5b50505050565b8181018281101561081957fe5b600082821115612c3357fe5b50900390565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663fbbac96285846040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b158015612cb057600080fd5b505afa158015612cc4573d6000803e3d6000fd5b505050506040513d6020811015612cda57600080fd5b5051905080612ce95750612a63565b60408051636eb1769f60e11b81526001600160a01b038581166004830152306024830152915183927f0000000000000000000000000000000000000000000000000000000000000000169163dd62ed3e916044808301926020929190829003018186803b158015612d5957600080fd5b505afa158015612d6d573d6000803e3d6000fd5b505050506040513d6020811015612d8357600080fd5b50511015612dc25760405162461bcd60e51b81526004018080602001828103825260268152602001806130356026913960400191505060405180910390fd5b612c147f0000000000000000000000000000000000000000000000000000000000000000847f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b3f006746040518163ffffffff1660e01b815260040160206040518083038186803b158015612e4057600080fd5b505afa158015612e54573d6000803e3d6000fd5b505050506040513d6020811015612e6a57600080fd5b505184604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b178152925182516000948594938a169392918291908083835b60208310612ef15780518252601f199092019160209182019101612ed2565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612f53576040519150601f19603f3d011682016040523d82523d6000602084013e612f58565b606091505b5091509150818015612f86575080511580612f865750808060200190516020811015612f8357600080fd5b50515b612fc15760405162461bcd60e51b815260040180806020018281038252602481526020018061309f6024913960400191505060405180910390fd5b50505050505056fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00556e69742050726f746f636f6c3a20574554485f5452414e534645525f46524f4d5f4641494c4544556e69742050726f746f636f6c3a20574554485f5452414e534645525f4641494c4544556e69742050726f746f636f6c3a20424f52524f575f4645455f4e4f545f415050524f564544556e69742050726f746f636f6c3a20494e56414c49445f4f5241434c455f54595045556e69742050726f746f636f6c3a204554485f5452414e534645525f4641494c45445472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544556e69742050726f746f636f6c3a20554e444552434f4c4c41544552414c495a4544556e69742050726f746f636f6c3a204e4f545f535550504f525445445f444543494d414c53a2646970667358221220c9ba18afc3146078163215dc32c6a971760a2aa09a5c7830ef76940c44985f1f64736f6c634300070600330000000000000000000000001c7aea8b6498f0854d1fce542a27ed6a10d71d2f0000000000000000000000000058ab54d4405d8084e8d71b8ab36b3091b21c7d0000000000000000000000001442bc024a92c2f96c3c1d2e9274bc4d8119d97e000000000000000000000000b8b807c1841d38443d9a135f0109cf27dac78af4

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

0000000000000000000000001c7aea8b6498f0854d1fce542a27ed6a10d71d2f0000000000000000000000000058ab54d4405d8084e8d71b8ab36b3091b21c7d0000000000000000000000001442bc024a92c2f96c3c1d2e9274bc4d8119d97e000000000000000000000000b8b807c1841d38443d9a135f0109cf27dac78af4

-----Decoded View---------------
Arg [0] : _vaultManagerParameters (address): 0x1c7aea8b6498f0854d1fce542a27ed6a10d71d2f
Arg [1] : _oracleRegistry (address): 0x0058ab54d4405d8084e8d71b8ab36b3091b21c7d
Arg [2] : _cdpRegistry (address): 0x1442bc024a92c2f96c3c1d2e9274bc4d8119d97e
Arg [3] : _vaultManagerBorrowFeeParameters (address): 0xb8b807c1841d38443d9a135f0109cf27dac78af4

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000001c7aea8b6498f0854d1fce542a27ed6a10d71d2f
Arg [1] : 0000000000000000000000000058ab54d4405d8084e8d71b8ab36b3091b21c7d
Arg [2] : 0000000000000000000000001442bc024a92c2f96c3c1d2e9274bc4d8119d97e
Arg [3] : 000000000000000000000000b8b807c1841d38443d9a135f0109cf27dac78af4


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.