Overview
APE Balance
0 APE
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 452778 | 34 days ago | IN | 0 APE | 0.01170981 |
Loading...
Loading
Contract Name:
JumpRateModel
Compiler Version
v0.8.19+commit.7dd6d404
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.19; import "./InterestRateModel.sol"; import "./SafeMath.sol"; /** * @title Moonwell's JumpRateModel Contract * @author Compound * @author Moonwell */ contract JumpRateModel is InterestRateModel { using SafeMath for uint; 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 = 60 * 60 * 24 * 365; /** * @notice The multiplier of utilization rate that gives the slope of the interest rate */ uint public multiplierPerTimestamp; /** * @notice The base interest rate which is the y-intercept when utilization rate is 0 */ uint public baseRatePerTimestamp; /** * @notice The multiplierPerTimestamp after hitting a specified utilization point */ uint public jumpMultiplierPerTimestamp; /** * @notice The utilization point at which the jump multiplier is applied */ uint public kink; /// @dev we know that we do not need to use safemath, however safemath is still used for safety /// and to not modify existing code. /** * @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 .mul(1e18) .div(timestampsPerYear) .div(1e18); multiplierPerTimestamp = multiplierPerYear .mul(1e18) .div(timestampsPerYear) .div(1e18); jumpMultiplierPerTimestamp = jumpMultiplierPerYear .mul(1e18) .div(timestampsPerYear) .div(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.mul(1e18).div(cash.add(borrows).sub(reserves)); } /** * @notice Calculates the current borrow rate per timestamp, 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 timestamp as a mantissa (scaled by 1e18) */ function getBorrowRate( uint cash, uint borrows, uint reserves ) public view override returns (uint) { uint util = utilizationRate(cash, borrows, reserves); if (util <= kink) { return util.mul(multiplierPerTimestamp).div(1e18).add( baseRatePerTimestamp ); } else { uint normalRate = kink.mul(multiplierPerTimestamp).div(1e18).add( baseRatePerTimestamp ); uint excessUtil = util.sub(kink); return excessUtil.mul(jumpMultiplierPerTimestamp).div(1e18).add( normalRate ); } } /** * @notice Calculates the current supply rate per timestamp * @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 timestamp as a mantissa (scaled by 1e18) */ function getSupplyRate( uint cash, uint borrows, uint reserves, uint reserveFactorMantissa ) public view override returns (uint) { uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa); uint borrowRate = getBorrowRate(cash, borrows, reserves); uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18); return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18); } }
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.8.19; /** * @title Moonwell's InterestRateModel Interface * @author Moonwell */ 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 timestamp * @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 timestamp (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 timestamp * @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 timestamp (as a percentage, and scaled by 1e18) */ function getSupplyRate( uint cash, uint borrows, uint reserves, uint reserveFactorMantissa ) external view virtual returns (uint); }
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.8.19; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, errorMessage); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction underflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, errorMessage); return c; } /** * @dev Returns the integer division of two unsigned integers. * Reverts on division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. * Reverts with custom message on division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "viaIR": false, "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"},{"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"}]
Contract Creation Code
608060405234801561001057600080fd5b506040516108b33803806108b383398101604081905261002f91610200565b610051670de0b6b3a764000061004b6301e133808188846100f1565b90610181565b600155610070670de0b6b3a764000061004b6301e133808187846100f1565b60005561008f670de0b6b3a764000061004b6301e133808186846100f1565b60028190556003829055600154600054604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a1505050506102cb565b6000826000036101035750600061017b565b600061010f8385610236565b90508261011c858361025b565b146101785760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084015b60405180910390fd5b90505b92915050565b600061017883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506101c960201b60201c565b600081836101ea5760405162461bcd60e51b815260040161016f919061027d565b5060006101f7848661025b565b95945050505050565b6000806000806080858703121561021657600080fd5b505082516020840151604085015160609095015191969095509092509050565b808202811582820484141761017b57634e487b7160e01b600052601160045260246000fd5b60008261027857634e487b7160e01b600052601260045260246000fd5b500490565b600060208083528351808285015260005b818110156102aa5785810183015185820160400152820161028e565b506000604082860101526040601f19601f8301168501019250505092915050565b6105d9806102da6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806340bc0af41161006657806340bc0af4146100ea5780636c2df6a7146100f35780636e71e2d8146100fc578063b81688161461010f578063fd2da3391461012257600080fd5b80630c5748611461009857806315f24053146100b65780632191f92a146100c957806326c394f7146100e1575b600080fd5b6100a36301e1338081565b6040519081526020015b60405180910390f35b6100a36100c4366004610482565b61012b565b6100d1600181565b60405190151581526020016100ad565b6100a360025481565b6100a360015481565b6100a360005481565b6100a361010a366004610482565b6101f7565b6100a361011d3660046104ae565b61023a565b6100a360035481565b6000806101398585856101f7565b9050600354811161017f57610177600154610171670de0b6b3a764000061016b600054866102a790919063ffffffff16565b90610337565b90610379565b9150506101f0565b60006101aa600154610171670de0b6b3a764000061016b6000546003546102a790919063ffffffff16565b905060006101c3600354846103d890919063ffffffff16565b90506101ea82610171670de0b6b3a764000061016b600254866102a790919063ffffffff16565b93505050505b9392505050565b600082600003610209575060006101f0565b6102326102208361021a8787610379565b906103d8565b61016b85670de0b6b3a76400006102a7565b949350505050565b60008061024f670de0b6b3a7640000846103d8565b9050600061025e87878761012b565b90506000610278670de0b6b3a764000061016b84866102a7565b905061029b670de0b6b3a764000061016b836102958c8c8c6101f7565b906102a7565b98975050505050505050565b6000826000036102b957506000610331565b60006102c583856104f6565b9050826102d2858361050d565b1461032e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084015b60405180910390fd5b90505b92915050565b600061032e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061041a565b600080610386838561052f565b90508381101561032e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610325565b600061032e83836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f7700815250610451565b6000818361043b5760405162461bcd60e51b81526004016103259190610542565b506000610448848661050d565b95945050505050565b600081848411156104755760405162461bcd60e51b81526004016103259190610542565b5060006104488486610590565b60008060006060848603121561049757600080fd5b505081359360208301359350604090920135919050565b600080600080608085870312156104c457600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610331576103316104e0565b60008261052a57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610331576103316104e0565b600060208083528351808285015260005b8181101561056f57858101830151858201604001528201610553565b506000604082860101526040601f19601f8301168501019250505092915050565b81810381811115610331576103316104e056fea264697066735822122015e24d40f894a14d40d51df16f34b9d85dbc120c8052eac8a37d19a8a0611e7164736f6c634300081300330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010a741a4627800000000000000000000000000000000000000000000000000022b1c8c1227a00000000000000000000000000000000000000000000000000000b1a2bc2ec500000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c806340bc0af41161006657806340bc0af4146100ea5780636c2df6a7146100f35780636e71e2d8146100fc578063b81688161461010f578063fd2da3391461012257600080fd5b80630c5748611461009857806315f24053146100b65780632191f92a146100c957806326c394f7146100e1575b600080fd5b6100a36301e1338081565b6040519081526020015b60405180910390f35b6100a36100c4366004610482565b61012b565b6100d1600181565b60405190151581526020016100ad565b6100a360025481565b6100a360015481565b6100a360005481565b6100a361010a366004610482565b6101f7565b6100a361011d3660046104ae565b61023a565b6100a360035481565b6000806101398585856101f7565b9050600354811161017f57610177600154610171670de0b6b3a764000061016b600054866102a790919063ffffffff16565b90610337565b90610379565b9150506101f0565b60006101aa600154610171670de0b6b3a764000061016b6000546003546102a790919063ffffffff16565b905060006101c3600354846103d890919063ffffffff16565b90506101ea82610171670de0b6b3a764000061016b600254866102a790919063ffffffff16565b93505050505b9392505050565b600082600003610209575060006101f0565b6102326102208361021a8787610379565b906103d8565b61016b85670de0b6b3a76400006102a7565b949350505050565b60008061024f670de0b6b3a7640000846103d8565b9050600061025e87878761012b565b90506000610278670de0b6b3a764000061016b84866102a7565b905061029b670de0b6b3a764000061016b836102958c8c8c6101f7565b906102a7565b98975050505050505050565b6000826000036102b957506000610331565b60006102c583856104f6565b9050826102d2858361050d565b1461032e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084015b60405180910390fd5b90505b92915050565b600061032e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061041a565b600080610386838561052f565b90508381101561032e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610325565b600061032e83836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f7700815250610451565b6000818361043b5760405162461bcd60e51b81526004016103259190610542565b506000610448848661050d565b95945050505050565b600081848411156104755760405162461bcd60e51b81526004016103259190610542565b5060006104488486610590565b60008060006060848603121561049757600080fd5b505081359360208301359350604090920135919050565b600080600080608085870312156104c457600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610331576103316104e0565b60008261052a57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610331576103316104e0565b600060208083528351808285015260005b8181101561056f57858101830151858201604001528201610553565b506000604082860101526040601f19601f8301168501019250505092915050565b81810381811115610331576103316104e056fea264697066735822122015e24d40f894a14d40d51df16f34b9d85dbc120c8052eac8a37d19a8a0611e7164736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010a741a4627800000000000000000000000000000000000000000000000000022b1c8c1227a00000000000000000000000000000000000000000000000000000b1a2bc2ec500000
-----Decoded View---------------
Arg [0] : baseRatePerYear (uint256): 0
Arg [1] : multiplierPerYear (uint256): 75000000000000000
Arg [2] : jumpMultiplierPerYear (uint256): 2500000000000000000
Arg [3] : kink_ (uint256): 800000000000000000
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 000000000000000000000000000000000000000000000000010a741a46278000
Arg [2] : 00000000000000000000000000000000000000000000000022b1c8c1227a0000
Arg [3] : 0000000000000000000000000000000000000000000000000b1a2bc2ec500000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.