ETH Price: $3,270.38 (-0.89%)

Contract

0xB2f579fbe334006ed4dD9F154962FF510bCE303E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FeeProvider

Compiler Version
v0.5.14+commit.01f1aaa4

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license
/**
 *Submitted for verification at Etherscan.io on 2020-08-04
*/

/**
 *Submitted for verification at Etherscan.io on 2020-06-22
*/

// File: contracts/libraries/openzeppelin-upgradeability/VersionedInitializable.sol

pragma solidity >=0.4.24 <0.6.0;

/**
 * @title VersionedInitializable
 *
 * @dev Helper contract to support initializer functions. To use it, replace
 * the constructor with a function that has the `initializer` modifier.
 * WARNING: Unlike constructors, initializer functions must be manually
 * invoked. This applies both to deploying an Initializable contract, as well
 * as extending an Initializable contract via inheritance.
 * WARNING: When used with inheritance, manual care must be taken to not invoke
 * a parent initializer twice, or ensure that all initializers are idempotent,
 * because this is not dealt with automatically as with constructors.
 *
 * @author Aave, inspired by the OpenZeppelin Initializable contract
 */
contract VersionedInitializable {
    /**
   * @dev Indicates that the contract has been initialized.
   */
    uint256 private lastInitializedRevision = 0;

    /**
   * @dev Indicates that the contract is in the process of being initialized.
   */
    bool private initializing;

    /**
   * @dev Modifier to use in the initializer function of a contract.
   */
    modifier initializer() {
        uint256 revision = getRevision();
        require(initializing || isConstructor() || revision > lastInitializedRevision, "Contract instance has already been initialized");

        bool isTopLevelCall = !initializing;
        if (isTopLevelCall) {
            initializing = true;
            lastInitializedRevision = revision;
        }

        _;

        if (isTopLevelCall) {
            initializing = false;
        }
    }

    /// @dev returns the revision number of the contract.
    /// Needs to be defined in the inherited class as a constant.
    function getRevision() internal pure returns(uint256);


    /// @dev Returns true if and only if the function is running in the constructor
    function isConstructor() private view returns (bool) {
        // extcodesize checks the size of the code stored in an address, and
        // address returns the current address. Since the code is still not
        // deployed when running a constructor, any checks on its code size will
        // yield zero, making it an effective way to detect if a contract is
        // under construction or not.
        uint256 cs;
        //solium-disable-next-line
        assembly {
            cs := extcodesize(address)
        }
        return cs == 0;
    }

    // Reserved storage space to allow for layout changes in the future.
    uint256[50] private ______gap;
}

// File: contracts/interfaces/IFeeProvider.sol

pragma solidity ^0.5.0;

/**
* @title IFeeProvider interface
* @notice Interface for the Aave fee provider.
**/

interface IFeeProvider {
    function calculateLoanOriginationFee(address _user, uint256 _amount) external view returns (uint256);
    function getLoanOriginationFeePercentage() external view returns (uint256);
}

// File: openzeppelin-solidity/contracts/math/SafeMath.sol

pragma solidity ^0.5.0;

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

        return c;
    }

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

        return c;
    }

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

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

        return c;
    }

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

        return c;
    }

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

// File: contracts/libraries/WadRayMath.sol

pragma solidity ^0.5.0;


/**
* @title WadRayMath library
* @author Aave
* @dev Provides mul and div function for wads (decimal numbers with 18 digits precision) and rays (decimals with 27 digits)
**/

library WadRayMath {
    using SafeMath for uint256;

    uint256 internal constant WAD = 1e18;
    uint256 internal constant halfWAD = WAD / 2;

    uint256 internal constant RAY = 1e27;
    uint256 internal constant halfRAY = RAY / 2;

    uint256 internal constant WAD_RAY_RATIO = 1e9;

    /**
    * @return one ray, 1e27
    **/
    function ray() internal pure returns (uint256) {
        return RAY;
    }

    /**
    * @return one wad, 1e18
    **/

    function wad() internal pure returns (uint256) {
        return WAD;
    }

    /**
    * @return half ray, 1e27/2
    **/
    function halfRay() internal pure returns (uint256) {
        return halfRAY;
    }

    /**
    * @return half ray, 1e18/2
    **/
    function halfWad() internal pure returns (uint256) {
        return halfWAD;
    }

    /**
    * @dev multiplies two wad, rounding half up to the nearest wad
    * @param a wad
    * @param b wad
    * @return the result of a*b, in wad
    **/
    function wadMul(uint256 a, uint256 b) internal pure returns (uint256) {
        return halfWAD.add(a.mul(b)).div(WAD);
    }

    /**
    * @dev divides two wad, rounding half up to the nearest wad
    * @param a wad
    * @param b wad
    * @return the result of a/b, in wad
    **/
    function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 halfB = b / 2;

        return halfB.add(a.mul(WAD)).div(b);
    }

    /**
    * @dev multiplies two ray, rounding half up to the nearest ray
    * @param a ray
    * @param b ray
    * @return the result of a*b, in ray
    **/
    function rayMul(uint256 a, uint256 b) internal pure returns (uint256) {
        return halfRAY.add(a.mul(b)).div(RAY);
    }

    /**
    * @dev divides two ray, rounding half up to the nearest ray
    * @param a ray
    * @param b ray
    * @return the result of a/b, in ray
    **/
    function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 halfB = b / 2;

        return halfB.add(a.mul(RAY)).div(b);
    }

    /**
    * @dev casts ray down to wad
    * @param a ray
    * @return a casted to wad, rounded half up to the nearest wad
    **/
    function rayToWad(uint256 a) internal pure returns (uint256) {
        uint256 halfRatio = WAD_RAY_RATIO / 2;

        return halfRatio.add(a).div(WAD_RAY_RATIO);
    }

    /**
    * @dev convert wad up to ray
    * @param a wad
    * @return a converted in ray
    **/
    function wadToRay(uint256 a) internal pure returns (uint256) {
        return a.mul(WAD_RAY_RATIO);
    }

    /**
    * @dev calculates base^exp. The code uses the ModExp precompile
    * @return base^exp, in ray
    */
    //solium-disable-next-line
    function rayPow(uint256 x, uint256 n) internal pure returns (uint256 z) {

        z = n % 2 != 0 ? x : RAY;

        for (n /= 2; n != 0; n /= 2) {
            x = rayMul(x, x);

            if (n % 2 != 0) {
                z = rayMul(z, x);
            }
        }
    }

}

// File: contracts/fees/FeeProvider.sol

pragma solidity ^0.5.0;





/**
* @title FeeProvider contract
* @notice Implements calculation for the fees applied by the protocol
* @author Aave
**/
contract FeeProvider is IFeeProvider, VersionedInitializable {
    using WadRayMath for uint256;

    // percentage of the fee to be calculated on the loan amount
    uint256 public originationFeePercentage;


    uint256 constant public FEE_PROVIDER_REVISION = 0x3;

    function getRevision() internal pure returns(uint256) {
        return FEE_PROVIDER_REVISION;
    }
    /**
    * @dev initializes the FeeProvider after it's added to the proxy
    * @param _addressesProvider the address of the LendingPoolAddressesProvider
    */
    function initialize(address _addressesProvider) public initializer {
        originationFeePercentage = 0.0000001 * 1e18;
    }

    /**
    * @dev calculates the origination fee for every loan executed on the platform.
    * @param _user can be used in the future to apply discount to the origination fee based on the
    * _user account (eg. stake AAVE tokens in the lending pool, or deposit > 1M USD etc.)
    * @param _amount the amount of the loan
    **/
    function calculateLoanOriginationFee(address _user, uint256 _amount) external view returns (uint256) {
        return _amount.wadMul(originationFeePercentage);
    }

    /**
    * @dev returns the origination fee percentage
    **/
    function getLoanOriginationFeePercentage() external view returns (uint256) {
        return originationFeePercentage;
    }

}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"FEE_PROVIDER_REVISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"calculateLoanOriginationFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLoanOriginationFeePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addressesProvider","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"originationFeePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]

60806040526000805534801561001457600080fd5b50610399806100246000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80639403ed3a1461005c578063b0d73d4e14610076578063c211f9a41461007e578063c4d66de814610086578063e563a7d0146100ae575b600080fd5b6100646100da565b60408051918252519081900360200190f35b6100646100e0565b6100646100e5565b6100ac6004803603602081101561009c57600080fd5b50356001600160a01b03166100eb565b005b610064600480360360408110156100c457600080fd5b506001600160a01b038135169060200135610191565b60345481565b600381565b60345490565b60006100f56101b1565b60015490915060ff168061010c575061010c6101b6565b80610118575060005481115b6101535760405162461bcd60e51b815260040180806020018281038252602e815260200180610337602e913960400191505060405180910390fd5b60015460ff16158015610172576001805460ff19168117905560008290555b64174876e800603455801561018c576001805460ff191690555b505050565b60006101a8603454836101bc90919063ffffffff16565b90505b92915050565b600390565b303b1590565b60006101a8670de0b6b3a76400006101ec6101dd868663ffffffff6101f816565b6706f05b59d3b2000090610251565b9063ffffffff6102ab16565b600082610207575060006101ab565b8282028284828161021457fe5b04146101a85760405162461bcd60e51b81526004018080602001828103825260218152602001806103166021913960400191505060405180910390fd5b6000828201838110156101a8576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000808211610301576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161030c57fe5b0494935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a265627a7a72315820a8afbd89b9b1f59d613684536f549ae368be372703401194525cc7d94942eb7a64736f6c634300050e0032

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c80639403ed3a1461005c578063b0d73d4e14610076578063c211f9a41461007e578063c4d66de814610086578063e563a7d0146100ae575b600080fd5b6100646100da565b60408051918252519081900360200190f35b6100646100e0565b6100646100e5565b6100ac6004803603602081101561009c57600080fd5b50356001600160a01b03166100eb565b005b610064600480360360408110156100c457600080fd5b506001600160a01b038135169060200135610191565b60345481565b600381565b60345490565b60006100f56101b1565b60015490915060ff168061010c575061010c6101b6565b80610118575060005481115b6101535760405162461bcd60e51b815260040180806020018281038252602e815260200180610337602e913960400191505060405180910390fd5b60015460ff16158015610172576001805460ff19168117905560008290555b64174876e800603455801561018c576001805460ff191690555b505050565b60006101a8603454836101bc90919063ffffffff16565b90505b92915050565b600390565b303b1590565b60006101a8670de0b6b3a76400006101ec6101dd868663ffffffff6101f816565b6706f05b59d3b2000090610251565b9063ffffffff6102ab16565b600082610207575060006101ab565b8282028284828161021457fe5b04146101a85760405162461bcd60e51b81526004018080602001828103825260218152602001806103166021913960400191505060405180910390fd5b6000828201838110156101a8576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000808211610301576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161030c57fe5b0494935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a265627a7a72315820a8afbd89b9b1f59d613684536f549ae368be372703401194525cc7d94942eb7a64736f6c634300050e0032

Deployed Bytecode Sourcemap

10393:1405:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10393:1405:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10564:39;;;:::i;:::-;;;;;;;;;;;;;;;;10614:51;;;:::i;11668:125::-;;;:::i;10949:129::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;10949:129:0;-1:-1:-1;;;;;10949:129:0;;:::i;:::-;;11424:167;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;11424:167:0;;;;;;;;:::i;10564:39::-;;;;:::o;10614:51::-;10662:3;10614:51;:::o;11668:125::-;11761:24;;11668:125;:::o;10949:129::-;1328:16;1347:13;:11;:13::i;:::-;1379:12;;1328:32;;-1:-1:-1;1379:12:0;;;:31;;;1395:15;:13;:15::i;:::-;1379:69;;;;1425:23;;1414:8;:34;1379:69;1371:128;;;;-1:-1:-1;;;1371:128:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1535:12;;;;1534:13;1558:115;;;;1608:4;1593:19;;-1:-1:-1;;1593:19:0;;;;;:12;1627:34;;;1558:115;11054:16;11027:24;:43;1699:67;;;;1734:12;:20;;-1:-1:-1;;1734:20:0;;;1699:67;10949:129;;;:::o;11424:167::-;11516:7;11543:40;11558:24;;11543:7;:14;;:40;;;;:::i;:::-;11536:47;;11424:167;;;;;:::o;10674:101::-;10662:3;10674:101;:::o;2056:568::-;2573:7;2561:20;2609:7;2056:568;:::o;8109:126::-;8170:7;8197:30;7182:4;8197:21;8209:8;:1;8215;8209:8;:5;:8;:::i;:::-;7229:7;;8197:11;:21::i;:::-;:25;:30;:25;:30;:::i;4944:470::-;5002:7;5246:6;5242:47;;-1:-1:-1;5276:1:0;5269:8;;5242:47;5313:5;;;5317:1;5313;:5;:1;5337:5;;;;;:10;5329:56;;;;-1:-1:-1;;;5329:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4053:181;4111:7;4143:5;;;4167:6;;;;4159:46;;;;;-1:-1:-1;;;4159:46:0;;;;;;;;;;;;;;;;;;;;;;;;;;;5882:333;5940:7;6039:1;6035;:5;6027:44;;;;;-1:-1:-1;;;6027:44:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;6082:9;6098:1;6094;:5;;;;;;;5882:333;-1:-1:-1;;;;5882:333:0:o

Swarm Source

bzzr://a8afbd89b9b1f59d613684536f549ae368be372703401194525cc7d94942eb7a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.