Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
JumpRateModel
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 10 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./interfaces/IInterestRateModel.sol"; /** * @title 0VIX's JumpRateModel Contract * @author 0VIX */ contract JumpRateModel is IInterestRateModel { bool public constant override isInterestRateModel = true; /** * @notice The approximate number of timestamps per year that is assumed by the interest rate model */ uint256 public constant timestampsPerYear = 31536000; /** * @notice The multiplier of utilization rate that gives the slope of the interest rate */ uint256 public immutable multiplierPerTimestamp; /** * @notice The base interest rate which is the y-intercept when utilization rate is 0 */ uint256 public immutable baseRatePerTimestamp; /** * @notice The multiplierPerTimestamp after hitting a specified utilization point */ uint256 public immutable jumpMultiplierPerTimestamp; /** * @notice The utilization point at which the jump multiplier is applied */ uint256 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( uint256 baseRatePerYear, uint256 multiplierPerYear, uint256 jumpMultiplierPerYear, uint256 kink_ ) { baseRatePerTimestamp = (baseRatePerYear * 1e18) / timestampsPerYear / 1e18; multiplierPerTimestamp = (multiplierPerYear * 1e18) / timestampsPerYear / 1e18; jumpMultiplierPerTimestamp = (jumpMultiplierPerYear * 1e18) / timestampsPerYear / 1e18; kink = 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( uint256 cash, uint256 borrows, uint256 reserves ) public pure returns (uint256) { // 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, 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 timestmp as a mantissa (scaled by 1e18) */ function getBorrowRate( uint256 cash, uint256 borrows, uint256 reserves ) public view override returns (uint256) { uint256 util = utilizationRate(cash, borrows, reserves); if (util <= kink) { return ((util * multiplierPerTimestamp) / 1e18) + baseRatePerTimestamp; } else { uint256 normalRate = ((kink * multiplierPerTimestamp) / 1e18) + baseRatePerTimestamp; uint256 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( uint256 cash, uint256 borrows, uint256 reserves, uint256 reserveFactorMantissa ) public view override returns (uint256) { uint256 oneMinusReserveFactor = uint256(1e18) - reserveFactorMantissa; uint256 borrowRate = getBorrowRate(cash, borrows, reserves); uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18; return (utilizationRate(cash, borrows, reserves) * rateToPool) / 1e18; } }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @title 0VIX's IInterestRateModel Interface * @author 0VIX */ interface IInterestRateModel { /// @notice Indicator that this is an InterestRateModel contract (for inspection) function isInterestRateModel() external view returns(bool); /** * @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 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 returns (uint); }
{ "optimizer": { "enabled": true, "runs": 10 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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"},{"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"}]
Contract Creation Code
61010060405234801561001157600080fd5b506040516106db3803806106db833981016040819052610030916100c9565b670de0b6b3a76400006301e13380610048868361011e565b61005291906100fe565b61005c91906100fe565b60a052670de0b6b3a76400006301e13380610077858361011e565b61008191906100fe565b61008b91906100fe565b608052670de0b6b3a76400006301e133806100a6848361011e565b6100b091906100fe565b6100ba91906100fe565b60c05260e05250610149915050565b600080600080608085870312156100de578384fd5b505082516020840151604085015160609095015191969095509092509050565b60008261011957634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561014457634e487b7160e01b81526011600452602481fd5b500290565b60805160a05160c05160e0516105236101b860003960008181610171015281816101a50152818161028c01526102cd01526000818160d6015261030301526000818160fd015281816101cc015261023e015260008181610124015281816101f9015261026b01526105236000f3fe608060405234801561001057600080fd5b50600436106100835760003560e01c80630c5748611461008857806315f24053146100a65780632191f92a146100b957806326c394f7146100d157806340bc0af4146100f85780636c2df6a71461011f5780636e71e2d814610146578063b816881614610159578063fd2da3391461016c575b600080fd5b6100936301e1338081565b6040519081526020015b60405180910390f35b6100936100b436600461040d565b610193565b6100c1600181565b604051901515815260200161009d565b6100937f000000000000000000000000000000000000000000000000000000000000000081565b6100937f000000000000000000000000000000000000000000000000000000000000000081565b6100937f000000000000000000000000000000000000000000000000000000000000000081565b61009361015436600461040d565b610349565b610093610167366004610438565b610391565b6100937f000000000000000000000000000000000000000000000000000000000000000081565b6000806101a1858585610349565b90507f0000000000000000000000000000000000000000000000000000000000000000811161023a577f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a764000061021e7f0000000000000000000000000000000000000000000000000000000000000000846104a1565b6102289190610481565b6102329190610469565b915050610342565b60007f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a76400006102b07f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006104a1565b6102ba9190610481565b6102c49190610469565b905060006102f27f0000000000000000000000000000000000000000000000000000000000000000846104c0565b905081670de0b6b3a76400006103287f0000000000000000000000000000000000000000000000000000000000000000846104a1565b6103329190610481565b61033c9190610469565b93505050505b9392505050565b60008261035857506000610342565b816103638486610469565b61036d91906104c0565b61037f84670de0b6b3a76400006104a1565b6103899190610481565b949350505050565b6000806103a683670de0b6b3a76400006104c0565b905060006103b5878787610193565b90506000670de0b6b3a76400006103cc84846104a1565b6103d69190610481565b9050670de0b6b3a7640000816103ed8a8a8a610349565b6103f791906104a1565b6104019190610481565b98975050505050505050565b600080600060608486031215610421578283fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561044d578081fd5b5050823594602084013594506040840135936060013592509050565b6000821982111561047c5761047c6104d7565b500190565b60008261049c57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156104bb576104bb6104d7565b500290565b6000828210156104d2576104d26104d7565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220c48ef9028f893fb3a856b270d828f869082c186014898bda6605116a74f7851d64736f6c63430008040033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec500000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100835760003560e01c80630c5748611461008857806315f24053146100a65780632191f92a146100b957806326c394f7146100d157806340bc0af4146100f85780636c2df6a71461011f5780636e71e2d814610146578063b816881614610159578063fd2da3391461016c575b600080fd5b6100936301e1338081565b6040519081526020015b60405180910390f35b6100936100b436600461040d565b610193565b6100c1600181565b604051901515815260200161009d565b6100937f000000000000000000000000000000000000000000000000000000080c27ccae81565b6100937f000000000000000000000000000000000000000000000000000000000000000081565b6100937f00000000000000000000000000000000000000000000000000000000ec41a0dd81565b61009361015436600461040d565b610349565b610093610167366004610438565b610391565b6100937f0000000000000000000000000000000000000000000000000b1a2bc2ec50000081565b6000806101a1858585610349565b90507f0000000000000000000000000000000000000000000000000b1a2bc2ec500000811161023a577f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a764000061021e7f00000000000000000000000000000000000000000000000000000000ec41a0dd846104a1565b6102289190610481565b6102329190610469565b915050610342565b60007f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a76400006102b07f00000000000000000000000000000000000000000000000000000000ec41a0dd7f0000000000000000000000000000000000000000000000000b1a2bc2ec5000006104a1565b6102ba9190610481565b6102c49190610469565b905060006102f27f0000000000000000000000000000000000000000000000000b1a2bc2ec500000846104c0565b905081670de0b6b3a76400006103287f000000000000000000000000000000000000000000000000000000080c27ccae846104a1565b6103329190610481565b61033c9190610469565b93505050505b9392505050565b60008261035857506000610342565b816103638486610469565b61036d91906104c0565b61037f84670de0b6b3a76400006104a1565b6103899190610481565b949350505050565b6000806103a683670de0b6b3a76400006104c0565b905060006103b5878787610193565b90506000670de0b6b3a76400006103cc84846104a1565b6103d69190610481565b9050670de0b6b3a7640000816103ed8a8a8a610349565b6103f791906104a1565b6104019190610481565b98975050505050505050565b600080600060608486031215610421578283fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561044d578081fd5b5050823594602084013594506040840135936060013592509050565b6000821982111561047c5761047c6104d7565b500190565b60008261049c57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156104bb576104bb6104d7565b500290565b6000828210156104d2576104d26104d7565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220c48ef9028f893fb3a856b270d828f869082c186014898bda6605116a74f7851d64736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec500000
-----Decoded View---------------
Arg [0] : baseRatePerYear (uint256): 0
Arg [1] : multiplierPerYear (uint256): 125000000000000000
Arg [2] : jumpMultiplierPerYear (uint256): 1090000000000000000
Arg [3] : kink_ (uint256): 800000000000000000
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 00000000000000000000000000000000000000000000000001bc16d674ec8000
Arg [2] : 0000000000000000000000000000000000000000000000000f207539952d0000
Arg [3] : 0000000000000000000000000000000000000000000000000b1a2bc2ec500000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.