Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 15690917 | 763 days ago | IN | 0 ETH | 0.00645002 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
VariableInterestRate50bp
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: ISC pragma solidity ^0.8.16; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ | // | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ | // | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ | // | | // ==================================================================== // ====================== VariableInterestRate ======================== // ==================================================================== // Frax Finance: https://github.com/FraxFinance // Primary Author // Drake Evans: https://github.com/DrakeEvans // Reviewers // Dennis: https://github.com/denett // Sam Kazemian: https://github.com/samkazemian // Travis Moore: https://github.com/FortisFortuna // Jack Corddry: https://github.com/corddry // Rich Gee: https://github.com/zer0blockchain // ==================================================================== import "./interfaces/IRateCalculator.sol"; /// @title A formula for calculating interest rates as a function of utilization and time /// @author Drake Evans github.com/drakeevans /// @notice A Contract for calculating interest rates as a function of utilization and time contract VariableInterestRate50bp is IRateCalculator { // Utilization Rate Settings uint32 private constant MIN_UTIL = 75_000; // 75% uint32 private constant MAX_UTIL = 85_000; // 85% uint32 private constant UTIL_PREC = 1e5; // 5 decimals // Interest Rate Settings (all rates are per second), 365.24 days per year uint64 private constant MIN_INT = 158_247_046; // 0.50% annual rate uint64 private constant MAX_INT = 146_248_476_607; // 10,000% annual rate uint256 private constant INT_HALF_LIFE = 43_200e36; // given in seconds, equal to 12 hours, additional 1e36 to make math simpler /// @notice The ```name``` function returns the name of the rate contract /// @return memory name of contract function name() external pure returns (string memory) { return "Variable Time-Weighted Interest Rate"; } /// @notice The ```getConstants``` function returns abi encoded constants /// @return _calldata abi.encode(uint32 MIN_UTIL, uint32 MAX_UTIL, uint32 UTIL_PREC, uint64 MIN_INT, uint64 MAX_INT, uint256 INT_HALF_LIFE) function getConstants() external pure returns (bytes memory _calldata) { return abi.encode(MIN_UTIL, MAX_UTIL, UTIL_PREC, MIN_INT, MAX_INT, INT_HALF_LIFE); } /// @notice The ```requireValidInitData``` function No-op as this contract has no init data function requireValidInitData(bytes calldata _initData) external pure {} /// @notice The ```getNewRate``` function calculates the new interest rate as a function of time and utilization /// @param _data abi.encode(uint64 _currentRatePerSec, uint256 _deltaTime, uint256 _utilization, uint256 _deltaBlocks) /// @param _initData empty for this Rate Calculator /// @return _newRatePerSec The new interest rate per second, 1e18 precision function getNewRate(bytes calldata _data, bytes calldata _initData) external pure returns (uint64 _newRatePerSec) { (uint64 _currentRatePerSec, uint256 _deltaTime, uint256 _utilization, ) = abi.decode( _data, (uint64, uint256, uint256, uint256) ); if (_utilization < MIN_UTIL) { uint256 _deltaUtilization = ((MIN_UTIL - _utilization) * 1e18) / MIN_UTIL; uint256 _decayGrowth = INT_HALF_LIFE + (_deltaUtilization * _deltaUtilization * _deltaTime); _newRatePerSec = uint64((_currentRatePerSec * INT_HALF_LIFE) / _decayGrowth); if (_newRatePerSec < MIN_INT) { _newRatePerSec = MIN_INT; } } else if (_utilization > MAX_UTIL) { uint256 _deltaUtilization = ((_utilization - MAX_UTIL) * 1e18) / (UTIL_PREC - MAX_UTIL); uint256 _decayGrowth = INT_HALF_LIFE + (_deltaUtilization * _deltaUtilization * _deltaTime); _newRatePerSec = uint64((_currentRatePerSec * _decayGrowth) / INT_HALF_LIFE); if (_newRatePerSec > MAX_INT) { _newRatePerSec = MAX_INT; } } else { _newRatePerSec = _currentRatePerSec; } } }
// SPDX-License-Identifier: ISC pragma solidity >=0.8.16; interface IRateCalculator { function name() external pure returns (string memory); function requireValidInitData(bytes calldata _initData) external pure; function getConstants() external pure returns (bytes memory _calldata); function getNewRate(bytes calldata _data, bytes calldata _initData) external pure returns (uint64 _newRatePerSec); }
{ "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 10000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"getConstants","outputs":[{"internalType":"bytes","name":"_calldata","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"bytes","name":"_initData","type":"bytes"}],"name":"getNewRate","outputs":[{"internalType":"uint64","name":"_newRatePerSec","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_initData","type":"bytes"}],"name":"requireValidInitData","outputs":[],"stateMutability":"pure","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506105df806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806306fdde03146100515780631b54c1a31461006f578063453f31d51461009b5780639a295e73146100af575b600080fd5b610059610114565b604051610066919061035e565b60405180910390f35b61008261007d3660046103c1565b610134565b60405167ffffffffffffffff9091168152602001610066565b6100ad6100a936600461042d565b5050565b005b60408051620124f8602082015262014c0881830152620186a0606082015263096ea886608082015264220d16a7bf60a0820152707ef4115c18c36b8df01919cc000000000060c0808301919091528251808303909101815260e0909101909152610059565b60606040518060600160405280602481526020016105af60249139905090565b60008080806101458789018961046f565b5091945092509050620124f8811015610211576000620124f861016883826104e6565b61017a90670de0b6b3a76400006104ff565b610184919061053c565b905060008361019383806104ff565b61019d91906104ff565b6101b890707ef4115c18c36b8df01919cc0000000000610577565b9050806101e0707ef4115c18c36b8df01919cc000000000067ffffffffffffffff88166104ff565b6101ea919061053c565b955063096ea88667ffffffffffffffff8716101561020a5763096ea88695505b50506102ef565b62014c088111156102eb57600061022e62014c08620186a061058a565b63ffffffff1661024162014c08846104e6565b61025390670de0b6b3a76400006104ff565b61025d919061053c565b905060008361026c83806104ff565b61027691906104ff565b61029190707ef4115c18c36b8df01919cc0000000000610577565b9050707ef4115c18c36b8df01919cc00000000006102b98267ffffffffffffffff88166104ff565b6102c3919061053c565b955064220d16a7bf67ffffffffffffffff8716111561020a5764220d16a7bf955050506102ef565b8293505b505050949350505050565b6000815180845260005b8181101561032057602081850181015186830182015201610304565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061037160208301846102fa565b9392505050565b60008083601f84011261038a57600080fd5b50813567ffffffffffffffff8111156103a257600080fd5b6020830191508360208285010111156103ba57600080fd5b9250929050565b600080600080604085870312156103d757600080fd5b843567ffffffffffffffff808211156103ef57600080fd5b6103fb88838901610378565b9096509450602087013591508082111561041457600080fd5b5061042187828801610378565b95989497509550505050565b6000806020838503121561044057600080fd5b823567ffffffffffffffff81111561045757600080fd5b61046385828601610378565b90969095509350505050565b6000806000806080858703121561048557600080fd5b843567ffffffffffffffff8116811461049d57600080fd5b966020860135965060408601359560600135945092505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156104f9576104f96104b7565b92915050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610537576105376104b7565b500290565b600082610572577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b808201808211156104f9576104f96104b7565b63ffffffff8281168282160390808211156105a7576105a76104b7565b509291505056fe5661726961626c652054696d652d576569676874656420496e7465726573742052617465a164736f6c6343000810000a
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806306fdde03146100515780631b54c1a31461006f578063453f31d51461009b5780639a295e73146100af575b600080fd5b610059610114565b604051610066919061035e565b60405180910390f35b61008261007d3660046103c1565b610134565b60405167ffffffffffffffff9091168152602001610066565b6100ad6100a936600461042d565b5050565b005b60408051620124f8602082015262014c0881830152620186a0606082015263096ea886608082015264220d16a7bf60a0820152707ef4115c18c36b8df01919cc000000000060c0808301919091528251808303909101815260e0909101909152610059565b60606040518060600160405280602481526020016105af60249139905090565b60008080806101458789018961046f565b5091945092509050620124f8811015610211576000620124f861016883826104e6565b61017a90670de0b6b3a76400006104ff565b610184919061053c565b905060008361019383806104ff565b61019d91906104ff565b6101b890707ef4115c18c36b8df01919cc0000000000610577565b9050806101e0707ef4115c18c36b8df01919cc000000000067ffffffffffffffff88166104ff565b6101ea919061053c565b955063096ea88667ffffffffffffffff8716101561020a5763096ea88695505b50506102ef565b62014c088111156102eb57600061022e62014c08620186a061058a565b63ffffffff1661024162014c08846104e6565b61025390670de0b6b3a76400006104ff565b61025d919061053c565b905060008361026c83806104ff565b61027691906104ff565b61029190707ef4115c18c36b8df01919cc0000000000610577565b9050707ef4115c18c36b8df01919cc00000000006102b98267ffffffffffffffff88166104ff565b6102c3919061053c565b955064220d16a7bf67ffffffffffffffff8716111561020a5764220d16a7bf955050506102ef565b8293505b505050949350505050565b6000815180845260005b8181101561032057602081850181015186830182015201610304565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061037160208301846102fa565b9392505050565b60008083601f84011261038a57600080fd5b50813567ffffffffffffffff8111156103a257600080fd5b6020830191508360208285010111156103ba57600080fd5b9250929050565b600080600080604085870312156103d757600080fd5b843567ffffffffffffffff808211156103ef57600080fd5b6103fb88838901610378565b9096509450602087013591508082111561041457600080fd5b5061042187828801610378565b95989497509550505050565b6000806020838503121561044057600080fd5b823567ffffffffffffffff81111561045757600080fd5b61046385828601610378565b90969095509350505050565b6000806000806080858703121561048557600080fd5b843567ffffffffffffffff8116811461049d57600080fd5b966020860135965060408601359560600135945092505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156104f9576104f96104b7565b92915050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610537576105376104b7565b500290565b600082610572577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b808201808211156104f9576104f96104b7565b63ffffffff8281168282160390808211156105a7576105a76104b7565b509291505056fe5661726961626c652054696d652d576569676874656420496e7465726573742052617465a164736f6c6343000810000a
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.