Source Code
Overview
S Balance
S Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 2857048 | 382 days ago | Contract Creation | 0 S |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
InterestRateModelV2Config
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;
import {IInterestRateModelV2Config} from "../interfaces/IInterestRateModelV2Config.sol";
import {IInterestRateModelV2} from "../interfaces/IInterestRateModelV2.sol";
/// @title InterestRateModelV2Config
/// @notice Please never deploy config manually, always use factory, because factory does necessary checks.
contract InterestRateModelV2Config is IInterestRateModelV2Config {
// uopt ∈ (0, 1) – optimal utilization;
int256 internal immutable _UOPT;
// ucrit ∈ (uopt, 1) – threshold of large utilization;
int256 internal immutable _UCRIT;
// ulow ∈ (0, uopt) – threshold of low utilization
int256 internal immutable _ULOW;
// ki > 0 – integrator gain
int256 internal immutable _KI;
// kcrit > 0 – proportional gain for large utilization
int256 internal immutable _KCRIT;
// klow ≥ 0 – proportional gain for low utilization
int256 internal immutable _KLOW;
// klin ≥ 0 – coefficient of the lower linear bound
int256 internal immutable _KLIN;
// beta ≥ 0 - a scaling factor
int256 internal immutable _BETA;
// initial value for ri, ri ≥ 0 – initial value of the integrator
int112 internal immutable _RI;
// initial value for Tcrit, Tcrit ≥ 0 - the time during which the utilization exceeds the critical value
int112 internal immutable _TCRIT;
constructor(IInterestRateModelV2.Config memory _config) {
_UOPT = _config.uopt;
_UCRIT = _config.ucrit;
_ULOW = _config.ulow;
_KI = _config.ki;
_KCRIT = _config.kcrit;
_KLOW = _config.klow;
_KLIN = _config.klin;
_BETA = _config.beta;
_RI = _config.ri;
_TCRIT = _config.Tcrit;
}
/// @inheritdoc IInterestRateModelV2Config
function getConfig() external view virtual returns (IInterestRateModelV2.Config memory config) {
config.uopt = _UOPT;
config.ucrit = _UCRIT;
config.ulow = _ULOW;
config.ki = _KI;
config.kcrit = _KCRIT;
config.klow = _KLOW;
config.klin = _KLIN;
config.beta = _BETA;
config.ri = _RI;
config.Tcrit = _TCRIT;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
import {IInterestRateModelV2} from "./IInterestRateModelV2.sol";
interface IInterestRateModelV2Config {
/// @return config returns immutable IRM configuration that is present in contract
function getConfig() external view returns (IInterestRateModelV2.Config memory config);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
import {IInterestRateModelV2Config} from "./IInterestRateModelV2Config.sol";
interface IInterestRateModelV2 {
struct Config {
// uopt ∈ (0, 1) – optimal utilization;
int256 uopt;
// ucrit ∈ (uopt, 1) – threshold of large utilization;
int256 ucrit;
// ulow ∈ (0, uopt) – threshold of low utilization
int256 ulow;
// ki > 0 – integrator gain
int256 ki;
// kcrit > 0 – proportional gain for large utilization
int256 kcrit;
// klow ≥ 0 – proportional gain for low utilization
int256 klow;
// klin ≥ 0 – coefficient of the lower linear bound
int256 klin;
// beta ≥ 0 - a scaling factor
int256 beta;
// ri ≥ 0 – initial value of the integrator
int112 ri;
// Tcrit ≥ 0 - initial value of the time during which the utilization exceeds the critical value
int112 Tcrit;
}
struct Setup {
// ri ≥ 0 – the integrator
int112 ri;
// Tcrit ≥ 0 - the time during which the utilization exceeds the critical value
int112 Tcrit;
// flag that informs if setup is initialized
bool initialized;
}
/* solhint-enable */
error AddressZero();
error DeployConfigFirst();
error AlreadyInitialized();
error InvalidBeta();
error InvalidKcrit();
error InvalidKi();
error InvalidKlin();
error InvalidKlow();
error InvalidTcrit();
error InvalidTimestamps();
error InvalidUcrit();
error InvalidUlow();
error InvalidUopt();
error InvalidRi();
/// @dev Get config for given asset in a Silo.
/// @param _silo Silo address for which config should be set
/// @return Config struct for asset in Silo
function getConfig(address _silo) external view returns (Config memory);
/// @notice get the flag to detect rcomp restriction (zero current interest) due to overflow
/// overflow boolean flag to detect rcomp restriction
function overflowDetected(address _silo, uint256 _blockTimestamp)
external
view
returns (bool overflow);
/// @dev pure function that calculates current annual interest rate
/// @param _c configuration object, IInterestRateModel.Config
/// @param _totalBorrowAmount current total borrows for asset
/// @param _totalDeposits current total deposits for asset
/// @param _interestRateTimestamp timestamp of last interest rate update
/// @param _blockTimestamp current block timestamp
/// @return rcur current annual interest rate (1e18 == 100%)
function calculateCurrentInterestRate(
Config calldata _c,
uint256 _totalDeposits,
uint256 _totalBorrowAmount,
uint256 _interestRateTimestamp,
uint256 _blockTimestamp
) external pure returns (uint256 rcur);
/// @dev pure function that calculates interest rate based on raw input data
/// @param _c configuration object, IInterestRateModel.Config
/// @param _totalBorrowAmount current total borrows for asset
/// @param _totalDeposits current total deposits for asset
/// @param _interestRateTimestamp timestamp of last interest rate update
/// @param _blockTimestamp current block timestamp
/// @return rcomp compounded interest rate from last update until now (1e18 == 100%)
/// @return ri current integral part of the rate
/// @return Tcrit time during which the utilization exceeds the critical value
/// @return overflow boolean flag to detect rcomp restriction
function calculateCompoundInterestRateWithOverflowDetection(
Config memory _c,
uint256 _totalDeposits,
uint256 _totalBorrowAmount,
uint256 _interestRateTimestamp,
uint256 _blockTimestamp
)
external
pure
returns (
uint256 rcomp,
int256 ri,
int256 Tcrit,
bool overflow
);
/// @dev pure function that calculates interest rate based on raw input data
/// @param _c configuration object, IInterestRateModel.Config
/// @param _totalBorrowAmount current total borrows for asset
/// @param _totalDeposits current total deposits for asset
/// @param _interestRateTimestamp timestamp of last interest rate update
/// @param _blockTimestamp current block timestamp
/// @return rcomp compounded interest rate from last update until now (1e18 == 100%)
/// @return ri current integral part of the rate
/// @return Tcrit time during which the utilization exceeds the critical value
function calculateCompoundInterestRate(
Config memory _c,
uint256 _totalDeposits,
uint256 _totalBorrowAmount,
uint256 _interestRateTimestamp,
uint256 _blockTimestamp
) external pure returns (uint256 rcomp, int256 ri, int256 Tcrit);
}{
"remappings": [
"forge-std/=gitmodules/forge-std/src/",
"silo-foundry-utils/=gitmodules/silo-foundry-utils/contracts/",
"properties/=gitmodules/crytic/properties/contracts/",
"silo-core/=silo-core/",
"silo-oracles/=silo-oracles/",
"silo-vaults/=silo-vaults/",
"ve-silo/=ve-silo/",
"@openzeppelin/=gitmodules/openzeppelin-contracts-5/contracts/",
"morpho-blue/=gitmodules/morpho-blue/src/",
"openzeppelin5/=gitmodules/openzeppelin-contracts-5/contracts/",
"openzeppelin5-upgradeable/=gitmodules/openzeppelin-contracts-upgradeable-5/contracts/",
"chainlink/=gitmodules/chainlink/contracts/src/",
"chainlink-ccip/=gitmodules/chainlink-ccip/contracts/src/",
"uniswap/=gitmodules/uniswap/",
"@uniswap/v3-core/=gitmodules/uniswap/v3-core/",
"balancer-labs/v2-solidity-utils/=external/balancer-v2-monorepo/pkg/solidity-utils/contracts/",
"balancer-labs/v2-interfaces/=external/balancer-v2-monorepo/pkg/interfaces/contracts/",
"balancer-labs/v2-liquidity-mining/=external/balancer-v2-monorepo/pkg/liquidity-mining/contracts/",
"@balancer-labs/=node_modules/@balancer-labs/",
"@ensdomains/=node_modules/@ensdomains/",
"@openzeppelin/contracts-upgradeable/=gitmodules/openzeppelin-contracts-upgradeable-5/contracts/",
"@openzeppelin/contracts/=gitmodules/openzeppelin-contracts-5/contracts/",
"@solidity-parser/=node_modules/@solidity-parser/",
"ERC4626/=gitmodules/crytic/properties/lib/ERC4626/contracts/",
"crytic/=gitmodules/crytic/",
"ds-test/=gitmodules/openzeppelin-contracts-5/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=gitmodules/openzeppelin-contracts-5/lib/erc4626-tests/",
"halmos-cheatcodes/=gitmodules/morpho-blue/lib/halmos-cheatcodes/src/",
"hardhat/=node_modules/hardhat/",
"openzeppelin-contracts-5/=gitmodules/openzeppelin-contracts-5/",
"openzeppelin-contracts-upgradeable-5/=gitmodules/openzeppelin-contracts-upgradeable-5/",
"openzeppelin-contracts/=gitmodules/openzeppelin-contracts-upgradeable-5/lib/openzeppelin-contracts/",
"prettier-plugin-solidity/=node_modules/prettier-plugin-solidity/",
"proposals/=node_modules/proposals/",
"solmate/=gitmodules/crytic/properties/lib/solmate/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"components":[{"internalType":"int256","name":"uopt","type":"int256"},{"internalType":"int256","name":"ucrit","type":"int256"},{"internalType":"int256","name":"ulow","type":"int256"},{"internalType":"int256","name":"ki","type":"int256"},{"internalType":"int256","name":"kcrit","type":"int256"},{"internalType":"int256","name":"klow","type":"int256"},{"internalType":"int256","name":"klin","type":"int256"},{"internalType":"int256","name":"beta","type":"int256"},{"internalType":"int112","name":"ri","type":"int112"},{"internalType":"int112","name":"Tcrit","type":"int112"}],"internalType":"struct IInterestRateModelV2.Config","name":"_config","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"getConfig","outputs":[{"components":[{"internalType":"int256","name":"uopt","type":"int256"},{"internalType":"int256","name":"ucrit","type":"int256"},{"internalType":"int256","name":"ulow","type":"int256"},{"internalType":"int256","name":"ki","type":"int256"},{"internalType":"int256","name":"kcrit","type":"int256"},{"internalType":"int256","name":"klow","type":"int256"},{"internalType":"int256","name":"klin","type":"int256"},{"internalType":"int256","name":"beta","type":"int256"},{"internalType":"int112","name":"ri","type":"int112"},{"internalType":"int112","name":"Tcrit","type":"int112"}],"internalType":"struct IInterestRateModelV2.Config","name":"config","type":"tuple"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6101c0604052348015610010575f5ffd5b506040516104b93803806104b983398101604081905261002f916100dd565b80516080908152602082015160a0908152604083015160c0908152606084015160e0908152928401516101009081529184015161012090815290840151610140529183015161016052820151600d90810b61018052910151900b6101a05261016f565b60405161014081016001600160401b03811182821017156100c157634e487b7160e01b5f52604160045260245ffd5b60405290565b8051600d81900b81146100d8575f5ffd5b919050565b5f6101408284031280156100ef575f5ffd5b506100f8610092565b825181526020808401519082015260408084015190820152606080840151908201526080808401519082015260a0808401519082015260c0808401519082015260e0808401519082015261014f61010084016100c7565b61010082015261016261012084016100c7565b6101208201529392505050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516102de6101db5f395f6101f801525f6101cc01525f6101a601525f61018001525f61015a01525f61013401525f61010e01525f60e801525f60c201525f609f01526102de5ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063c3f909d41461002d575b5f5ffd5b61003561004b565b6040516100429190610222565b60405180910390f35b61009d6040518061014001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f600d0b81526020015f600d0b81525090565b7f000000000000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000000060208201527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201527f000000000000000000000000000000000000000000000000000000000000000060808201527f000000000000000000000000000000000000000000000000000000000000000060a08201527f000000000000000000000000000000000000000000000000000000000000000060c08201527f000000000000000000000000000000000000000000000000000000000000000060e08201527f0000000000000000000000000000000000000000000000000000000000000000600d90810b6101008301527f0000000000000000000000000000000000000000000000000000000000000000900b61012082015290565b5f61014082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010083015161028a610100840182600d0b9052565b506101208301516102a1610120840182600d0b9052565b509291505056fea2646970667358221220b115e739af79140490d56798607b39258eac5f9c54365bedb6b20f53dfb5988564736f6c634300081c00330000000000000000000000000000000000000000000000000c7d713b49da00010000000000000000000000000000000000000000000000000c7d713b49da00020000000000000000000000000000000000000000000000000c7d713b49da0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d88341bc000000000000000000000000000000000000000000000000000000007380cbcd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000150d9925c7b40000000000000000000000000000000000000000000000000000000067f3ea9f0000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063c3f909d41461002d575b5f5ffd5b61003561004b565b6040516100429190610222565b60405180910390f35b61009d6040518061014001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f600d0b81526020015f600d0b81525090565b7f0000000000000000000000000000000000000000000000000c7d713b49da000181527f0000000000000000000000000000000000000000000000000c7d713b49da000260208201527f0000000000000000000000000000000000000000000000000c7d713b49da000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201527f00000000000000000000000000000000000000000000000000000001d88341bc60808201527f000000000000000000000000000000000000000000000000000000007380cbcd60a08201527f000000000000000000000000000000000000000000000000000000000000000060c08201527f0000000000000000000000000000000000000000000000000000150d9925c7b460e08201527f0000000000000000000000000000000000000000000000000000000067f3ea9f600d90810b6101008301527f0000000000000000000000000000000000000000000000000000000000000000900b61012082015290565b5f61014082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010083015161028a610100840182600d0b9052565b506101208301516102a1610120840182600d0b9052565b509291505056fea2646970667358221220b115e739af79140490d56798607b39258eac5f9c54365bedb6b20f53dfb5988564736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000c7d713b49da00010000000000000000000000000000000000000000000000000c7d713b49da00020000000000000000000000000000000000000000000000000c7d713b49da0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d88341bc000000000000000000000000000000000000000000000000000000007380cbcd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000150d9925c7b40000000000000000000000000000000000000000000000000000000067f3ea9f0000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _config (tuple):
Arg [1] : uopt (int256): 900000000000000001
Arg [2] : ucrit (int256): 900000000000000002
Arg [3] : ulow (int256): 900000000000000000
Arg [4] : ki (int256): 0
Arg [5] : kcrit (int256): 7927447996
Arg [6] : klow (int256): 1937820621
Arg [7] : klin (int256): 0
Arg [8] : beta (int256): 23148148148148
Arg [9] : ri (int112): 1744038559
Arg [10] : Tcrit (int112): 0
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000c7d713b49da0001
Arg [1] : 0000000000000000000000000000000000000000000000000c7d713b49da0002
Arg [2] : 0000000000000000000000000000000000000000000000000c7d713b49da0000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 00000000000000000000000000000000000000000000000000000001d88341bc
Arg [5] : 000000000000000000000000000000000000000000000000000000007380cbcd
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000150d9925c7b4
Arg [8] : 0000000000000000000000000000000000000000000000000000000067f3ea9f
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.