Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
JumpRateModelV2
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.10;
import "./BaseJumpRateModelV2.sol";
import "./InterestRateModel.sol";
/**
* @title Orbit's JumpRateModel Contract V2 for V2 cTokens
* @author Orbit
* @notice Supports only for V2 cTokens
*/
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
) external view override returns (uint) {
return getBorrowRateInternal(cash, borrows, reserves);
}
constructor(
uint baseRatePerYear,
uint multiplierPerYear,
uint jumpMultiplierPerYear,
uint kink_,
address owner_
)
public
BaseJumpRateModelV2(
baseRatePerYear,
multiplierPerYear,
jumpMultiplierPerYear,
kink_,
owner_
)
{}
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.10;
import "./InterestRateModel.sol";
/**
* @title Orbit's BaseJumpRateModelV2 Contract
* @author Orbit Protocol
* @notice
*/
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_
) external virtual {
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
) public view virtual override 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
);
}
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.10;
/**
* @title Interest Rate Model Interface
* @author Orbit
*/
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
) external view virtual 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
) external view virtual returns (uint);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"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"}]Contract Creation Code
608060405234801561001057600080fd5b5060405161072038038061072083398101604081905261002f91610112565b600080546001600160a01b0319166001600160a01b038316179055848484848461005b8585858561006a565b505050505050505050506101ba565b61007762f099c08561016d565b6002556100878162f099c061018f565b610099670de0b6b3a76400008561018f565b6100a3919061016d565b6001556100b362f099c08361016d565b60038190556004829055600254600154604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050565b600080600080600060a0868803121561012a57600080fd5b855160208701516040880151606089015160808a0151939850919650945092506001600160a01b038116811461015f57600080fd5b809150509295509295909350565b60008261018a57634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176101b457634e487b7160e01b600052601160045260246000fd5b92915050565b610557806101c96000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b1461011d578063a385fb9614610148578063b816881614610152578063b9f9850a14610165578063f14039de1461016e578063fd2da3391461017757600080fd5b806315f24053146100ae5780632037f3e7146100d45780632191f92a146100e95780636e71e2d8146101015780638726bb8914610114575b600080fd5b6100c16100bc366004610448565b610180565b6040519081526020015b60405180910390f35b6100e76100e2366004610474565b610197565b005b6100f1600181565b60405190151581526020016100cb565b6100c161010f366004610448565b610216565b6100c160015481565b600054610130906001600160a01b031681565b6040516001600160a01b0390911681526020016100cb565b6100c162f099c081565b6100c1610160366004610474565b610259565b6100c160035481565b6100c160025481565b6100c160045481565b600061018d8484846102d5565b90505b9392505050565b6000546001600160a01b031633146102045760405162461bcd60e51b815260206004820152602660248201527f6f6e6c7920746865206f776e6572206d61792063616c6c20746869732066756e60448201526531ba34b7b71760d11b606482015260840160405180910390fd5b610210848484846103a0565b50505050565b60008260000361022857506000610190565b8161023384866104bc565b61023d91906104d5565b61024f670de0b6b3a7640000856104e8565b61018d91906104ff565b60008061026e83670de0b6b3a76400006104d5565b9050600061027d8787876102d5565b90506000670de0b6b3a764000061029484846104e8565b61029e91906104ff565b9050670de0b6b3a7640000816102b58a8a8a610216565b6102bf91906104e8565b6102c991906104ff565b98975050505050505050565b6000806102e3858585610216565b9050600454811161032457600254670de0b6b3a76400006001548361030891906104e8565b61031291906104ff565b61031c91906104bc565b915050610190565b6000600254670de0b6b3a764000060015460045461034291906104e8565b61034c91906104ff565b61035691906104bc565b905060006004548361036891906104d5565b905081670de0b6b3a76400006003548361038291906104e8565b61038c91906104ff565b61039691906104bc565b9350505050610190565b6103ad62f099c0856104ff565b6002556103bd8162f099c06104e8565b6103cf670de0b6b3a7640000856104e8565b6103d991906104ff565b6001556103e962f099c0836104ff565b60038190556004829055600254600154604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050565b60008060006060848603121561045d57600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561048a57600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104cf576104cf6104a6565b92915050565b818103818111156104cf576104cf6104a6565b80820281158282048414176104cf576104cf6104a6565b60008261051c57634e487b7160e01b600052601260045260246000fd5b50049056fea26469706673582212202ecb28bedcb89075b80c069bad0fad953ae7c2f7845978e14083c657003f351564736f6c63430008140033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d529ae9e8600000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec5000000000000000000000000000006315f65843e7582508e4f0aac20a7203e7b09f02
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b1461011d578063a385fb9614610148578063b816881614610152578063b9f9850a14610165578063f14039de1461016e578063fd2da3391461017757600080fd5b806315f24053146100ae5780632037f3e7146100d45780632191f92a146100e95780636e71e2d8146101015780638726bb8914610114575b600080fd5b6100c16100bc366004610448565b610180565b6040519081526020015b60405180910390f35b6100e76100e2366004610474565b610197565b005b6100f1600181565b60405190151581526020016100cb565b6100c161010f366004610448565b610216565b6100c160015481565b600054610130906001600160a01b031681565b6040516001600160a01b0390911681526020016100cb565b6100c162f099c081565b6100c1610160366004610474565b610259565b6100c160035481565b6100c160025481565b6100c160045481565b600061018d8484846102d5565b90505b9392505050565b6000546001600160a01b031633146102045760405162461bcd60e51b815260206004820152602660248201527f6f6e6c7920746865206f776e6572206d61792063616c6c20746869732066756e60448201526531ba34b7b71760d11b606482015260840160405180910390fd5b610210848484846103a0565b50505050565b60008260000361022857506000610190565b8161023384866104bc565b61023d91906104d5565b61024f670de0b6b3a7640000856104e8565b61018d91906104ff565b60008061026e83670de0b6b3a76400006104d5565b9050600061027d8787876102d5565b90506000670de0b6b3a764000061029484846104e8565b61029e91906104ff565b9050670de0b6b3a7640000816102b58a8a8a610216565b6102bf91906104e8565b6102c991906104ff565b98975050505050505050565b6000806102e3858585610216565b9050600454811161032457600254670de0b6b3a76400006001548361030891906104e8565b61031291906104ff565b61031c91906104bc565b915050610190565b6000600254670de0b6b3a764000060015460045461034291906104e8565b61034c91906104ff565b61035691906104bc565b905060006004548361036891906104d5565b905081670de0b6b3a76400006003548361038291906104e8565b61038c91906104ff565b61039691906104bc565b9350505050610190565b6103ad62f099c0856104ff565b6002556103bd8162f099c06104e8565b6103cf670de0b6b3a7640000856104e8565b6103d991906104ff565b6001556103e962f099c0836104ff565b60038190556004829055600254600154604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050565b60008060006060848603121561045d57600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561048a57600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104cf576104cf6104a6565b92915050565b818103818111156104cf576104cf6104a6565b80820281158282048414176104cf576104cf6104a6565b60008261051c57634e487b7160e01b600052601260045260246000fd5b50049056fea26469706673582212202ecb28bedcb89075b80c069bad0fad953ae7c2f7845978e14083c657003f351564736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d529ae9e8600000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec5000000000000000000000000000006315f65843e7582508e4f0aac20a7203e7b09f02
-----Decoded View---------------
Arg [0] : baseRatePerYear (uint256): 0
Arg [1] : multiplierPerYear (uint256): 60000000000000000
Arg [2] : jumpMultiplierPerYear (uint256): 1090000000000000000
Arg [3] : kink_ (uint256): 800000000000000000
Arg [4] : owner_ (address): 0x6315F65843e7582508e4F0aAC20a7203E7B09F02
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 00000000000000000000000000000000000000000000000000d529ae9e860000
Arg [2] : 0000000000000000000000000000000000000000000000000f207539952d0000
Arg [3] : 0000000000000000000000000000000000000000000000000b1a2bc2ec500000
Arg [4] : 0000000000000000000000006315f65843e7582508e4f0aac20a7203e7b09f02
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.