ETH Price: $2,540.00 (+3.12%)

Contract

0xff767BdCd76f6E5AF75957E15D5B2a8BFC43B4Bf
 

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

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
187981392023-12-16 10:49:47256 days ago1702723787  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LinearInterestRateModelV3

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
london EvmVersion
File 1 of 5 : LinearInterestRateModelV3.sol
// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;
pragma abicoder v1;

import {WAD, RAY, PERCENTAGE_FACTOR} from "@gearbox-protocol/core-v2/contracts/libraries/Constants.sol";
import {ILinearInterestRateModelV3} from "../interfaces/ILinearInterestRateModelV3.sol";

// EXCEPTIONS
import {IncorrectParameterException, BorrowingMoreThanU2ForbiddenException} from "../interfaces/IExceptions.sol";

/// @title Linear interest rate model V3
/// @notice Gearbox V3 uses a two-point linear interest rate model in its pools.
///         Unlike previous single-point models, it has a new intermediate slope between the obtuse and steep regions
///         which serves to decrease interest rate jumps due to large withdrawals.
///         The model can also be configured to prevent borrowing after in the steep region (over `U_2` utilization)
///         in order to create a reserve for exits and make rates more stable.
contract LinearInterestRateModelV3 is ILinearInterestRateModelV3 {
    /// @notice Contract version
    uint256 public constant override version = 3_00;

    /// @notice Whether to prevent borrowing over `U_2` utilization
    bool public immutable override isBorrowingMoreU2Forbidden;

    /// @notice The first slope change point (obtuse -> intermediate region)
    uint256 public immutable U_1_WAD;

    /// @notice The second slope change point (intermediate -> steep region)
    uint256 public immutable U_2_WAD;

    /// @notice Base interest rate in RAY format
    uint256 public immutable R_base_RAY;

    /// @notice Slope of the obtuse region
    uint256 public immutable R_slope1_RAY;

    /// @notice Slope of the intermediate region
    uint256 public immutable R_slope2_RAY;

    /// @notice Slope of the steep region
    uint256 public immutable R_slope3_RAY;

    /// @notice Constructor
    /// @param U_1 `U_1` in basis points
    /// @param U_2 `U_2` in basis points
    /// @param R_base `R_base` in basis points
    /// @param R_slope1 `R_slope1` in basis points
    /// @param R_slope2 `R_slope2` in basis points
    /// @param R_slope3 `R_slope3` in basis points
    /// @param _isBorrowingMoreU2Forbidden Whether to prevent borrowing over `U_2` utilization
    constructor(
        uint16 U_1,
        uint16 U_2,
        uint16 R_base,
        uint16 R_slope1,
        uint16 R_slope2,
        uint16 R_slope3,
        bool _isBorrowingMoreU2Forbidden
    ) {
        if (
            (U_1 >= PERCENTAGE_FACTOR) || (U_2 >= PERCENTAGE_FACTOR) || (U_1 > U_2) || (R_base > PERCENTAGE_FACTOR)
                || (R_slope1 > PERCENTAGE_FACTOR) || (R_slope2 > PERCENTAGE_FACTOR) || (R_slope1 > R_slope2)
                || (R_slope2 > R_slope3)
        ) {
            revert IncorrectParameterException(); // U:[LIM-2]
        }

        /// Critical utilization points are stored in WAD format

        U_1_WAD = U_1 * (WAD / PERCENTAGE_FACTOR); // U:[LIM-1]
        U_2_WAD = U_2 * (WAD / PERCENTAGE_FACTOR); // U:[LIM-1]

        /// Slopes are stored in RAY format
        R_base_RAY = R_base * (RAY / PERCENTAGE_FACTOR); // U:[LIM-1]
        R_slope1_RAY = R_slope1 * (RAY / PERCENTAGE_FACTOR); // U:[LIM-1]
        R_slope2_RAY = R_slope2 * (RAY / PERCENTAGE_FACTOR); // U:[LIM-1]
        R_slope3_RAY = R_slope3 * (RAY / PERCENTAGE_FACTOR); // U:[LIM-1]

        isBorrowingMoreU2Forbidden = _isBorrowingMoreU2Forbidden; // U:[LIM-1]
    }

    /// @dev Same as the next one with `checkOptimalBorrowing` set to `false`, added for compatibility with older pools
    function calcBorrowRate(uint256 expectedLiquidity, uint256 availableLiquidity) external view returns (uint256) {
        return calcBorrowRate(expectedLiquidity, availableLiquidity, false);
    }

    /// @notice Returns the borrow rate calculated based on expected and available liquidity
    /// @param expectedLiquidity Expected liquidity in the pool
    /// @param availableLiquidity Available liquidity in the pool
    /// @param checkOptimalBorrowing Whether to check if borrowing over `U_2` utilization should be prevented
    function calcBorrowRate(uint256 expectedLiquidity, uint256 availableLiquidity, bool checkOptimalBorrowing)
        public
        view
        override
        returns (uint256)
    {
        if (expectedLiquidity <= availableLiquidity) {
            return R_base_RAY; // U:[LIM-3]
        }

        //      expectedLiquidity - availableLiquidity
        // U = ----------------------------------------
        //                expectedLiquidity

        uint256 U_WAD = (WAD * (expectedLiquidity - availableLiquidity)) / expectedLiquidity; // U:[LIM-3]

        // If U < U_1:
        //                                    U
        // borrowRate = R_base + R_slope1 * -----
        //                                   U_1

        if (U_WAD < U_1_WAD) {
            return R_base_RAY + ((R_slope1_RAY * U_WAD) / U_1_WAD); // U:[LIM-3]
        }

        // If U >= U_1 & U < U_2:
        //                                               U  - U_1
        // borrowRate = R_base + R_slope1 + R_slope2 * -----------
        //                                              U_2 - U_1

        if (U_WAD < U_2_WAD) {
            return R_base_RAY + R_slope1_RAY + (R_slope2_RAY * (U_WAD - U_1_WAD)) / (U_2_WAD - U_1_WAD); // U:[LIM-3]
        }

        // If U > U_2 in `isBorrowingMoreU2Forbidden` and the utilization check is requested,
        // the function will revert to prevent raising utilization over the limit
        if (checkOptimalBorrowing && isBorrowingMoreU2Forbidden) {
            revert BorrowingMoreThanU2ForbiddenException(); // U:[LIM-3]
        }

        // If U >= U_2:
        //                                                         U - U_2
        // borrowRate = R_base + R_slope1 + R_slope2 + R_slope3 * ----------
        //                                                         1 - U_2

        return R_base_RAY + R_slope1_RAY + R_slope2_RAY + R_slope3_RAY * (U_WAD - U_2_WAD) / (WAD - U_2_WAD); // U:[LIM-3]
    }

    /// @notice Returns the model's parameters in basis points
    function getModelParameters()
        external
        view
        override
        returns (uint16 U_1, uint16 U_2, uint16 R_base, uint16 R_slope1, uint16 R_slope2, uint16 R_slope3)
    {
        U_1 = uint16(U_1_WAD / (WAD / PERCENTAGE_FACTOR)); // U:[LIM-1]
        U_2 = uint16(U_2_WAD / (WAD / PERCENTAGE_FACTOR)); // U:[LIM-1]
        R_base = uint16(R_base_RAY / (RAY / PERCENTAGE_FACTOR)); // U:[LIM-1]
        R_slope1 = uint16(R_slope1_RAY / (RAY / PERCENTAGE_FACTOR)); // U:[LIM-1]
        R_slope2 = uint16(R_slope2_RAY / (RAY / PERCENTAGE_FACTOR)); // U:[LIM-1]
        R_slope3 = uint16(R_slope3_RAY / (RAY / PERCENTAGE_FACTOR)); // U:[LIM-1]
    }

    /// @notice Returns the amount available to borrow
    ///         - If borrowing over `U_2` is prohibited, returns the amount that can be borrowed before `U_2` is reached
    ///         - Otherwise, simply returns the available liquidity
    function availableToBorrow(uint256 expectedLiquidity, uint256 availableLiquidity)
        external
        view
        override
        returns (uint256)
    {
        if (isBorrowingMoreU2Forbidden && (expectedLiquidity >= availableLiquidity) && (expectedLiquidity != 0)) {
            uint256 U_WAD = (WAD * (expectedLiquidity - availableLiquidity)) / expectedLiquidity; // U:[LIM-3]

            return (U_WAD < U_2_WAD) ? ((U_2_WAD - U_WAD) * expectedLiquidity) / WAD : 0; // U:[LIM-3]
        } else {
            return availableLiquidity; // U:[LIM-3]
        }
    }
}

File 2 of 5 : Constants.sol
// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2022
pragma solidity ^0.8.10;

// Denominations

uint256 constant WAD = 1e18;
uint256 constant RAY = 1e27;
uint16 constant PERCENTAGE_FACTOR = 1e4; //percentage plus two decimals

// 25% of type(uint256).max
uint256 constant ALLOWANCE_THRESHOLD = type(uint96).max >> 3;

// FEE = 50%
uint16 constant DEFAULT_FEE_INTEREST = 50_00; // 50%

// LIQUIDATION_FEE 1.5%
uint16 constant DEFAULT_FEE_LIQUIDATION = 1_50; // 1.5%

// LIQUIDATION PREMIUM 4%
uint16 constant DEFAULT_LIQUIDATION_PREMIUM = 4_00; // 4%

// LIQUIDATION_FEE_EXPIRED 2%
uint16 constant DEFAULT_FEE_LIQUIDATION_EXPIRED = 1_00; // 2%

// LIQUIDATION PREMIUM EXPIRED 2%
uint16 constant DEFAULT_LIQUIDATION_PREMIUM_EXPIRED = 2_00; // 2%

// DEFAULT PROPORTION OF MAX BORROWED PER BLOCK TO MAX BORROWED PER ACCOUNT
uint16 constant DEFAULT_LIMIT_PER_BLOCK_MULTIPLIER = 2;

// Seconds in a year
uint256 constant SECONDS_PER_YEAR = 365 days;
uint256 constant SECONDS_PER_ONE_AND_HALF_YEAR = (SECONDS_PER_YEAR * 3) / 2;

// OPERATIONS

// Leverage decimals - 100 is equal to 2x leverage (100% * collateral amount + 100% * borrowed amount)
uint8 constant LEVERAGE_DECIMALS = 100;

// Maximum withdraw fee for pool in PERCENTAGE_FACTOR format
uint8 constant MAX_WITHDRAW_FEE = 100;

uint256 constant EXACT_INPUT = 1;
uint256 constant EXACT_OUTPUT = 2;

address constant UNIVERSAL_CONTRACT = 0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC;

File 3 of 5 : ILinearInterestRateModelV3.sol
// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;

import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol";

/// @title Linear interest rate model V3 interface
interface ILinearInterestRateModelV3 is IVersion {
    function calcBorrowRate(uint256 expectedLiquidity, uint256 availableLiquidity, bool checkOptimalBorrowing)
        external
        view
        returns (uint256);

    function availableToBorrow(uint256 expectedLiquidity, uint256 availableLiquidity) external view returns (uint256);

    function isBorrowingMoreU2Forbidden() external view returns (bool);

    function getModelParameters()
        external
        view
        returns (uint16 U_1, uint16 U_2, uint16 R_base, uint16 R_slope1, uint16 R_slope2, uint16 R_slope3);
}

File 4 of 5 : IExceptions.sol
// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;

// ------- //
// GENERAL //
// ------- //

/// @notice Thrown on attempting to set an important address to zero address
error ZeroAddressException();

/// @notice Thrown when attempting to pass a zero amount to a funding-related operation
error AmountCantBeZeroException();

/// @notice Thrown on incorrect input parameter
error IncorrectParameterException();

/// @notice Thrown when balance is insufficient to perform an operation
error InsufficientBalanceException();

/// @notice Thrown if parameter is out of range
error ValueOutOfRangeException();

/// @notice Thrown when trying to send ETH to a contract that is not allowed to receive ETH directly
error ReceiveIsNotAllowedException();

/// @notice Thrown on attempting to set an EOA as an important contract in the system
error AddressIsNotContractException(address);

/// @notice Thrown on attempting to receive a token that is not a collateral token or was forbidden
error TokenNotAllowedException();

/// @notice Thrown on attempting to add a token that is already in a collateral list
error TokenAlreadyAddedException();

/// @notice Thrown when attempting to use quota-related logic for a token that is not quoted in quota keeper
error TokenIsNotQuotedException();

/// @notice Thrown on attempting to interact with an address that is not a valid target contract
error TargetContractNotAllowedException();

/// @notice Thrown if function is not implemented
error NotImplementedException();

// ------------------ //
// CONTRACTS REGISTER //
// ------------------ //

/// @notice Thrown when an address is expected to be a registered credit manager, but is not
error RegisteredCreditManagerOnlyException();

/// @notice Thrown when an address is expected to be a registered pool, but is not
error RegisteredPoolOnlyException();

// ---------------- //
// ADDRESS PROVIDER //
// ---------------- //

/// @notice Reverts if address key isn't found in address provider
error AddressNotFoundException();

// ----------------- //
// POOL, PQK, GAUGES //
// ----------------- //

/// @notice Thrown by pool-adjacent contracts when a credit manager being connected has a wrong pool address
error IncompatibleCreditManagerException();

/// @notice Thrown when attempting to set an incompatible successor staking contract
error IncompatibleSuccessorException();

/// @notice Thrown when attempting to vote in a non-approved contract
error VotingContractNotAllowedException();

/// @notice Thrown when attempting to unvote more votes than there are
error InsufficientVotesException();

/// @notice Thrown when attempting to borrow more than the second point on a two-point curve
error BorrowingMoreThanU2ForbiddenException();

/// @notice Thrown when a credit manager attempts to borrow more than its limit in the current block, or in general
error CreditManagerCantBorrowException();

/// @notice Thrown when attempting to connect a quota keeper to an incompatible pool
error IncompatiblePoolQuotaKeeperException();

/// @notice Thrown when the quota is outside of min/max bounds
error QuotaIsOutOfBoundsException();

// -------------- //
// CREDIT MANAGER //
// -------------- //

/// @notice Thrown on failing a full collateral check after multicall
error NotEnoughCollateralException();

/// @notice Thrown if an attempt to approve a collateral token to adapter's target contract fails
error AllowanceFailedException();

/// @notice Thrown on attempting to perform an action for a credit account that does not exist
error CreditAccountDoesNotExistException();

/// @notice Thrown on configurator attempting to add more than 255 collateral tokens
error TooManyTokensException();

/// @notice Thrown if more than the maximum number of tokens were enabled on a credit account
error TooManyEnabledTokensException();

/// @notice Thrown when attempting to execute a protocol interaction without active credit account set
error ActiveCreditAccountNotSetException();

/// @notice Thrown when trying to update credit account's debt more than once in the same block
error DebtUpdatedTwiceInOneBlockException();

/// @notice Thrown when trying to repay all debt while having active quotas
error DebtToZeroWithActiveQuotasException();

/// @notice Thrown when a zero-debt account attempts to update quota
error UpdateQuotaOnZeroDebtAccountException();

/// @notice Thrown when attempting to close an account with non-zero debt
error CloseAccountWithNonZeroDebtException();

/// @notice Thrown when value of funds remaining on the account after liquidation is insufficient
error InsufficientRemainingFundsException();

/// @notice Thrown when Credit Facade tries to write over a non-zero active Credit Account
error ActiveCreditAccountOverridenException();

// ------------------- //
// CREDIT CONFIGURATOR //
// ------------------- //

/// @notice Thrown on attempting to use a non-ERC20 contract or an EOA as a token
error IncorrectTokenContractException();

/// @notice Thrown if the newly set LT if zero or greater than the underlying's LT
error IncorrectLiquidationThresholdException();

/// @notice Thrown if borrowing limits are incorrect: minLimit > maxLimit or maxLimit > blockLimit
error IncorrectLimitsException();

/// @notice Thrown if the new expiration date is less than the current expiration date or current timestamp
error IncorrectExpirationDateException();

/// @notice Thrown if a contract returns a wrong credit manager or reverts when trying to retrieve it
error IncompatibleContractException();

/// @notice Thrown if attempting to forbid an adapter that is not registered in the credit manager
error AdapterIsNotRegisteredException();

/// @notice Thrown when trying to manually set total debt parameters in a credit facade that doesn't track them
error TotalDebtNotTrackedException();

// ------------- //
// CREDIT FACADE //
// ------------- //

/// @notice Thrown when attempting to perform an action that is forbidden in whitelisted mode
error ForbiddenInWhitelistedModeException();

/// @notice Thrown if credit facade is not expirable, and attempted aciton requires expirability
error NotAllowedWhenNotExpirableException();

/// @notice Thrown if a selector that doesn't match any allowed function is passed to the credit facade in a multicall
error UnknownMethodException();

/// @notice Thrown when trying to close an account with enabled tokens
error CloseAccountWithEnabledTokensException();

/// @notice Thrown if a liquidator tries to liquidate an account with a health factor above 1
error CreditAccountNotLiquidatableException();

/// @notice Thrown if too much new debt was taken within a single block
error BorrowedBlockLimitException();

/// @notice Thrown if the new debt principal for a credit account falls outside of borrowing limits
error BorrowAmountOutOfLimitsException();

/// @notice Thrown if a user attempts to open an account via an expired credit facade
error NotAllowedAfterExpirationException();

/// @notice Thrown if expected balances are attempted to be set twice without performing a slippage check
error ExpectedBalancesAlreadySetException();

/// @notice Thrown if attempting to perform a slippage check when excepted balances are not set
error ExpectedBalancesNotSetException();

/// @notice Thrown if balance of at least one token is less than expected during a slippage check
error BalanceLessThanExpectedException();

/// @notice Thrown when trying to perform an action that is forbidden when credit account has enabled forbidden tokens
error ForbiddenTokensException();

/// @notice Thrown when new forbidden tokens are enabled during the multicall
error ForbiddenTokenEnabledException();

/// @notice Thrown when enabled forbidden token balance is increased during the multicall
error ForbiddenTokenBalanceIncreasedException();

/// @notice Thrown when the remaining token balance is increased during the liquidation
error RemainingTokenBalanceIncreasedException();

/// @notice Thrown if `botMulticall` is called by an address that is not approved by account owner or is forbidden
error NotApprovedBotException();

/// @notice Thrown when attempting to perform a multicall action with no permission for it
error NoPermissionException(uint256 permission);

/// @notice Thrown when attempting to give a bot unexpected permissions
error UnexpectedPermissionsException();

/// @notice Thrown when a custom HF parameter lower than 10000 is passed into the full collateral check
error CustomHealthFactorTooLowException();

/// @notice Thrown when submitted collateral hint is not a valid token mask
error InvalidCollateralHintException();

// ------ //
// ACCESS //
// ------ //

/// @notice Thrown on attempting to call an access restricted function not as credit account owner
error CallerNotCreditAccountOwnerException();

/// @notice Thrown on attempting to call an access restricted function not as configurator
error CallerNotConfiguratorException();

/// @notice Thrown on attempting to call an access-restructed function not as account factory
error CallerNotAccountFactoryException();

/// @notice Thrown on attempting to call an access restricted function not as credit manager
error CallerNotCreditManagerException();

/// @notice Thrown on attempting to call an access restricted function not as credit facade
error CallerNotCreditFacadeException();

/// @notice Thrown on attempting to call an access restricted function not as controller or configurator
error CallerNotControllerException();

/// @notice Thrown on attempting to pause a contract without pausable admin rights
error CallerNotPausableAdminException();

/// @notice Thrown on attempting to unpause a contract without unpausable admin rights
error CallerNotUnpausableAdminException();

/// @notice Thrown on attempting to call an access restricted function not as gauge
error CallerNotGaugeException();

/// @notice Thrown on attempting to call an access restricted function not as quota keeper
error CallerNotPoolQuotaKeeperException();

/// @notice Thrown on attempting to call an access restricted function not as voter
error CallerNotVoterException();

/// @notice Thrown on attempting to call an access restricted function not as allowed adapter
error CallerNotAdapterException();

/// @notice Thrown on attempting to call an access restricted function not as migrator
error CallerNotMigratorException();

/// @notice Thrown when an address that is not the designated executor attempts to execute a transaction
error CallerNotExecutorException();

/// @notice Thrown on attempting to call an access restricted function not as veto admin
error CallerNotVetoAdminException();

// ------------------- //
// CONTROLLER TIMELOCK //
// ------------------- //

/// @notice Thrown when the new parameter values do not satisfy required conditions
error ParameterChecksFailedException();

/// @notice Thrown when attempting to execute a non-queued transaction
error TxNotQueuedException();

/// @notice Thrown when attempting to execute a transaction that is either immature or stale
error TxExecutedOutsideTimeWindowException();

/// @notice Thrown when execution of a transaction fails
error TxExecutionRevertedException();

/// @notice Thrown when the value of a parameter on execution is different from the value on queue
error ParameterChangedAfterQueuedTxException();

// -------- //
// BOT LIST //
// -------- //

/// @notice Thrown when attempting to set non-zero permissions for a forbidden or special bot
error InvalidBotException();

// --------------- //
// ACCOUNT FACTORY //
// --------------- //

/// @notice Thrown when trying to deploy second master credit account for a credit manager
error MasterCreditAccountAlreadyDeployedException();

/// @notice Thrown when trying to rescue funds from a credit account that is currently in use
error CreditAccountIsInUseException();

// ------------ //
// PRICE ORACLE //
// ------------ //

/// @notice Thrown on attempting to set a token price feed to an address that is not a correct price feed
error IncorrectPriceFeedException();

/// @notice Thrown on attempting to interact with a price feed for a token not added to the price oracle
error PriceFeedDoesNotExistException();

/// @notice Thrown when price feed returns incorrect price for a token
error IncorrectPriceException();

/// @notice Thrown when token's price feed becomes stale
error StalePriceException();

File 5 of 5 : IVersion.sol
// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2022
pragma solidity ^0.8.10;

/// @title Version interface
/// @notice Defines contract version
interface IVersion {
    /// @notice Contract version
    function version() external view returns (uint256);
}

Settings
{
  "remappings": [
    "@1inch/=node_modules/@1inch/",
    "@chainlink/=node_modules/@chainlink/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "@gearbox-protocol/=node_modules/@gearbox-protocol/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@redstone-finance/=node_modules/@redstone-finance/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint16","name":"U_1","type":"uint16"},{"internalType":"uint16","name":"U_2","type":"uint16"},{"internalType":"uint16","name":"R_base","type":"uint16"},{"internalType":"uint16","name":"R_slope1","type":"uint16"},{"internalType":"uint16","name":"R_slope2","type":"uint16"},{"internalType":"uint16","name":"R_slope3","type":"uint16"},{"internalType":"bool","name":"_isBorrowingMoreU2Forbidden","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BorrowingMoreThanU2ForbiddenException","type":"error"},{"inputs":[],"name":"IncorrectParameterException","type":"error"},{"inputs":[],"name":"R_base_RAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"R_slope1_RAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"R_slope2_RAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"R_slope3_RAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"U_1_WAD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"U_2_WAD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"expectedLiquidity","type":"uint256"},{"internalType":"uint256","name":"availableLiquidity","type":"uint256"}],"name":"availableToBorrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"expectedLiquidity","type":"uint256"},{"internalType":"uint256","name":"availableLiquidity","type":"uint256"},{"internalType":"bool","name":"checkOptimalBorrowing","type":"bool"}],"name":"calcBorrowRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"expectedLiquidity","type":"uint256"},{"internalType":"uint256","name":"availableLiquidity","type":"uint256"}],"name":"calcBorrowRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getModelParameters","outputs":[{"internalType":"uint16","name":"U_1","type":"uint16"},{"internalType":"uint16","name":"U_2","type":"uint16"},{"internalType":"uint16","name":"R_base","type":"uint16"},{"internalType":"uint16","name":"R_slope1","type":"uint16"},{"internalType":"uint16","name":"R_slope2","type":"uint16"},{"internalType":"uint16","name":"R_slope3","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isBorrowingMoreU2Forbidden","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

6101606040523480156200001257600080fd5b5060405162000d5d38038062000d5d833981810160405260e08110156200003857600080fd5b508051602082015160408301516060840151608085015160a086015160c090960151949593949293919290919061271061ffff881610158062000081575061271061ffff871610155b806200009457508561ffff168761ffff16115b80620000a5575061271061ffff8616115b80620000b6575061271061ffff8516115b80620000c7575061271061ffff8416115b80620000da57508261ffff168461ffff16115b80620000ed57508161ffff168361ffff16115b156200010c576040516347fbaa9760e01b815260040160405180910390fd5b62000122612710670de0b6b3a764000062000227565b620001329061ffff89166200024a565b60a0526200014b612710670de0b6b3a764000062000227565b6200015b9061ffff88166200024a565b60c052620001786127106b033b2e3c9fd0803ce800000062000227565b620001889061ffff87166200024a565b60e052620001a56127106b033b2e3c9fd0803ce800000062000227565b620001b59061ffff86166200024a565b61010052620001d36127106b033b2e3c9fd0803ce800000062000227565b620001e39061ffff85166200024a565b61012052620002016127106b033b2e3c9fd0803ce800000062000227565b620002119061ffff84166200024a565b6101405215156080525062000276945050505050565b6000826200024557634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176200027057634e487b7160e01b600052601160045260246000fd5b92915050565b60805160a05160c05160e0516101005161012051610140516109c96200039460003960008181610117015281816105c101526108f00152600081816101bc0152818161047c015281816105f101526108ac01526000818160de0152818161037a015281816104af015281816106150152610868015260008181610195015281816102dc015281816103ae015281816104d001528181610636015261082401526000818161021e015281816103dc015281816104280152818161056401528181610596015281816106fc0152818161073801526107e00152600081816102680152818161032d01528181610355015281816104070152818161045101526107a00152600081816101e301528181610508015261069401526109c96000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80636e55f77e1161008157806381ec4ab71161005b57806381ec4ab714610240578063be3c37cd14610263578063c8284e6d1461028a57600080fd5b80636e55f77e146101b7578063762dbdb8146101de5780637f681d541461021957600080fd5b806342568d44116100b257806342568d441461016457806354fd4d50146101875780636cdc90fd1461019057600080fd5b806301967344146100d95780631a40526514610112578063306ea06714610139575b600080fd5b6101007f000000000000000000000000000000000000000000000000000000000000000081565b60408051918252519081900360200190f35b6101007f000000000000000000000000000000000000000000000000000000000000000081565b6101006004803603606081101561014f57600080fd5b508035906020810135906040013515156102d0565b6101006004803603604081101561017a57600080fd5b5080359060200135610679565b61010061012c81565b6101007f000000000000000000000000000000000000000000000000000000000000000081565b6101007f000000000000000000000000000000000000000000000000000000000000000081565b6102057f000000000000000000000000000000000000000000000000000000000000000081565b604080519115158252519081900360200190f35b6101007f000000000000000000000000000000000000000000000000000000000000000081565b6101006004803603604081101561025657600080fd5b5080359060200135610690565b6101007f000000000000000000000000000000000000000000000000000000000000000081565b61029261077f565b6040805161ffff978816815295871660208701529386168585015291851660608501528416608084015290921660a082015290519081900360c00190f35b600082841161030057507f0000000000000000000000000000000000000000000000000000000000000000610672565b60008461030d8582610934565b61031f90670de0b6b3a7640000610947565b610329919061095e565b90507f00000000000000000000000000000000000000000000000000000000000000008110156103da577f000000000000000000000000000000000000000000000000000000000000000061039e827f0000000000000000000000000000000000000000000000000000000000000000610947565b6103a8919061095e565b6103d2907f0000000000000000000000000000000000000000000000000000000000000000610980565b915050610672565b7f00000000000000000000000000000000000000000000000000000000000000008110156104fe5761044c7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610934565b6104767f000000000000000000000000000000000000000000000000000000000000000083610934565b6104a0907f0000000000000000000000000000000000000000000000000000000000000000610947565b6104aa919061095e565b6104f47f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610980565b6103d29190610980565b82801561052857507f00000000000000000000000000000000000000000000000000000000000000005b1561055f576040517f351f03e300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105917f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000610934565b6105bb7f000000000000000000000000000000000000000000000000000000000000000083610934565b6105e5907f0000000000000000000000000000000000000000000000000000000000000000610947565b6105ef919061095e565b7f000000000000000000000000000000000000000000000000000000000000000061065a7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610980565b6106649190610980565b61066e9190610980565b9150505b9392505050565b6000610687838360006102d0565b90505b92915050565b60007f000000000000000000000000000000000000000000000000000000000000000080156106bf5750818310155b80156106ca57508215155b15610778576000836106dc8482610934565b6106ee90670de0b6b3a7640000610947565b6106f8919061095e565b90507f00000000000000000000000000000000000000000000000000000000000000008110610728576000610770565b670de0b6b3a76400008461075c837f0000000000000000000000000000000000000000000000000000000000000000610934565b6107669190610947565b610770919061095e565b91505061068a565b508061068a565b6000808080808061079a612710670de0b6b3a764000061095e565b6107c4907f000000000000000000000000000000000000000000000000000000000000000061095e565b95506107da612710670de0b6b3a764000061095e565b610804907f000000000000000000000000000000000000000000000000000000000000000061095e565b945061081e6127106b033b2e3c9fd0803ce800000061095e565b610848907f000000000000000000000000000000000000000000000000000000000000000061095e565b93506108626127106b033b2e3c9fd0803ce800000061095e565b61088c907f000000000000000000000000000000000000000000000000000000000000000061095e565b92506108a66127106b033b2e3c9fd0803ce800000061095e565b6108d0907f000000000000000000000000000000000000000000000000000000000000000061095e565b91506108ea6127106b033b2e3c9fd0803ce800000061095e565b610914907f000000000000000000000000000000000000000000000000000000000000000061095e565b9050909192939495565b634e487b7160e01b600052601160045260246000fd5b8181038181111561068a5761068a61091e565b808202811582820484141761068a5761068a61091e565b60008261097b57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561068a5761068a61091e56fea26469706673582212205ae1a1a33c8bb975c879fb250a8ab5a230bb55a5f6f11ae547e6d7e6b79ec79264736f6c634300081100330000000000000000000000000000000000000000000000000000000000001b58000000000000000000000000000000000000000000000000000000000000232800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000027100000000000000000000000000000000000000000000000000000000000000001

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100d45760003560e01c80636e55f77e1161008157806381ec4ab71161005b57806381ec4ab714610240578063be3c37cd14610263578063c8284e6d1461028a57600080fd5b80636e55f77e146101b7578063762dbdb8146101de5780637f681d541461021957600080fd5b806342568d44116100b257806342568d441461016457806354fd4d50146101875780636cdc90fd1461019057600080fd5b806301967344146100d95780631a40526514610112578063306ea06714610139575b600080fd5b6101007f000000000000000000000000000000000000000000084595161401484a00000081565b60408051918252519081900360200190f35b6101007f0000000000000000000000000000000000000000033b2e3c9fd0803ce800000081565b6101006004803603606081101561014f57600080fd5b508035906020810135906040013515156102d0565b6101006004803603604081101561017a57600080fd5b5080359060200135610679565b61010061012c81565b6101007f000000000000000000000000000000000000000000000000000000000000000081565b6101007f0000000000000000000000000000000000000000000a56fa5b99019a5c80000081565b6102057f000000000000000000000000000000000000000000000000000000000000000181565b604080519115158252519081900360200190f35b6101007f0000000000000000000000000000000000000000000000000c7d713b49da000081565b6101006004803603604081101561025657600080fd5b5080359060200135610690565b6101007f00000000000000000000000000000000000000000000000009b6e64a8ec6000081565b61029261077f565b6040805161ffff978816815295871660208701529386168585015291851660608501528416608084015290921660a082015290519081900360c00190f35b600082841161030057507f0000000000000000000000000000000000000000000000000000000000000000610672565b60008461030d8582610934565b61031f90670de0b6b3a7640000610947565b610329919061095e565b90507f00000000000000000000000000000000000000000000000009b6e64a8ec600008110156103da577f00000000000000000000000000000000000000000000000009b6e64a8ec6000061039e827f000000000000000000000000000000000000000000084595161401484a000000610947565b6103a8919061095e565b6103d2907f0000000000000000000000000000000000000000000000000000000000000000610980565b915050610672565b7f0000000000000000000000000000000000000000000000000c7d713b49da00008110156104fe5761044c7f00000000000000000000000000000000000000000000000009b6e64a8ec600007f0000000000000000000000000000000000000000000000000c7d713b49da0000610934565b6104767f00000000000000000000000000000000000000000000000009b6e64a8ec6000083610934565b6104a0907f0000000000000000000000000000000000000000000a56fa5b99019a5c800000610947565b6104aa919061095e565b6104f47f000000000000000000000000000000000000000000084595161401484a0000007f0000000000000000000000000000000000000000000000000000000000000000610980565b6103d29190610980565b82801561052857507f00000000000000000000000000000000000000000000000000000000000000015b1561055f576040517f351f03e300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105917f0000000000000000000000000000000000000000000000000c7d713b49da0000670de0b6b3a7640000610934565b6105bb7f0000000000000000000000000000000000000000000000000c7d713b49da000083610934565b6105e5907f0000000000000000000000000000000000000000033b2e3c9fd0803ce8000000610947565b6105ef919061095e565b7f0000000000000000000000000000000000000000000a56fa5b99019a5c80000061065a7f000000000000000000000000000000000000000000084595161401484a0000007f0000000000000000000000000000000000000000000000000000000000000000610980565b6106649190610980565b61066e9190610980565b9150505b9392505050565b6000610687838360006102d0565b90505b92915050565b60007f000000000000000000000000000000000000000000000000000000000000000180156106bf5750818310155b80156106ca57508215155b15610778576000836106dc8482610934565b6106ee90670de0b6b3a7640000610947565b6106f8919061095e565b90507f0000000000000000000000000000000000000000000000000c7d713b49da00008110610728576000610770565b670de0b6b3a76400008461075c837f0000000000000000000000000000000000000000000000000c7d713b49da0000610934565b6107669190610947565b610770919061095e565b91505061068a565b508061068a565b6000808080808061079a612710670de0b6b3a764000061095e565b6107c4907f00000000000000000000000000000000000000000000000009b6e64a8ec6000061095e565b95506107da612710670de0b6b3a764000061095e565b610804907f0000000000000000000000000000000000000000000000000c7d713b49da000061095e565b945061081e6127106b033b2e3c9fd0803ce800000061095e565b610848907f000000000000000000000000000000000000000000000000000000000000000061095e565b93506108626127106b033b2e3c9fd0803ce800000061095e565b61088c907f000000000000000000000000000000000000000000084595161401484a00000061095e565b92506108a66127106b033b2e3c9fd0803ce800000061095e565b6108d0907f0000000000000000000000000000000000000000000a56fa5b99019a5c80000061095e565b91506108ea6127106b033b2e3c9fd0803ce800000061095e565b610914907f0000000000000000000000000000000000000000033b2e3c9fd0803ce800000061095e565b9050909192939495565b634e487b7160e01b600052601160045260246000fd5b8181038181111561068a5761068a61091e565b808202811582820484141761068a5761068a61091e565b60008261097b57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561068a5761068a61091e56fea26469706673582212205ae1a1a33c8bb975c879fb250a8ab5a230bb55a5f6f11ae547e6d7e6b79ec79264736f6c63430008110033

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

0000000000000000000000000000000000000000000000000000000000001b58000000000000000000000000000000000000000000000000000000000000232800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000027100000000000000000000000000000000000000000000000000000000000000001

-----Decoded View---------------
Arg [0] : U_1 (uint16): 7000
Arg [1] : U_2 (uint16): 9000
Arg [2] : R_base (uint16): 0
Arg [3] : R_slope1 (uint16): 100
Arg [4] : R_slope2 (uint16): 125
Arg [5] : R_slope3 (uint16): 10000
Arg [6] : _isBorrowingMoreU2Forbidden (bool): True

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000001b58
Arg [1] : 0000000000000000000000000000000000000000000000000000000000002328
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [4] : 000000000000000000000000000000000000000000000000000000000000007d
Arg [5] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000001


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
[ Download: CSV Export  ]

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.