Contract Overview
Balance:
0 MATIC
MATIC Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x5ef4c7376a52abfb2ffb6e768ade5f1da18fe8be4b8dccf644b2d5cd71453290 | 0x60806040 | 40786614 | 64 days 8 hrs ago | 0xe820cc557279acc115d61b7c450f47ff000b4ef6 | IN | Create: JumpRateModel | 0 MATIC | 0.04373408 |
[ Download CSV Export ]
Contract Name:
JumpRateModel
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 300 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
//SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.4; /** * @title Modified Compound's InterestRateModel Interface * @author Honey Labs Inc. * @custom:coauthor BowTiedPickle * @custom:contributor m4rio */ interface InterestRateModelI { /** * @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( uint256 _cash, uint256 _borrows, uint256 _reserves ) external view returns (uint256); /** * @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 1e18) */ function getSupplyRate( uint256 _cash, uint256 _borrows, uint256 _reserves, uint256 _reserveFactorMantissa ) external view returns (uint256); /** * @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 * @return The utilization rate as a mantissa between [0, 1e18] */ function utilizationRate( uint256 _cash, uint256 _borrows, uint256 _reserves ) external pure returns (uint256); /** * * @param _interfaceId The interface identifier, as specified in ERC-165 */ function supportsInterface(bytes4 _interfaceId) external view returns (bool); }
//SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.15; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/InterestRateModelI.sol"; /** * @title Logic for Modified Version of Compound's JumpRateModel Contract V2. * @author Honey Labs Inc. * @custom:coauthor BowTiedPickle * @custom:contributor m4rio */ abstract contract BaseJumpRateModel is Ownable, InterestRateModelI { /** * @notice The approximate number of blocks per year that is assumed by the interest rate model */ uint256 public constant blocksPerYear = 2102400; /** * @notice The multiplier of utilization rate that gives the slope of the interest rate */ uint256 public multiplierPerBlock; /** * @notice The base interest rate which is the y-intercept when utilization rate is 0 */ uint256 public baseRatePerBlock; /** * @notice The multiplierPerBlock after hitting a specified utilization point */ uint256 public jumpMultiplierPerBlock; /** * @notice The utilization point at which the jump multiplier is applied */ uint256 public kink; event NewInterestParams( uint256 _baseRatePerBlock, uint256 _multiplierPerBlock, uint256 _jumpMultiplierPerBlock, uint256 _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 * @return The utilization rate as a mantissa between [0, 1e18] */ function utilizationRate( uint256 _cash, uint256 _borrows, uint256 _reserves ) public pure override returns (uint256) { // Utilization rate is 0 when there are no borrows if (_borrows == 0) { return 0; } uint256 util = (_borrows * 1e18) / (_cash + _borrows - _reserves); return util; } /** * @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 1e18) */ function getSupplyRate( uint256 _cash, uint256 _borrows, uint256 _reserves, uint256 _reserveFactorMantissa ) external view override returns (uint256) { uint256 oneMinusReserveFactor = uint256(1e18) - _reserveFactorMantissa; uint256 borrowRate = getBorrowRateInternal(_cash, _borrows, _reserves); uint256 rateToPool = (borrowRate * oneMinusReserveFactor) / 1e18; uint256 supplyRate = (utilizationRate(_cash, _borrows, _reserves) * rateToPool) / 1e18; return supplyRate; } /** * @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 1e18) * @param _multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18) * @param _jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point * @param _kink The utilization point at which the jump multiplier is applied */ function _updateJumpRateModel( uint256 _baseRatePerYear, uint256 _multiplierPerYear, uint256 _jumpMultiplierPerYear, uint256 _kink ) public onlyOwner { uint256 newBaseRatePerBlock = _baseRatePerYear / blocksPerYear; uint256 newMultiplierPerBlock = (_multiplierPerYear * 1e18) / (blocksPerYear * _kink); uint256 newJumpMultiplierPerBlock = _jumpMultiplierPerYear / blocksPerYear; baseRatePerBlock = newBaseRatePerBlock; multiplierPerBlock = newMultiplierPerBlock; jumpMultiplierPerBlock = newJumpMultiplierPerBlock; kink = _kink; emit NewInterestParams(newBaseRatePerBlock, newMultiplierPerBlock, newJumpMultiplierPerBlock, _kink); } /** * @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 1e18) */ function getBorrowRateInternal( uint256 _cash, uint256 _borrows, uint256 _reserves ) internal view returns (uint256) { uint256 util = utilizationRate(_cash, _borrows, _reserves); uint256 cachedKink = kink; if (util <= cachedKink) { return ((util * multiplierPerBlock) / 1e18) + baseRatePerBlock; } else { uint256 normalRate = ((cachedKink * multiplierPerBlock) / 1e18) + baseRatePerBlock; uint256 excessUtil; unchecked { excessUtil = util - cachedKink; } return ((excessUtil * jumpMultiplierPerBlock) / 1e18) + normalRate; } } /** * @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 */ function getBorrowRate( uint256 _cash, uint256 _borrows, uint256 _reserves ) external view virtual override returns (uint256); function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) { return _interfaceId == type(InterestRateModelI).interfaceId; } }
//SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.15; import "./BaseJumpRateModel.sol"; /** * @title Modified Compound's JumpRateModel Contract V2 for V2 cTokens * @author Honey Labs Inc. * @custom:coauthor BowTiedPickle * @custom:contributor m4rio */ contract JumpRateModel is BaseJumpRateModel { /// @notice this corresponds to 1.0.0 uint256 public constant version = 1_000_000; /** * @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( uint256 _cash, uint256 _borrows, uint256 _reserves ) external view override returns (uint256) { return getBorrowRateInternal(_cash, _borrows, _reserves); } /** * @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 multiplierPerBlock 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 ) { _updateJumpRateModel(_baseRatePerYear, _multiplierPerYear, _jumpMultiplierPerYear, _kink); } }
{ "optimizer": { "enabled": true, "runs": 300 }, "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":"_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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"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":[],"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":"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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","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"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161095938038061095983398101604081905261002f916101ba565b6100383361004d565b6100448484848461009d565b5050505061023f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100a561015a565b60006100b462201480866101f0565b905060006100c58362201480610212565b6100d786670de0b6b3a7640000610212565b6100e191906101f0565b905060006100f262201480866101f0565b60028490556001839055600381905560048590556040805185815260208101859052908101829052606081018690529091507f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050505050565b6000546001600160a01b031633146101b85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b565b600080600080608085870312156101d057600080fd5b505082516020840151604085015160609095015191969095509092509050565b60008261020d57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561023a57634e487b7160e01b600052601160045260246000fd5b500290565b61070b8061024e6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063b9f9850a11610066578063b9f9850a146101c4578063f14039de146101cd578063f2fde38b146101d6578063fd2da339146101e957600080fd5b80638da5cb5b1461018c578063a385fb96146101a7578063b8168816146101b157600080fd5b806354fd4d50116100c857806354fd4d501461015e5780636e71e2d814610168578063715018a61461017b5780638726bb891461018357600080fd5b806301fbb5a1146100ef57806301ffc9a71461010457806315f240531461013d575b600080fd5b6101026100fd36600461059e565b6101f2565b005b6101286101123660046105d0565b6001600160e01b031916636135719d60e11b1490565b60405190151581526020015b60405180910390f35b61015061014b3660046105fa565b6102af565b604051908152602001610134565b610150620f424081565b6101506101763660046105fa565b6102c6565b610102610314565b61015060015481565b6000546040516001600160a01b039091168152602001610134565b6101506220148081565b6101506101bf36600461059e565b610328565b61015060035481565b61015060025481565b6101026101e4366004610626565b6103a7565b61015060045481565b6101fa610425565b60006102096220148086610665565b9050600061021a8362201480610687565b61022c86670de0b6b3a7640000610687565b6102369190610665565b905060006102476220148086610665565b60028490556001839055600381905560048590556040805185815260208101859052908101829052606081018690529091507f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050505050565b60006102bc84848461047f565b90505b9392505050565b6000826000036102d8575060006102bf565b6000826102e585876106a6565b6102ef91906106be565b61030185670de0b6b3a7640000610687565b61030b9190610665565b95945050505050565b61031c610425565b6103266000610541565b565b60008061033d83670de0b6b3a76400006106be565b9050600061034c87878761047f565b90506000670de0b6b3a76400006103638484610687565b61036d9190610665565b90506000670de0b6b3a7640000826103868b8b8b6102c6565b6103909190610687565b61039a9190610665565b9998505050505050505050565b6103af610425565b6001600160a01b0381166104195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61042281610541565b50565b6000546001600160a01b031633146103265760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610410565b60008061048d8585856102c6565b6004549091508082116104d157600254670de0b6b3a7640000600154846104b49190610687565b6104be9190610665565b6104c891906106a6565b925050506102bf565b6000600254670de0b6b3a7640000600154846104ed9190610687565b6104f79190610665565b61050191906106a6565b90506000828403905081670de0b6b3a7640000600354836105229190610687565b61052c9190610665565b61053691906106a6565b9450505050506102bf565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080600080608085870312156105b457600080fd5b5050823594602084013594506040840135936060013592509050565b6000602082840312156105e257600080fd5b81356001600160e01b0319811681146102bf57600080fd5b60008060006060848603121561060f57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561063857600080fd5b81356001600160a01b03811681146102bf57600080fd5b634e487b7160e01b600052601160045260246000fd5b60008261068257634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156106a1576106a161064f565b500290565b600082198211156106b9576106b961064f565b500190565b6000828210156106d0576106d061064f565b50039056fea2646970667358221220b438413a7daacb2df590937a1137a8704704c3af67439d838e3a9135304a030964736f6c634300080f00330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008e1bc9bf0400000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec500000
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008e1bc9bf0400000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec500000
-----Decoded View---------------
Arg [0] : _baseRatePerYear (uint256): 0
Arg [1] : _multiplierPerYear (uint256): 40000000000000000
Arg [2] : _jumpMultiplierPerYear (uint256): 1090000000000000000
Arg [3] : _kink (uint256): 800000000000000000
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 000000000000000000000000000000000000000000000000008e1bc9bf040000
Arg [2] : 0000000000000000000000000000000000000000000000000f207539952d0000
Arg [3] : 0000000000000000000000000000000000000000000000000b1a2bc2ec500000
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.