Contract 0x0Bc03bd8d4aF1e8bab2194860268F5774C9d400a

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x0519dce3daee224f7f2f9e2487a982dc61ea85e563f72150c3116e81e18c74ee0x61010060605014462022-03-01 4:23:36211 days 12 hrs ago0xb969526ebc8dd4b1d816da846ee08180515ffbbc IN  Create: JumpRateModel0 ETH0
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
JumpRateModel

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 3000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 2 : JumpRateModel.sol
pragma solidity 0.8.11;

import "./interfaces/InterestRateModel.sol";

/**
  * @title Aurigami's JumpRateModel Contract
  * @author Aurigami
  */
contract JumpRateModel is InterestRateModel {
    event NewInterestParams(uint baseRatePerTimestamp, uint multiplierPerTimestamp, uint jumpMultiplierPerTimestamp, uint kink);

    /**
     * @notice The approximate number of timestamps per year that is assumed by the interest rate model
     */
    uint public constant timestampsPerYear = 31536000; // 1 year

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

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

    /**
     * @notice The multiplierPerTimestamp after hitting a specified utilization point
     */
    uint public immutable jumpMultiplierPerTimestamp;

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

    /**
     * @notice Construct an interest rate model
     * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
     * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
     * @param jumpMultiplierPerYear The multiplierPerTimestamp after hitting a specified utilization point
     * @param kink_ The utilization point at which the jump multiplier is applied
     */
    constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) {
        baseRatePerTimestamp = baseRatePerYear * 1e18 / timestampsPerYear / 1e18;
        multiplierPerTimestamp = multiplierPerYear * 1e18 / timestampsPerYear / 1e18;
        jumpMultiplierPerTimestamp = jumpMultiplierPerYear * 1e18 / timestampsPerYear / 1e18;
        kink = kink_;

        emit NewInterestParams(baseRatePerTimestamp, multiplierPerTimestamp, jumpMultiplierPerTimestamp, 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, 1e18]
     */
    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 * 1e18 / (cash + borrows - reserves);
    }

    /**
     * @notice Calculates the current borrow rate per timestmp
     * @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 timestmp as a mantissa (scaled by 1e18)
     */
    function getBorrowRate(uint cash, uint borrows, uint reserves) public override view returns (uint) {
        uint util = utilizationRate(cash, borrows, reserves);

        if (util <= kink) {
            return util * multiplierPerTimestamp / 1e18 + baseRatePerTimestamp;
        } else {
            uint normalRate = kink * multiplierPerTimestamp / 1e18 + baseRatePerTimestamp;
            uint excessUtil = util - kink;
            return excessUtil * jumpMultiplierPerTimestamp / 1e18 + normalRate;
        }
    }

    /**
     * @notice Calculates the current supply rate per timestmp
     * @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 timestmp as a mantissa (scaled by 1e18)
     */
    function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public override view returns (uint) {
        uint oneMinusReserveFactor = 1e18 - reserveFactorMantissa;
        uint borrowRate = getBorrowRate(cash, borrows, reserves);
        uint rateToPool = borrowRate * oneMinusReserveFactor / 1e18;
        return utilizationRate(cash, borrows, reserves) * rateToPool / 1e18;
    }
}

File 2 of 2 : InterestRateModel.sol
pragma solidity 0.8.11;

/**
  * @title Aurigami Finance's InterestRateModel Interface
  */
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 timestmp
      * @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 timestmp (as a percentage, and scaled by 1e18)
      */
    function getBorrowRate(uint cash, uint borrows, uint reserves) external view virtual returns (uint);

    /**
      * @notice Calculates the current supply interest rate per timestmp
      * @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 timestmp (as a percentage, and scaled by 1e18)
      */
    function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view virtual returns (uint);

}

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

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"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"baseRatePerTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplierPerTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"jumpMultiplierPerTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"kink","type":"uint256"}],"name":"NewInterestParams","type":"event"},{"inputs":[],"name":"baseRatePerTimestamp","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":"jumpMultiplierPerTimestamp","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":"multiplierPerTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timestampsPerYear","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":"utilizationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}]

61010060405234801561001157600080fd5b506040516107a73803806107a78339810160408190526100309161011b565b670de0b6b3a76400006301e133806100488683610151565b610052919061017e565b61005c919061017e565b60a052670de0b6b3a76400006301e133806100778583610151565b610081919061017e565b61008b919061017e565b608052670de0b6b3a76400006301e133806100a68483610151565b6100b0919061017e565b6100ba919061017e565b60c081905260e082905260a05160808051604080519384526020840191909152820192909252606081018390527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d910160405180910390a1505050506101a0565b6000806000806080858703121561013157600080fd5b505082516020840151604085015160609095015191969095509092509050565b600081600019048311821515161561017957634e487b7160e01b600052601160045260246000fd5b500290565b60008261019b57634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c05160e05161059761021060003960008181610191015281816101c5015281816102ac01526102ed01526000818160f6015261032301526000818161011d015281816101ec015261025e01526000818161014401528181610219015261028b01526105976000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c806340bc0af4116100765780636e71e2d81161005b5780636e71e2d814610166578063b816881614610179578063fd2da3391461018c57600080fd5b806340bc0af4146101185780636c2df6a71461013f57600080fd5b80630c574861146100a857806315f24053146100c65780632191f92a146100d957806326c394f7146100f1575b600080fd5b6100b36301e1338081565b6040519081526020015b60405180910390f35b6100b36100d436600461042d565b6101b3565b6100e1600181565b60405190151581526020016100bd565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6100b361017436600461042d565b610369565b6100b3610187366004610459565b6103b1565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6000806101c1858585610369565b90507f0000000000000000000000000000000000000000000000000000000000000000811161025a577f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a764000061023e7f0000000000000000000000000000000000000000000000000000000000000000846104ba565b61024891906104f7565b6102529190610532565b915050610362565b60007f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a76400006102d07f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006104ba565b6102da91906104f7565b6102e49190610532565b905060006103127f00000000000000000000000000000000000000000000000000000000000000008461054a565b905081670de0b6b3a76400006103487f0000000000000000000000000000000000000000000000000000000000000000846104ba565b61035291906104f7565b61035c9190610532565b93505050505b9392505050565b60008261037857506000610362565b816103838486610532565b61038d919061054a565b61039f84670de0b6b3a76400006104ba565b6103a991906104f7565b949350505050565b6000806103c683670de0b6b3a764000061054a565b905060006103d58787876101b3565b90506000670de0b6b3a76400006103ec84846104ba565b6103f691906104f7565b9050670de0b6b3a76400008161040d8a8a8a610369565b61041791906104ba565b61042191906104f7565b98975050505050505050565b60008060006060848603121561044257600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561046f57600080fd5b5050823594602084013594506040840135936060013592509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156104f2576104f261048b565b500290565b60008261052d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600082198211156105455761054561048b565b500190565b60008282101561055c5761055c61048b565b50039056fea2646970667358221220ee639c9d4411e2f01e0995b611b85fd2ddc78336706cdcc764e0e8c734af9bd864736f6c634300080b003300000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec500000

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

00000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec500000

-----Decoded View---------------
Arg [0] : baseRatePerYear (uint256): 20000000000000000
Arg [1] : multiplierPerYear (uint256): 100000000000000000
Arg [2] : jumpMultiplierPerYear (uint256): 1090000000000000000
Arg [3] : kink_ (uint256): 800000000000000000

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000470de4df820000
Arg [1] : 000000000000000000000000000000000000000000000000016345785d8a0000
Arg [2] : 0000000000000000000000000000000000000000000000000f207539952d0000
Arg [3] : 0000000000000000000000000000000000000000000000000b1a2bc2ec500000


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.