Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- JumpRateModel
- Optimization enabled
- true
- Compiler version
- v0.8.11+commit.d7f03943
- Optimization runs
- 3000
- EVM Version
- london
- Verified at
- 2023-09-01T20:00:14.953310Z
Constructor Arguments
00000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec500000
Arg [0] (uint256) : 20000000000000000
Arg [1] (uint256) : 100000000000000000
Arg [2] (uint256) : 1090000000000000000
Arg [3] (uint256) : 800000000000000000
JumpRateModel.sol
pragma solidity 0.8.11; /** * @title Aurigami Finance's InterestRateModel Interface */ 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 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 virtual 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 virtual returns (uint); } /** * @title Aurigami's JumpRateModel Contract * @author Aurigami */ contract JumpRateModel is InterestRateModel { 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 = 31536000; // 1 year /** * @notice The multiplier of utilization rate that gives the slope of the interest rate */ uint public immutable multiplierPerTimestamp; /** * @notice The base interest rate which is the y-intercept when utilization rate is 0 */ uint public immutable baseRatePerTimestamp; /** * @notice The multiplierPerTimestamp after hitting a specified utilization point */ uint public immutable jumpMultiplierPerTimestamp; /** * @notice The utilization point at which the jump multiplier is applied */ uint 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(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) { baseRatePerTimestamp = baseRatePerYear * 1e18 / timestampsPerYear / 1e18; multiplierPerTimestamp = multiplierPerYear * 1e18 / timestampsPerYear / 1e18; jumpMultiplierPerTimestamp = jumpMultiplierPerYear * 1e18 / timestampsPerYear / 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 * 1e18 / (cash + borrows - reserves); } /** * @notice Calculates the current borrow 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 * @return The borrow rate percentage per timestmp as a mantissa (scaled by 1e18) */ function getBorrowRate(uint cash, uint borrows, uint reserves) public override view returns (uint) { uint util = utilizationRate(cash, borrows, reserves); if (util <= kink) { return util * multiplierPerTimestamp / 1e18 + baseRatePerTimestamp; } else { uint normalRate = kink * multiplierPerTimestamp / 1e18 + baseRatePerTimestamp; uint 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(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public override view returns (uint) { uint oneMinusReserveFactor = 1e18 - reserveFactorMantissa; uint borrowRate = getBorrowRate(cash, borrows, reserves); uint rateToPool = borrowRate * oneMinusReserveFactor / 1e18; return utilizationRate(cash, borrows, reserves) * rateToPool / 1e18; } }
Compiler Settings
{"remappings":[],"optimizer":{"runs":3000,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"london","compilationTarget":{"JumpRateModel.sol":"JumpRateModel"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"uint256","name":"baseRatePerYear","internalType":"uint256"},{"type":"uint256","name":"multiplierPerYear","internalType":"uint256"},{"type":"uint256","name":"jumpMultiplierPerYear","internalType":"uint256"},{"type":"uint256","name":"kink_","internalType":"uint256"}]},{"type":"event","name":"NewInterestParams","inputs":[{"type":"uint256","name":"baseRatePerTimestamp","internalType":"uint256","indexed":false},{"type":"uint256","name":"multiplierPerTimestamp","internalType":"uint256","indexed":false},{"type":"uint256","name":"jumpMultiplierPerTimestamp","internalType":"uint256","indexed":false},{"type":"uint256","name":"kink","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"baseRatePerTimestamp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBorrowRate","inputs":[{"type":"uint256","name":"cash","internalType":"uint256"},{"type":"uint256","name":"borrows","internalType":"uint256"},{"type":"uint256","name":"reserves","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getSupplyRate","inputs":[{"type":"uint256","name":"cash","internalType":"uint256"},{"type":"uint256","name":"borrows","internalType":"uint256"},{"type":"uint256","name":"reserves","internalType":"uint256"},{"type":"uint256","name":"reserveFactorMantissa","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isInterestRateModel","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"jumpMultiplierPerTimestamp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"kink","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"multiplierPerTimestamp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"timestampsPerYear","inputs":[]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"utilizationRate","inputs":[{"type":"uint256","name":"cash","internalType":"uint256"},{"type":"uint256","name":"borrows","internalType":"uint256"},{"type":"uint256","name":"reserves","internalType":"uint256"}]}]
Contract Creation Code
0x61010060405234801561001157600080fd5b506040516107a73803806107a78339810160408190526100309161011b565b670de0b6b3a76400006301e133806100488683610151565b610052919061017e565b61005c919061017e565b60a052670de0b6b3a76400006301e133806100778583610151565b610081919061017e565b61008b919061017e565b608052670de0b6b3a76400006301e133806100a68483610151565b6100b0919061017e565b6100ba919061017e565b60c081905260e082905260a05160808051604080519384526020840191909152820192909252606081018390527f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d910160405180910390a1505050506101a0565b6000806000806080858703121561013157600080fd5b505082516020840151604085015160609095015191969095509092509050565b600081600019048311821515161561017957634e487b7160e01b600052601160045260246000fd5b500290565b60008261019b57634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c05160e05161059761021060003960008181610191015281816101c5015281816102ac01526102ed01526000818160f6015261032301526000818161011d015281816101ec015261025e01526000818161014401528181610219015261028b01526105976000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c806340bc0af4116100765780636e71e2d81161005b5780636e71e2d814610166578063b816881614610179578063fd2da3391461018c57600080fd5b806340bc0af4146101185780636c2df6a71461013f57600080fd5b80630c574861146100a857806315f24053146100c65780632191f92a146100d957806326c394f7146100f1575b600080fd5b6100b36301e1338081565b6040519081526020015b60405180910390f35b6100b36100d436600461042d565b6101b3565b6100e1600181565b60405190151581526020016100bd565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6100b361017436600461042d565b610369565b6100b3610187366004610459565b6103b1565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6000806101c1858585610369565b90507f0000000000000000000000000000000000000000000000000000000000000000811161025a577f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a764000061023e7f0000000000000000000000000000000000000000000000000000000000000000846104ba565b61024891906104f7565b6102529190610532565b915050610362565b60007f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a76400006102d07f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006104ba565b6102da91906104f7565b6102e49190610532565b905060006103127f00000000000000000000000000000000000000000000000000000000000000008461054a565b905081670de0b6b3a76400006103487f0000000000000000000000000000000000000000000000000000000000000000846104ba565b61035291906104f7565b61035c9190610532565b93505050505b9392505050565b60008261037857506000610362565b816103838486610532565b61038d919061054a565b61039f84670de0b6b3a76400006104ba565b6103a991906104f7565b949350505050565b6000806103c683670de0b6b3a764000061054a565b905060006103d58787876101b3565b90506000670de0b6b3a76400006103ec84846104ba565b6103f691906104f7565b9050670de0b6b3a76400008161040d8a8a8a610369565b61041791906104ba565b61042191906104f7565b98975050505050505050565b60008060006060848603121561044257600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561046f57600080fd5b5050823594602084013594506040840135936060013592509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156104f2576104f261048b565b500290565b60008261052d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600082198211156105455761054561048b565b500190565b60008282101561055c5761055c61048b565b50039056fea2646970667358221220ee639c9d4411e2f01e0995b611b85fd2ddc78336706cdcc764e0e8c734af9bd864736f6c634300080b003300000000000000000000000000000000000000000000000000470de4df820000000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000f207539952d00000000000000000000000000000000000000000000000000000b1a2bc2ec500000
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100a35760003560e01c806340bc0af4116100765780636e71e2d81161005b5780636e71e2d814610166578063b816881614610179578063fd2da3391461018c57600080fd5b806340bc0af4146101185780636c2df6a71461013f57600080fd5b80630c574861146100a857806315f24053146100c65780632191f92a146100d957806326c394f7146100f1575b600080fd5b6100b36301e1338081565b6040519081526020015b60405180910390f35b6100b36100d436600461042d565b6101b3565b6100e1600181565b60405190151581526020016100bd565b6100b37f000000000000000000000000000000000000000000000000000000080c27ccae81565b6100b37f0000000000000000000000000000000000000000000000000000000025cd0f7f81565b6100b37f00000000000000000000000000000000000000000000000000000000bd014d7e81565b6100b361017436600461042d565b610369565b6100b3610187366004610459565b6103b1565b6100b37f0000000000000000000000000000000000000000000000000b1a2bc2ec50000081565b6000806101c1858585610369565b90507f0000000000000000000000000000000000000000000000000b1a2bc2ec500000811161025a577f0000000000000000000000000000000000000000000000000000000025cd0f7f670de0b6b3a764000061023e7f00000000000000000000000000000000000000000000000000000000bd014d7e846104ba565b61024891906104f7565b6102529190610532565b915050610362565b60007f0000000000000000000000000000000000000000000000000000000025cd0f7f670de0b6b3a76400006102d07f00000000000000000000000000000000000000000000000000000000bd014d7e7f0000000000000000000000000000000000000000000000000b1a2bc2ec5000006104ba565b6102da91906104f7565b6102e49190610532565b905060006103127f0000000000000000000000000000000000000000000000000b1a2bc2ec5000008461054a565b905081670de0b6b3a76400006103487f000000000000000000000000000000000000000000000000000000080c27ccae846104ba565b61035291906104f7565b61035c9190610532565b93505050505b9392505050565b60008261037857506000610362565b816103838486610532565b61038d919061054a565b61039f84670de0b6b3a76400006104ba565b6103a991906104f7565b949350505050565b6000806103c683670de0b6b3a764000061054a565b905060006103d58787876101b3565b90506000670de0b6b3a76400006103ec84846104ba565b6103f691906104f7565b9050670de0b6b3a76400008161040d8a8a8a610369565b61041791906104ba565b61042191906104f7565b98975050505050505050565b60008060006060848603121561044257600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561046f57600080fd5b5050823594602084013594506040840135936060013592509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156104f2576104f261048b565b500290565b60008261052d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600082198211156105455761054561048b565b500190565b60008282101561055c5761055c61048b565b50039056fea2646970667358221220ee639c9d4411e2f01e0995b611b85fd2ddc78336706cdcc764e0e8c734af9bd864736f6c634300080b0033