Contract 0x16B39D80dd31018760d988B8D8677821498Cc486

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x8423b7810a973eda52692bf7f6409c325b99c3007229b21f0ca1408076ffef970x60806040142505782022-11-16 0:59:4323 days 52 mins agoBitlend: Deployer IN  Create: JumpRateModelV20 BTT135.3132
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
JumpRateModelV2

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, BSD-3-Clause license
/**
 *Submitted for verification at bttcscan.com on 2022-11-16
*/

// Sources flattened with hardhat v2.10.1 https://hardhat.org

// File contracts/InterestRateModel.sol

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.10;

/**
  * @title Compound's InterestRateModel Interface
  * @author Compound
  */
abstract contract InterestRateModel {
    /// @notice Indicator that this is an InterestRateModel contract (for inspection)
    bool public constant isInterestRateModel = true;

    /**
      * @notice Calculates the current borrow interest rate per block
      * @param cash The total amount of cash the market has
      * @param borrows The total amount of borrows the market has outstanding
      * @param reserves The total amount of reserves the market has
      * @return The borrow rate per block (as a percentage, and scaled by 1e18)
      */
    function getBorrowRate(uint cash, uint borrows, uint reserves) virtual external view returns (uint);

    /**
      * @notice Calculates the current supply interest rate per block
      * @param cash The total amount of cash the market has
      * @param borrows The total amount of borrows the market has outstanding
      * @param reserves The total amount of reserves the market has
      * @param reserveFactorMantissa The current reserve factor the market has
      * @return The supply rate per block (as a percentage, and scaled by 1e18)
      */
    function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) virtual external view returns (uint);
}



abstract contract BaseJumpRateModelV2 is InterestRateModel {
    event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);

    uint256 private constant BASE = 1e18;

    /**
     * @notice The address of the owner, i.e. the Timelock contract, which can update parameters directly
     */
    address public owner;

    /**
     * @notice The approximate number of blocks per year that is assumed by the interest rate model
     */
    uint public constant blocksPerYear = 15768000;

    /**
     * @notice The multiplier of utilization rate that gives the slope of the interest rate
     */
    uint public multiplierPerBlock;

    /**
     * @notice The base interest rate which is the y-intercept when utilization rate is 0
     */
    uint public baseRatePerBlock;

    /**
     * @notice The multiplierPerBlock after hitting a specified utilization point
     */
    uint public jumpMultiplierPerBlock;

    /**
     * @notice The utilization point at which the jump multiplier is applied
     */
    uint public kink;

    /**
     * @notice Construct an interest rate model
     * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by BASE)
     * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by BASE)
     * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
     * @param kink_ The utilization point at which the jump multiplier is applied
     * @param owner_ The address of the owner, i.e. the Timelock contract (which has the ability to update parameters directly)
     */
    constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_) internal {
        owner = owner_;

        updateJumpRateModelInternal(baseRatePerYear,  multiplierPerYear, jumpMultiplierPerYear, kink_);
    }

    /**
     * @notice Update the parameters of the interest rate model (only callable by owner, i.e. Timelock)
     * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by BASE)
     * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by BASE)
     * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
     * @param kink_ The utilization point at which the jump multiplier is applied
     */
    function updateJumpRateModel(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) virtual external {
        require(msg.sender == owner, "only the owner may call this function.");

        updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_);
    }

    /**
     * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`
     * @param cash The amount of cash in the market
     * @param borrows The amount of borrows in the market
     * @param reserves The amount of reserves in the market (currently unused)
     * @return The utilization rate as a mantissa between [0, BASE]
     */
    function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {
        // Utilization rate is 0 when there are no borrows
        if (borrows == 0) {
            return 0;
        }

        return borrows * BASE / (cash + borrows - reserves);
    }

    /**
     * @notice Calculates the current borrow rate per block, with the error code expected by the market
     * @param cash The amount of cash in the market
     * @param borrows The amount of borrows in the market
     * @param reserves The amount of reserves in the market
     * @return The borrow rate percentage per block as a mantissa (scaled by BASE)
     */
    function getBorrowRateInternal(uint cash, uint borrows, uint reserves) internal view returns (uint) {
        uint util = utilizationRate(cash, borrows, reserves);

        if (util <= kink) {
            return ((util * multiplierPerBlock) / BASE) + baseRatePerBlock;
        } else {
            uint normalRate = ((kink * multiplierPerBlock) / BASE) + baseRatePerBlock;
            uint excessUtil = util - kink;
            return ((excessUtil * jumpMultiplierPerBlock) / BASE) + normalRate;
        }
    }

    /**
     * @notice Calculates the current supply rate per block
     * @param cash The amount of cash in the market
     * @param borrows The amount of borrows in the market
     * @param reserves The amount of reserves in the market
     * @param reserveFactorMantissa The current reserve factor for the market
     * @return The supply rate percentage per block as a mantissa (scaled by BASE)
     */
    function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) virtual override public view returns (uint) {
        uint oneMinusReserveFactor = BASE - reserveFactorMantissa;
        uint borrowRate = getBorrowRateInternal(cash, borrows, reserves);
        uint rateToPool = borrowRate * oneMinusReserveFactor / BASE;
        return utilizationRate(cash, borrows, reserves) * rateToPool / BASE;
    }

    /**
     * @notice Internal function to update the parameters of the interest rate model
     * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by BASE)
     * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by BASE)
     * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
     * @param kink_ The utilization point at which the jump multiplier is applied
     */
    function updateJumpRateModelInternal(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) internal {
        baseRatePerBlock = baseRatePerYear / blocksPerYear;
        multiplierPerBlock = (multiplierPerYear * BASE) / (blocksPerYear * kink_);
        jumpMultiplierPerBlock = jumpMultiplierPerYear / blocksPerYear;
        kink = kink_;

        emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);
    }
}


contract JumpRateModelV2 is InterestRateModel, BaseJumpRateModelV2  {

	/**
     * @notice Calculates the current borrow rate per block
     * @param cash The amount of cash in the market
     * @param borrows The amount of borrows in the market
     * @param reserves The amount of reserves in the market
     * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)
     */
    function getBorrowRate(uint cash, uint borrows, uint reserves) override external view returns (uint) {
        return getBorrowRateInternal(cash, borrows, reserves);
    }

    constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_)

    BaseJumpRateModelV2(baseRatePerYear,multiplierPerYear,jumpMultiplierPerYear,kink_,owner_) public {}
}

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"baseRatePerYear","type":"uint256"},{"internalType":"uint256","name":"multiplierPerYear","type":"uint256"},{"internalType":"uint256","name":"jumpMultiplierPerYear","type":"uint256"},{"internalType":"uint256","name":"kink_","type":"uint256"},{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"baseRatePerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplierPerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"jumpMultiplierPerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"kink","type":"uint256"}],"name":"NewInterestParams","type":"event"},{"inputs":[],"name":"baseRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blocksPerYear","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cash","type":"uint256"},{"internalType":"uint256","name":"borrows","type":"uint256"},{"internalType":"uint256","name":"reserves","type":"uint256"}],"name":"getBorrowRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cash","type":"uint256"},{"internalType":"uint256","name":"borrows","type":"uint256"},{"internalType":"uint256","name":"reserves","type":"uint256"},{"internalType":"uint256","name":"reserveFactorMantissa","type":"uint256"}],"name":"getSupplyRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInterestRateModel","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"jumpMultiplierPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kink","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multiplierPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"baseRatePerYear","type":"uint256"},{"internalType":"uint256","name":"multiplierPerYear","type":"uint256"},{"internalType":"uint256","name":"jumpMultiplierPerYear","type":"uint256"},{"internalType":"uint256","name":"kink_","type":"uint256"}],"name":"updateJumpRateModel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cash","type":"uint256"},{"internalType":"uint256","name":"borrows","type":"uint256"},{"internalType":"uint256","name":"reserves","type":"uint256"}],"name":"utilizationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}]

608060405234801561001057600080fd5b5060405161072a38038061072a83398101604081905261002f91610112565b600080546001600160a01b0319166001600160a01b038316179055848484848461005b8585858561006a565b505050505050505050506101bc565b61007762f099c08561016d565b6002556100878162f099c061018f565b610099670de0b6b3a76400008561018f565b6100a3919061016d565b6001556100b362f099c08361016d565b60038190556004829055600254600154604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050565b600080600080600060a0868803121561012a57600080fd5b855160208701516040880151606089015160808a0151939850919650945092506001600160a01b038116811461015f57600080fd5b809150509295509295909350565b60008261018a57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156101b757634e487b7160e01b600052601160045260246000fd5b500290565b61055f806101cb6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b1461011d578063a385fb9614610148578063b816881614610152578063b9f9850a14610165578063f14039de1461016e578063fd2da3391461017757600080fd5b806315f24053146100ae5780632037f3e7146100d45780632191f92a146100e95780636e71e2d8146101015780638726bb8914610114575b600080fd5b6100c16100bc366004610445565b610180565b6040519081526020015b60405180910390f35b6100e76100e2366004610471565b610197565b005b6100f1600181565b60405190151581526020016100cb565b6100c161010f366004610445565b610216565b6100c160015481565b600054610130906001600160a01b031681565b6040516001600160a01b0390911681526020016100cb565b6100c162f099c081565b6100c1610160366004610471565b610256565b6100c160035481565b6100c160025481565b6100c160045481565b600061018d8484846102d2565b90505b9392505050565b6000546001600160a01b031633146102045760405162461bcd60e51b815260206004820152602660248201527f6f6e6c7920746865206f776e6572206d61792063616c6c20746869732066756e60448201526531ba34b7b71760d11b606482015260840160405180910390fd5b6102108484848461039d565b50505050565b60008261022557506000610190565b8161023084866104b9565b61023a91906104d1565b61024c670de0b6b3a7640000856104e8565b61018d9190610507565b60008061026b83670de0b6b3a76400006104d1565b9050600061027a8787876102d2565b90506000670de0b6b3a764000061029184846104e8565b61029b9190610507565b9050670de0b6b3a7640000816102b28a8a8a610216565b6102bc91906104e8565b6102c69190610507565b98975050505050505050565b6000806102e0858585610216565b9050600454811161032157600254670de0b6b3a76400006001548361030591906104e8565b61030f9190610507565b61031991906104b9565b915050610190565b6000600254670de0b6b3a764000060015460045461033f91906104e8565b6103499190610507565b61035391906104b9565b905060006004548361036591906104d1565b905081670de0b6b3a76400006003548361037f91906104e8565b6103899190610507565b61039391906104b9565b9350505050610190565b6103aa62f099c085610507565b6002556103ba8162f099c06104e8565b6103cc670de0b6b3a7640000856104e8565b6103d69190610507565b6001556103e662f099c083610507565b60038190556004829055600254600154604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050565b60008060006060848603121561045a57600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561048757600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052601160045260246000fd5b600082198211156104cc576104cc6104a3565b500190565b6000828210156104e3576104e36104a3565b500390565b6000816000190483118215151615610502576105026104a3565b500290565b60008261052457634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122022febb659dd0ca23ec2f7c9517df06b429b0787475d5053a5da4eefcc6f5185e64736f6c634300080a0033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec500000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000c7d713b49da00000000000000000000000000002595a0ad6d36f9faab4ef9295f0326e1d850490c

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

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec500000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000c7d713b49da00000000000000000000000000002595a0ad6d36f9faab4ef9295f0326e1d850490c

-----Decoded View---------------
Arg [0] : baseRatePerYear (uint256): 0
Arg [1] : multiplierPerYear (uint256): 50000000000000000
Arg [2] : jumpMultiplierPerYear (uint256): 1090000000000000000
Arg [3] : kink_ (uint256): 900000000000000000
Arg [4] : owner_ (address): 0x2595a0ad6d36f9faab4ef9295f0326e1d850490c

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 00000000000000000000000000000000000000000000000000b1a2bc2ec50000
Arg [2] : 0000000000000000000000000000000000000000000000000f207539952d0000
Arg [3] : 0000000000000000000000000000000000000000000000000c7d713b49da0000
Arg [4] : 0000000000000000000000002595a0ad6d36f9faab4ef9295f0326e1d850490c


Deployed ByteCode Sourcemap

7777:814:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8187:173;;;;;;:::i;:::-;;:::i;:::-;;;481:25:1;;;469:2;454:18;8187:173:0;;;;;;;;4016:327;;;;;;:::i;:::-;;:::i;:::-;;392:47;;435:4;392:47;;;;;1072:14:1;;1065:22;1047:41;;1035:2;1020:18;392:47:0;907:187:1;4733:287:0;;;;;;:::i;:::-;;:::i;2204:30::-;;;;;;1891:20;;;;;-1:-1:-1;;;;;1891:20:0;;;;;;-1:-1:-1;;;;;1263:32:1;;;1245:51;;1233:2;1218:18;1891:20:0;1099:203:1;2039:45:0;;2076:8;2039:45;;6352:434;;;;;;:::i;:::-;;:::i;2490:34::-;;;;;;2352:28;;;;;;2629:16;;;;;;8187:173;8282:4;8306:46;8328:4;8334:7;8343:8;8306:21;:46::i;:::-;8299:53;;8187:173;;;;;;:::o;4016:327::-;4181:5;;-1:-1:-1;;;;;4181:5:0;4167:10;:19;4159:70;;;;-1:-1:-1;;;4159:70:0;;1509:2:1;4159:70:0;;;1491:21:1;1548:2;1528:18;;;1521:30;1587:34;1567:18;;;1560:62;-1:-1:-1;;;1638:18:1;;;1631:36;1684:19;;4159:70:0;;;;;;;;4242:93;4270:15;4287:17;4306:21;4329:5;4242:27;:93::i;:::-;4016:327;;;;:::o;4733:287::-;4819:4;4900:12;4896:53;;-1:-1:-1;4936:1:0;4929:8;;4896:53;5003:8;4986:14;4993:7;4986:4;:14;:::i;:::-;:25;;;;:::i;:::-;4968:14;1753:4;4968:7;:14;:::i;:::-;:44;;;;:::i;6352:434::-;6481:4;;6527:28;6534:21;1753:4;6527:28;:::i;:::-;6498:57;;6566:15;6584:46;6606:4;6612:7;6621:8;6584:21;:46::i;:::-;6566:64;-1:-1:-1;6641:15:0;1753:4;6659:34;6672:21;6566:64;6659:34;:::i;:::-;:41;;;;:::i;:::-;6641:59;;1753:4;6761:10;6718:40;6734:4;6740:7;6749:8;6718:15;:40::i;:::-;:53;;;;:::i;:::-;:60;;;;:::i;:::-;6711:67;6352:434;-1:-1:-1;;;;;;;;6352:434:0:o;5408:521::-;5502:4;5519:9;5531:40;5547:4;5553:7;5562:8;5531:15;:40::i;:::-;5519:52;;5596:4;;5588;:12;5584:338;;5663:16;;1753:4;5633:18;;5626:4;:25;;;;:::i;:::-;5625:34;;;;:::i;:::-;5624:55;;;;:::i;:::-;5617:62;;;;;5584:338;5712:15;5769:16;;1753:4;5739:18;;5732:4;;:25;;;;:::i;:::-;5731:34;;;;:::i;:::-;5730:55;;;;:::i;:::-;5712:73;;5800:15;5825:4;;5818;:11;;;;:::i;:::-;5800:29;;5900:10;1753:4;5866:22;;5853:10;:35;;;;:::i;:::-;5852:44;;;;:::i;:::-;5851:59;;;;:::i;:::-;5844:66;;;;;;;7284:484;7446:31;2076:8;7446:15;:31;:::i;:::-;7427:16;:50;7539:21;7555:5;2076:8;7539:21;:::i;:::-;7510:24;1753:4;7510:17;:24;:::i;:::-;7509:52;;;;:::i;:::-;7488:18;:73;7597:37;2076:8;7597:21;:37;:::i;:::-;7572:22;:62;;;7645:4;:12;;;7693:16;;7711:18;;7675:85;;;2735:25:1;;;2791:2;2776:18;;2769:34;;;;2819:18;;2812:34;;;;2877:2;2862:18;;2855:34;;;7675:85:0;;2722:3:1;2707:19;7675:85:0;;;;;;;7284:484;;;;:::o;14:316:1:-;91:6;99;107;160:2;148:9;139:7;135:23;131:32;128:52;;;176:1;173;166:12;128:52;-1:-1:-1;;199:23:1;;;269:2;254:18;;241:32;;-1:-1:-1;320:2:1;305:18;;;292:32;;14:316;-1:-1:-1;14:316:1:o;517:385::-;603:6;611;619;627;680:3;668:9;659:7;655:23;651:33;648:53;;;697:1;694;687:12;648:53;-1:-1:-1;;720:23:1;;;790:2;775:18;;762:32;;-1:-1:-1;841:2:1;826:18;;813:32;;892:2;877:18;864:32;;-1:-1:-1;517:385:1;-1:-1:-1;517:385:1:o;1714:127::-;1775:10;1770:3;1766:20;1763:1;1756:31;1806:4;1803:1;1796:15;1830:4;1827:1;1820:15;1846:128;1886:3;1917:1;1913:6;1910:1;1907:13;1904:39;;;1923:18;;:::i;:::-;-1:-1:-1;1959:9:1;;1846:128::o;1979:125::-;2019:4;2047:1;2044;2041:8;2038:34;;;2052:18;;:::i;:::-;-1:-1:-1;2089:9:1;;1979:125::o;2109:168::-;2149:7;2215:1;2211;2207:6;2203:14;2200:1;2197:21;2192:1;2185:9;2178:17;2174:45;2171:71;;;2222:18;;:::i;:::-;-1:-1:-1;2262:9:1;;2109:168::o;2282:217::-;2322:1;2348;2338:132;;2392:10;2387:3;2383:20;2380:1;2373:31;2427:4;2424:1;2417:15;2455:4;2452:1;2445:15;2338:132;-1:-1:-1;2484:9:1;;2282:217::o

Swarm Source

ipfs://22febb659dd0ca23ec2f7c9517df06b429b0787475d5053a5da4eefcc6f5185e
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.