Source Code
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:
TripleSlopeModel
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: MIT
pragma solidity 0.8.20;
import "../interfaces/IInterestModel.sol";
/**
* @title TripleSlopeModel
* @notice Triple slope interest rate model for bank
* @dev Implements a three-tier interest rate model based on utilization
*/
contract TripleSlopeModel is IInterestModel {
/// @dev Return the interest rate per second, using 1e18 as denom.
function getInterestRate(uint256 debt, uint256 floating) external pure returns (uint256) {
uint256 total = debt + floating;
if (total == 0) return 0; // Prevent division by zero
uint256 utilization = (debt * 100e18) / total;
//Triple Slope Model
if (utilization < 80e18) {
// Less than 80% utilization - % APY
return (utilization * 8e16) / (80e18) / 365 days;
} else if (utilization < 90e18) {
// Between 80% and 90% - 8%-15% APY
return (8e16 + ((utilization - 80e18) * 7e16) / 10e18) / 365 days;
} else if (utilization < 100e18) {
// Between 90% and 100% - 15%-50% APY
return (15e16 + ((utilization - 90e18) * 35e16) / 10e18) / 365 days;
} else {
// Not possible, but just in case - 50% APY
return uint256(50e16) / 365 days;
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title IInterestModel
* @notice Interface for interest rate model
*/
interface IInterestModel {
/// @dev Return the interest rate per second, using 1e18 as denom.
function getInterestRate(uint256 debt, uint256 floating) external view returns (uint256);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"debt","type":"uint256"},{"internalType":"uint256","name":"floating","type":"uint256"}],"name":"getInterestRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
60808060405234610016576101dd908161001c8239f35b600080fdfe6080604052600436101561001257600080fd5b60003560e01c63c6dfa13f1461002757600080fd5b34610050576040366003190112610050576020610048602435600435610055565b604051908152f35b600080fd5b9081018082116100bc5780156101a05768056bc75e2d6310000091828102908082048414901517156100bc5704906804563918244f40000090818310156100d2575067011c37937e080000918281029281840414901517156100bc576301e1338091040490565b634e487b7160e01b600052601160045260246000fd5b90506804e1003b28d928000082101561013a57506804563918244f3fffff1981019081116100bc5766f8b0a10e470000908181029181830414901517156100bc57678ac7230489e8000067011c37937e080000910481018091116100bc576301e13380900490565b811015610196576804e1003b28d927ffff1981019081116100bc576704db732547630000908181029181830414901517156100bc57678ac7230489e80000670214e8348c4f0000910481018091116100bc576301e13380900490565b506403b106837790565b505060009056fea26469706673582212207d0a4fcbbd2c3f20a04ed60f7a050941b1a3e19010207d11f1f6255e8ddb361b64736f6c63430008140033
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c63c6dfa13f1461002757600080fd5b34610050576040366003190112610050576020610048602435600435610055565b604051908152f35b600080fd5b9081018082116100bc5780156101a05768056bc75e2d6310000091828102908082048414901517156100bc5704906804563918244f40000090818310156100d2575067011c37937e080000918281029281840414901517156100bc576301e1338091040490565b634e487b7160e01b600052601160045260246000fd5b90506804e1003b28d928000082101561013a57506804563918244f3fffff1981019081116100bc5766f8b0a10e470000908181029181830414901517156100bc57678ac7230489e8000067011c37937e080000910481018091116100bc576301e13380900490565b811015610196576804e1003b28d927ffff1981019081116100bc576704db732547630000908181029181830414901517156100bc57678ac7230489e80000670214e8348c4f0000910481018091116100bc576301e13380900490565b506403b106837790565b505060009056fea26469706673582212207d0a4fcbbd2c3f20a04ed60f7a050941b1a3e19010207d11f1f6255e8ddb361b64736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
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.