Contract 0x8E1C8845d444991a9B8eeaFF384fB12f902D19e4 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x8432cd40501907e0ebe6dcd6529b6a9d29c264eda9b6e212d94d8895bb9d4c2f0x60c06040208550972021-11-02 15:01:5736 days 4 hrs ago0x55d56e1bb2fc8280a775ccfe9ececcecf1a01562 IN  Contract Creation0 FTM0.171223366633
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x8432cd40501907e0ebe6dcd6529b6a9d29c264eda9b6e212d94d8895bb9d4c2f208550972021-11-02 15:01:5736 days 4 hrs ago 0x55d56e1bb2fc8280a775ccfe9ececcecf1a01562  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AssetParametersViewer

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 1 : AssetParametersViewer.sol
// SPDX-License-Identifier: bsl-1.1

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

pragma experimental ABIEncoderV2;


/**
 * @notice Interface of the autogenerated views of the `VaultParameters`.
 */
interface IVaultParametersViewer {

    function stabilityFee(address asset) external view returns (uint);

    function liquidationFee(address asset) external view returns (uint);

    function tokenDebtLimit(address asset) external view returns (uint);

    function isOracleTypeEnabled(uint _type, address asset) external view returns (bool);


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

    function foundation() external view returns (address);


    function canModifyVault(address who) external view returns (bool);

    function isManager(address who) external view returns (bool);
}


/**
 * @notice Interface of the autogenerated views of the `VaultManagerParameters`.
 */
interface IVaultManagerParametersViewer {

    function vaultParameters() external view returns (address);


    function minColPercent(address asset) external view returns (uint);

    function maxColPercent(address asset) external view returns (uint);

    function initialCollateralRatio(address asset) external view returns (uint);

    function liquidationRatio(address asset) external view returns (uint);

    function liquidationDiscount(address asset) external view returns (uint);

    function devaluationPeriod(address asset) external view returns (uint);
}


/**
 * @notice Views collaterals in one request to save node requests and speed up dapps.
 *
 * @dev It makes no sense to clog a node with hundreds of RPC requests and slow a client app/dapp. Since usually
 *      a huge amount of gas is available to node static calls, we can aggregate asset data in a huge batch on the
 *      node's side and pull it to the client.
 */
contract AssetParametersViewer {
    IVaultParametersViewer public immutable vaultParameters;

    IVaultManagerParametersViewer public immutable vaultManagerParameters;

    struct AssetParameters {
        // asset address
        address asset;

        // Percentage with 3 decimals
        uint stabilityFee;

        // Percentage with 0 decimals
        uint liquidationFee;

        // Percentage with 0 decimals
        uint initialCollateralRatio;

        // Percentage with 0 decimals
        uint liquidationRatio;

        // Percentage with 3 decimals
        uint liquidationDiscount;

        // Devaluation period in blocks
        uint devaluationPeriod;

        // USDP mint limit
        uint tokenDebtLimit;

        // Oracle types enabled for this asset
        uint[] oracles;

        // Percentage with 0 decimals
        uint minColPercent;

        // Percentage with 0 decimals
        uint maxColPercent;
    }


    constructor(address _vaultManagerParameters) {
        IVaultManagerParametersViewer vmp = IVaultManagerParametersViewer(_vaultManagerParameters);
        vaultManagerParameters = vmp;
        vaultParameters = IVaultParametersViewer(vmp.vaultParameters());
    }

    /**
     * @notice Get parameters of one asset
     * @param asset asset address
     * @param maxOracleTypesToSearch since complete list of oracle types is unknown, we'll check types up to this number
     */
    function getAssetParameters(address asset, uint maxOracleTypesToSearch)
        public
        view
        returns (AssetParameters memory r)
    {
        r.asset = asset;
        r.stabilityFee = vaultParameters.stabilityFee(asset);
        r.liquidationFee = vaultParameters.liquidationFee(asset);

        r.initialCollateralRatio = vaultManagerParameters.initialCollateralRatio(asset);
        r.liquidationRatio = vaultManagerParameters.liquidationRatio(asset);
        r.liquidationDiscount = vaultManagerParameters.liquidationDiscount(asset);
        r.devaluationPeriod = vaultManagerParameters.devaluationPeriod(asset);

        r.tokenDebtLimit = vaultParameters.tokenDebtLimit(asset);

        r.minColPercent = vaultManagerParameters.minColPercent(asset);
        r.maxColPercent = vaultManagerParameters.maxColPercent(asset);

        // Memory arrays can't be reallocated so we'll overprovision
        uint[] memory foundOracleTypes = new uint[](maxOracleTypesToSearch);
        uint actualOraclesCount = 0;

        for (uint _type = 0; _type < maxOracleTypesToSearch; ++_type) {
            if (vaultParameters.isOracleTypeEnabled(_type, asset)) {
                foundOracleTypes[actualOraclesCount++] = _type;
            }
        }

        r.oracles = new uint[](actualOraclesCount);
        for (uint i = 0; i < actualOraclesCount; ++i) {
            r.oracles[i] = foundOracleTypes[i];
        }
    }

    /**
     * @notice Get parameters of many assets
     * @param assets asset addresses
     * @param maxOracleTypesToSearch since complete list of oracle types is unknown, we'll check types up to this number
     */
    function getMultiAssetParameters(address[] calldata assets, uint maxOracleTypesToSearch)
        external
        view
        returns (AssetParameters[] memory r)
    {
        uint length = assets.length;
        r = new AssetParameters[](length);
        for (uint i = 0; i < length; ++i) {
            r[i] = getAssetParameters(assets[i], maxOracleTypesToSearch);
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vaultManagerParameters","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"maxOracleTypesToSearch","type":"uint256"}],"name":"getAssetParameters","outputs":[{"components":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"stabilityFee","type":"uint256"},{"internalType":"uint256","name":"liquidationFee","type":"uint256"},{"internalType":"uint256","name":"initialCollateralRatio","type":"uint256"},{"internalType":"uint256","name":"liquidationRatio","type":"uint256"},{"internalType":"uint256","name":"liquidationDiscount","type":"uint256"},{"internalType":"uint256","name":"devaluationPeriod","type":"uint256"},{"internalType":"uint256","name":"tokenDebtLimit","type":"uint256"},{"internalType":"uint256[]","name":"oracles","type":"uint256[]"},{"internalType":"uint256","name":"minColPercent","type":"uint256"},{"internalType":"uint256","name":"maxColPercent","type":"uint256"}],"internalType":"struct AssetParametersViewer.AssetParameters","name":"r","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets","type":"address[]"},{"internalType":"uint256","name":"maxOracleTypesToSearch","type":"uint256"}],"name":"getMultiAssetParameters","outputs":[{"components":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"stabilityFee","type":"uint256"},{"internalType":"uint256","name":"liquidationFee","type":"uint256"},{"internalType":"uint256","name":"initialCollateralRatio","type":"uint256"},{"internalType":"uint256","name":"liquidationRatio","type":"uint256"},{"internalType":"uint256","name":"liquidationDiscount","type":"uint256"},{"internalType":"uint256","name":"devaluationPeriod","type":"uint256"},{"internalType":"uint256","name":"tokenDebtLimit","type":"uint256"},{"internalType":"uint256[]","name":"oracles","type":"uint256[]"},{"internalType":"uint256","name":"minColPercent","type":"uint256"},{"internalType":"uint256","name":"maxColPercent","type":"uint256"}],"internalType":"struct AssetParametersViewer.AssetParameters[]","name":"r","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultManagerParameters","outputs":[{"internalType":"contract IVaultManagerParametersViewer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultParameters","outputs":[{"internalType":"contract IVaultParametersViewer","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60c060405234801561001057600080fd5b50604051610da5380380610da583398101604081905261002f916100da565b6000819050806001600160a01b031660a0816001600160a01b031660601b81525050806001600160a01b031663aca345ee6040518163ffffffff1660e01b815260040160206040518083038186803b15801561008a57600080fd5b505afa15801561009e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100c291906100da565b60601b6001600160601b031916608052506101089050565b6000602082840312156100eb578081fd5b81516001600160a01b0381168114610101578182fd5b9392505050565b60805160601c60a05160601c610c4261016360003980610191528061031d52806103be528061045f52806104ff528061064152806106e352508061016d52806101d7528061027a52806105a052806107d75250610c426000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806376359f4c14610051578063aca345ee1461007a578063b7ebdc0c1461008f578063d904d44c14610097575b600080fd5b61006461005f3660046109e9565b6100b7565b6040516100719190610b82565b60405180910390f35b61008261016b565b6040516100719190610b6e565b61008261018f565b6100aa6100a53660046109c0565b6101b3565b6040516100719190610be2565b6060828067ffffffffffffffff811180156100d157600080fd5b5060405190808252806020026020018201604052801561010b57816020015b6100f8610920565b8152602001906001900390816100f05790505b50915060005b818110156101625761014386868381811061012857fe5b905060200201602081019061013d919061099f565b856101b3565b83828151811061014f57fe5b6020908102919091010152600101610111565b50509392505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6101bb610920565b6001600160a01b038084168252604051634cbd12b960e11b81527f00000000000000000000000000000000000000000000000000000000000000009091169063997a25729061020e908690600401610b6e565b60206040518083038186803b15801561022657600080fd5b505afa15801561023a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025e9190610a7e565b60208201526040516332008ebd60e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c8023af4906102af908690600401610b6e565b60206040518083038186803b1580156102c757600080fd5b505afa1580156102db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ff9190610a7e565b60408083019190915251635c2e224b60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b85c449690610352908690600401610b6e565b60206040518083038186803b15801561036a57600080fd5b505afa15801561037e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a29190610a7e565b6060820152604051631dffddf160e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633bffbbe2906103f3908690600401610b6e565b60206040518083038186803b15801561040b57600080fd5b505afa15801561041f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104439190610a7e565b6080820152604051630ad0275160e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906315a04ea290610494908690600401610b6e565b60206040518083038186803b1580156104ac57600080fd5b505afa1580156104c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e49190610a7e565b60a082015260405162aaddb560e41b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630aaddb5090610534908690600401610b6e565b60206040518083038186803b15801561054c57600080fd5b505afa158015610560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105849190610a7e565b60c082015260405163797191dd60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f2e323ba906105d5908690600401610b6e565b60206040518083038186803b1580156105ed57600080fd5b505afa158015610601573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106259190610a7e565b60e082015260405163212ce07560e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906384b381d490610676908690600401610b6e565b60206040518083038186803b15801561068e57600080fd5b505afa1580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190610a7e565b6101208201526040516335e9253960e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906335e9253990610718908690600401610b6e565b60206040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190610a7e565b61014082015260008267ffffffffffffffff8111801561078757600080fd5b506040519080825280602002602001820160405280156107b1578160200160208202803683370190505b5090506000805b8481101561088b5760405163fec0feb360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063fec0feb39061080e9084908a90600401610bf5565b60206040518083038186803b15801561082657600080fd5b505afa15801561083a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085e9190610a5e565b15610883578083838060010194508151811061087657fe5b6020026020010181815250505b6001016107b8565b508067ffffffffffffffff811180156108a357600080fd5b506040519080825280602002602001820160405280156108cd578160200160208202803683370190505b5061010084015260005b81811015610917578281815181106108eb57fe5b6020026020010151846101000151828151811061090457fe5b60209081029190910101526001016108d7565b50505092915050565b60405180610160016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016060815260200160008152602001600081525090565b80356001600160a01b038116811461099a57600080fd5b919050565b6000602082840312156109b0578081fd5b6109b982610983565b9392505050565b600080604083850312156109d2578081fd5b6109db83610983565b946020939093013593505050565b6000806000604084860312156109fd578081fd5b833567ffffffffffffffff80821115610a14578283fd5b818601915086601f830112610a27578283fd5b813581811115610a35578384fd5b8760208083028501011115610a48578384fd5b6020928301989097509590910135949350505050565b600060208284031215610a6f578081fd5b815180151581146109b9578182fd5b600060208284031215610a8f578081fd5b5051919050565b6001600160a01b03169052565b6000815180845260208085019450808401835b83811015610ad257815187529582019590820190600101610ab6565b509495945050505050565b6000610160610aed848451610a96565b6020830151602085015260408301516040850152606083015160608501526080830151608085015260a083015160a085015260c083015160c085015260e083015160e0850152610100808401518282870152610b4b83870182610aa3565b610120868101519088015261014095860151959096019490945250929392505050565b6001600160a01b0391909116815260200190565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015610bd557603f19888603018452610bc3858351610add565b94509285019290850190600101610ba7565b5092979650505050505050565b6000602082526109b96020830184610add565b9182526001600160a01b031660208201526040019056fea264697066735822122031acf8da02bbd493dc5f24ec15af61d4d5227398101cc5def038595ff3a31d7b64736f6c634300070600330000000000000000000000001c7aea8b6498f0854d1fce542a27ed6a10d71d2f

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

0000000000000000000000001c7aea8b6498f0854d1fce542a27ed6a10d71d2f

-----Decoded View---------------
Arg [0] : _vaultManagerParameters (address): 0x1c7aea8b6498f0854d1fce542a27ed6a10d71d2f

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000001c7aea8b6498f0854d1fce542a27ed6a10d71d2f


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.