diff --git a/.env.example b/.env.example index 55516d8cf..346a2599f 100644 --- a/.env.example +++ b/.env.example @@ -20,7 +20,7 @@ DEPLOYER_PRIVATE_KEY= #ARCHIVE_NODE_zksyncmainnet=https://open-platform.nodereal.io//zksync #ARCHIVE_NODE_opsepolia=https://sepolia.optimism.io #ARCHIVE_NODE_opmainnet=https://opt-mainnet.nodereal.io/v1/ - +#ARCHIVE_NODE_basesepolia=https://sepolia.base.org ETHERSCAN_API_KEY= REPORT_GAS= \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 64f26d2d6..0eb0455ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,33 @@ +## [9.4.0-dev.3](https://github.com/VenusProtocol/venus-protocol/compare/v9.4.0-dev.2...v9.4.0-dev.3) (2024-11-22) + + +### Features + +* deployed VTreasury to basesepolia ([13aa8c1](https://github.com/VenusProtocol/venus-protocol/commit/13aa8c18e61d3302a8b79724be63433a979e8e1b)) +* updating deployment files ([567c94f](https://github.com/VenusProtocol/venus-protocol/commit/567c94f4073be589711a510a532e4f06aa377efd)) + + +### Bug Fixes + +* added to custom chains ([777909d](https://github.com/VenusProtocol/venus-protocol/commit/777909dfa6e4e22def057a7fc10e342a0e95e11b)) +* fixed url ([d663e71](https://github.com/VenusProtocol/venus-protocol/commit/d663e71814fa53729d1c62083bb357d0684ee25b)) +* fixed yarn lock ([aac7867](https://github.com/VenusProtocol/venus-protocol/commit/aac786782298a82635df49d2d63aa093ff3606d0)) +* updated ci ([3af2230](https://github.com/VenusProtocol/venus-protocol/commit/3af22304174e0e9386f2f7ecbb61765e9ce31428)) + +## [9.4.0-dev.2](https://github.com/VenusProtocol/venus-protocol/compare/v9.4.0-dev.1...v9.4.0-dev.2) (2024-11-14) + + +### Features + +* updating deployment files ([9f1a591](https://github.com/VenusProtocol/venus-protocol/commit/9f1a591387868f7d8ab7a393ddb54b573962f075)) + + +### Bug Fixes + +* deployed vETH IRM ([e11713c](https://github.com/VenusProtocol/venus-protocol/commit/e11713c94800a8f985fcf01cecf571494b937e06)) +* fixed yarn ([6779e55](https://github.com/VenusProtocol/venus-protocol/commit/6779e556baf1e5236397178cf8ac80baee51c4b2)) +* updated IRM params ([c95d8ac](https://github.com/VenusProtocol/venus-protocol/commit/c95d8ac946759da7eb74e6aef00e4adc4ed209ed)) + ## [9.4.0-dev.1](https://github.com/VenusProtocol/venus-protocol/compare/v9.3.0...v9.4.0-dev.1) (2024-10-23) diff --git a/deploy/002-interest-rate-model.ts b/deploy/002-interest-rate-model.ts index 9ba3cd626..0a22261f2 100644 --- a/deploy/002-interest-rate-model.ts +++ b/deploy/002-interest-rate-model.ts @@ -26,6 +26,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { }); } + if (network.name === "bscmainnet") { + await deploy("InterestRateModelVETH", { + contract: "JumpRateModel", + from: deployer, + log: true, + autoMine: true, + args: [0, parseUnits("0.03", 18), parseUnits("4.5", 18), parseUnits("0.9", 18)], + }); + } + if (network.name === "bscmainnet" || network.name === "bsctestnet") { await deploy("InterestRateModelVBNB", { contract: "TwoKinksInterestRateModel", diff --git a/deployments/bscmainnet.json b/deployments/bscmainnet.json index 86ea2218e..8c8bbcc3c 100644 --- a/deployments/bscmainnet.json +++ b/deployments/bscmainnet.json @@ -6788,6 +6788,257 @@ } ] }, + "InterestRateModelVETH": { + "address": "0x3aa125788FC6b9F801772baEa887aA40328015e9", + "abi": [ + { + "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" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "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" + }, + { + "constant": true, + "inputs": [], + "name": "baseRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "blocksPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "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" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "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" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isInterestRateModel", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "jumpMultiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kink", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "multiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "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" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ] + }, "JumpRateModel_base0bps_slope10000bps_jump25000bps_kink8000bps": { "address": "0x9e8fbACBfbD811Fc561af3Af7df8e38dEd4c52F3", "abi": [ diff --git a/deployments/bscmainnet/InterestRateModelVETH.json b/deployments/bscmainnet/InterestRateModelVETH.json new file mode 100644 index 000000000..45109e440 --- /dev/null +++ b/deployments/bscmainnet/InterestRateModelVETH.json @@ -0,0 +1,380 @@ +{ + "address": "0x3aa125788FC6b9F801772baEa887aA40328015e9", + "abi": [ + { + "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" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "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" + }, + { + "constant": true, + "inputs": [], + "name": "baseRatePerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "blocksPerYear", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "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" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "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" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isInterestRateModel", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "jumpMultiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kink", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "multiplierPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "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" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x0ca56813f619e1b74ea0c209a12424b37386cf8571cf20d7bd695400974d2a17", + "receipt": { + "to": null, + "from": "0x8BDA9f9E1fEF0DFd404Fef338D9fE4c543d172e1", + "contractAddress": "0x3aa125788FC6b9F801772baEa887aA40328015e9", + "transactionIndex": 69, + "gasUsed": "468688", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000800000000000000000080000000000000000000000000000000000002000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002", + "blockHash": "0x49341b9f5af03d4f133a957a9e95dbc8dab993ff4f97c64f04b8f3e118603bd9", + "transactionHash": "0x0ca56813f619e1b74ea0c209a12424b37386cf8571cf20d7bd695400974d2a17", + "logs": [ + { + "transactionIndex": 69, + "blockNumber": 43741773, + "transactionHash": "0x0ca56813f619e1b74ea0c209a12424b37386cf8571cf20d7bd695400974d2a17", + "address": "0x3aa125788FC6b9F801772baEa887aA40328015e9", + "topics": ["0x6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d"], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa1ac5be00000000000000000000000000000000000000000000000000000063abafdda40000000000000000000000000000000000000000000000000c7d713b49da0000", + "logIndex": 189, + "blockHash": "0x49341b9f5af03d4f133a957a9e95dbc8dab993ff4f97c64f04b8f3e118603bd9" + } + ], + "blockNumber": 43741773, + "cumulativeGasUsed": "7313876", + "status": 1, + "byzantium": true + }, + "args": [0, "30000000000000000", "4500000000000000000", "900000000000000000"], + "numDeployments": 1, + "solcInputHash": "a2594572bdae270af6749f50c8019b6c", + "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"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\"},{\"constant\":true,\"inputs\":[],\"name\":\"baseRatePerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"blocksPerYear\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"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\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"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\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isInterestRateModel\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"jumpMultiplierPerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"kink\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"multiplierPerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"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\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Venus\",\"methods\":{\"constructor\":{\"params\":{\"baseRatePerYear\":\"The approximate target base APR, as a mantissa (scaled by 1e18)\",\"jumpMultiplierPerYear\":\"The multiplierPerBlock after hitting a specified utilization point\",\"kink_\":\"The utilization point at which the jump multiplier is applied\",\"multiplierPerYear\":\"The rate of increase in interest rate wrt utilization (scaled by 1e18)\"}},\"getBorrowRate(uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserves\":\"The amount of reserves in the market\"},\"return\":\"The borrow rate percentage per block as a mantissa (scaled by 1e18)\"},\"getSupplyRate(uint256,uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserveFactorMantissa\":\"The current reserve factor for the market\",\"reserves\":\"The amount of reserves in the market\"},\"return\":\"The supply rate percentage per block as a mantissa (scaled by 1e18)\"},\"utilizationRate(uint256,uint256,uint256)\":{\"params\":{\"borrows\":\"The amount of borrows in the market\",\"cash\":\"The amount of cash in the market\",\"reserves\":\"The amount of reserves in the market (currently unused)\"},\"return\":\"The utilization rate as a mantissa between [0, 1e18]\"}},\"title\":\"Venus's JumpRateModel Contract\"},\"userdoc\":{\"methods\":{\"constructor\":\"Construct an interest rate model\",\"getBorrowRate(uint256,uint256,uint256)\":{\"notice\":\"Calculates the current borrow rate per block, with the error code expected by the market\"},\"getSupplyRate(uint256,uint256,uint256,uint256)\":{\"notice\":\"Calculates the current supply rate per block\"},\"utilizationRate(uint256,uint256,uint256)\":{\"notice\":\"Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\"}}}},\"settings\":{\"compilationTarget\":{\"contracts/InterestRateModels/JumpRateModel.sol\":\"JumpRateModel\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/InterestRateModels/InterestRateModel.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @title Venus's InterestRateModel Interface\\n * @author Venus\\n */\\ncontract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amnount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint cash,\\n uint borrows,\\n uint reserves,\\n uint reserveFactorMantissa\\n ) external view returns (uint);\\n}\\n\",\"keccak256\":\"0x7896290ed5d98f1b744676c0cf5cb0bc656befdd8a79ae4cd2d9f90d83aaa52d\"},\"contracts/InterestRateModels/JumpRateModel.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\nimport \\\"../Utils/SafeMath.sol\\\";\\nimport \\\"./InterestRateModel.sol\\\";\\n\\n/**\\n * @title Venus's JumpRateModel Contract\\n * @author Venus\\n */\\ncontract JumpRateModel is InterestRateModel {\\n using SafeMath for uint;\\n\\n event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);\\n\\n /**\\n * @notice The approximate number of blocks per year that is assumed by the interest rate model\\n */\\n uint public constant blocksPerYear = (60 * 60 * 24 * 365) / 3; // (assuming 3s blocks)\\n\\n /**\\n * @notice The multiplier of utilization rate that gives the slope of the interest rate\\n */\\n uint public multiplierPerBlock;\\n\\n /**\\n * @notice The base interest rate which is the y-intercept when utilization rate is 0\\n */\\n uint public baseRatePerBlock;\\n\\n /**\\n * @notice The multiplierPerBlock after hitting a specified utilization point\\n */\\n uint public jumpMultiplierPerBlock;\\n\\n /**\\n * @notice The utilization point at which the jump multiplier is applied\\n */\\n uint public kink;\\n\\n /**\\n * @notice Construct an interest rate model\\n * @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)\\n * @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)\\n * @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point\\n * @param kink_ The utilization point at which the jump multiplier is applied\\n */\\n constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) public {\\n baseRatePerBlock = baseRatePerYear.div(blocksPerYear);\\n multiplierPerBlock = multiplierPerYear.div(blocksPerYear);\\n jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);\\n kink = kink_;\\n\\n emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);\\n }\\n\\n /**\\n * @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market (currently unused)\\n * @return The utilization rate as a mantissa between [0, 1e18]\\n */\\n function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {\\n // Utilization rate is 0 when there are no borrows\\n if (borrows == 0) {\\n return 0;\\n }\\n\\n return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));\\n }\\n\\n /**\\n * @notice Calculates the current borrow rate per block, with the error code expected by the market\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market\\n * @return The borrow rate percentage per block as a mantissa (scaled by 1e18)\\n */\\n function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {\\n uint util = utilizationRate(cash, borrows, reserves);\\n\\n if (util <= kink) {\\n return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\\n } else {\\n uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);\\n uint excessUtil = util.sub(kink);\\n return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);\\n }\\n }\\n\\n /**\\n * @notice Calculates the current supply rate per block\\n * @param cash The amount of cash in the market\\n * @param borrows The amount of borrows in the market\\n * @param reserves The amount of reserves in the market\\n * @param reserveFactorMantissa The current reserve factor for the market\\n * @return The supply rate percentage per block as a mantissa (scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint cash,\\n uint borrows,\\n uint reserves,\\n uint reserveFactorMantissa\\n ) public view returns (uint) {\\n uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);\\n uint borrowRate = getBorrowRate(cash, borrows, reserves);\\n uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);\\n return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);\\n }\\n}\\n\",\"keccak256\":\"0x0c90d867067f823ca47664590f132385830ed66d2cfccdf242c028d0a85bd7c9\"},\"contracts/Utils/SafeMath.sol\":{\"content\":\"pragma solidity ^0.5.16;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return add(a, b, \\\"SafeMath: addition overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n * - Subtraction cannot overflow.\\n */\\n function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, errorMessage);\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return sub(a, b, \\\"SafeMath: subtraction overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n uint256 c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return div(a, b, \\\"SafeMath: division by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n // Solidity only automatically asserts when dividing by 0\\n require(b > 0, errorMessage);\\n uint256 c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return mod(a, b, \\\"SafeMath: modulo by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts with custom message when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b != 0, errorMessage);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0x9431fd772ed4abc038cdfe9ce6c0066897bd1685ad45848748d1952935d5b8ef\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516108113803806108118339818101604052608081101561003357600080fd5b508051602080830151604084015160609094015192939092909161006590859062a066809061039e6100fd821b17901c565b6001556100808362a066806100fd602090811b61039e17901c565b60005561009b8262a066806100fd602090811b61039e17901c565b60028190556003829055600154600054604080519283526020830191909152818101929092526060810183905290517f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9181900360800190a1505050506101ee565b600061014583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061014c60201b60201c565b9392505050565b600081836101d85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561019d578181015183820152602001610185565b50505050905090810190601f1680156101ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816101e457fe5b0495945050505050565b610614806101fd6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063a385fb9611610066578063a385fb9614610120578063b816881614610128578063b9f9850a14610157578063f14039de1461015f578063fd2da3391461016757610093565b806315f24053146100985780632191f92a146100d35780636e71e2d8146100ef5780638726bb8914610118575b600080fd5b6100c1600480360360608110156100ae57600080fd5b508035906020810135906040013561016f565b60408051918252519081900360200190f35b6100db610247565b604080519115158252519081900360200190f35b6100c16004803603606081101561010557600080fd5b508035906020810135906040013561024c565b6100c161029e565b6100c16102a4565b6100c16004803603608081101561013e57600080fd5b50803590602081013590604081013590606001356102ab565b6100c161032a565b6100c1610330565b6100c1610336565b60008061017d85858561024c565b905060035481116101cf576101c76001546101bb670de0b6b3a76400006101af6000548661033c90919063ffffffff16565b9063ffffffff61039e16565b9063ffffffff6103e016565b915050610240565b60006101fa6001546101bb670de0b6b3a76400006101af60005460035461033c90919063ffffffff16565b905060006102136003548461042290919063ffffffff16565b905061023a826101bb670de0b6b3a76400006101af6002548661033c90919063ffffffff16565b93505050505b9392505050565b600181565b60008261025b57506000610240565b61029661027e83610272878763ffffffff6103e016565b9063ffffffff61042216565b6101af85670de0b6b3a764000063ffffffff61033c16565b949350505050565b60005481565b62a0668081565b6000806102c6670de0b6b3a76400008463ffffffff61042216565b905060006102d587878761016f565b905060006102f5670de0b6b3a76400006101af848663ffffffff61033c16565b905061031e670de0b6b3a76400006101af836103128c8c8c61024c565b9063ffffffff61033c16565b98975050505050505050565b60025481565b60015481565b60035481565b60008261034b57506000610398565b8282028284828161035857fe5b04146103955760405162461bcd60e51b81526004018080602001828103825260218152602001806105bf6021913960400191505060405180910390fd5b90505b92915050565b600061039583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610464565b600061039583836040518060400160405280601b81526020017f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815250610506565b600061039583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610564565b600081836104f05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104b557818101518382015260200161049d565b50505050905090810190601f1680156104e25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816104fc57fe5b0495945050505050565b6000838301828582101561055b5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50949350505050565b600081848411156105b65760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158208d524531d4bd676b08c415f951c89512128d7ce72185b07b426ac97c6c3b50a564736f6c63430005100032", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063a385fb9611610066578063a385fb9614610120578063b816881614610128578063b9f9850a14610157578063f14039de1461015f578063fd2da3391461016757610093565b806315f24053146100985780632191f92a146100d35780636e71e2d8146100ef5780638726bb8914610118575b600080fd5b6100c1600480360360608110156100ae57600080fd5b508035906020810135906040013561016f565b60408051918252519081900360200190f35b6100db610247565b604080519115158252519081900360200190f35b6100c16004803603606081101561010557600080fd5b508035906020810135906040013561024c565b6100c161029e565b6100c16102a4565b6100c16004803603608081101561013e57600080fd5b50803590602081013590604081013590606001356102ab565b6100c161032a565b6100c1610330565b6100c1610336565b60008061017d85858561024c565b905060035481116101cf576101c76001546101bb670de0b6b3a76400006101af6000548661033c90919063ffffffff16565b9063ffffffff61039e16565b9063ffffffff6103e016565b915050610240565b60006101fa6001546101bb670de0b6b3a76400006101af60005460035461033c90919063ffffffff16565b905060006102136003548461042290919063ffffffff16565b905061023a826101bb670de0b6b3a76400006101af6002548661033c90919063ffffffff16565b93505050505b9392505050565b600181565b60008261025b57506000610240565b61029661027e83610272878763ffffffff6103e016565b9063ffffffff61042216565b6101af85670de0b6b3a764000063ffffffff61033c16565b949350505050565b60005481565b62a0668081565b6000806102c6670de0b6b3a76400008463ffffffff61042216565b905060006102d587878761016f565b905060006102f5670de0b6b3a76400006101af848663ffffffff61033c16565b905061031e670de0b6b3a76400006101af836103128c8c8c61024c565b9063ffffffff61033c16565b98975050505050505050565b60025481565b60015481565b60035481565b60008261034b57506000610398565b8282028284828161035857fe5b04146103955760405162461bcd60e51b81526004018080602001828103825260218152602001806105bf6021913960400191505060405180910390fd5b90505b92915050565b600061039583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610464565b600061039583836040518060400160405280601b81526020017f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815250610506565b600061039583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610564565b600081836104f05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104b557818101518382015260200161049d565b50505050905090810190601f1680156104e25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816104fc57fe5b0495945050505050565b6000838301828582101561055b5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50949350505050565b600081848411156105b65760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104b557818101518382015260200161049d565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158208d524531d4bd676b08c415f951c89512128d7ce72185b07b426ac97c6c3b50a564736f6c63430005100032", + "devdoc": { + "author": "Venus", + "methods": { + "constructor": { + "params": { + "baseRatePerYear": "The approximate target base APR, as a mantissa (scaled by 1e18)", + "jumpMultiplierPerYear": "The multiplierPerBlock after hitting a specified utilization point", + "kink_": "The utilization point at which the jump multiplier is applied", + "multiplierPerYear": "The rate of increase in interest rate wrt utilization (scaled by 1e18)" + } + }, + "getBorrowRate(uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserves": "The amount of reserves in the market" + }, + "return": "The borrow rate percentage per block as a mantissa (scaled by 1e18)" + }, + "getSupplyRate(uint256,uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserveFactorMantissa": "The current reserve factor for the market", + "reserves": "The amount of reserves in the market" + }, + "return": "The supply rate percentage per block as a mantissa (scaled by 1e18)" + }, + "utilizationRate(uint256,uint256,uint256)": { + "params": { + "borrows": "The amount of borrows in the market", + "cash": "The amount of cash in the market", + "reserves": "The amount of reserves in the market (currently unused)" + }, + "return": "The utilization rate as a mantissa between [0, 1e18]" + } + }, + "title": "Venus's JumpRateModel Contract" + }, + "userdoc": { + "methods": { + "constructor": "Construct an interest rate model", + "getBorrowRate(uint256,uint256,uint256)": { + "notice": "Calculates the current borrow rate per block, with the error code expected by the market" + }, + "getSupplyRate(uint256,uint256,uint256,uint256)": { + "notice": "Calculates the current supply rate per block" + }, + "utilizationRate(uint256,uint256,uint256)": { + "notice": "Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`" + } + } + }, + "storageLayout": { + "storage": [ + { + "astId": 9329, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "multiplierPerBlock", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 9331, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "baseRatePerBlock", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 9333, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "jumpMultiplierPerBlock", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 9335, + "contract": "contracts/InterestRateModels/JumpRateModel.sol:JumpRateModel", + "label": "kink", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "types": { + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/deployments/bscmainnet_addresses.json b/deployments/bscmainnet_addresses.json index ca6184735..ac1faa714 100644 --- a/deployments/bscmainnet_addresses.json +++ b/deployments/bscmainnet_addresses.json @@ -17,6 +17,7 @@ "ETH": "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", "FIL": "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", "InterestRateModelVBNB": "0xC682145a767ca98B743B895f1Bd2D4696bC9C2eC", + "InterestRateModelVETH": "0x3aa125788FC6b9F801772baEa887aA40328015e9", "JumpRateModel_base0bps_slope10000bps_jump25000bps_kink8000bps": "0x9e8fbACBfbD811Fc561af3Af7df8e38dEd4c52F3", "JumpRateModel_base0bps_slope10000bps_jump50000bps_kink8000bps": "0x958F4C84d3ad523Fa9936Dc465A123C7AD43D69B", "JumpRateModel_base0bps_slope1000bps_jump25000bps_kink8000bps": "0x62A8919C4C413fd4F9aef7348540Bc4B1b5CC805", diff --git a/hardhat.config.ts b/hardhat.config.ts index 0e35c4715..b62d48433 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -226,6 +226,7 @@ const config: HardhatUserConfig = { arbitrumone: process.env.ETHERSCAN_API_KEY || "ETHERSCAN_API_KEY", opsepolia: process.env.ETHERSCAN_API_KEY || "ETHERSCAN_API_KEY", opmainnet: process.env.ETHERSCAN_API_KEY || "ETHERSCAN_API_KEY", + basesepolia: process.env.ETHERSCAN_API_KEY || "ETHERSCAN_API_KEY", }, customChains: [ { diff --git a/package.json b/package.json index 958f61b1d..ae8337b50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@venusprotocol/venus-protocol", - "version": "9.4.0-dev.1", + "version": "9.4.0-dev.3", "description": "The Venus Money Market", "repository": "git@github.com:VenusProtocol/venus-protocol.git", "author": "Venus",