Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 19442542 | 298 days ago | IN | 0 ETH | 0.00100889 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
JumpRateModelV2
Compiler Version
v0.8.23+commit.f704f362
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.8.23; import "contracts/BaseJumpRateModelV2.sol"; import "contracts/InterestRateModel.sol"; /** * @title Compound's JumpRateModel Contract V2 for V2 cTokens * @author Arr00 * @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) override public view returns (uint) { return getBorrowRateInternal(cash, borrows, reserves); } constructor(uint256 blocksPerYear_, uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_) BaseJumpRateModelV2(blocksPerYear_, baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_, owner_) public {} }
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.8.23; import "contracts/InterestRateModel.sol"; /** * @title Logic for Compound's JumpRateModel Contract V2. * @author Compound (modified by Dharma Labs, refactored by Arr00) * @notice Version 2 modifies Version 1 by enabling updateable parameters. */ abstract contract BaseJumpRateModelV2 is InterestRateModel { event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink); event OwnershipTransferred(address oldOwner, address newOwner); error Unauthorized(); 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 blocksPerYear; /** * @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 blocksPerYear_ The approximate number of blocks per year on the current chain * @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(uint256 blocksPerYear_, uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_) internal { owner = owner_; blocksPerYear = blocksPerYear_; 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_) virtual external { if (msg.sender != owner) { revert Unauthorized(); } 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) virtual override public view 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); } /** * @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 { if (msg.sender != owner) { revert Unauthorized(); } address oldOwner = owner; owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.8.23; /** * @title Compound's InterestRateModel Interface * @author Compound */ 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) virtual public view 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) virtual public view returns (uint); /** * @notice Calculates the current borrow and 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 (uint, uint) The borrow rate percentage per block as a mantissa (scaled by BASE), * supply rate percentage per block as a mantissa (scaled by BASE) */ function getMarketRates(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) virtual public view returns (uint, uint) { return (getBorrowRate(cash, borrows, reserves), getSupplyRate(cash, borrows, reserves, reserveFactorMantissa)); } }
{ "evmVersion": "shanghai", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "JumpRateModelV2.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"blocksPerYear_","type":"uint256"},{"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"},{"inputs":[],"name":"Unauthorized","type":"error"},{"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":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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":"getMarketRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"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":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","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
608060405234801561000f575f80fd5b506040516107fb3803806107fb83398101604081905261002e91610119565b5f80546001600160a01b0319166001600160a01b038316179055600186905585858585858561005f85858585610070565b5050505050505050505050506101c0565b60015461007d9085610178565b60035560015461008e908290610197565b6100a0670de0b6b3a764000085610197565b6100aa9190610178565b6002556001546100ba9083610178565b60048190556005829055600354600254604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050565b5f805f805f8060c0878903121561012e575f80fd5b86516020880151604089015160608a015160808b015160a08c0151949a50929850909650945092506001600160a01b038116811461016a575f80fd5b809150509295509295509295565b5f8261019257634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176101ba57634e487b7160e01b5f52601160045260245ffd5b92915050565b61062e806101cd5f395ff3fe608060405234801561000f575f80fd5b50600436106100cb575f3560e01c8063a2b96c1011610088578063b9f9850a11610063578063b9f9850a146101ac578063f14039de146101b5578063f2fde38b146101be578063fd2da339146101d1575f80fd5b8063a2b96c1014610168578063a385fb9614610190578063b816881614610199575f80fd5b806315f24053146100cf5780632037f3e7146100f55780632191f92a1461010a5780636e71e2d8146101225780638726bb89146101355780638da5cb5b1461013e575b5f80fd5b6100e26100dd366004610504565b6101da565b6040519081526020015b60405180910390f35b61010861010336600461052d565b6101f0565b005b610112600181565b60405190151581526020016100ec565b6100e2610130366004610504565b61022b565b6100e260025481565b5f54610150906001600160a01b031681565b6040516001600160a01b0390911681526020016100ec565b61017b61017636600461052d565b61026b565b604080519283526020830191909152016100ec565b6100e260015481565b6100e26101a736600461052d565b610291565b6100e260045481565b6100e260035481565b6101086101cc36600461055c565b61030a565b6100e260055481565b5f6101e6848484610393565b90505b9392505050565b5f546001600160a01b03163314610219576040516282b42960e81b815260040160405180910390fd5b6102258484848461045b565b50505050565b5f825f0361023a57505f6101e9565b816102458486610596565b61024f91906105af565b610261670de0b6b3a7640000856105c2565b6101e691906105d9565b5f806102788686866101da565b61028487878787610291565b9150915094509492505050565b5f806102a583670de0b6b3a76400006105af565b90505f6102b3878787610393565b90505f670de0b6b3a76400006102c984846105c2565b6102d391906105d9565b9050670de0b6b3a7640000816102ea8a8a8a61022b565b6102f491906105c2565b6102fe91906105d9565b98975050505050505050565b5f546001600160a01b03163314610333576040516282b42960e81b815260040160405180910390fd5b5f80546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0910160405180910390a15050565b5f806103a085858561022b565b905060055481116103e157600354670de0b6b3a7640000600254836103c591906105c2565b6103cf91906105d9565b6103d99190610596565b9150506101e9565b5f600354670de0b6b3a76400006002546005546103fe91906105c2565b61040891906105d9565b6104129190610596565b90505f6005548361042391906105af565b905081670de0b6b3a76400006004548361043d91906105c2565b61044791906105d9565b6104519190610596565b93505050506101e9565b60015461046890856105d9565b6003556001546104799082906105c2565b61048b670de0b6b3a7640000856105c2565b61049591906105d9565b6002556001546104a590836105d9565b60048190556005829055600354600254604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050565b5f805f60608486031215610516575f80fd5b505081359360208301359350604090920135919050565b5f805f8060808587031215610540575f80fd5b5050823594602084013594506040840135936060013592509050565b5f6020828403121561056c575f80fd5b81356001600160a01b03811681146101e9575f80fd5b634e487b7160e01b5f52601160045260245ffd5b808201808211156105a9576105a9610582565b92915050565b818103818111156105a9576105a9610582565b80820281158282048414176105a9576105a9610582565b5f826105f357634e487b7160e01b5f52601260045260245ffd5b50049056fea2646970667358221220bbc6cf77649397deb8ce51ddeb8a9d471a359a5c21b8f28d9d7e959241f280f564736f6c6343000817003300000000000000000000000000000000000000000000000000000000002819a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000058d15e17628000000000000000000000000000000000000000000000000000014d1120d7b1600000000000000000000000000000000000000000000000000000b1a2bc2ec50000000000000000000000000000043a314183c0033528827be7cf426523bac412780
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106100cb575f3560e01c8063a2b96c1011610088578063b9f9850a11610063578063b9f9850a146101ac578063f14039de146101b5578063f2fde38b146101be578063fd2da339146101d1575f80fd5b8063a2b96c1014610168578063a385fb9614610190578063b816881614610199575f80fd5b806315f24053146100cf5780632037f3e7146100f55780632191f92a1461010a5780636e71e2d8146101225780638726bb89146101355780638da5cb5b1461013e575b5f80fd5b6100e26100dd366004610504565b6101da565b6040519081526020015b60405180910390f35b61010861010336600461052d565b6101f0565b005b610112600181565b60405190151581526020016100ec565b6100e2610130366004610504565b61022b565b6100e260025481565b5f54610150906001600160a01b031681565b6040516001600160a01b0390911681526020016100ec565b61017b61017636600461052d565b61026b565b604080519283526020830191909152016100ec565b6100e260015481565b6100e26101a736600461052d565b610291565b6100e260045481565b6100e260035481565b6101086101cc36600461055c565b61030a565b6100e260055481565b5f6101e6848484610393565b90505b9392505050565b5f546001600160a01b03163314610219576040516282b42960e81b815260040160405180910390fd5b6102258484848461045b565b50505050565b5f825f0361023a57505f6101e9565b816102458486610596565b61024f91906105af565b610261670de0b6b3a7640000856105c2565b6101e691906105d9565b5f806102788686866101da565b61028487878787610291565b9150915094509492505050565b5f806102a583670de0b6b3a76400006105af565b90505f6102b3878787610393565b90505f670de0b6b3a76400006102c984846105c2565b6102d391906105d9565b9050670de0b6b3a7640000816102ea8a8a8a61022b565b6102f491906105c2565b6102fe91906105d9565b98975050505050505050565b5f546001600160a01b03163314610333576040516282b42960e81b815260040160405180910390fd5b5f80546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0910160405180910390a15050565b5f806103a085858561022b565b905060055481116103e157600354670de0b6b3a7640000600254836103c591906105c2565b6103cf91906105d9565b6103d99190610596565b9150506101e9565b5f600354670de0b6b3a76400006002546005546103fe91906105c2565b61040891906105d9565b6104129190610596565b90505f6005548361042391906105af565b905081670de0b6b3a76400006004548361043d91906105c2565b61044791906105d9565b6104519190610596565b93505050506101e9565b60015461046890856105d9565b6003556001546104799082906105c2565b61048b670de0b6b3a7640000856105c2565b61049591906105d9565b6002556001546104a590836105d9565b60048190556005829055600354600254604080519283526020830191909152810191909152606081018290527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9060800160405180910390a150505050565b5f805f60608486031215610516575f80fd5b505081359360208301359350604090920135919050565b5f805f8060808587031215610540575f80fd5b5050823594602084013594506040840135936060013592509050565b5f6020828403121561056c575f80fd5b81356001600160a01b03811681146101e9575f80fd5b634e487b7160e01b5f52601160045260245ffd5b808201808211156105a9576105a9610582565b92915050565b818103818111156105a9576105a9610582565b80820281158282048414176105a9576105a9610582565b5f826105f357634e487b7160e01b5f52601260045260245ffd5b50049056fea2646970667358221220bbc6cf77649397deb8ce51ddeb8a9d471a359a5c21b8f28d9d7e959241f280f564736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000002819a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000058d15e17628000000000000000000000000000000000000000000000000000014d1120d7b1600000000000000000000000000000000000000000000000000000b1a2bc2ec50000000000000000000000000000043a314183c0033528827be7cf426523bac412780
-----Decoded View---------------
Arg [0] : blocksPerYear_ (uint256): 2628000
Arg [1] : baseRatePerYear (uint256): 0
Arg [2] : multiplierPerYear (uint256): 400000000000000000
Arg [3] : jumpMultiplierPerYear (uint256): 1500000000000000000
Arg [4] : kink_ (uint256): 800000000000000000
Arg [5] : owner_ (address): 0x43A314183c0033528827Be7cF426523bAc412780
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000002819a0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 000000000000000000000000000000000000000000000000058d15e176280000
Arg [3] : 00000000000000000000000000000000000000000000000014d1120d7b160000
Arg [4] : 0000000000000000000000000000000000000000000000000b1a2bc2ec500000
Arg [5] : 00000000000000000000000043a314183c0033528827be7cf426523bac412780
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.