From 3e5c71778c5dd49d0b27cd45a11375d5f2926bdd Mon Sep 17 00:00:00 2001 From: 0xLucian <0xluciandev@gmail.com> Date: Wed, 11 Oct 2023 11:59:13 +0300 Subject: [PATCH] fix: lint and preconfiguredAddress decaration of Vtreasury wrong reference --- contracts/Comptroller.sol | 99 +++++++++++--- contracts/ComptrollerInterface.sol | 25 +++- contracts/ExponentialNoError.sol | 6 +- contracts/Lens/PoolLens.sol | 50 ++++--- contracts/Pool/PoolRegistry.sol | 6 +- contracts/Rewards/RewardsDistributor.sol | 12 +- contracts/RiskFund/ProtocolShareReserve.sol | 14 +- contracts/RiskFund/RiskFund.sol | 10 +- contracts/Shortfall/Shortfall.sol | 6 +- contracts/VToken.sol | 63 +++++++-- contracts/VTokenInterfaces.sol | 29 +++- contracts/lib/ApproveOrRevert.sol | 6 +- contracts/lib/TokenDebtTracker.sol | 18 ++- contracts/test/ERC20.sol | 44 +++++- contracts/test/EvilToken.sol | 6 +- contracts/test/FaucetToken.sol | 12 +- contracts/test/FeeToken.sol | 6 +- contracts/test/MockDeflationaryToken.sol | 18 ++- contracts/test/Mocks/MockPancakeSwap.sol | 128 ++++++++++++++---- contracts/test/Mocks/MockToken.sol | 6 +- contracts/test/SafeMath.sol | 30 +++- contracts/test/VTokenHarness.sol | 24 +++- contracts/test/lib/ApproveOrRevertHarness.sol | 6 +- .../test/lib/TokenDebtTrackerHarness.sol | 12 +- deploy/014-riskfund-protocolshare.ts | 2 +- helpers/deploymentConfig.ts | 8 +- 26 files changed, 508 insertions(+), 138 deletions(-) diff --git a/contracts/Comptroller.sol b/contracts/Comptroller.sol index eb473cded..9d2de5830 100644 --- a/contracts/Comptroller.sol +++ b/contracts/Comptroller.sol @@ -269,7 +269,11 @@ contract Comptroller is * @custom:error SupplyCapExceeded error is thrown if the total supply exceeds the cap after minting * @custom:access Not restricted */ - function preMintHook(address vToken, address minter, uint256 mintAmount) external override { + function preMintHook( + address vToken, + address minter, + uint256 mintAmount + ) external override { _checkActionPauseState(vToken, Action.MINT); if (!markets[vToken].isListed) { @@ -309,7 +313,11 @@ contract Comptroller is * @custom:error PriceError is thrown if the oracle returns an incorrect price for some asset * @custom:access Not restricted */ - function preRedeemHook(address vToken, address redeemer, uint256 redeemTokens) external override { + function preRedeemHook( + address vToken, + address redeemer, + uint256 redeemTokens + ) external override { _checkActionPauseState(vToken, Action.REDEEM); _checkRedeemAllowed(vToken, redeemer, redeemTokens); @@ -338,7 +346,11 @@ contract Comptroller is * @custom:access Not restricted if vToken is enabled as collateral, otherwise only vToken */ /// disable-eslint - function preBorrowHook(address vToken, address borrower, uint256 borrowAmount) external override { + function preBorrowHook( + address vToken, + address borrower, + uint256 borrowAmount + ) external override { _checkActionPauseState(vToken, Action.BORROW); if (!markets[vToken].isListed) { @@ -562,7 +574,12 @@ contract Comptroller is * @custom:error PriceError is thrown if the oracle returns an incorrect price for some asset * @custom:access Not restricted */ - function preTransferHook(address vToken, address src, address dst, uint256 transferTokens) external override { + function preTransferHook( + address vToken, + address src, + address dst, + uint256 transferTokens + ) external override { _checkActionPauseState(vToken, Action.TRANSFER); // Currently the only consideration is whether or not @@ -903,7 +920,11 @@ contract Comptroller is * @param paused The new paused state (true=paused, false=unpaused) * @custom:access Controlled by AccessControlManager */ - function setActionsPaused(VToken[] calldata marketsList, Action[] calldata actionsList, bool paused) external { + function setActionsPaused( + VToken[] calldata marketsList, + Action[] calldata actionsList, + bool paused + ) external { _checkAccessAllowed("setActionsPaused(address[],uint256[],bool)"); uint256 marketsCount = marketsList.length; @@ -991,9 +1012,15 @@ contract Comptroller is * @return liquidity Account liquidity in excess of liquidation threshold requirements, * @return shortfall Account shortfall below liquidation threshold requirements */ - function getAccountLiquidity( - address account - ) external view returns (uint256 error, uint256 liquidity, uint256 shortfall) { + function getAccountLiquidity(address account) + external + view + returns ( + uint256 error, + uint256 liquidity, + uint256 shortfall + ) + { AccountLiquiditySnapshot memory snapshot = _getCurrentLiquiditySnapshot(account, _getLiquidationThreshold); return (NO_ERROR, snapshot.liquidity, snapshot.shortfall); } @@ -1006,9 +1033,15 @@ contract Comptroller is * @return liquidity Account liquidity in excess of collateral requirements, * @return shortfall Account shortfall below collateral requirements */ - function getBorrowingPower( - address account - ) external view returns (uint256 error, uint256 liquidity, uint256 shortfall) { + function getBorrowingPower(address account) + external + view + returns ( + uint256 error, + uint256 liquidity, + uint256 shortfall + ) + { AccountLiquiditySnapshot memory snapshot = _getCurrentLiquiditySnapshot(account, _getCollateralFactor); return (NO_ERROR, snapshot.liquidity, snapshot.shortfall); } @@ -1029,7 +1062,15 @@ contract Comptroller is address vTokenModify, uint256 redeemTokens, uint256 borrowAmount - ) external view returns (uint256 error, uint256 liquidity, uint256 shortfall) { + ) + external + view + returns ( + uint256 error, + uint256 liquidity, + uint256 shortfall + ) + { AccountLiquiditySnapshot memory snapshot = _getHypotheticalLiquiditySnapshot( account, VToken(vTokenModify), @@ -1248,7 +1289,11 @@ contract Comptroller is * @param action Action id to pause/unpause * @param paused The new paused state (true=paused, false=unpaused) */ - function _setActionPaused(address market, Action action, bool paused) internal { + function _setActionPaused( + address market, + Action action, + bool paused + ) internal { require(markets[market].isListed, "cannot pause a market that is not listed"); _actionPaused[market][action] = paused; emit ActionPausedMarket(VToken(market), action, paused); @@ -1260,7 +1305,11 @@ contract Comptroller is * @param redeemer Account redeeming the tokens * @param redeemTokens The number of tokens to redeem */ - function _checkRedeemAllowed(address vToken, address redeemer, uint256 redeemTokens) internal { + function _checkRedeemAllowed( + address vToken, + address redeemer, + uint256 redeemTokens + ) internal { Market storage market = markets[vToken]; if (!market.isListed) { @@ -1297,10 +1346,11 @@ contract Comptroller is * without calculating accumulated interest. * @return snapshot Account liquidity snapshot */ - function _getCurrentLiquiditySnapshot( - address account, - function(VToken) internal view returns (Exp memory) weight - ) internal view returns (AccountLiquiditySnapshot memory snapshot) { + function _getCurrentLiquiditySnapshot(address account, function(VToken) internal view returns (Exp memory) weight) + internal + view + returns (AccountLiquiditySnapshot memory snapshot) + { return _getHypotheticalLiquiditySnapshot(account, VToken(address(0)), 0, 0, weight); } @@ -1422,10 +1472,15 @@ contract Comptroller is * @return borrowBalance Borrowed amount, including the interest * @return exchangeRateMantissa Stored exchange rate */ - function _safeGetAccountSnapshot( - VToken vToken, - address user - ) internal view returns (uint256 vTokenBalance, uint256 borrowBalance, uint256 exchangeRateMantissa) { + function _safeGetAccountSnapshot(VToken vToken, address user) + internal + view + returns ( + uint256 vTokenBalance, + uint256 borrowBalance, + uint256 exchangeRateMantissa + ) + { uint256 err; (err, vTokenBalance, borrowBalance, exchangeRateMantissa) = vToken.getAccountSnapshot(user); if (err != 0) { diff --git a/contracts/ComptrollerInterface.sol b/contracts/ComptrollerInterface.sol index d1879f90a..ce00ae3c5 100644 --- a/contracts/ComptrollerInterface.sol +++ b/contracts/ComptrollerInterface.sol @@ -20,11 +20,23 @@ interface ComptrollerInterface { /*** Policy Hooks ***/ - function preMintHook(address vToken, address minter, uint256 mintAmount) external; + function preMintHook( + address vToken, + address minter, + uint256 mintAmount + ) external; - function preRedeemHook(address vToken, address redeemer, uint256 redeemTokens) external; + function preRedeemHook( + address vToken, + address redeemer, + uint256 redeemTokens + ) external; - function preBorrowHook(address vToken, address borrower, uint256 borrowAmount) external; + function preBorrowHook( + address vToken, + address borrower, + uint256 borrowAmount + ) external; function preRepayHook(address vToken, address borrower) external; @@ -43,7 +55,12 @@ interface ComptrollerInterface { address borrower ) external; - function preTransferHook(address vToken, address src, address dst, uint256 transferTokens) external; + function preTransferHook( + address vToken, + address src, + address dst, + uint256 transferTokens + ) external; function isComptroller() external view returns (bool); diff --git a/contracts/ExponentialNoError.sol b/contracts/ExponentialNoError.sol index ed39c6a48..a4c5e6b9d 100644 --- a/contracts/ExponentialNoError.sol +++ b/contracts/ExponentialNoError.sol @@ -46,7 +46,11 @@ contract ExponentialNoError { * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer. */ // solhint-disable-next-line func-name-mixedcase - function mul_ScalarTruncateAddUInt(Exp memory a, uint256 scalar, uint256 addend) internal pure returns (uint256) { + function mul_ScalarTruncateAddUInt( + Exp memory a, + uint256 scalar, + uint256 addend + ) internal pure returns (uint256) { Exp memory product = mul_(a, scalar); return add_(truncate(product), addend); } diff --git a/contracts/Lens/PoolLens.sol b/contracts/Lens/PoolLens.sol index de29c8b31..54124238f 100644 --- a/contracts/Lens/PoolLens.sol +++ b/contracts/Lens/PoolLens.sol @@ -177,10 +177,11 @@ contract PoolLens is ExponentialNoError { * @param comptroller The Comptroller implementation address * @return PoolData structure containing the details of the pool */ - function getPoolByComptroller( - address poolRegistryAddress, - address comptroller - ) external view returns (PoolData memory) { + function getPoolByComptroller(address poolRegistryAddress, address comptroller) + external + view + returns (PoolData memory) + { PoolRegistryInterface poolRegistryInterface = PoolRegistryInterface(poolRegistryAddress); return getPoolDataFromVenusPool(poolRegistryAddress, poolRegistryInterface.getPoolByComptroller(comptroller)); } @@ -207,10 +208,11 @@ contract PoolLens is ExponentialNoError { * @param asset The underlying asset of vToken * @return A list of Comptroller contracts */ - function getPoolsSupportedByAsset( - address poolRegistryAddress, - address asset - ) external view returns (address[] memory) { + function getPoolsSupportedByAsset(address poolRegistryAddress, address asset) + external + view + returns (address[] memory) + { PoolRegistryInterface poolRegistryInterface = PoolRegistryInterface(poolRegistryAddress); return poolRegistryInterface.getPoolsSupportedByAsset(asset); } @@ -220,9 +222,11 @@ contract PoolLens is ExponentialNoError { * @param vTokens The list of vToken addresses * @return An array containing the price data for each asset */ - function vTokenUnderlyingPriceAll( - VToken[] calldata vTokens - ) external view returns (VTokenUnderlyingPrice[] memory) { + function vTokenUnderlyingPriceAll(VToken[] calldata vTokens) + external + view + returns (VTokenUnderlyingPrice[] memory) + { uint256 vTokenCount = vTokens.length; VTokenUnderlyingPrice[] memory res = new VTokenUnderlyingPrice[](vTokenCount); for (uint256 i; i < vTokenCount; ++i) { @@ -237,13 +241,14 @@ contract PoolLens is ExponentialNoError { * @param comptrollerAddress address * @return Pending rewards array */ - function getPendingRewards( - address account, - address comptrollerAddress - ) external view returns (RewardSummary[] memory) { + function getPendingRewards(address account, address comptrollerAddress) + external + view + returns (RewardSummary[] memory) + { VToken[] memory markets = ComptrollerInterface(comptrollerAddress).getAllMarkets(); RewardsDistributor[] memory rewardsDistributors = ComptrollerViewInterface(comptrollerAddress) - .getRewardDistributors(); + .getRewardDistributors(); RewardSummary[] memory rewardSummary = new RewardSummary[](rewardsDistributors.length); for (uint256 i; i < rewardsDistributors.length; ++i) { RewardSummary memory reward; @@ -328,10 +333,11 @@ contract PoolLens is ExponentialNoError { * @param venusPool The VenusPool Object from PoolRegistry * @return Enriched PoolData */ - function getPoolDataFromVenusPool( - address poolRegistryAddress, - PoolRegistry.VenusPool memory venusPool - ) public view returns (PoolData memory) { + function getPoolDataFromVenusPool(address poolRegistryAddress, PoolRegistry.VenusPool memory venusPool) + public + view + returns (PoolData memory) + { // Get tokens in the Pool ComptrollerInterface comptrollerInstance = ComptrollerInterface(venusPool.comptroller); @@ -441,10 +447,10 @@ contract PoolLens is ExponentialNoError { // Market borrow and supply state we will modify update in-memory, in order to not modify storage RewardTokenState memory borrowState; (borrowState.index, borrowState.block, borrowState.lastRewardingBlock) = rewardsDistributor - .rewardTokenBorrowState(address(markets[i])); + .rewardTokenBorrowState(address(markets[i])); RewardTokenState memory supplyState; (supplyState.index, supplyState.block, supplyState.lastRewardingBlock) = rewardsDistributor - .rewardTokenSupplyState(address(markets[i])); + .rewardTokenSupplyState(address(markets[i])); Exp memory marketBorrowIndex = Exp({ mantissa: markets[i].borrowIndex() }); // Update market supply and borrow index in-memory diff --git a/contracts/Pool/PoolRegistry.sol b/contracts/Pool/PoolRegistry.sol index 4a5b0e16e..3b33ade1f 100644 --- a/contracts/Pool/PoolRegistry.sol +++ b/contracts/Pool/PoolRegistry.sol @@ -292,7 +292,11 @@ contract PoolRegistry is Ownable2StepUpgradeable, AccessControlledV8, PoolRegist return numberOfPools_; } - function _transferIn(IERC20Upgradeable token, address from, uint256 amount) internal returns (uint256) { + function _transferIn( + IERC20Upgradeable token, + address from, + uint256 amount + ) internal returns (uint256) { uint256 balanceBefore = token.balanceOf(address(this)); token.safeTransferFrom(from, address(this), amount); uint256 balanceAfter = token.balanceOf(address(this)); diff --git a/contracts/Rewards/RewardsDistributor.sol b/contracts/Rewards/RewardsDistributor.sol index 667dc5328..c19a3fe4e 100644 --- a/contracts/Rewards/RewardsDistributor.sol +++ b/contracts/Rewards/RewardsDistributor.sol @@ -396,7 +396,11 @@ contract RewardsDistributor is ExponentialNoError, Ownable2StepUpgradeable, Acce * @param supplySpeed New supply-side REWARD TOKEN speed for market * @param borrowSpeed New borrow-side REWARD TOKEN speed for market */ - function _setRewardTokenSpeed(VToken vToken, uint256 supplySpeed, uint256 borrowSpeed) internal { + function _setRewardTokenSpeed( + VToken vToken, + uint256 supplySpeed, + uint256 borrowSpeed + ) internal { require(comptroller.isMarketListed(vToken), "rewardToken market is not listed"); if (rewardTokenSupplySpeeds[address(vToken)] != supplySpeed) { @@ -463,7 +467,11 @@ contract RewardsDistributor is ExponentialNoError, Ownable2StepUpgradeable, Acce * @param borrower The address of the borrower to distribute REWARD TOKEN to * @param marketBorrowIndex The current global borrow index of vToken */ - function _distributeBorrowerRewardToken(address vToken, address borrower, Exp memory marketBorrowIndex) internal { + function _distributeBorrowerRewardToken( + address vToken, + address borrower, + Exp memory marketBorrowIndex + ) internal { RewardToken storage borrowState = rewardTokenBorrowState[vToken]; uint256 borrowIndex = borrowState.index; uint256 borrowerIndex = rewardTokenBorrowerIndex[vToken][borrower]; diff --git a/contracts/RiskFund/ProtocolShareReserve.sol b/contracts/RiskFund/ProtocolShareReserve.sol index bc4733c99..0b08b1d4d 100644 --- a/contracts/RiskFund/ProtocolShareReserve.sol +++ b/contracts/RiskFund/ProtocolShareReserve.sol @@ -69,7 +69,11 @@ contract ProtocolShareReserve is ExponentialNoError, ReserveHelpers, IProtocolSh * @return Number of total released tokens * @custom:error ZeroAddressNotAllowed is thrown when asset address is zero */ - function releaseFunds(address comptroller, address asset, uint256 amount) external nonReentrant returns (uint256) { + function releaseFunds( + address comptroller, + address asset, + uint256 amount + ) external nonReentrant returns (uint256) { ensureNonzeroAddress(asset); require(amount <= _poolsAssetsReserves[comptroller][asset], "ProtocolShareReserve: Insufficient pool balance"); @@ -98,10 +102,10 @@ contract ProtocolShareReserve is ExponentialNoError, ReserveHelpers, IProtocolSh * @param comptroller Comptroller address(pool) * @param asset Asset address. */ - function updateAssetsState( - address comptroller, - address asset - ) public override(IProtocolShareReserve, ReserveHelpers) { + function updateAssetsState(address comptroller, address asset) + public + override(IProtocolShareReserve, ReserveHelpers) + { super.updateAssetsState(comptroller, asset); } } diff --git a/contracts/RiskFund/RiskFund.sol b/contracts/RiskFund/RiskFund.sol index 3c9bf21dd..aebf91bea 100644 --- a/contracts/RiskFund/RiskFund.sol +++ b/contracts/RiskFund/RiskFund.sol @@ -207,10 +207,12 @@ contract RiskFund is AccessControlledV8, ExponentialNoError, ReserveHelpers, Max * @param amount Amount to be transferred to auction contract. * @return Number reserved tokens. */ - function transferReserveForAuction( - address comptroller, - uint256 amount - ) external override nonReentrant returns (uint256) { + function transferReserveForAuction(address comptroller, uint256 amount) + external + override + nonReentrant + returns (uint256) + { address shortfall_ = shortfall; require(msg.sender == shortfall_, "Risk fund: Only callable by Shortfall contract"); require( diff --git a/contracts/Shortfall/Shortfall.sol b/contracts/Shortfall/Shortfall.sol index 79e61d5e1..6a609c08a 100644 --- a/contracts/Shortfall/Shortfall.sol +++ b/contracts/Shortfall/Shortfall.sol @@ -181,7 +181,11 @@ contract Shortfall is Ownable2StepUpgradeable, AccessControlledV8, ReentrancyGua * @param auctionStartBlock The block number when auction started * @custom:event Emits BidPlaced event on success */ - function placeBid(address comptroller, uint256 bidBps, uint256 auctionStartBlock) external nonReentrant { + function placeBid( + address comptroller, + uint256 bidBps, + uint256 auctionStartBlock + ) external nonReentrant { Auction storage auction = auctions[comptroller]; require(auction.startBlock == auctionStartBlock, "auction has been restarted"); diff --git a/contracts/VToken.sol b/contracts/VToken.sol index 527f9e5fd..8d56450fe 100644 --- a/contracts/VToken.sol +++ b/contracts/VToken.sol @@ -142,7 +142,11 @@ contract VToken is * @custom:error TransferNotAllowed is thrown if trying to transfer to self * @custom:access Not restricted */ - function transferFrom(address src, address dst, uint256 amount) external override nonReentrant returns (bool) { + function transferFrom( + address src, + address dst, + uint256 amount + ) external override nonReentrant returns (bool) { _transferTokens(msg.sender, src, dst, amount); return true; } @@ -464,7 +468,11 @@ contract VToken is * @custom:error HealBorrowUnauthorized is thrown when the request does not come from Comptroller * @custom:access Only Comptroller */ - function healBorrow(address payer, address borrower, uint256 repayAmount) external override nonReentrant { + function healBorrow( + address payer, + address borrower, + uint256 repayAmount + ) external override nonReentrant { if (repayAmount != 0) { comptroller.preRepayHook(address(this), borrower); } @@ -553,7 +561,11 @@ contract VToken is * @custom:error LiquidateSeizeLiquidatorIsBorrower is thrown when trying to liquidate self * @custom:access Not restricted */ - function seize(address liquidator, address borrower, uint256 seizeTokens) external override nonReentrant { + function seize( + address liquidator, + address borrower, + uint256 seizeTokens + ) external override nonReentrant { _seize(msg.sender, liquidator, borrower, seizeTokens); } @@ -637,13 +649,16 @@ contract VToken is * @return borrowBalance Amount owed in terms of underlying * @return exchangeRate Stored exchange rate */ - function getAccountSnapshot( - address account - ) + function getAccountSnapshot(address account) external view override - returns (uint256 error, uint256 vTokenBalance, uint256 borrowBalance, uint256 exchangeRate) + returns ( + uint256 error, + uint256 vTokenBalance, + uint256 borrowBalance, + uint256 exchangeRate + ) { return (NO_ERROR, accountTokens[account], _borrowBalanceStored(account), _exchangeRateStored()); } @@ -779,7 +794,11 @@ contract VToken is * @param minter The address of the account which is supplying the assets * @param mintAmount The amount of the underlying asset to supply */ - function _mintFresh(address payer, address minter, uint256 mintAmount) internal { + function _mintFresh( + address payer, + address minter, + uint256 mintAmount + ) internal { /* Fail if mint not allowed */ comptroller.preMintHook(address(this), minter, mintAmount); @@ -832,7 +851,11 @@ contract VToken is * @param redeemTokensIn The number of vTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) * @param redeemAmountIn The number of underlying tokens to receive from redeeming vTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero) */ - function _redeemFresh(address redeemer, uint256 redeemTokensIn, uint256 redeemAmountIn) internal { + function _redeemFresh( + address redeemer, + uint256 redeemTokensIn, + uint256 redeemAmountIn + ) internal { require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero"); /* Verify market's block number equals current block number */ @@ -962,7 +985,11 @@ contract VToken is * @param repayAmount the amount of underlying tokens being returned, or type(uint256).max for the full outstanding amount * @return (uint) the actual repayment amount. */ - function _repayBorrowFresh(address payer, address borrower, uint256 repayAmount) internal returns (uint256) { + function _repayBorrowFresh( + address payer, + address borrower, + uint256 repayAmount + ) internal returns (uint256) { /* Fail if repayBorrow not allowed */ comptroller.preRepayHook(address(this), borrower); @@ -1125,7 +1152,12 @@ contract VToken is * @param borrower The account having collateral seized * @param seizeTokens The number of vTokens to seize */ - function _seize(address seizerContract, address liquidator, address borrower, uint256 seizeTokens) internal { + function _seize( + address seizerContract, + address liquidator, + address borrower, + uint256 seizeTokens + ) internal { /* Fail if seize not allowed */ comptroller.preSeizeHook(address(this), seizerContract, liquidator, borrower); @@ -1140,7 +1172,7 @@ contract VToken is * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens */ uint256 liquidationIncentiveMantissa = ComptrollerViewInterface(address(comptroller)) - .liquidationIncentiveMantissa(); + .liquidationIncentiveMantissa(); uint256 numerator = mul_(seizeTokens, Exp({ mantissa: protocolSeizeShareMantissa })); uint256 protocolSeizeTokens = div_(numerator, Exp({ mantissa: liquidationIncentiveMantissa })); uint256 liquidatorSeizeTokens = seizeTokens - protocolSeizeTokens; @@ -1329,7 +1361,12 @@ contract VToken is * @param dst The address of the destination account * @param tokens The number of tokens to transfer */ - function _transferTokens(address spender, address src, address dst, uint256 tokens) internal { + function _transferTokens( + address spender, + address src, + address dst, + uint256 tokens + ) internal { /* Fail if transfer not allowed */ comptroller.preTransferHook(address(this), src, dst, tokens); diff --git a/contracts/VTokenInterfaces.sol b/contracts/VTokenInterfaces.sol index 7483e68b8..7b6c58f53 100644 --- a/contracts/VTokenInterfaces.sol +++ b/contracts/VTokenInterfaces.sol @@ -293,7 +293,11 @@ abstract contract VTokenInterface is VTokenStorage { VTokenInterface vTokenCollateral ) external virtual returns (uint256); - function healBorrow(address payer, address borrower, uint256 repayAmount) external virtual; + function healBorrow( + address payer, + address borrower, + uint256 repayAmount + ) external virtual; function forceLiquidateBorrow( address liquidator, @@ -303,11 +307,19 @@ abstract contract VTokenInterface is VTokenStorage { bool skipCloseFactorCheck ) external virtual; - function seize(address liquidator, address borrower, uint256 seizeTokens) external virtual; + function seize( + address liquidator, + address borrower, + uint256 seizeTokens + ) external virtual; function transfer(address dst, uint256 amount) external virtual returns (bool); - function transferFrom(address src, address dst, uint256 amount) external virtual returns (bool); + function transferFrom( + address src, + address dst, + uint256 amount + ) external virtual returns (bool); function accrueInterest() external virtual returns (uint256); @@ -341,7 +353,16 @@ abstract contract VTokenInterface is VTokenStorage { function balanceOf(address owner) external view virtual returns (uint256); - function getAccountSnapshot(address account) external view virtual returns (uint256, uint256, uint256, uint256); + function getAccountSnapshot(address account) + external + view + virtual + returns ( + uint256, + uint256, + uint256, + uint256 + ); function borrowRatePerBlock() external view virtual returns (uint256); diff --git a/contracts/lib/ApproveOrRevert.sol b/contracts/lib/ApproveOrRevert.sol index 8ea61ae4b..c13d4460f 100644 --- a/contracts/lib/ApproveOrRevert.sol +++ b/contracts/lib/ApproveOrRevert.sol @@ -17,7 +17,11 @@ library ApproveOrRevert { /// @param token The contract address of the token which will be transferred /// @param spender The spender contract address /// @param amount The value of the transfer - function approveOrRevert(IERC20Upgradeable token, address spender, uint256 amount) internal { + function approveOrRevert( + IERC20Upgradeable token, + address spender, + uint256 amount + ) internal { bytes memory callData = abi.encodeCall(token.approve, (spender, amount)); // solhint-disable-next-line avoid-low-level-calls diff --git a/contracts/lib/TokenDebtTracker.sol b/contracts/lib/TokenDebtTracker.sol index aac79291c..c183be6cc 100644 --- a/contracts/lib/TokenDebtTracker.sol +++ b/contracts/lib/TokenDebtTracker.sol @@ -110,7 +110,11 @@ abstract contract TokenDebtTracker is Initializable { * @param amount The amount to transfer * @custom:error InsufficientBalance The contract doesn't have enough balance to transfer */ - function _transferOutOrTrackDebt(IERC20Upgradeable token, address to, uint256 amount) internal { + function _transferOutOrTrackDebt( + IERC20Upgradeable token, + address to, + uint256 amount + ) internal { uint256 balance = token.balanceOf(address(this)); if (balance < amount) { revert InsufficientBalance(address(token), address(this), amount, balance); @@ -125,7 +129,11 @@ abstract contract TokenDebtTracker is Initializable { * @param to The recipient of the transfer * @param amount The amount to transfer */ - function _transferOutOrTrackDebtSkippingBalanceCheck(IERC20Upgradeable token, address to, uint256 amount) internal { + function _transferOutOrTrackDebtSkippingBalanceCheck( + IERC20Upgradeable token, + address to, + uint256 amount + ) internal { // We can't use safeTransfer here because we can't try-catch internal calls bool success = _tryTransferOut(token, to, amount); if (!success) { @@ -144,7 +152,11 @@ abstract contract TokenDebtTracker is Initializable { * @param amount The amount to transfer * @return true if the transfer succeeded, false otherwise */ - function _tryTransferOut(IERC20Upgradeable token, address to, uint256 amount) private returns (bool) { + function _tryTransferOut( + IERC20Upgradeable token, + address to, + uint256 amount + ) private returns (bool) { bytes memory callData = abi.encodeCall(token.transfer, (to, amount)); // solhint-disable-next-line avoid-low-level-calls diff --git a/contracts/test/ERC20.sol b/contracts/test/ERC20.sol index 9dbc4d2a7..cabcd78c8 100644 --- a/contracts/test/ERC20.sol +++ b/contracts/test/ERC20.sol @@ -19,13 +19,21 @@ interface ERC20Base { abstract contract ERC20 is ERC20Base { function transfer(address to, uint256 value) external virtual returns (bool); - function transferFrom(address from, address to, uint256 value) external virtual returns (bool); + function transferFrom( + address from, + address to, + uint256 value + ) external virtual returns (bool); } abstract contract ERC20NS is ERC20Base { function transfer(address to, uint256 value) external virtual; - function transferFrom(address from, address to, uint256 value) external virtual; + function transferFrom( + address from, + address to, + uint256 value + ) external virtual; } /** @@ -43,7 +51,12 @@ contract StandardToken is ERC20 { mapping(address => mapping(address => uint256)) public override allowance; mapping(address => uint256) public override balanceOf; - constructor(uint256 _initialAmount, string memory _tokenName, uint8 _decimalUnits, string memory _tokenSymbol) { + constructor( + uint256 _initialAmount, + string memory _tokenName, + uint8 _decimalUnits, + string memory _tokenSymbol + ) { totalSupply = _initialAmount; balanceOf[msg.sender] = _initialAmount; name = _tokenName; @@ -58,7 +71,11 @@ contract StandardToken is ERC20 { return true; } - function transferFrom(address src, address dst, uint256 amount) external virtual override returns (bool) { + function transferFrom( + address src, + address dst, + uint256 amount + ) external virtual override returns (bool) { allowance[src][msg.sender] = allowance[src][msg.sender].sub(amount, "Insufficient allowance"); balanceOf[src] = balanceOf[src].sub(amount, "Insufficient balance"); balanceOf[dst] = balanceOf[dst].add(amount, "Balance overflow"); @@ -88,7 +105,12 @@ contract NonStandardToken is ERC20NS { mapping(address => mapping(address => uint256)) public override allowance; mapping(address => uint256) public override balanceOf; - constructor(uint256 _initialAmount, string memory _tokenName, uint8 _decimalUnits, string memory _tokenSymbol) { + constructor( + uint256 _initialAmount, + string memory _tokenName, + uint8 _decimalUnits, + string memory _tokenSymbol + ) { totalSupply = _initialAmount; balanceOf[msg.sender] = _initialAmount; name = _tokenName; @@ -102,7 +124,11 @@ contract NonStandardToken is ERC20NS { emit Transfer(msg.sender, dst, amount); } - function transferFrom(address src, address dst, uint256 amount) external override { + function transferFrom( + address src, + address dst, + uint256 amount + ) external override { allowance[src][msg.sender] = allowance[src][msg.sender].sub(amount, "Insufficient allowance"); balanceOf[src] = balanceOf[src].sub(amount, "Insufficient balance"); balanceOf[dst] = balanceOf[dst].add(amount, "Balance overflow"); @@ -147,7 +173,11 @@ contract ERC20Harness is StandardToken { return true; } - function transferFrom(address src, address dst, uint256 amount) external override returns (bool success) { + function transferFrom( + address src, + address dst, + uint256 amount + ) external override returns (bool success) { // Added for testing purposes if (failTransferFromAddresses[src]) { return false; diff --git a/contracts/test/EvilToken.sol b/contracts/test/EvilToken.sol index 103c751d2..6d72af717 100644 --- a/contracts/test/EvilToken.sol +++ b/contracts/test/EvilToken.sol @@ -37,7 +37,11 @@ contract EvilToken is FaucetToken { return true; } - function transferFrom(address src, address dst, uint256 amount) external override returns (bool) { + function transferFrom( + address src, + address dst, + uint256 amount + ) external override returns (bool) { if (fail) { return false; } diff --git a/contracts/test/FaucetToken.sol b/contracts/test/FaucetToken.sol index 1a607c303..93779e038 100644 --- a/contracts/test/FaucetToken.sol +++ b/contracts/test/FaucetToken.sol @@ -147,14 +147,22 @@ contract FaucetTokenReEntrantHarness { return true; } - function _approve(address owner, address spender, uint256 amount) internal { + function _approve( + address owner, + address spender, + uint256 amount + ) internal { require(spender != address(0), "FaucetToken: approve to the zero address"); require(owner != address(0), "FaucetToken: approve from the zero address"); allowance_[owner][spender] = amount; emit Approval(owner, spender, amount); } - function _transfer(address src, address dst, uint256 amount) internal { + function _transfer( + address src, + address dst, + uint256 amount + ) internal { require(dst != address(0), "FaucetToken: transfer to the zero address"); balanceOf_[src] = balanceOf_[src].sub(amount); balanceOf_[dst] = balanceOf_[dst].add(amount); diff --git a/contracts/test/FeeToken.sol b/contracts/test/FeeToken.sol index 0879624d9..67972d963 100644 --- a/contracts/test/FeeToken.sol +++ b/contracts/test/FeeToken.sol @@ -37,7 +37,11 @@ contract FeeToken is FaucetToken { return true; } - function transferFrom(address src, address dst, uint256 amount) public override returns (bool) { + function transferFrom( + address src, + address dst, + uint256 amount + ) public override returns (bool) { uint256 fee = amount.mul(basisPointFee).div(10000); uint256 net = amount.sub(fee); balanceOf[owner] = balanceOf[owner].add(fee); diff --git a/contracts/test/MockDeflationaryToken.sol b/contracts/test/MockDeflationaryToken.sol index 4845c3141..5403cf2e6 100644 --- a/contracts/test/MockDeflationaryToken.sol +++ b/contracts/test/MockDeflationaryToken.sol @@ -43,7 +43,11 @@ contract MockDeflatingToken { return true; } - function transferFrom(address from, address to, uint256 value) external returns (bool) { + function transferFrom( + address from, + address to, + uint256 value + ) external returns (bool) { if (allowance[from][msg.sender] != type(uint256).max) { allowance[from][msg.sender] = allowance[from][msg.sender] - value; } @@ -85,12 +89,20 @@ contract MockDeflatingToken { emit Transfer(from, address(0), value); } - function _approve(address owner, address spender, uint256 value) private { + function _approve( + address owner, + address spender, + uint256 value + ) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } - function _transfer(address from, address to, uint256 value) private { + function _transfer( + address from, + address to, + uint256 value + ) private { uint256 burnAmount = value / 100; _burn(from, burnAmount); uint256 transferAmount = value - burnAmount; diff --git a/contracts/test/Mocks/MockPancakeSwap.sol b/contracts/test/Mocks/MockPancakeSwap.sol index 8c7f44fae..6894dd396 100644 --- a/contracts/test/Mocks/MockPancakeSwap.sol +++ b/contracts/test/Mocks/MockPancakeSwap.sol @@ -10,19 +10,32 @@ pragma solidity >=0.6.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { - function safeApprove(address token, address to, uint256 value) internal { + function safeApprove( + address token, + address to, + uint256 value + ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: APPROVE_FAILED"); } - function safeTransfer(address token, address to, uint256 value) internal { + function safeTransfer( + address token, + address to, + uint256 value + ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: TRANSFER_FAILED"); } - function safeTransferFrom(address token, address from, address to, uint256 value) internal { + function safeTransferFrom( + address token, + address from, + address to, + uint256 value + ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: TRANSFER_FROM_FAILED"); @@ -54,7 +67,13 @@ interface IPancakeRouter01 { uint256 amountBMin, address to, uint256 deadline - ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity); + ) + external + returns ( + uint256 amountA, + uint256 amountB, + uint256 liquidity + ); function addLiquidityETH( address token, @@ -63,7 +82,14 @@ interface IPancakeRouter01 { uint256 amountETHMin, address to, uint256 deadline - ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity); + ) + external + payable + returns ( + uint256 amountToken, + uint256 amountETH, + uint256 liquidity + ); function removeLiquidity( address tokenA, @@ -157,7 +183,11 @@ interface IPancakeRouter01 { uint256 deadline ) external payable returns (uint256[] memory amounts); - function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) external pure returns (uint256 amountB); + function quote( + uint256 amountA, + uint256 reserveA, + uint256 reserveB + ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, @@ -305,7 +335,11 @@ interface IPancakePair { function transfer(address to, uint256 value) external returns (bool); - function transferFrom(address from, address to, uint256 value) external returns (bool); + function transferFrom( + address from, + address to, + uint256 value + ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); @@ -343,7 +377,14 @@ interface IPancakePair { function token1() external view returns (address); - function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); + function getReserves() + external + view + returns ( + uint112 reserve0, + uint112 reserve1, + uint32 blockTimestampLast + ); function price0CumulativeLast() external view returns (uint256); @@ -355,7 +396,12 @@ interface IPancakePair { function burn(address to) external returns (uint256 amount0, uint256 amount1); - function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external; + function swap( + uint256 amount0Out, + uint256 amount1Out, + address to, + bytes calldata data + ) external; function skim(address to) external; @@ -381,7 +427,11 @@ library PancakeLibrary { } // calculates the CREATE2 address for a pair without making any external calls - function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { + function pairFor( + address factory, + address tokenA, + address tokenB + ) internal pure returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address( uint256( @@ -411,7 +461,11 @@ library PancakeLibrary { } // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset - function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) internal pure returns (uint256 amountB) { + function quote( + uint256 amountA, + uint256 reserveA, + uint256 reserveB + ) internal pure returns (uint256 amountB) { require(amountA > 0, "PancakeLibrary: INSUFFICIENT_AMOUNT"); require(reserveA > 0 && reserveB > 0, "PancakeLibrary: INSUFFICIENT_LIQUIDITY"); amountB = amountA.mul(reserveB) / reserveA; @@ -501,7 +555,11 @@ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); - function transferFrom(address from, address to, uint256 value) external returns (bool); + function transferFrom( + address from, + address to, + uint256 value + ) external returns (bool); } // File: contracts\interfaces\IWETH.sol @@ -583,7 +641,17 @@ contract PancakeRouter is IPancakeRouter02 { uint256 amountBMin, address to, uint256 deadline - ) external virtual override ensure(deadline) returns (uint256 amountA, uint256 amountB, uint256 liquidity) { + ) + external + virtual + override + ensure(deadline) + returns ( + uint256 amountA, + uint256 amountB, + uint256 liquidity + ) + { (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin); address pair = PancakeLibrary.pairFor(factory, tokenA, tokenB); TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA); @@ -604,7 +672,11 @@ contract PancakeRouter is IPancakeRouter02 { virtual override ensure(deadline) - returns (uint256 amountToken, uint256 amountETH, uint256 liquidity) + returns ( + uint256 amountToken, + uint256 amountETH, + uint256 liquidity + ) { (amountToken, amountETH) = _addLiquidity( token, @@ -743,7 +815,11 @@ contract PancakeRouter is IPancakeRouter02 { // **** SWAP **** // requires the initial amount to have already been sent to the first pair - function _swap(uint256[] memory amounts, address[] memory path, address _to) internal virtual { + function _swap( + uint256[] memory amounts, + address[] memory path, + address _to + ) internal virtual { for (uint256 i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); PancakeLibrary.sortTokens(input, output); @@ -971,17 +1047,23 @@ contract PancakeRouter is IPancakeRouter02 { return PancakeLibrary.getAmountIn(amountOut, reserveIn, reserveOut); } - function getAmountsOut( - uint256 amountIn, - address[] memory path - ) public view virtual override returns (uint256[] memory amounts) { + function getAmountsOut(uint256 amountIn, address[] memory path) + public + view + virtual + override + returns (uint256[] memory amounts) + { return PancakeLibrary.getAmountsOut(factory, amountIn, path); } - function getAmountsIn( - uint256 amountOut, - address[] memory path - ) public view virtual override returns (uint256[] memory amounts) { + function getAmountsIn(uint256 amountOut, address[] memory path) + public + view + virtual + override + returns (uint256[] memory amounts) + { return PancakeLibrary.getAmountsIn(factory, amountOut, path); } } diff --git a/contracts/test/Mocks/MockToken.sol b/contracts/test/Mocks/MockToken.sol index ced5e3e4f..2615a27d4 100644 --- a/contracts/test/Mocks/MockToken.sol +++ b/contracts/test/Mocks/MockToken.sol @@ -8,7 +8,11 @@ import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract MockToken is ERC20 { uint8 private immutable _decimals; - constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) { + constructor( + string memory name_, + string memory symbol_, + uint8 decimals_ + ) ERC20(name_, symbol_) { _decimals = decimals_; } diff --git a/contracts/test/SafeMath.sol b/contracts/test/SafeMath.sol index 569e8e8a7..33ca62cf2 100644 --- a/contracts/test/SafeMath.sol +++ b/contracts/test/SafeMath.sol @@ -44,7 +44,11 @@ library SafeMath { * Requirements: * - Addition cannot overflow. */ - function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + function add( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { uint256 c; unchecked { c = a + b; @@ -74,7 +78,11 @@ library SafeMath { * Requirements: * - Subtraction cannot underflow. */ - function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + function sub( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; @@ -114,7 +122,11 @@ library SafeMath { * Requirements: * - Multiplication cannot overflow. */ - function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + function mul( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 @@ -157,7 +169,11 @@ library SafeMath { * Requirements: * - The divisor cannot be zero. */ - function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + function div( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; @@ -192,7 +208,11 @@ library SafeMath { * Requirements: * - The divisor cannot be zero. */ - function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + function mod( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } diff --git a/contracts/test/VTokenHarness.sol b/contracts/test/VTokenHarness.sol index 3690c212e..cc91adade 100644 --- a/contracts/test/VTokenHarness.sol +++ b/contracts/test/VTokenHarness.sol @@ -41,7 +41,11 @@ contract VTokenHarness is VToken { totalReserves = totalReserves_; } - function harnessExchangeRateDetails(uint256 totalSupply_, uint256 totalBorrows_, uint256 totalReserves_) external { + function harnessExchangeRateDetails( + uint256 totalSupply_, + uint256 totalBorrows_, + uint256 totalReserves_ + ) external { totalSupply = totalSupply_; totalBorrows = totalBorrows_; totalReserves = totalReserves_; @@ -60,11 +64,19 @@ contract VTokenHarness is VToken { super._mintFresh(account, account, mintAmount); } - function harnessRedeemFresh(address payable account, uint256 vTokenAmount, uint256 underlyingAmount) external { + function harnessRedeemFresh( + address payable account, + uint256 vTokenAmount, + uint256 underlyingAmount + ) external { super._redeemFresh(account, vTokenAmount, underlyingAmount); } - function harnessSetAccountBorrows(address account, uint256 principal, uint256 interestIndex) external { + function harnessSetAccountBorrows( + address account, + uint256 principal, + uint256 interestIndex + ) external { accountBorrows[account] = BorrowSnapshot({ principal: principal, interestIndex: interestIndex }); } @@ -76,7 +88,11 @@ contract VTokenHarness is VToken { _borrowFresh(account, borrowAmount); } - function harnessRepayBorrowFresh(address payer, address account, uint256 repayAmount) external { + function harnessRepayBorrowFresh( + address payer, + address account, + uint256 repayAmount + ) external { _repayBorrowFresh(payer, account, repayAmount); } diff --git a/contracts/test/lib/ApproveOrRevertHarness.sol b/contracts/test/lib/ApproveOrRevertHarness.sol index e590d90b6..b0d3185a3 100644 --- a/contracts/test/lib/ApproveOrRevertHarness.sol +++ b/contracts/test/lib/ApproveOrRevertHarness.sol @@ -8,7 +8,11 @@ import { ApproveOrRevert } from "../../lib/ApproveOrRevert.sol"; contract ApproveOrRevertHarness { using ApproveOrRevert for IERC20Upgradeable; - function approve(IERC20Upgradeable token, address spender, uint256 amount) external { + function approve( + IERC20Upgradeable token, + address spender, + uint256 amount + ) external { token.approveOrRevert(spender, amount); } } diff --git a/contracts/test/lib/TokenDebtTrackerHarness.sol b/contracts/test/lib/TokenDebtTrackerHarness.sol index 37e8f7282..4b8747689 100644 --- a/contracts/test/lib/TokenDebtTrackerHarness.sol +++ b/contracts/test/lib/TokenDebtTrackerHarness.sol @@ -10,12 +10,20 @@ contract TokenDebtTrackerHarness is TokenDebtTracker { __TokenDebtTracker_init(); } - function addTokenDebt(IERC20Upgradeable token, address user, uint256 amount) external { + function addTokenDebt( + IERC20Upgradeable token, + address user, + uint256 amount + ) external { tokenDebt[token][user] += amount; totalTokenDebt[token] += amount; } - function transferOutOrTrackDebt(IERC20Upgradeable token, address user, uint256 amount) external { + function transferOutOrTrackDebt( + IERC20Upgradeable token, + address user, + uint256 amount + ) external { _transferOutOrTrackDebt(token, user, amount); } diff --git a/deploy/014-riskfund-protocolshare.ts b/deploy/014-riskfund-protocolshare.ts index b82030253..0efb88b05 100644 --- a/deploy/014-riskfund-protocolshare.ts +++ b/deploy/014-riskfund-protocolshare.ts @@ -112,4 +112,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { }; func.tags = ["RiskFund", "il"]; -export default func; \ No newline at end of file +export default func; diff --git a/helpers/deploymentConfig.ts b/helpers/deploymentConfig.ts index 8ca71933a..b8ea9e873 100644 --- a/helpers/deploymentConfig.ts +++ b/helpers/deploymentConfig.ts @@ -134,7 +134,7 @@ const preconfiguredAddresses = { Shortfall: "0xf37530A8a810Fcb501AA0Ecd0B0699388F0F2209", }, sepolia: { - VTreasury: preconfiguredAddresses.sepolia.VTreasury, + VTreasury: "0xFc43c055B9be2Ec3BEe6f8C291Af862d764016a0", NormalTimelock: SEPOLIA_MULTISIG, FastTrackTimelock: SEPOLIA_MULTISIG, CriticalTimelock: SEPOLIA_MULTISIG, @@ -2169,7 +2169,7 @@ export const globalConfig: NetworkConfig = { initialSupply: convertToUnit(1, 8), // 1 WBTC supplyCap: convertToUnit(100, 8), borrowCap: convertToUnit(50, 8), - vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, }, { name: "Venus WETH (Core)", @@ -2203,7 +2203,7 @@ export const globalConfig: NetworkConfig = { initialSupply: convertToUnit(10_000, 6), // 10,000 USDT supplyCap: convertToUnit(1_000_000, 6), borrowCap: convertToUnit(500_000, 6), - vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury + vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, }, { name: "Venus USDC (Core)", @@ -2220,7 +2220,7 @@ export const globalConfig: NetworkConfig = { initialSupply: convertToUnit(10_000, 6), // 10,000 USDC supplyCap: convertToUnit(1_000_000, 6), borrowCap: convertToUnit(500_000, 6), - vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury + vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, }, ], rewards: [],