Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VEN-2843] Upgrade implementation of vToken contracts #444

Merged
merged 15 commits into from
Oct 2, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 70 additions & 5 deletions deployments/ethereum.json
Original file line number Diff line number Diff line change
@@ -26166,10 +26166,26 @@
]
},
"VTokenImpl": {
"address": "0xE5A008B6A0bAB405343B3ABe8895966EAaFb5790",
"address": "0xefdf5CcC12d8cff4a7ed4e421b95F8f69Cf2F766",
"abi": [
{
"inputs": [],
"inputs": [
{
"internalType": "bool",
"name": "timeBased_",
"type": "bool"
},
{
"internalType": "uint256",
"name": "blocksPerYear_",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "maxBorrowRateMantissa_",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
@@ -26209,6 +26225,16 @@
"name": "HealBorrowUnauthorized",
"type": "error"
},
{
"inputs": [],
"name": "InvalidBlocksPerYear",
"type": "error"
},
{
"inputs": [],
"name": "InvalidTimeBasedConfiguration",
"type": "error"
},
{
"inputs": [
{
@@ -26680,13 +26706,13 @@
{
"indexed": false,
"internalType": "uint256",
"name": "oldReduceReservesBlockDelta",
"name": "oldReduceReservesBlockOrTimestampDelta",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "newReduceReservesBlockDelta",
"name": "newReduceReservesBlockOrTimestampDelta",
"type": "uint256"
}
],
@@ -27134,6 +27160,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "blocksOrSecondsPerYear",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@@ -27384,6 +27423,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getBlockNumberOrTimestamp",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getCash",
@@ -27532,6 +27584,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isTimeBased",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isVToken",
@@ -27949,7 +28014,7 @@
"inputs": [
{
"internalType": "uint256",
"name": "_newReduceReservesBlockDelta",
"name": "_newReduceReservesBlockOrTimestampDelta",
"type": "uint256"
}
],
2 changes: 1 addition & 1 deletion deployments/ethereum_addresses.json
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@
"RewardsDistributor_Liquid Staked ETH_3": "0x1e25CF968f12850003Db17E0Dba32108509C4359",
"RewardsDistributor_Liquid Staked ETH_3_Proxy": "0x1e25CF968f12850003Db17E0Dba32108509C4359",
"VTokenBeacon": "0xfc08aADC7a1A93857f6296C3fb78aBA1d286533a",
"VTokenImpl": "0xE5A008B6A0bAB405343B3ABe8895966EAaFb5790",
"VTokenImpl": "0xefdf5CcC12d8cff4a7ed4e421b95F8f69Cf2F766",
"VToken_vCRV_Curve": "0x30aD10Bd5Be62CAb37863C2BfcC6E8fb4fD85BDa",
"VToken_vDAI_Core": "0xd8AdD9B41D4E1cd64Edad8722AB0bA8D35536657",
"VToken_vFRAX_Core": "0x4fAfbDc4F2a9876Bd1764827b26fb8dc4FD1dB95",

Unchanged files with check annotations Beta

{
// PoolRegistry, immutable to save on gas
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address public immutable poolRegistry;

Check warning on line 50 in contracts/Comptroller.sol

GitHub Actions / Lint

Immutable variables name are set to be in capitalized SNAKE_CASE
/// @notice Emitted when an account enters a market
event MarketEntered(VToken indexed vToken, address indexed account);
* @param redeemAmount The amount of the underlying asset being redeemed
* @param redeemTokens The number of tokens being redeemed
*/
function redeemVerify(address vToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external {

Check warning on line 503 in contracts/Comptroller.sol

GitHub Actions / Lint

Variable "redeemAmount" is unused

Check warning on line 503 in contracts/Comptroller.sol

GitHub Actions / Lint

Variable "redeemTokens" is unused
if (address(prime) != address(0)) {
prime.accrueInterestAndUpdateScore(redeemer, vToken);
}
for (uint256 i; i < marketsCount; ++i) {
(, uint256 borrowBalance, ) = _safeGetAccountSnapshot(borrowMarkets[i], borrower);
require(borrowBalance == 0, "Nonzero borrow balance after liquidation");

Check warning on line 986 in contracts/Comptroller.sol

GitHub Actions / Lint

Use Custom Errors instead of require statements
}
}
*/
function setCloseFactor(uint256 newCloseFactorMantissa) external {
_checkAccessAllowed("setCloseFactor(uint256)");
require(MAX_CLOSE_FACTOR_MANTISSA >= newCloseFactorMantissa, "Close factor greater than maximum close factor");

Check warning on line 998 in contracts/Comptroller.sol

GitHub Actions / Lint

Use Custom Errors instead of require statements
require(MIN_CLOSE_FACTOR_MANTISSA <= newCloseFactorMantissa, "Close factor smaller than minimum close factor");

Check warning on line 999 in contracts/Comptroller.sol

GitHub Actions / Lint

Use Custom Errors instead of require statements
uint256 oldCloseFactorMantissa = closeFactorMantissa;
closeFactorMantissa = newCloseFactorMantissa;
* @custom:access Controlled by AccessControlManager
*/
function setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external {
require(newLiquidationIncentiveMantissa >= MANTISSA_ONE, "liquidation incentive should be greater than 1e18");

Check warning on line 1074 in contracts/Comptroller.sol

GitHub Actions / Lint

Use Custom Errors instead of require statements
_checkAccessAllowed("setLiquidationIncentive(uint256)");
revert MarketAlreadyListed(address(vToken));
}
require(vToken.isVToken(), "Comptroller: Invalid vToken"); // Sanity check to make sure its really a VToken

Check warning on line 1102 in contracts/Comptroller.sol

GitHub Actions / Lint

Use Custom Errors instead of require statements
Market storage newMarket = markets[address(vToken)];
newMarket.isListed = true;
uint256 numMarkets = vTokens.length;
uint256 numBorrowCaps = newBorrowCaps.length;
require(numMarkets != 0 && numMarkets == numBorrowCaps, "invalid input");

Check warning on line 1136 in contracts/Comptroller.sol

GitHub Actions / Lint

Use Custom Errors instead of require statements
_ensureMaxLoops(numMarkets);
_checkAccessAllowed("setMarketSupplyCaps(address[],uint256[])");
uint256 vTokensCount = vTokens.length;
require(vTokensCount != 0, "invalid number of markets");

Check warning on line 1160 in contracts/Comptroller.sol

GitHub Actions / Lint

Use Custom Errors instead of require statements
require(vTokensCount == newSupplyCaps.length, "invalid number of markets");
_ensureMaxLoops(vTokensCount);