Contract 0xb8b807C1841d38443D9A135f0109cf27DAc78Af4 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xb7e377a7c162d493a296f7a70f116e1793d06a05207cc671fed692e810e9a2b90x60a06040215460192021-11-09 14:06:05240 days 3 hrs ago0xc29f1facff8c228b38e6b7681a73ca55581c1ff7 IN  Create: VaultManagerBorrowFeeParameters0 FTM0.057409043027
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0xb7e377a7c162d493a296f7a70f116e1793d06a05207cc671fed692e810e9a2b9215460192021-11-09 14:06:05240 days 3 hrs ago 0xc29f1facff8c228b38e6b7681a73ca55581c1ff7  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VaultManagerBorrowFeeParameters

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

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

import "../../VaultParameters.sol";
import "../../interfaces/vault-managers/parameters/IVaultManagerBorrowFeeParameters.sol";
import "../../helpers/SafeMath.sol";


/**
 * @title VaultManagerBorrowFeeParameters
 **/
contract VaultManagerBorrowFeeParameters is Auth, IVaultManagerBorrowFeeParameters {
    using SafeMath for uint;

    uint public constant override BASIS_POINTS_IN_1 = 1e4;

    struct AssetBorrowFeeParams {
        bool enabled; // is custom fee for asset enabled
        uint16 feeBasisPoints; // fee basis points, 1 basis point = 0.0001
    }

    // map token to borrow fee
    mapping(address => AssetBorrowFeeParams) public assetBorrowFee;
    uint16 public baseBorrowFeeBasisPoints;

    address public override feeReceiver;

    event AssetBorrowFeeParamsEnabled(address asset, uint16 feeBasisPoints);
    event AssetBorrowFeeParamsDisabled(address asset);

    modifier nonZeroAddress(address addr) {
        require(addr != address(0), "Unit Protocol: ZERO_ADDRESS");
        _;
    }

    modifier correctFee(uint16 fee) {
        require(fee < BASIS_POINTS_IN_1, "Unit Protocol: INCORRECT_FEE_VALUE");
        _;
    }

    constructor(address _vaultParameters, uint16 _baseBorrowFeeBasisPoints, address _feeReceiver)
        Auth(_vaultParameters)
        nonZeroAddress(_feeReceiver)
        correctFee(_baseBorrowFeeBasisPoints)
    {
        baseBorrowFeeBasisPoints = _baseBorrowFeeBasisPoints;
        feeReceiver = _feeReceiver;
    }

    /// @inheritdoc IVaultManagerBorrowFeeParameters
    function setFeeReceiver(address newFeeReceiver) external override onlyManager nonZeroAddress(newFeeReceiver) {
        feeReceiver = newFeeReceiver;
    }

    /// @inheritdoc IVaultManagerBorrowFeeParameters
    function setBaseBorrowFee(uint16 newBaseBorrowFeeBasisPoints) external override onlyManager correctFee(newBaseBorrowFeeBasisPoints) {
        baseBorrowFeeBasisPoints = newBaseBorrowFeeBasisPoints;
    }

    /// @inheritdoc IVaultManagerBorrowFeeParameters
    function setAssetBorrowFee(address asset, bool newEnabled, uint16 newFeeBasisPoints) external override onlyManager correctFee(newFeeBasisPoints) {
        assetBorrowFee[asset].enabled = newEnabled;
        assetBorrowFee[asset].feeBasisPoints = newFeeBasisPoints;

        if (newEnabled) {
            emit AssetBorrowFeeParamsEnabled(asset, newFeeBasisPoints);
        } else {
            emit AssetBorrowFeeParamsDisabled(asset);
        }
    }

    /// @inheritdoc IVaultManagerBorrowFeeParameters
    function getBorrowFee(address asset) public override view returns (uint16 feeBasisPoints) {
        if (assetBorrowFee[asset].enabled) {
            return assetBorrowFee[asset].feeBasisPoints;
        }

        return baseBorrowFeeBasisPoints;
    }

    /// @inheritdoc IVaultManagerBorrowFeeParameters
    function calcBorrowFeeAmount(address asset, uint usdpAmount) external override view returns (uint) {
        uint16 borrowFeeBasisPoints = getBorrowFee(asset);
        if (borrowFeeBasisPoints == 0) {
            return 0;
        }

        return usdpAmount.mul(uint(borrowFeeBasisPoints)).div(BASIS_POINTS_IN_1);
    }
}

File 2 of 4 : VaultParameters.sol
// SPDX-License-Identifier: bsl-1.1

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



/**
 * @title Auth
 * @dev Manages USDP's system access
 **/
contract Auth {

    // address of the the contract with vault parameters
    VaultParameters public immutable vaultParameters;

    constructor(address _parameters) {
        vaultParameters = VaultParameters(_parameters);
    }

    // ensures tx's sender is a manager
    modifier onlyManager() {
        require(vaultParameters.isManager(msg.sender), "Unit Protocol: AUTH_FAILED");
        _;
    }

    // ensures tx's sender is able to modify the Vault
    modifier hasVaultAccess() {
        require(vaultParameters.canModifyVault(msg.sender), "Unit Protocol: AUTH_FAILED");
        _;
    }

    // ensures tx's sender is the Vault
    modifier onlyVault() {
        require(msg.sender == vaultParameters.vault(), "Unit Protocol: AUTH_FAILED");
        _;
    }
}



/**
 * @title VaultParameters
 **/
contract VaultParameters is Auth {

    // map token to stability fee percentage; 3 decimals
    mapping(address => uint) public stabilityFee;

    // map token to liquidation fee percentage, 0 decimals
    mapping(address => uint) public liquidationFee;

    // map token to USDP mint limit
    mapping(address => uint) public tokenDebtLimit;

    // permissions to modify the Vault
    mapping(address => bool) public canModifyVault;

    // managers
    mapping(address => bool) public isManager;

    // enabled oracle types
    mapping(uint => mapping (address => bool)) public isOracleTypeEnabled;

    // address of the Vault
    address payable public immutable vault;

    // The foundation address
    address public foundation;

    /**
     * The address for an Ethereum contract is deterministically computed from the address of its creator (sender)
     * and how many transactions the creator has sent (nonce). The sender and nonce are RLP encoded and then
     * hashed with Keccak-256.
     * Therefore, the Vault address can be pre-computed and passed as an argument before deployment.
    **/
    constructor(address payable _vault, address _foundation) Auth(address(this)) {
        require(_vault != address(0), "Unit Protocol: ZERO_ADDRESS");
        require(_foundation != address(0), "Unit Protocol: ZERO_ADDRESS");

        isManager[msg.sender] = true;
        vault = _vault;
        foundation = _foundation;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Grants and revokes manager's status of any address
     * @param who The target address
     * @param permit The permission flag
     **/
    function setManager(address who, bool permit) external onlyManager {
        isManager[who] = permit;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets the foundation address
     * @param newFoundation The new foundation address
     **/
    function setFoundation(address newFoundation) external onlyManager {
        require(newFoundation != address(0), "Unit Protocol: ZERO_ADDRESS");
        foundation = newFoundation;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets ability to use token as the main collateral
     * @param asset The address of the main collateral token
     * @param stabilityFeeValue The percentage of the year stability fee (3 decimals)
     * @param liquidationFeeValue The liquidation fee percentage (0 decimals)
     * @param usdpLimit The USDP token issue limit
     * @param oracles The enables oracle types
     **/
    function setCollateral(
        address asset,
        uint stabilityFeeValue,
        uint liquidationFeeValue,
        uint usdpLimit,
        uint[] calldata oracles
    ) external onlyManager {
        setStabilityFee(asset, stabilityFeeValue);
        setLiquidationFee(asset, liquidationFeeValue);
        setTokenDebtLimit(asset, usdpLimit);
        for (uint i=0; i < oracles.length; i++) {
            setOracleType(oracles[i], asset, true);
        }
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets a permission for an address to modify the Vault
     * @param who The target address
     * @param permit The permission flag
     **/
    function setVaultAccess(address who, bool permit) external onlyManager {
        canModifyVault[who] = permit;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets the percentage of the year stability fee for a particular collateral
     * @param asset The address of the main collateral token
     * @param newValue The stability fee percentage (3 decimals)
     **/
    function setStabilityFee(address asset, uint newValue) public onlyManager {
        stabilityFee[asset] = newValue;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets the percentage of the liquidation fee for a particular collateral
     * @param asset The address of the main collateral token
     * @param newValue The liquidation fee percentage (0 decimals)
     **/
    function setLiquidationFee(address asset, uint newValue) public onlyManager {
        require(newValue <= 100, "Unit Protocol: VALUE_OUT_OF_RANGE");
        liquidationFee[asset] = newValue;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Enables/disables oracle types
     * @param _type The type of the oracle
     * @param asset The address of the main collateral token
     * @param enabled The control flag
     **/
    function setOracleType(uint _type, address asset, bool enabled) public onlyManager {
        isOracleTypeEnabled[_type][asset] = enabled;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets USDP limit for a specific collateral
     * @param asset The address of the main collateral token
     * @param limit The limit number
     **/
    function setTokenDebtLimit(address asset, uint limit) public onlyManager {
        tokenDebtLimit[asset] = limit;
    }
}

File 3 of 4 : 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 4 of 4 : 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;
    }
}

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":"_vaultParameters","type":"address"},{"internalType":"uint16","name":"_baseBorrowFeeBasisPoints","type":"uint16"},{"internalType":"address","name":"_feeReceiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"AssetBorrowFeeParamsDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint16","name":"feeBasisPoints","type":"uint16"}],"name":"AssetBorrowFeeParamsEnabled","type":"event"},{"inputs":[],"name":"BASIS_POINTS_IN_1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"assetBorrowFee","outputs":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"feeBasisPoints","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseBorrowFeeBasisPoints","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"usdpAmount","type":"uint256"}],"name":"calcBorrowFeeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getBorrowFee","outputs":[{"internalType":"uint16","name":"feeBasisPoints","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"bool","name":"newEnabled","type":"bool"},{"internalType":"uint16","name":"newFeeBasisPoints","type":"uint16"}],"name":"setAssetBorrowFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"newBaseBorrowFeeBasisPoints","type":"uint16"}],"name":"setBaseBorrowFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newFeeReceiver","type":"address"}],"name":"setFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultParameters","outputs":[{"internalType":"contract VaultParameters","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a060405234801561001057600080fd5b50604051610a1b380380610a1b8339818101604052606081101561003357600080fd5b50805160208201516040909201516001600160601b0319606083901b16608052909190806001600160a01b0381166100b2576040805162461bcd60e51b815260206004820152601b60248201527f556e69742050726f746f636f6c3a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b826127108161ffff16106100f75760405162461bcd60e51b81526004018080602001828103825260228152602001806109f96022913960400191505060405180910390fd5b5050600180546001600160a01b03909216620100000262010000600160b01b031961ffff90941661ffff1990931692909217929092161790555060805160601c61089c61015d6000398061023f528061049952806104f0528061062e525061089c6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063aca345ee11610066578063aca345ee14610180578063b3f00674146101a4578063b7ca77f2146101ac578063efdcd974146101cd578063fbbac962146101f35761009e565b80634bec2dba146100a35780637610361c146100dd57806387426a84146100fc57806387f21ac7146101225780639624176a1461013c575b600080fd5b6100db600480360360608110156100b957600080fd5b5080356001600160a01b03169060208101351515906040013561ffff1661021f565b005b6100e5610410565b6040805161ffff9092168252519081900360200190f35b6100e56004803603602081101561011257600080fd5b50356001600160a01b031661041a565b61012a610471565b60408051918252519081900360200190f35b6101626004803603602081101561015257600080fd5b50356001600160a01b0316610477565b60408051921515835261ffff90911660208301528051918290030190f35b610188610497565b604080516001600160a01b039092168252519081900360200190f35b6101886104bb565b6100db600480360360208110156101c257600080fd5b503561ffff166104d0565b6100db600480360360208110156101e357600080fd5b50356001600160a01b031661060e565b61012a6004803603604081101561020957600080fd5b506001600160a01b038135169060200135610775565b6040805163f3ae241560e01b815233600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163f3ae2415916024808301926020929190829003018186803b15801561028557600080fd5b505afa158015610299573d6000803e3d6000fd5b505050506040513d60208110156102af57600080fd5b50516102ff576040805162461bcd60e51b815260206004820152601a602482015279155b9a5d08141c9bdd1bd8dbdb0e881055551217d1905253115160321b604482015290519081900360640190fd5b806127108161ffff16106103445760405162461bcd60e51b81526004018080602001828103825260228152602001806108456022913960400191505060405180910390fd5b6001600160a01b0384166000908152602081905260409020805460ff1916841580159190911762ffff00191661010061ffff861602179091556103cd57604080516001600160a01b038616815261ffff8416602082015281517f9c0112a9b7dafd87c47aef059f83740371ad6a4c0bf51d053a631c7f65ebe4bb929181900390910190a161040a565b604080516001600160a01b038616815290517fc48ba4f2bf86e2f2929533dbc1d4305db79433e448ce61620978df0c366a9d319181900360200190a15b50505050565b60015461ffff1681565b6001600160a01b03811660009081526020819052604081205460ff161561046357506001600160a01b038116600090815260208190526040902054610100900461ffff1661046c565b5060015461ffff165b919050565b61271081565b60006020819052908152604090205460ff811690610100900461ffff1682565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001546201000090046001600160a01b031681565b6040805163f3ae241560e01b815233600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163f3ae2415916024808301926020929190829003018186803b15801561053657600080fd5b505afa15801561054a573d6000803e3d6000fd5b505050506040513d602081101561056057600080fd5b50516105b0576040805162461bcd60e51b815260206004820152601a602482015279155b9a5d08141c9bdd1bd8dbdb0e881055551217d1905253115160321b604482015290519081900360640190fd5b806127108161ffff16106105f55760405162461bcd60e51b81526004018080602001828103825260228152602001806108456022913960400191505060405180910390fd5b506001805461ffff191661ffff92909216919091179055565b6040805163f3ae241560e01b815233600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163f3ae2415916024808301926020929190829003018186803b15801561067457600080fd5b505afa158015610688573d6000803e3d6000fd5b505050506040513d602081101561069e57600080fd5b50516106ee576040805162461bcd60e51b815260206004820152601a602482015279155b9a5d08141c9bdd1bd8dbdb0e881055551217d1905253115160321b604482015290519081900360640190fd5b806001600160a01b03811661074a576040805162461bcd60e51b815260206004820152601b60248201527f556e69742050726f746f636f6c3a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b50600180546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b6000806107818461041a565b905061ffff81166107965760009150506107b4565b6107b06127106107aa8561ffff85166107ba565b906107df565b9150505b92915050565b6000826107c9575060006107b4565b50818102818382816107d757fe5b04146107b457fe5b600081610833576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161083c57fe5b04939250505056fe556e69742050726f746f636f6c3a20494e434f52524543545f4645455f56414c5545a2646970667358221220d30bb6c5df398a7ec74010a1b97187dbf8fe8d5f58387c31fd643785424616af64736f6c63430007060033556e69742050726f746f636f6c3a20494e434f52524543545f4645455f56414c5545000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000f1c0ffce3ada8b6f591a161968fc254ac323cfa4

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

000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000f1c0ffce3ada8b6f591a161968fc254ac323cfa4

-----Decoded View---------------
Arg [0] : _vaultParameters (address): 0xa8f0b5758041158cf0375b7adc8ac175ff031b6c
Arg [1] : _baseBorrowFeeBasisPoints (uint16): 90
Arg [2] : _feeReceiver (address): 0xf1c0ffce3ada8b6f591a161968fc254ac323cfa4

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c
Arg [1] : 000000000000000000000000000000000000000000000000000000000000005a
Arg [2] : 000000000000000000000000f1c0ffce3ada8b6f591a161968fc254ac323cfa4


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.