From daa3fc2216d8e964407900dde7b1fb308fcf0ec6 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Wed, 18 Dec 2024 16:55:12 +0530 Subject: [PATCH 01/15] feat: simple flash loan contracts --- .../base/FlashloanSimpleReceiverBase.sol | 24 +++++++++++++++++++ .../interfaces/IFlashloanSimpleReceiver.sol | 23 ++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 contracts/Flashloan/base/FlashloanSimpleReceiverBase.sol create mode 100644 contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol diff --git a/contracts/Flashloan/base/FlashloanSimpleReceiverBase.sol b/contracts/Flashloan/base/FlashloanSimpleReceiverBase.sol new file mode 100644 index 000000000..0ba5c8746 --- /dev/null +++ b/contracts/Flashloan/base/FlashloanSimpleReceiverBase.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: BSD-3-Clause +pragma solidity 0.8.25; + +import { IFlashloanSimpleReceiver } from "../interfaces/IFlashloanSimpleReceiver.sol"; +import { VTokenInterface } from "../../VTokenInterfaces.sol"; + +/** + * @title FlashloanSimpleReceiverBase + * @author Venus + * @notice Base contract to develop a flashloan-receiver contract. + * @dev This contract serves as a foundational contract for implementing custom flash loan receiver logic. + * Inheritors of this contract need to implement the `executeOperation` function defined in the `IFlashloanSimpleReceiver` interface. + */ +abstract contract FlashloanSimpleReceiverBase is IFlashloanSimpleReceiver { + /// @notice The VToken contract used to initiate and handle flash loan + /// @dev This is an immutable reference to the VTokenInterface, which enables the flash loan functionality. + VTokenInterface public immutable VTOKEN; + + /// @notice Initializes the base contract by setting the VToken address + /// @param vToken_ The address of the VToken contract that supports flash loan + constructor(VTokenInterface vToken_) { + VTOKEN = vToken_; + } +} diff --git a/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol b/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol new file mode 100644 index 000000000..21c1be1ad --- /dev/null +++ b/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause +pragma solidity ^0.8.25; + +interface IFlashloanSimpleReceiver { + /** + * @notice Executes an operation after receiving the flash-borrowed asset + * @dev Ensure that the contract can return the debt + premium, e.g., has + * enough funds to repay and has to transfer the debt + premium to the VToken + * @param asset The address of the flash-borrowed asset + * @param amount The amount of the flash-borrowed asset + * @param premium The fee on flash-borrowed asset + * @param initiator The address of the flashloan initiator + * @param param The byte-encoded param passed when initiating the flashloan + * @return True if the execution of the operation succeeds, false otherwise + */ + function executeOperation( + address asset, + uint256 amount, + uint256 premium, + address initiator, + bytes calldata param + ) external returns (bool); +} From 32bd0be78163b8771b23c5c8b11a2c5f9e177237 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Wed, 18 Dec 2024 16:55:47 +0530 Subject: [PATCH 02/15] feat: add simple flash loan functionality --- contracts/VToken.sol | 112 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 109 insertions(+), 3 deletions(-) diff --git a/contracts/VToken.sol b/contracts/VToken.sol index 0e12b02f7..34a846b26 100644 --- a/contracts/VToken.sol +++ b/contracts/VToken.sol @@ -14,6 +14,7 @@ import { InterestRateModel } from "./InterestRateModel.sol"; import { ExponentialNoError } from "./ExponentialNoError.sol"; import { TimeManagerV8 } from "@venusprotocol/solidity-utilities/contracts/TimeManagerV8.sol"; import { ensureNonzeroAddress } from "./lib/validators.sol"; +import { IFlashloanSimpleReceiver } from "./Flashloan/interfaces/IFlashloanSimpleReceiver.sol"; /** * @title VToken @@ -106,6 +107,7 @@ contract VToken is * @param accessControlManager_ AccessControlManager contract address * @param riskManagement Addresses of risk & income related contracts * @param reserveFactorMantissa_ Percentage of borrow interest that goes to reserves (from 0 to 1e18) + * @param flashLoanEnabled_ Enable flashloan or not for this market * @custom:error ZeroAddressNotAllowed is thrown when admin address is zero * @custom:error ZeroAddressNotAllowed is thrown when shortfall contract address is zero * @custom:error ZeroAddressNotAllowed is thrown when protocol share reserve address is zero @@ -121,7 +123,9 @@ contract VToken is address admin_, address accessControlManager_, RiskManagementInit memory riskManagement, - uint256 reserveFactorMantissa_ + uint256 reserveFactorMantissa_, + bool flashLoanEnabled_, + uint256 flashloanFeeMantissa_ ) external initializer { ensureNonzeroAddress(admin_); @@ -137,7 +141,9 @@ contract VToken is admin_, accessControlManager_, riskManagement, - reserveFactorMantissa_ + reserveFactorMantissa_, + flashLoanEnabled_, + flashloanFeeMantissa_ ); } @@ -697,6 +703,101 @@ contract VToken is emit SweepToken(address(token)); } + /** + * @notice Transfers the underlying asset to the specified address. + * @dev Can only be called by the Comptroller contract. This function performs the actual transfer of the underlying + * asset by calling the `_doTransferOut` internal function. + * @param to The address to which the underlying asset is to be transferred. + * @param amount The amount of the underlying asset to transfer. + * @custom:requirements + * - The caller must be the Comptroller contract. + * @custom:reverts + * - Reverts with "Only Comptroller" if the caller is not the Comptroller. + * @custom:event Emits FlashloanAmountTransferred event on successful transfer of amount to receiver + */ + function transferUnderlying(address to, uint256 amount) external override nonReentrant { + if (msg.sender != address(comptroller)) { + revert InvalidComptroller(address(comptroller)); + } + + _doTransferOut(to, amount); + + emit FlashloanAmountTransferred(underlying, to, amount); + } + + /** + * @notice Executes a flashloan operation. + * @dev Transfers the amount to the receiver contract and ensures that the total repayment (amount + fee) + * is returned by the receiver contract after the operation. The function performs checks to ensure the validity + * of parameters, that flashloan is enabled for the given asset, and that the total repayment is sufficient. + * Reverts on invalid parameters, disabled flashloans, or insufficient repayment. + * @param receiver The address of the contract that will receive the flashloan and execute the operation. + * @param amount The amount of asset to be loaned. + * @custom:requirements + * - The `receiver` address must not be the zero address. + * - Flashloans must be enabled for the asset. + * - The `receiver` contract must repay the loan with the appropriate fee. + * @custom:reverts + * - Reverts with `FlashLoanNotEnabled(asset)` if flashloans are disabled for any of the requested assets. + * - Reverts with `ExecuteFlashloanFailed` if the receiver contract fails to execute the operation. + * - Reverts with `InsufficientReypaymentBalance(asset)` if the repayment (amount + fee) is insufficient after the operation. + * @custom:event Emits FlashloanExecuted event on success + */ + function executeFlashloan(address receiver, uint256 amount) external override nonReentrant returns (uint256) { + if (!isFlashloanEnabled) revert FlashLoanNotEnabled(address(this)); + ensureNonzeroAddress(receiver); + + IFlashloanSimpleReceiver receiverContract = IFlashloanSimpleReceiver(receiver); + + uint256 fee = (amount * flashloanFeeMantissa) / MANTISSA_ONE; + uint256 totalRepayment = amount + fee; + + // Transfer the underlying asset to the receiver. + _doTransferOut(receiver, amount); + + uint256 balanceBefore = _getCashPrior(); + + // Call the execute operation on receiver contract + if (!receiverContract.executeOperation(underlying, amount, fee, msg.sender, "")) { + revert ExecuteFlashloanFailed(); + } + + uint256 balanceAfter = _getCashPrior(); + + // balanceAfter should be greater than the fee calculated + if ((balanceAfter - balanceBefore) < totalRepayment) { + revert InsufficientReypaymentBalance(underlying); + } + + emit FlashloanExecuted(receiver, underlying, amount); + + return NO_ERROR; + } + + /** + * @notice Enable or disable flash loan for the market + * @custom:access Only Governance + * @custom:event Emits ToggleFlashloanEnabled event on success + */ + function toggleFlashloan() external override { + _checkAccessAllowed("toggleFlashloan()"); + isFlashloanEnabled = !isFlashloanEnabled; + + emit ToggleFlashloanEnabled(!isFlashloanEnabled, isFlashloanEnabled); + } + + /** + * @notice Update flashloan fee mantissa + * @custom:access Only Governance + * @custom:event Emits FLashloanFeeUpdated event on success + */ + function setFlashloanFeeMantissa(uint256 fee) external override { + _checkAccessAllowed("setFlashloanFeeMantissa(uint256)"); + + emit FLashloanFeeUpdated(flashloanFeeMantissa, fee); + flashloanFeeMantissa = fee; + } + /** * @notice A public function to set new threshold of slot(block or second) difference after which funds will be sent to the protocol share reserve * @param _newReduceReservesBlockOrTimestampDelta slot(block or second) difference value @@ -1536,6 +1637,7 @@ contract VToken is * @param accessControlManager_ AccessControlManager contract address * @param riskManagement Addresses of risk & income related contracts * @param reserveFactorMantissa_ Percentage of borrow interest that goes to reserves (from 0 to 1e18) + * @param flashLoanEnabled_ Enable flashloan or not for this market */ function _initialize( address underlying_, @@ -1548,7 +1650,9 @@ contract VToken is address admin_, address accessControlManager_, RiskManagementInit memory riskManagement, - uint256 reserveFactorMantissa_ + uint256 reserveFactorMantissa_, + bool flashLoanEnabled_, + uint256 flashloanFeeMantissa_ ) internal onlyInitializing { __Ownable2Step_init(); __AccessControlled_init_unchained(accessControlManager_); @@ -1575,6 +1679,8 @@ contract VToken is _setShortfallContract(riskManagement.shortfall); _setProtocolShareReserve(riskManagement.protocolShareReserve); protocolSeizeShareMantissa = DEFAULT_PROTOCOL_SEIZE_SHARE_MANTISSA; + isFlashloanEnabled = flashLoanEnabled_; + flashloanFeeMantissa = flashloanFeeMantissa_; // Set underlying and sanity check it underlying = underlying_; From a0c30a6b81117a8ddb053ce46b5af01fec38c817 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Wed, 18 Dec 2024 17:44:12 +0530 Subject: [PATCH 03/15] feat: add flash loan contracts --- .../Flashloan/base/FlashloanReceiverBase.sol | 23 +++++++++++++++ .../interfaces/IFlashloanReceiver.sol | 28 +++++++++++++++++++ .../interfaces/IFlashloanSimpleReceiver.sol | 4 +-- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 contracts/Flashloan/base/FlashloanReceiverBase.sol create mode 100644 contracts/Flashloan/interfaces/IFlashloanReceiver.sol diff --git a/contracts/Flashloan/base/FlashloanReceiverBase.sol b/contracts/Flashloan/base/FlashloanReceiverBase.sol new file mode 100644 index 000000000..b38a13819 --- /dev/null +++ b/contracts/Flashloan/base/FlashloanReceiverBase.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause +pragma solidity 0.8.25; + +import { IFlashloanReceiver } from "../interfaces/IFlashloanReceiver.sol"; +import { ComptrollerInterface } from "../../ComptrollerInterface.sol"; + +/// @title FlashloanReceiverBase +/// @notice A base contract for implementing flashloan receiver logic. +/// @dev This abstract contract provides the necessary structure for inheriting contracts to implement the `IFlashloanReceiver` interface. +/// It stores a reference to the Comptroller contract, which manages various aspects of the protocol. +abstract contract FlashloanReceiverBase is IFlashloanReceiver { + /// @notice The Comptroller contract that governs the protocol. + /// @dev This immutable variable stores the address of the Comptroller contract, which cannot be changed after deployment. + ComptrollerInterface public immutable COMPTROLLER; + + /** + * @notice Constructor to initialize the base contract with the Comptroller address. + * @param comptroller_ The address of the Comptroller contract that oversees the protocol. + */ + constructor(ComptrollerInterface comptroller_) { + COMPTROLLER = comptroller_; + } +} diff --git a/contracts/Flashloan/interfaces/IFlashloanReceiver.sol b/contracts/Flashloan/interfaces/IFlashloanReceiver.sol new file mode 100644 index 000000000..7c2942ccd --- /dev/null +++ b/contracts/Flashloan/interfaces/IFlashloanReceiver.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: BSD-3-Clause +pragma solidity ^0.8.25; + +import { VTokenInterface } from "../../VTokenInterfaces.sol"; + +/// @title IFlashloanReceiver +/// @notice Interface for flashloan receiver contract, which execute custom logic with flash-borrowed assets. +/// @dev This interface defines the method that must be implemented by any contract wishing to interact with the flashloan system. +/// Contracts must ensure they have the means to repay both the flashloaned amount and the associated premium (fee). +interface IFlashloanReceiver { + /** + * @notice Executes an operation after receiving the flash-borrowed assets. + * @dev Implementation of this function must ensure the borrowed amount plus the premium (fee) is repaid within the same transaction. + * @param assets The addresses of the assets that were flash-borrowed. + * @param amounts The amounts of each of the flash-borrowed assets. + * @param premiums The premiums (fees) associated with each flash-borrowed asset. + * @param initiator The address that initiated the flashloan operation. + * @param param Additional parameters encoded as bytes. These can be used to pass custom data to the receiver contract. + * @return True if the operation succeeds and the borrowed amount plus the premium is repaid, false otherwise. + */ + function executeOperation( + VTokenInterface[] calldata assets, + uint256[] calldata amounts, + uint256[] calldata premiums, + address initiator, + bytes calldata param + ) external returns (bool); +} diff --git a/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol b/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol index 21c1be1ad..52d0d190a 100644 --- a/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol +++ b/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol @@ -8,8 +8,8 @@ interface IFlashloanSimpleReceiver { * enough funds to repay and has to transfer the debt + premium to the VToken * @param asset The address of the flash-borrowed asset * @param amount The amount of the flash-borrowed asset - * @param premium The fee on flash-borrowed asset - * @param initiator The address of the flashloan initiator + * @param premium The premium (fee) associated with flash-borrowed asset. + * @param initiator The address that initiated the flashloan operation * @param param The byte-encoded param passed when initiating the flashloan * @return True if the execution of the operation succeeds, false otherwise */ From eb28e0d4b32f09a4e31b2a0ebb679092d69d4a8a Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Wed, 18 Dec 2024 17:46:59 +0530 Subject: [PATCH 04/15] feat: add flash loan functionality for multiple assets --- contracts/Comptroller.sol | 95 +++++++++++++++++++++++++++++- contracts/ComptrollerInterface.sol | 3 + contracts/ErrorReporter.sol | 5 ++ contracts/VTokenInterfaces.sol | 40 ++++++++++++- contracts/test/UpgradedVToken.sol | 8 ++- hardhat.config.ts | 1 + 6 files changed, 148 insertions(+), 4 deletions(-) diff --git a/contracts/Comptroller.sol b/contracts/Comptroller.sol index 8d25f5ad4..5a96cb6da 100644 --- a/contracts/Comptroller.sol +++ b/contracts/Comptroller.sol @@ -6,13 +6,14 @@ import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interf import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol"; import { IPrime } from "@venusprotocol/venus-protocol/contracts/Tokens/Prime/Interfaces/IPrime.sol"; -import { ComptrollerInterface, Action } from "./ComptrollerInterface.sol"; +import { ComptrollerInterface, VTokenInterface, Action } from "./ComptrollerInterface.sol"; import { ComptrollerStorage } from "./ComptrollerStorage.sol"; import { ExponentialNoError } from "./ExponentialNoError.sol"; import { VToken } from "./VToken.sol"; import { RewardsDistributor } from "./Rewards/RewardsDistributor.sol"; import { MaxLoopsLimitHelper } from "./MaxLoopsLimitHelper.sol"; import { ensureNonzeroAddress } from "./lib/validators.sol"; +import { IFlashloanReceiver } from "./Flashloan/interfaces/IFlashloanReceiver.sol"; /** * @title Comptroller @@ -100,9 +101,13 @@ contract Comptroller is /// @notice Emitted when a market is unlisted event MarketUnlisted(address indexed vToken); + /// @notice Emitted when the borrowing or redeeming delegate rights are updated for an account event DelegateUpdated(address indexed approver, address indexed delegate, bool approved); + /// @notice Emitted When the flash loan is successfully executed + event FlashloanExecuted(address receiver, VTokenInterface[] assets, uint256[] amounts); + /// @notice Thrown when collateral factor exceeds the upper bound error InvalidCollateralFactor(); @@ -199,6 +204,18 @@ contract Comptroller is /// @notice Thrown if delegate approval status is already set to the requested value error DelegationStatusUnchanged(); + /// @notice Thrown if invalid flashloan params passed + error InvalidFlashloanParams(); + + ///@notice Thrown if the flashloan is not enabled for a particular market + error FlashLoanNotEnabled(address market); + + ///@notice Thrown if repayment amount is insufficient + error InsufficientReypaymentBalance(address tokenAddress); + + ///@notice Thrown if executeOperation failed + error ExecuteFlashloanFailed(); + /// @param poolRegistry_ Pool registry address /// @custom:oz-upgrades-unsafe-allow constructor /// @custom:error ZeroAddressNotAllowed is thrown when pool registry address is zero @@ -919,6 +936,82 @@ contract Comptroller is } } + /** + * @notice Executes a flashloan operation with the specified assets and amounts. + * @dev Transfer the specified assets to the receiver contract and ensures that the total repayment (amount + fee) + * is returned by the receiver contract after the operation for each asset. The function performs checks to ensure the validity + * of parameters, that flashloans are enabled for the given assets, and that the total repayment is sufficient. + * Reverts on invalid parameters, disabled flashloans, or insufficient repayment. + * @param receiver The address of the contract that will receive the flashloan and execute the operation. + * @param assets The addresses of the assets to be loaned. + * @param amounts The amounts of each asset to be loaned. + * @custom:requirements + * - `assets.length` must be equal to `amounts.length`. + * - `assets.length` and `amounts.length` must not be zero. + * - The `receiver` address must not be the zero address. + * - Flashloans must be enabled for each asset. + * - The `receiver` contract must repay the loan with the appropriate fee. + * @custom:reverts + * - Reverts with `InvalidFlashloanParams()` if parameter checks fail. + * - Reverts with `FlashLoanNotEnabled(asset)` if flashloans are disabled for any of the requested assets. + * - Reverts with `ExecuteFlashloanFailed` if the receiver contract fails to execute the operation. + * - Reverts with `InsufficientReypaymentBalance(asset)` if the repayment (amount + fee) is insufficient after the operation. + */ + function executeFlashloan( + address receiver, + VTokenInterface[] calldata assets, + uint256[] calldata amounts + ) external override { + // Asset and amount length must be equals and not be zero + if (assets.length != amounts.length || assets.length == 0 || receiver == address(0)) { + revert InvalidFlashloanParams(); + } + + IFlashloanReceiver receiverContract = IFlashloanReceiver(receiver); + uint256 len = assets.length; + uint256[] memory fees = new uint256[](len); + uint256[] memory balanceBefore = new uint256[](len); + + for (uint256 j; j < len; ) { + // Revert if flashloan is not enabled + if (!(assets[j]).isFlashloanEnabled()) { + revert FlashLoanNotEnabled(address(assets[j])); + } + + uint256 assetFlashloanFee = (assets[j]).flashloanFeeMantissa(); + fees[j] = (amounts[j] * assetFlashloanFee) / MANTISSA_ONE; + + // Transfer the asset + (assets[j]).transferUnderlying(receiver, amounts[j]); + + balanceBefore[j] = (assets[j]).getCash(); + + unchecked { + ++j; + } + } + + // Call the execute operation on receiver contract + if (!receiverContract.executeOperation(assets, amounts, fees, receiver, "")) { + revert ExecuteFlashloanFailed(); + } + + for (uint256 k; k < len; ) { + uint256 balanceAfter = (assets[k]).getCash(); + + // balanceAfter should be greater than the fee calculated + if ((balanceAfter - balanceBefore[k]) < (amounts[k] + fees[k])) { + revert InsufficientReypaymentBalance(address(assets[k])); + } + + unchecked { + ++k; + } + } + + emit FlashloanExecuted(receiver, assets, amounts); + } + /** * @notice Liquidates all borrows of the borrower. Callable only if the collateral is less than * a predefined threshold, and the account collateral can be seized to cover all borrows. If diff --git a/contracts/ComptrollerInterface.sol b/contracts/ComptrollerInterface.sol index 662a6aef9..786599ac4 100644 --- a/contracts/ComptrollerInterface.sol +++ b/contracts/ComptrollerInterface.sol @@ -5,6 +5,7 @@ import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interf import { VToken } from "./VToken.sol"; import { RewardsDistributor } from "./Rewards/RewardsDistributor.sol"; +import { VTokenInterface } from "./VTokenInterfaces.sol"; enum Action { MINT, @@ -90,6 +91,8 @@ interface ComptrollerInterface { function preTransferHook(address vToken, address src, address dst, uint256 transferTokens) external; + function executeFlashloan(address receiver, VTokenInterface[] calldata assets, uint256[] calldata amounts) external; + function isComptroller() external view returns (bool); /*** Liquidity/Liquidation Calculations ***/ diff --git a/contracts/ErrorReporter.sol b/contracts/ErrorReporter.sol index 080c0b73c..e05ab34be 100644 --- a/contracts/ErrorReporter.sol +++ b/contracts/ErrorReporter.sol @@ -46,4 +46,9 @@ contract TokenErrorReporter { error ReduceReservesCashValidation(); error SetInterestRateModelFreshCheck(); + + error FlashLoanNotEnabled(address); + error ExecuteFlashloanFailed(); + error InvalidComptroller(address comptroller); + error InsufficientReypaymentBalance(address tokenAddress); } diff --git a/contracts/VTokenInterfaces.sol b/contracts/VTokenInterfaces.sol index 0f01e1f17..878496536 100644 --- a/contracts/VTokenInterfaces.sol +++ b/contracts/VTokenInterfaces.sol @@ -131,12 +131,22 @@ contract VTokenStorage { */ uint256 public reduceReservesBlockNumber; + /** + * @notice flashloan is enabled for this market or not + */ + bool public isFlashloanEnabled; + + /** + * @notice fee percentage collected by protocol on flashloan + */ + uint256 public flashloanFeeMantissa; + /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ - uint256[48] private __gap; + uint256[47] private __gap; } /** @@ -288,6 +298,26 @@ abstract contract VTokenInterface is VTokenStorage { */ event ProtocolSeize(address indexed from, address indexed to, uint256 amount); + /** + * @notice Event emitted when flashloanEnabled status is changed + */ + event ToggleFlashloanEnabled(bool oldEnabled, bool enabled); + + /** + * @notice Event emitted when flashloan is executed + */ + event FlashloanExecuted(address receiver, address underlying, uint256 amount); + + /** + * @notice Event emitted when asset is transferred to receiver + */ + event FlashloanAmountTransferred(address asset, address receiver, uint256 amount); + + /** + * @notice Event emitted when flashloan fee mantissa is updated + */ + event FLashloanFeeUpdated(uint256 oldFee, uint256 fee); + /*** User Interface ***/ function mint(uint256 mintAmount) external virtual returns (uint256); @@ -336,6 +366,10 @@ abstract contract VTokenInterface is VTokenStorage { function sweepToken(IERC20Upgradeable token) external virtual; + function transferUnderlying(address receiver, uint256 amount) external virtual; + + function executeFlashloan(address receiver, uint256 amount) external virtual returns (uint256); + /*** Admin Functions ***/ function setReserveFactor(uint256 newReserveFactorMantissa) external virtual; @@ -350,6 +384,10 @@ abstract contract VTokenInterface is VTokenStorage { function addReserves(uint256 addAmount) external virtual; + function toggleFlashloan() external virtual; + + function setFlashloanFeeMantissa(uint256 fee) external virtual; + function totalBorrowsCurrent() external virtual returns (uint256); function balanceOfUnderlying(address owner) external virtual returns (uint256); diff --git a/contracts/test/UpgradedVToken.sol b/contracts/test/UpgradedVToken.sol index efae5ac4f..a2480b932 100644 --- a/contracts/test/UpgradedVToken.sol +++ b/contracts/test/UpgradedVToken.sol @@ -57,7 +57,9 @@ contract UpgradedVToken is VToken { address payable admin_, address accessControlManager_, RiskManagementInit memory riskManagement, - uint256 reserveFactorMantissa_ + uint256 reserveFactorMantissa_, + bool isFlashloanEnabled_, + uint256 flashloanFeeMantissa_ ) public reinitializer(2) { super._initialize( underlying_, @@ -70,7 +72,9 @@ contract UpgradedVToken is VToken { admin_, accessControlManager_, riskManagement, - reserveFactorMantissa_ + reserveFactorMantissa_, + isFlashloanEnabled_, + flashloanFeeMantissa_ ); } diff --git a/hardhat.config.ts b/hardhat.config.ts index 011e59c8f..cef18c32b 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -171,6 +171,7 @@ const config: HardhatUserConfig = { yul: !process.env.CI, }, }, + viaIR: true, evmVersion: "paris", outputSelection: { "*": { From b0f3b25f8742b76f1e5f01ccf57e8e33cb500483 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Thu, 19 Dec 2024 15:19:33 +0530 Subject: [PATCH 05/15] test: add tests for flash loan single and multiple assets --- .../test/Mocks/MockFlashloanReceiver.sol | 70 +++++ .../Mocks/MockFlashloanSimpleReceiver.sol | 63 +++++ tests/hardhat/FlashLoanSimple.ts | 121 +++++++++ tests/hardhat/Flashloan.ts | 252 ++++++++++++++++++ tests/hardhat/util/TokenTestHelpers.ts | 6 + 5 files changed, 512 insertions(+) create mode 100644 contracts/test/Mocks/MockFlashloanReceiver.sol create mode 100644 contracts/test/Mocks/MockFlashloanSimpleReceiver.sol create mode 100644 tests/hardhat/FlashLoanSimple.ts create mode 100644 tests/hardhat/Flashloan.ts diff --git a/contracts/test/Mocks/MockFlashloanReceiver.sol b/contracts/test/Mocks/MockFlashloanReceiver.sol new file mode 100644 index 000000000..ceeed6718 --- /dev/null +++ b/contracts/test/Mocks/MockFlashloanReceiver.sol @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: BSD-3-Clause +pragma solidity ^0.8.10; + +import { FlashloanReceiverBase } from "../../Flashloan/base/FlashloanReceiverBase.sol"; +import { ComptrollerInterface } from "../../ComptrollerInterface.sol"; +import { VTokenInterface } from "../../VTokenInterfaces.sol"; +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +/// @title MockFlashloanReceiver +/// @notice A mock implementation of a flashloan receiver contract that interacts with the Comptroller to request and handle flash loans. +/// @dev This contract extends `FlashloanReceiverBase` and implements custom logic to request flash loans and repay them. +contract MockFlashloanReceiver is FlashloanReceiverBase { + /** + * @notice Constructor to initialize the flashloan receiver with the Comptroller contract. + * @param comptroller The address of the Comptroller contract used to request flash loans. + */ + constructor(ComptrollerInterface comptroller) FlashloanReceiverBase(comptroller) {} + + /** + * @notice Requests a flash loan from the Comptroller contract. + * @dev This function calls the `executeFlashloan` function from the Comptroller to initiate a flash loan. + * @param assets_ An array of VToken contracts that support flash loans. + * @param amount_ An array of amounts to borrow in the flash loan for each corresponding asset. + */ + function requestFlashloan(VTokenInterface[] calldata assets_, uint256[] memory amount_) external { + address receiver = address(this); // Receiver address is this contract itself + uint256[] memory amount = amount_; // Set the requested amounts + + // Request the flashloan from the Comptroller contract + COMPTROLLER.executeFlashloan(receiver, assets_, amount); + } + + /** + * @notice Executes custom logic after receiving the flash loan. + * @dev This function is called by the Comptroller contract as part of the flashloan process. + * It must repay the loan amount plus the premium for each borrowed asset. + * @param assets The addresses of the VToken contracts for the flash-borrowed assets. + * @param amounts The amounts of each asset borrowed. + * @param premiums The fees for each flash-borrowed asset. + * @param initiator The address that initiated the flash loan. + * @param param Additional encoded parameters passed with the flash loan. + * @return True if the operation succeeds and the debt plus premium is repaid, false otherwise. + */ + function executeOperation( + VTokenInterface[] calldata assets, + uint256[] calldata amounts, + uint256[] calldata premiums, + address initiator, + bytes calldata param + ) external returns (bool) { + // 👇 Your custom logic for the flash loan should be implemented here 👇 + /** YOUR CUSTOM LOGIC HERE */ + // 👆 Your custom logic for the flash loan should be implemented above here 👆 + + // Calculate the total repayment amount (loan amount + premium) for each borrowed asset + uint256 len = assets.length; + for (uint256 k; k < len; ) { + uint256 total = amounts[k] + premiums[k]; + + // Transfer the repayment (amount + premium) back to the VToken contract + IERC20(VTokenInterface(assets[k]).underlying()).transfer(address(VTokenInterface(assets[k])), total); + unchecked { + ++k; + } + } + + // Return true to indicate successful execution of the flash loan operation + return true; + } +} diff --git a/contracts/test/Mocks/MockFlashloanSimpleReceiver.sol b/contracts/test/Mocks/MockFlashloanSimpleReceiver.sol new file mode 100644 index 000000000..a39c19a9a --- /dev/null +++ b/contracts/test/Mocks/MockFlashloanSimpleReceiver.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: BSD-3-Clause +pragma solidity ^0.8.10; + +import { FlashloanSimpleReceiverBase } from "../../Flashloan/base/FlashloanSimpleReceiverBase.sol"; +import { VTokenInterface } from "../../VTokenInterfaces.sol"; +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +/// @title MockFlashloanSimpleReceiver +/// @notice This contract serves as a mock implementation for a flash loan receiver, utilizing the +/// FlashloanSimpleReceiverBase as a foundation. It provides the ability to request a flash loan and +/// defines how the loan is repaid by implementing custom logic in the `executeOperation` function. +contract MockFlashloanSimpleReceiver is FlashloanSimpleReceiverBase { + /** + * @notice Constructor that initializes the flashloan receiver with a reference to the VToken contract. + * @param vToken The address of the VTokenInterface contract that supports flashloan functionality. + */ + constructor(VTokenInterface vToken) FlashloanSimpleReceiverBase(vToken) {} + + /** + * @notice Requests a flash loan from the VToken contract. + * @param amount_ The amount of tokens to borrow through the flash loan. + * @dev This function calls the `executeFlashloan` function of the VToken contract. + */ + function requestFlashloan(uint256 amount_) external { + address receiver = address(this); // Receiver address is this contract itself + uint256 amount = amount_; // Set the requested amount + + // Request the flashloan from the VToken contract + VTOKEN.executeFlashloan(receiver, amount); + } + + /** + * @notice This function is invoked after receiving the flash loan to handle the loan execution. + * @dev Custom logic for the use of the borrowed amount is implemented in this function. + * It is important that the total borrowed amount plus the premium is repaid. + * @param asset The address of the token being borrowed in the flash loan. + * @param amount The amount of tokens borrowed. + * @param premium The fee for the flash loan, typically a small percentage of the borrowed amount. + * @param initiator The address that initiated the flash loan. + * @param param Additional parameters passed along with the flash loan (can be empty). + * @return Returns true if the operation is successful. + */ + function executeOperation( + address asset, + uint256 amount, + uint256 premium, + address initiator, + bytes calldata param + ) external returns (bool) { + // 👇 Your custom logic for the flash loan should be implemented here 👇 + /** YOUR CUSTOM LOGIC HERE */ + // 👆 Your custom logic for the flash loan should be implemented above here 👆 + + // Calculate the total repayment amount (loan amount + premium) + uint256 total = amount + premium; + + // Transfer the total amount (principal + premium) back to the VToken contract to repay the loan + IERC20(asset).transfer(address(VTOKEN), total); + + // Return true to indicate successful execution of the flash loan operation + return true; + } +} diff --git a/tests/hardhat/FlashLoanSimple.ts b/tests/hardhat/FlashLoanSimple.ts new file mode 100644 index 000000000..8459683de --- /dev/null +++ b/tests/hardhat/FlashLoanSimple.ts @@ -0,0 +1,121 @@ +import { MockContract, smock } from "@defi-wonderland/smock"; +import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; +import chai from "chai"; +import { BigNumberish } from "ethers"; +import { formatUnits, parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { SignerWithAddress } from "hardhat-deploy-ethers/signers"; + +import { + ERC20Harness, + MockFlashloanSimpleReceiver, + MockFlashloanSimpleReceiver__factory, + VTokenHarness, +} from "../../typechain"; +import { VTokenTestFixture, preApprove, vTokenTestFixture } from "./util/TokenTestHelpers"; + +const { expect } = chai; +chai.use(smock.matchers); + +const exchangeRate = parseUnits("50000", 18).toBigInt(); +const mintAmount = parseUnits("10000", 18).toBigInt(); +const flashloanAmount = parseUnits("200", 18).toBigInt(); + +async function preMint( + contracts: VTokenTestFixture, + minter: SignerWithAddress, + mintAmount: BigNumberish, + exchangeRate: BigNumberish, +) { + const { comptroller, interestRateModel, underlying, vToken } = contracts; + await preApprove(underlying, vToken, minter, mintAmount, { faucet: true }); + + comptroller.preMintHook.reset(); + + interestRateModel.getBorrowRate.reset(); + interestRateModel.getSupplyRate.reset(); + + const minterAddress = minter.address; + await underlying.harnessSetFailTransferFromAddress(minterAddress, false); + await vToken.harnessSetBalance(minterAddress, 0); + await vToken.harnessSetExchangeRate(exchangeRate); +} + +async function quickMint( + underlying: MockContract, + vToken: VTokenHarness, + minter: SignerWithAddress, + mintAmount: BigNumberish, + opts: { approve?: boolean; exchangeRate?: BigNumberish; faucet?: boolean } = { approve: true, faucet: true }, +) { + // make sure to accrue interest + await vToken.harnessFastForward(1); + + if (opts.approve || opts.approve === undefined) { + await preApprove(underlying, vToken, minter, mintAmount, opts); + } + if (opts.exchangeRate !== undefined) { + await vToken.harnessSetExchangeRate(opts.exchangeRate); + } + return vToken.connect(minter).mint(mintAmount); +} +describe("Flashloan Simple", () => { + let minter: SignerWithAddress; + let admin: SignerWithAddress; + let alice: SignerWithAddress; + let contracts: VTokenTestFixture; + let underlying: MockContract; + let vToken: VTokenHarness; + let mockReceiverSimple: MockFlashloanSimpleReceiver; + + beforeEach(async () => { + [admin, minter, alice] = await ethers.getSigners(); + contracts = await loadFixture(vTokenTestFixture); + ({ vToken, underlying } = contracts); + }); + describe("Flashloan Single Asset", () => { + beforeEach(async () => { + // TODO: Initial Setup + // 1. There should be underlying in the VToken in order to take flashloan (mint underlying supply) + const MockFlashloanSimpleReceiver = await ethers.getContractFactory( + "MockFlashloanSimpleReceiver", + ); + mockReceiverSimple = await MockFlashloanSimpleReceiver.deploy(vToken.address); + await mockReceiverSimple.deployed(); + }); + it("Should revert if the flashloan is not enabled", async () => { + await expect(mockReceiverSimple.requestFlashloan(flashloanAmount)).to.be.revertedWithCustomError( + vToken, + "FlashLoanNotEnabled", + ); + }); + + it("Should be able to toggle flashloan feature", async () => { + await vToken.connect(admin).toggleFlashloan(); + expect(await vToken.isFlashloanEnabled()).to.be.true; + }); + + it("Flashloan for single underlying", async () => { + // Enable flashloan feature + await vToken.connect(admin).toggleFlashloan(); + // Before mint state setup + await preMint(contracts, minter, mintAmount, exchangeRate); + // Now supplying underlying to vToken + await quickMint(underlying, vToken, minter, mintAmount, { + approve: true, + exchangeRate: exchangeRate, + faucet: false, + }); + // Now alice will use the flashloan feature and should have underlying in receiver contract to pay for fee + await underlying.harnessSetBalance(mockReceiverSimple.address, parseUnits("2", 18)); + const balanceBeforeAliceReceiver = await underlying.balanceOf(mockReceiverSimple.address); + console.log(`Underlying Balance Alice's Receiver contract ${formatUnits(balanceBeforeAliceReceiver, "18")}`); + let balanceBeforeVToken = await underlying.balanceOf(vToken.address); + console.log(`Underlying Balance vToken Before Flashloan ${formatUnits(balanceBeforeVToken, "18")}`); + expect(await mockReceiverSimple.VTOKEN()).to.be.equals(vToken.address); + await mockReceiverSimple.connect(alice).requestFlashloan(flashloanAmount); + balanceBeforeVToken = await underlying.balanceOf(vToken.address); + console.log(`Underlying Balance vToken After Flashloan ${formatUnits(balanceBeforeVToken, "18")}`); + }); + }); +}); diff --git a/tests/hardhat/Flashloan.ts b/tests/hardhat/Flashloan.ts new file mode 100644 index 000000000..359213f57 --- /dev/null +++ b/tests/hardhat/Flashloan.ts @@ -0,0 +1,252 @@ +import { FakeContract, MockContract, smock } from "@defi-wonderland/smock"; +import { loadFixture, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import chai from "chai"; +import { BigNumberish } from "ethers"; +import { parseEther, parseUnits } from "ethers/lib/utils"; +import { ethers, upgrades } from "hardhat"; +import { SignerWithAddress } from "hardhat-deploy-ethers/signers"; + +import { convertToUnit } from "../../helpers/utils"; +import { + AccessControlManager, + Comptroller, + ERC20Harness, + InterestRateModel, + MockFlashloanReceiver, + MockFlashloanReceiver__factory, + PoolRegistry, + ProtocolShareReserve, + VTokenHarness, + VTokenHarness__factory, +} from "../../typechain"; +import { makeVToken, mockUnderlying, preApprove } from "./util/TokenTestHelpers"; + +const { expect } = chai; +chai.use(smock.matchers); + +const MAX_LOOP_LIMIT = 150; + +const exchangeRate = parseUnits("50000", 18).toBigInt(); +const flashloanAmount1 = parseUnits("1000", 18).toBigInt(); +const flashloanAmount2 = parseUnits("2000", 18).toBigInt(); +const mintAmount1 = parseUnits("5000", 18).toBigInt(); +const mintAmount2 = parseUnits("5000", 18).toBigInt(); + +// Declare the types here +type FlashloanContractsFixture = { + accessControlManager: FakeContract; + protocolShareReserve: FakeContract; + interestRateModel: FakeContract; + poolRegistry: FakeContract; + comptroller: Comptroller; + underlyingA: MockContract; + underlyingB: MockContract; + VTokenA: VTokenHarness; + VTokenB: VTokenHarness; +}; + +async function preMint( + contracts: FlashloanContractsFixture, + minter: SignerWithAddress, + mintAmountA: BigNumberish, + mintAmountB: BigNumberish, + exchangeRate: BigNumberish, +) { + const { interestRateModel, underlyingA, underlyingB, VTokenA, VTokenB } = contracts; + await preApprove(underlyingA, VTokenA, minter, mintAmountA, { faucet: true }); + await preApprove(underlyingB, VTokenB, minter, mintAmountB, { faucet: true }); + + // await comptroller.premintHook.reset + interestRateModel.getBorrowRate.reset(); + interestRateModel.getSupplyRate.reset(); + + const minterAddress = minter.address; + await underlyingA.harnessSetFailTransferFromAddress(minterAddress, false); + await underlyingB.harnessSetFailTransferFromAddress(minterAddress, false); + await VTokenA.harnessSetBalance(minterAddress, 0); + await VTokenB.harnessSetBalance(minterAddress, 0); + await VTokenA.harnessSetExchangeRate(exchangeRate); + await VTokenB.harnessSetExchangeRate(exchangeRate); +} + +async function quickMint( + underlying: MockContract, + vToken: VTokenHarness, + minter: SignerWithAddress, + mintAmount: BigNumberish, + opts: { approve?: boolean; exchangeRate?: BigNumberish; faucet?: boolean } = { approve: true, faucet: true }, +) { + // make sure to accrue interest + await vToken.harnessFastForward(1); + + if (opts.approve || opts.approve === undefined) { + await preApprove(underlying, vToken, minter, mintAmount, opts); + } + if (opts.exchangeRate !== undefined) { + await vToken.harnessSetExchangeRate(opts.exchangeRate); + } + return vToken.connect(minter).mint(mintAmount); +} + +// Create a fixture will deploy all the required contracts for flashloan +const flashLoanTestFixture = async (): Promise => { + const [admin] = await ethers.getSigners(); + const accessControlManager = await smock.fake("AccessControlManager"); + accessControlManager.isAllowedToCall.returns(true); + const protocolShareReserve = await smock.fake("ProtocolShareReserve"); + const interestRateModel = await smock.fake("InterestRateModel"); + interestRateModel.isInterestRateModel.returns(true); + + const poolRegistry = await smock.fake("PoolRegistry"); + + const underlyingA = await mockUnderlying("Mock AAVE", "AAVE"); + const underlyingB = await mockUnderlying("Mock UNI", "UNI"); + + const Comptroller = await ethers.getContractFactory("Comptroller"); + const comptrollerBeacon = await upgrades.deployBeacon(Comptroller, { constructorArgs: [poolRegistry.address] }); + + const comptroller = await upgrades.deployBeaconProxy(comptrollerBeacon, Comptroller, [ + MAX_LOOP_LIMIT, + accessControlManager.address, + ]); + + const VTokenA = await makeVToken( + { + underlying: underlyingA, + comptroller, + accessControlManager, + admin, + interestRateModel, + protocolShareReserve, + }, + { kind: "VTokenHarness" }, + ); + + const VTokenB = await makeVToken( + { + underlying: underlyingB, + comptroller, + accessControlManager, + admin, + interestRateModel, + protocolShareReserve, + }, + { kind: "VTokenHarness" }, + ); + + console.log(`Market Name and Address ${await VTokenA.name()} & ${VTokenA.address}`); + console.log(`Market Name and Address ${await VTokenB.name()} & ${VTokenB.address}`); + + await comptroller.setMarketSupplyCaps( + [VTokenA.address, VTokenB.address], + [convertToUnit(1, 50), convertToUnit(1, 50)], + ); + + await setBalance(poolRegistry.address, parseEther("1")); + await comptroller.connect(poolRegistry.wallet).supportMarket(VTokenA.address); + await comptroller.connect(poolRegistry.wallet).supportMarket(VTokenB.address); + + // await comptroller.enterMarkets([VTokenA.address, VTokenB.address]); + return { + accessControlManager, + protocolShareReserve, + interestRateModel, + poolRegistry, + comptroller, + underlyingA, + underlyingB, + VTokenA, + VTokenB, + }; +}; + +describe("Flashloan", async () => { + let admin: SignerWithAddress; + let minter: SignerWithAddress; + let alice: SignerWithAddress; + let contracts: FlashloanContractsFixture; + let VTokenA: VTokenHarness; + let VTokenB: VTokenHarness; + let underlyingA: MockContract; + let underlyingB: MockContract; + let comptroller: Comptroller; + let mockReceiverContract: MockFlashloanReceiver; + + beforeEach(async () => { + [admin, minter, alice] = await ethers.getSigners(); + contracts = await loadFixture(flashLoanTestFixture); + ({ comptroller, VTokenA, VTokenB, underlyingA, underlyingB } = contracts); + }); + + describe("Flashloan Multi-Assets", async () => { + beforeEach(async () => { + const MockFlashloanReceiver = await ethers.getContractFactory( + "MockFlashloanReceiver", + ); + mockReceiverContract = await MockFlashloanReceiver.deploy(comptroller.address); + await mockReceiverContract.deployed(); + }); + + it("Should revert if flashloan is not enabled", async () => { + await expect( + mockReceiverContract.requestFlashloan( + [VTokenA.address.toString(), VTokenB.address.toString()], + [flashloanAmount1, flashloanAmount2], + ), + ).to.be.revertedWithCustomError(comptroller, "FlashLoanNotEnabled"); + }); + + it("Should be able to toggle flashloan feature", async () => { + await VTokenA.connect(admin).toggleFlashloan(); + await VTokenB.connect(admin).toggleFlashloan(); + expect(await VTokenA.isFlashloanEnabled()).to.be.true; + expect(await VTokenB.isFlashloanEnabled()).to.be.true; + }); + + it("Flashloan for multiple underlying", async () => { + // Admin Enable flashLoan for multiple vToken + await VTokenA.toggleFlashloan(); + expect(await VTokenA.isFlashloanEnabled()).to.be.true; + await VTokenB.toggleFlashloan(); + expect(await VTokenB.isFlashloanEnabled()).to.be.true; + + // Before Mint State Setup we need to mint for multiple vToken + await preMint(contracts, minter, mintAmount1, mintAmount2, exchangeRate); + + // Now supplying underlying to VToken1 + await quickMint(underlyingA, VTokenA, minter, mintAmount1, { approve: true, exchangeRate, faucet: false }); + await quickMint(underlyingB, VTokenB, minter, mintAmount2, { approve: true, exchangeRate, faucet: false }); + + // Set the balance of mockReceiver in order to pay for flashloan fee + await underlyingA.harnessSetBalance(mockReceiverContract.address, parseUnits("10", 18)); + await underlyingB.harnessSetBalance(mockReceiverContract.address, parseUnits("20", 18)); + + // Get the balance before the flashloan + const beforeBalanceA = await underlyingA.balanceOf(mockReceiverContract.address); + const beforeBalanceB = await underlyingA.balanceOf(mockReceiverContract.address); + + console.log( + `Underlying Balances Alice Receiver Contract ${beforeBalanceA.toString()} & ${beforeBalanceB.toString()}`, + ); + + // Execute the flashloan from the mockReceiverContract + await mockReceiverContract + .connect(alice) + .requestFlashloan( + [VTokenA.address.toString(), VTokenB.address.toString()], + [flashloanAmount1, flashloanAmount2], + ); + + // Get the balance after the flashloan + const afterBalanceA = await underlyingA.balanceOf(mockReceiverContract.address); + const afterBalanceB = await underlyingA.balanceOf(mockReceiverContract.address); + + console.log( + `Underlying Balances Alice Receiver Contract ${afterBalanceA.toString()} & ${afterBalanceB.toString()}`, + ); + + expect(afterBalanceA).to.be.equal(0); + expect(afterBalanceB).to.be.equal(0); + }); + }); +}); diff --git a/tests/hardhat/util/TokenTestHelpers.ts b/tests/hardhat/util/TokenTestHelpers.ts index bbb3f22d7..64b6a0e11 100644 --- a/tests/hardhat/util/TokenTestHelpers.ts +++ b/tests/hardhat/util/TokenTestHelpers.ts @@ -38,6 +38,8 @@ interface VTokenParameters { isTimeBased: boolean; blocksPerYear: BigNumberish; maxBorrowRateMantissa: BigNumberish; + isFlashloanEnabled: boolean; + flashloanFeeMantissa: BigNumberish; } const getNameAndSymbol = async (underlying: AddressOrContract): Promise<[string, string]> => { @@ -109,6 +111,8 @@ const deployVTokenDependencies = async ( @@ -145,6 +149,8 @@ export const makeVToken = async ; return vToken; From 64c01dd8ab24e84b5b891ac0caf561ed56313296 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Tue, 24 Dec 2024 16:50:47 +0530 Subject: [PATCH 06/15] test: refactor tests for the single asset flashloan --- contracts/VToken.sol | 4 +- contracts/VTokenInterfaces.sol | 4 +- tests/hardhat/FlashLoanSimple.ts | 121 ------------------ tests/hardhat/Tokens/flashLoanSimple.ts | 163 ++++++++++++++++++++++++ 4 files changed, 167 insertions(+), 125 deletions(-) delete mode 100644 tests/hardhat/FlashLoanSimple.ts create mode 100644 tests/hardhat/Tokens/flashLoanSimple.ts diff --git a/contracts/VToken.sol b/contracts/VToken.sol index 34a846b26..531900944 100644 --- a/contracts/VToken.sol +++ b/contracts/VToken.sol @@ -789,12 +789,12 @@ contract VToken is /** * @notice Update flashloan fee mantissa * @custom:access Only Governance - * @custom:event Emits FLashloanFeeUpdated event on success + * @custom:event Emits FlashloanFeeUpdated event on success */ function setFlashloanFeeMantissa(uint256 fee) external override { _checkAccessAllowed("setFlashloanFeeMantissa(uint256)"); - emit FLashloanFeeUpdated(flashloanFeeMantissa, fee); + emit FlashloanFeeUpdated(flashloanFeeMantissa, fee); flashloanFeeMantissa = fee; } diff --git a/contracts/VTokenInterfaces.sol b/contracts/VTokenInterfaces.sol index 878496536..ddee1e6b1 100644 --- a/contracts/VTokenInterfaces.sol +++ b/contracts/VTokenInterfaces.sol @@ -146,7 +146,7 @@ contract VTokenStorage { * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ - uint256[47] private __gap; + uint256[46] private __gap; } /** @@ -316,7 +316,7 @@ abstract contract VTokenInterface is VTokenStorage { /** * @notice Event emitted when flashloan fee mantissa is updated */ - event FLashloanFeeUpdated(uint256 oldFee, uint256 fee); + event FlashloanFeeUpdated(uint256 oldFee, uint256 fee); /*** User Interface ***/ diff --git a/tests/hardhat/FlashLoanSimple.ts b/tests/hardhat/FlashLoanSimple.ts deleted file mode 100644 index 8459683de..000000000 --- a/tests/hardhat/FlashLoanSimple.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { MockContract, smock } from "@defi-wonderland/smock"; -import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; -import chai from "chai"; -import { BigNumberish } from "ethers"; -import { formatUnits, parseUnits } from "ethers/lib/utils"; -import { ethers } from "hardhat"; -import { SignerWithAddress } from "hardhat-deploy-ethers/signers"; - -import { - ERC20Harness, - MockFlashloanSimpleReceiver, - MockFlashloanSimpleReceiver__factory, - VTokenHarness, -} from "../../typechain"; -import { VTokenTestFixture, preApprove, vTokenTestFixture } from "./util/TokenTestHelpers"; - -const { expect } = chai; -chai.use(smock.matchers); - -const exchangeRate = parseUnits("50000", 18).toBigInt(); -const mintAmount = parseUnits("10000", 18).toBigInt(); -const flashloanAmount = parseUnits("200", 18).toBigInt(); - -async function preMint( - contracts: VTokenTestFixture, - minter: SignerWithAddress, - mintAmount: BigNumberish, - exchangeRate: BigNumberish, -) { - const { comptroller, interestRateModel, underlying, vToken } = contracts; - await preApprove(underlying, vToken, minter, mintAmount, { faucet: true }); - - comptroller.preMintHook.reset(); - - interestRateModel.getBorrowRate.reset(); - interestRateModel.getSupplyRate.reset(); - - const minterAddress = minter.address; - await underlying.harnessSetFailTransferFromAddress(minterAddress, false); - await vToken.harnessSetBalance(minterAddress, 0); - await vToken.harnessSetExchangeRate(exchangeRate); -} - -async function quickMint( - underlying: MockContract, - vToken: VTokenHarness, - minter: SignerWithAddress, - mintAmount: BigNumberish, - opts: { approve?: boolean; exchangeRate?: BigNumberish; faucet?: boolean } = { approve: true, faucet: true }, -) { - // make sure to accrue interest - await vToken.harnessFastForward(1); - - if (opts.approve || opts.approve === undefined) { - await preApprove(underlying, vToken, minter, mintAmount, opts); - } - if (opts.exchangeRate !== undefined) { - await vToken.harnessSetExchangeRate(opts.exchangeRate); - } - return vToken.connect(minter).mint(mintAmount); -} -describe("Flashloan Simple", () => { - let minter: SignerWithAddress; - let admin: SignerWithAddress; - let alice: SignerWithAddress; - let contracts: VTokenTestFixture; - let underlying: MockContract; - let vToken: VTokenHarness; - let mockReceiverSimple: MockFlashloanSimpleReceiver; - - beforeEach(async () => { - [admin, minter, alice] = await ethers.getSigners(); - contracts = await loadFixture(vTokenTestFixture); - ({ vToken, underlying } = contracts); - }); - describe("Flashloan Single Asset", () => { - beforeEach(async () => { - // TODO: Initial Setup - // 1. There should be underlying in the VToken in order to take flashloan (mint underlying supply) - const MockFlashloanSimpleReceiver = await ethers.getContractFactory( - "MockFlashloanSimpleReceiver", - ); - mockReceiverSimple = await MockFlashloanSimpleReceiver.deploy(vToken.address); - await mockReceiverSimple.deployed(); - }); - it("Should revert if the flashloan is not enabled", async () => { - await expect(mockReceiverSimple.requestFlashloan(flashloanAmount)).to.be.revertedWithCustomError( - vToken, - "FlashLoanNotEnabled", - ); - }); - - it("Should be able to toggle flashloan feature", async () => { - await vToken.connect(admin).toggleFlashloan(); - expect(await vToken.isFlashloanEnabled()).to.be.true; - }); - - it("Flashloan for single underlying", async () => { - // Enable flashloan feature - await vToken.connect(admin).toggleFlashloan(); - // Before mint state setup - await preMint(contracts, minter, mintAmount, exchangeRate); - // Now supplying underlying to vToken - await quickMint(underlying, vToken, minter, mintAmount, { - approve: true, - exchangeRate: exchangeRate, - faucet: false, - }); - // Now alice will use the flashloan feature and should have underlying in receiver contract to pay for fee - await underlying.harnessSetBalance(mockReceiverSimple.address, parseUnits("2", 18)); - const balanceBeforeAliceReceiver = await underlying.balanceOf(mockReceiverSimple.address); - console.log(`Underlying Balance Alice's Receiver contract ${formatUnits(balanceBeforeAliceReceiver, "18")}`); - let balanceBeforeVToken = await underlying.balanceOf(vToken.address); - console.log(`Underlying Balance vToken Before Flashloan ${formatUnits(balanceBeforeVToken, "18")}`); - expect(await mockReceiverSimple.VTOKEN()).to.be.equals(vToken.address); - await mockReceiverSimple.connect(alice).requestFlashloan(flashloanAmount); - balanceBeforeVToken = await underlying.balanceOf(vToken.address); - console.log(`Underlying Balance vToken After Flashloan ${formatUnits(balanceBeforeVToken, "18")}`); - }); - }); -}); diff --git a/tests/hardhat/Tokens/flashLoanSimple.ts b/tests/hardhat/Tokens/flashLoanSimple.ts new file mode 100644 index 000000000..090d5b381 --- /dev/null +++ b/tests/hardhat/Tokens/flashLoanSimple.ts @@ -0,0 +1,163 @@ +import { FakeContract, MockContract, smock } from "@defi-wonderland/smock"; +import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; +import chai from "chai"; +import { BigNumber } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { SignerWithAddress } from "hardhat-deploy-ethers/signers"; + +import { + AccessControlManager, + Comptroller, + ERC20Harness, + MockFlashloanSimpleReceiver, + MockFlashloanSimpleReceiver__factory, + VTokenHarness, +} from "../../../typechain"; +import { initMainnetUser } from "../Fork/utils"; +import { VTokenTestFixture, vTokenTestFixture } from "../util/TokenTestHelpers"; + +const { expect } = chai; +chai.use(smock.matchers); + +const flashloanAmount = parseUnits("2", 18).toBigInt(); +const feeMantissa = parseUnits("0.01", 18); + +describe.only("Flashloan Simple", () => { + let minter: SignerWithAddress; + let alice: SignerWithAddress; + let receiver: SignerWithAddress; + let acmUser: SignerWithAddress; + let contracts: VTokenTestFixture; + let underlying: MockContract; + let vToken: VTokenHarness; + let mockReceiverSimple: MockFlashloanSimpleReceiver; + let accessControlManager: FakeContract; + let comptroller: FakeContract; + let comptrollerSigner: SignerWithAddress; + + beforeEach(async () => { + [admin, minter, alice, acmUser, receiver] = await ethers.getSigners(); + contracts = await loadFixture(vTokenTestFixture); + ({ vToken, underlying, accessControlManager, comptroller } = contracts); + comptrollerSigner = await initMainnetUser(comptroller.address, ethers.utils.parseUnits("2")); + }); + + describe("Enable/disable flash loan feature", () => { + it("Should have access to toggle falsh loan feature", async () => { + accessControlManager.isAllowedToCall.returns(false); + + expect(await vToken.isFlashloanEnabled()).to.be.false; + await expect(vToken.connect(acmUser).toggleFlashloan()).to.be.revertedWithCustomError(vToken, "Unauthorized"); + expect(await vToken.isFlashloanEnabled()).to.be.false; + }); + + it("Enable flashloan feature", async () => { + accessControlManager.isAllowedToCall.returns(true); + + expect(await vToken.isFlashloanEnabled()).to.be.false; + await vToken.connect(acmUser).toggleFlashloan(); + expect(await vToken.isFlashloanEnabled()).to.be.true; + }); + + it("Disable flashloan feature", async () => { + expect(await vToken.isFlashloanEnabled()).to.be.false; + await vToken.connect(acmUser).toggleFlashloan(); + expect(await vToken.isFlashloanEnabled()).to.be.true; + + await vToken.connect(acmUser).toggleFlashloan(); + expect(await vToken.isFlashloanEnabled()).to.be.false; + }); + + it("Emit ToggleFlashloanEnabled event on toggle flashloan feature", async () => { + let result = await vToken.connect(acmUser).toggleFlashloan(); + await expect(result).to.emit(vToken, "ToggleFlashloanEnabled").withArgs(false, true); + + result = await vToken.connect(acmUser).toggleFlashloan(); + await expect(result).to.emit(vToken, "ToggleFlashloanEnabled").withArgs(true, false); + }); + }); + + describe("Set fee on flashloan", () => { + it("Should have access to set fee on flashloan", async () => { + accessControlManager.isAllowedToCall.returns(false); + + await expect(vToken.connect(acmUser).setFlashloanFeeMantissa(feeMantissa)).to.be.revertedWithCustomError( + vToken, + "Unauthorized", + ); + }); + + it("Set fee on flashloan", async () => { + accessControlManager.isAllowedToCall.returns(true); + + await vToken.connect(acmUser).setFlashloanFeeMantissa(feeMantissa); + expect(await vToken.flashloanFeeMantissa()).to.be.equal(feeMantissa); + }); + + it("Emit FlashloanFeeUpdated event on set fee on flashloan", async () => { + const result = await vToken.connect(acmUser).setFlashloanFeeMantissa(feeMantissa); + await expect(result).to.emit(vToken, "FlashloanFeeUpdated").withArgs(0, feeMantissa); + }); + }); + + describe("Transfer underlying assets to receiver contract", () => { + beforeEach(async () => { + await underlying.harnessSetBalance(vToken.address, parseUnits("1", 18)); + }); + + it("Revert if not comptroller", async () => { + await expect( + vToken.connect(acmUser).transferUnderlying(minter.address, parseUnits("1", 18)), + ).to.be.revertedWithCustomError(vToken, "InvalidComptroller"); + }); + + it("Only comptroller can transfer underlying assets to receiver contract", async () => { + await vToken.connect(comptrollerSigner).transferUnderlying(minter.address, parseUnits("1", 18)); + expect(await underlying.balanceOf(minter.address)).to.be.equal(parseUnits("1", 18)); + }); + + it("Emit TransferUnderlying event on transfer underlying assets to receiver contract", async () => { + const result = await vToken.connect(comptrollerSigner).transferUnderlying(receiver.address, parseUnits("1", 18)); + await expect(result) + .to.emit(vToken, "FlashloanAmountTransferred") + .withArgs(underlying.address, receiver.address, parseUnits("1", 18)); + }); + }); + + describe("Flashloan Single Asset", () => { + beforeEach(async () => { + const MockFlashloanSimpleReceiver = await ethers.getContractFactory( + "MockFlashloanSimpleReceiver", + ); + mockReceiverSimple = await MockFlashloanSimpleReceiver.deploy(vToken.address); + await mockReceiverSimple.deployed(); + + await vToken.connect(acmUser).setFlashloanFeeMantissa(feeMantissa); + await underlying.harnessSetBalance(mockReceiverSimple.address, parseUnits("1", 18)); + await underlying.harnessSetBalance(vToken.address, parseUnits("10", 18)); + }); + + it("Should revert if the flashloan is not enabled", async () => { + await expect(mockReceiverSimple.requestFlashloan(flashloanAmount)).to.be.revertedWithCustomError( + vToken, + "FlashLoanNotEnabled", + ); + }); + + it("Flashloan for single underlying", async () => { + await vToken.connect(acmUser).toggleFlashloan(); + + const balanceBeforeflashLoan = await underlying.balanceOf(vToken.address); + const flashloan = await mockReceiverSimple.connect(alice).requestFlashloan(flashloanAmount); + const balanceAfterflashLoan = await underlying.balanceOf(vToken.address); + + const fee = BigNumber.from(flashloanAmount).mul(feeMantissa).div(parseUnits("1", 18)); + + expect(balanceAfterflashLoan).to.be.equal(balanceBeforeflashLoan.add(fee)); + await expect(flashloan) + .to.emit(vToken, "FlashloanExecuted") + .withArgs(mockReceiverSimple.address, underlying.address, flashloanAmount); + }); + }); +}); From 82b0fc8ee07fb0763088e59173cfeb5b7cadbcec Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Thu, 26 Dec 2024 14:41:55 +0530 Subject: [PATCH 07/15] refactor: flash loan functionality to reduce comptroller size --- contracts/Comptroller.sol | 22 +++---------- contracts/VToken.sol | 58 +++++++++++++++++++++++++++------- contracts/VTokenInterfaces.sol | 9 +++++- 3 files changed, 58 insertions(+), 31 deletions(-) diff --git a/contracts/Comptroller.sol b/contracts/Comptroller.sol index 5a96cb6da..8842fd2ec 100644 --- a/contracts/Comptroller.sol +++ b/contracts/Comptroller.sol @@ -967,24 +967,15 @@ contract Comptroller is revert InvalidFlashloanParams(); } - IFlashloanReceiver receiverContract = IFlashloanReceiver(receiver); uint256 len = assets.length; uint256[] memory fees = new uint256[](len); uint256[] memory balanceBefore = new uint256[](len); for (uint256 j; j < len; ) { - // Revert if flashloan is not enabled - if (!(assets[j]).isFlashloanEnabled()) { - revert FlashLoanNotEnabled(address(assets[j])); - } - - uint256 assetFlashloanFee = (assets[j]).flashloanFeeMantissa(); - fees[j] = (amounts[j] * assetFlashloanFee) / MANTISSA_ONE; + (fees[j], ) = (assets[j]).calculateFee(receiver, amounts[j]); // Transfer the asset - (assets[j]).transferUnderlying(receiver, amounts[j]); - - balanceBefore[j] = (assets[j]).getCash(); + (balanceBefore[j]) = (assets[j]).transferUnderlying(receiver, amounts[j]); unchecked { ++j; @@ -992,17 +983,12 @@ contract Comptroller is } // Call the execute operation on receiver contract - if (!receiverContract.executeOperation(assets, amounts, fees, receiver, "")) { + if (!IFlashloanReceiver(receiver).executeOperation(assets, amounts, fees, receiver, "")) { revert ExecuteFlashloanFailed(); } for (uint256 k; k < len; ) { - uint256 balanceAfter = (assets[k]).getCash(); - - // balanceAfter should be greater than the fee calculated - if ((balanceAfter - balanceBefore[k]) < (amounts[k] + fees[k])) { - revert InsufficientReypaymentBalance(address(assets[k])); - } + (assets[k]).verifyBalance(balanceBefore[k], amounts[k] + fees[k]); unchecked { ++k; diff --git a/contracts/VToken.sol b/contracts/VToken.sol index 531900944..b8256f0fa 100644 --- a/contracts/VToken.sol +++ b/contracts/VToken.sol @@ -715,13 +715,17 @@ contract VToken is * - Reverts with "Only Comptroller" if the caller is not the Comptroller. * @custom:event Emits FlashloanAmountTransferred event on successful transfer of amount to receiver */ - function transferUnderlying(address to, uint256 amount) external override nonReentrant { + function transferUnderlying( + address to, + uint256 amount + ) external override nonReentrant returns (uint256 balanceBefore) { if (msg.sender != address(comptroller)) { revert InvalidComptroller(address(comptroller)); } _doTransferOut(to, amount); + balanceBefore = _getCashPrior(); emit FlashloanAmountTransferred(underlying, to, amount); } @@ -744,14 +748,12 @@ contract VToken is * @custom:event Emits FlashloanExecuted event on success */ function executeFlashloan(address receiver, uint256 amount) external override nonReentrant returns (uint256) { - if (!isFlashloanEnabled) revert FlashLoanNotEnabled(address(this)); - ensureNonzeroAddress(receiver); + uint256 repaymentAmount; + uint256 fee; + (fee, repaymentAmount) = calculateFee(receiver, amount); IFlashloanSimpleReceiver receiverContract = IFlashloanSimpleReceiver(receiver); - uint256 fee = (amount * flashloanFeeMantissa) / MANTISSA_ONE; - uint256 totalRepayment = amount + fee; - // Transfer the underlying asset to the receiver. _doTransferOut(receiver, amount); @@ -762,12 +764,7 @@ contract VToken is revert ExecuteFlashloanFailed(); } - uint256 balanceAfter = _getCashPrior(); - - // balanceAfter should be greater than the fee calculated - if ((balanceAfter - balanceBefore) < totalRepayment) { - revert InsufficientReypaymentBalance(underlying); - } + verifyBalance(balanceBefore, repaymentAmount); emit FlashloanExecuted(receiver, underlying, amount); @@ -984,6 +981,43 @@ contract VToken is return NO_ERROR; } + /** + * @notice Calculates the fee and repayment amount for a flash loan. + * @param receiver The address of the receiver of the flash loan. + * @param amount The amount of the flash loan. + * @return fee The calculated fee for the flash loan. + * @return repaymentAmount The total amount to be repaid (amount + fee). + * @dev This function reverts if flash loans are not enabled. + */ + function calculateFee( + address receiver, + uint256 amount + ) public view override returns (uint256 fee, uint256 repaymentAmount) { + if (!isFlashloanEnabled) revert FlashLoanNotEnabled(address(this)); + ensureNonzeroAddress(receiver); + + fee = (amount * flashloanFeeMantissa) / MANTISSA_ONE; + repaymentAmount = amount + fee; + } + + /** + * @notice Verifies that the balance after a flash loan is sufficient to cover the repayment amount. + * @param balanceBefore The balance before the flash loan. + * @param repaymentAmount The total amount to be repaid (amount + fee). + * @return NO_ERROR Indicates that the balance verification was successful. + * @dev This function reverts if the balance after the flash loan is insufficient to cover the repayment amount. + */ + function verifyBalance(uint256 balanceBefore, uint256 repaymentAmount) public view override returns (uint256) { + uint256 balanceAfter = _getCashPrior(); + + // balanceAfter should be greater than the fee calculated + if ((balanceAfter - balanceBefore) < repaymentAmount) { + revert InsufficientReypaymentBalance(underlying); + } + + return NO_ERROR; + } + /** * @notice User supplies assets into the market and receives vTokens in exchange * @dev Assumes interest has already been accrued up to the current block or timestamp diff --git a/contracts/VTokenInterfaces.sol b/contracts/VTokenInterfaces.sol index ddee1e6b1..cec499098 100644 --- a/contracts/VTokenInterfaces.sol +++ b/contracts/VTokenInterfaces.sol @@ -366,7 +366,7 @@ abstract contract VTokenInterface is VTokenStorage { function sweepToken(IERC20Upgradeable token) external virtual; - function transferUnderlying(address receiver, uint256 amount) external virtual; + function transferUnderlying(address receiver, uint256 amount) external virtual returns (uint256 balanceBefore); function executeFlashloan(address receiver, uint256 amount) external virtual returns (uint256); @@ -421,4 +421,11 @@ abstract contract VTokenInterface is VTokenStorage { function isVToken() external pure virtual returns (bool) { return true; } + + function calculateFee( + address receiver, + uint256 amount + ) public view virtual returns (uint256 fee, uint256 repaymentAmount); + + function verifyBalance(uint256 balanceBefore, uint256 repaymentAmount) public view virtual returns (uint256); } From 008e135bca84aa9b1632abe7589949c397f9752f Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Thu, 26 Dec 2024 14:52:15 +0530 Subject: [PATCH 08/15] chore: update deployment config and script to allow flashloan in vtokens --- deploy/009-deploy-vtokens.ts | 2 + helpers/deploymentConfig.ts | 173 ++++++++++++++++++++++++ tests/hardhat/Tokens/flashLoanSimple.ts | 2 +- 3 files changed, 176 insertions(+), 1 deletion(-) diff --git a/deploy/009-deploy-vtokens.ts b/deploy/009-deploy-vtokens.ts index d7c6b9fce..39e1ac579 100644 --- a/deploy/009-deploy-vtokens.ts +++ b/deploy/009-deploy-vtokens.ts @@ -64,6 +64,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { jumpMultiplierPerYear, kink_, reserveFactor, + isFlashloanAllowed, } = vtoken; const token = getTokenConfig(asset, tokensConfig); @@ -143,6 +144,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { accessControlManagerAddress, [AddressOne, protocolShareReserveAddress], reserveFactor, + isFlashloanAllowed, ]; await deploy(`VToken_${symbol}`, { from: deployer, diff --git a/helpers/deploymentConfig.ts b/helpers/deploymentConfig.ts index da78b93b2..3fe5f6fb4 100644 --- a/helpers/deploymentConfig.ts +++ b/helpers/deploymentConfig.ts @@ -108,6 +108,7 @@ export type VTokenConfig = { borrowCap: string; vTokenReceiver: string; reduceReservesBlockDelta: string; + isFlashloanAllowed: boolean; }; export type AccessControlEntry = { @@ -473,6 +474,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(478980, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus BTCB", @@ -491,6 +493,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1000, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -532,6 +535,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3000000, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus ankrBNB", @@ -550,6 +554,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(100, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus MBOX", @@ -568,6 +573,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3184294, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus NFT", @@ -586,6 +592,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(24654278679, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus RACA", @@ -604,6 +611,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3805812642, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus stkBNB", @@ -622,6 +630,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(324, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDD", @@ -640,6 +649,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1698253, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -927,6 +937,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(200_000, 18), vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDT (Stable Coins)", @@ -945,6 +956,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(400_000, 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDD (Stable Coins)", @@ -963,6 +975,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(400_000, 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus agEUR (Stablecoins)", @@ -981,6 +994,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(50000, 18), vTokenReceiver: "0xc444949e0054a23c44fc45789738bdf64aed2391", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -1028,6 +1042,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("10500000", 18), vTokenReceiver: "0x109E8083a64c7DedE513e8b580c5b08B96f9cE73", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus ALPACA (DeFi)", @@ -1046,6 +1061,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1750000", 18), vTokenReceiver: "0xAD9CADe20100B8b945da48e1bCbd805C38d8bE77", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDT (DeFi)", @@ -1064,6 +1080,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDD (DeFi)", @@ -1082,6 +1099,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus ANKR (DeFi)", @@ -1100,6 +1118,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("6656161", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus ankrBNB (DeFi)", @@ -1118,6 +1137,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("4000", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus PLANET (DeFi)", @@ -1136,6 +1156,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500000000", 18), vTokenReceiver: "0x0554d6079eBc222AD12405E52b264Bdb5B65D1cf", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus TWT (DeFi)", @@ -1154,6 +1175,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500000", 18), vTokenReceiver: "0x0848dB7cB495E7b9aDA1D4dC972b9A526D014D84", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -1201,6 +1223,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2800000000", 18), vTokenReceiver: "0x6Ee74536B3Ff10Ff639aa781B7220121287F6Fa5", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus FLOKI (GameFi)", @@ -1219,6 +1242,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("28000000000", 18), // FLOKI has 18 decimals on testnet vTokenReceiver: "0x17e98a24f992BB7bcd62d6722d714A3C74814B94", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDT (GameFi)", @@ -1237,6 +1261,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDD (GameFi)", @@ -1255,6 +1280,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -1296,6 +1322,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("5600", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus BNBx (Liquid Staked BNB)", @@ -1314,6 +1341,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1272", 18), vTokenReceiver: "0xF0348E1748FCD45020151C097D234DbbD5730BE7", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus stkBNB (Liquid Staked BNB)", @@ -1332,6 +1360,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("378", 18), vTokenReceiver: "0xccc022502d6c65e1166fd34147040f05880f7972", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus WBNB (Liquid Staked BNB)", @@ -1350,6 +1379,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("56000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDT (Liquid Staked BNB)", @@ -1368,6 +1398,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDD (Liquid Staked BNB)", @@ -1386,6 +1417,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus SnBNB (Liquid Staked BNB)", @@ -1404,6 +1436,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("100", 18), vTokenReceiver: "0xDC2D855A95Ee70d7282BebD35c96f905CDE31f55", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -1463,6 +1496,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1050000000000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus NFT (Tron)", @@ -1481,6 +1515,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2800000000", 18), // NFT has 18 decimals on testnet vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus WIN (Tron)", @@ -1499,6 +1534,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2100000000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus TRX (Tron)", @@ -1517,6 +1553,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("7700000", 6), // Note 6 decimals vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDT (Tron)", @@ -1535,6 +1572,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDD (Tron)", @@ -1553,6 +1591,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -1606,6 +1645,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("800000000000000", 9), vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDT (Meme)", @@ -1624,6 +1664,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("900000", 6), vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -1659,6 +1700,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("5", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus weETH (Liquid Staked ETH)", @@ -1677,6 +1719,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("200", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus ETH (Liquid Staked ETH)", @@ -1695,6 +1738,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("400", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [], @@ -1925,6 +1969,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(200_000, 18), vTokenReceiver: "0x09702Ea135d9D707DD51f530864f2B9220aAD87B", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDT (Stablecoins)", @@ -1943,6 +1988,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(400_000, 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDD (Stablecoins)", @@ -1961,6 +2007,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(400_000, 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus agEUR (Stablecoins)", @@ -1979,6 +2026,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(50000, 18), vTokenReceiver: "0xc444949e0054a23c44fc45789738bdf64aed2391", // community wallet reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, ], rewards: [ @@ -2026,6 +2074,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("10500000", 18), vTokenReceiver: "0x109E8083a64c7DedE513e8b580c5b08B96f9cE73", // biswap team treasury reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus ALPACA (DeFi)", @@ -2044,6 +2093,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1750000", 18), vTokenReceiver: "0xAD9CADe20100B8b945da48e1bCbd805C38d8bE77", // alpaca team treasury reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDT (DeFi)", @@ -2062,6 +2112,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDD (DeFi)", @@ -2080,6 +2131,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", // tron ecosystem treasury reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus ANKR (DeFi)", @@ -2098,6 +2150,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("6656161", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", // ankr team treasury reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { @@ -2117,6 +2170,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("4000", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", // ankr team treasury reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus PLANET (DeFi)", @@ -2135,6 +2189,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500000000", 18), vTokenReceiver: "0x0554d6079eBc222AD12405E52b264Bdb5B65D1cf", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus TWT (DeFi)", @@ -2153,6 +2208,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500000", 18), vTokenReceiver: "0x0848dB7cB495E7b9aDA1D4dC972b9A526D014D84", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, ], rewards: [ @@ -2201,6 +2257,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2800000000", 18), vTokenReceiver: "0x6Ee74536B3Ff10Ff639aa781B7220121287F6Fa5", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus FLOKI (GameFi)", @@ -2219,6 +2276,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("28000000000", 9), // Note 9 decimals vTokenReceiver: "0x17e98a24f992BB7bcd62d6722d714A3C74814B94", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDT (GameFi)", @@ -2237,6 +2295,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDD (GameFi)", @@ -2255,6 +2314,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, ], rewards: [ @@ -2296,6 +2356,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("5600", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus BNBx (Liquid Staked BNB)", @@ -2314,6 +2375,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1272", 18), vTokenReceiver: "0xF0348E1748FCD45020151C097D234DbbD5730BE7", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus stkBNB (Liquid Staked BNB)", @@ -2332,6 +2394,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("378", 18), vTokenReceiver: "0xccc022502d6c65e1166fd34147040f05880f7972", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus WBNB (Liquid Staked BNB)", @@ -2350,6 +2413,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("56000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDT (Liquid Staked BNB)", @@ -2368,6 +2432,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDD (Liquid Staked BNB)", @@ -2386,6 +2451,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus SnBNB (Liquid Staked BNB)", @@ -2404,6 +2470,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("100", 18), vTokenReceiver: "0xDC2D855A95Ee70d7282BebD35c96f905CDE31f55", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, ], rewards: [ @@ -2463,6 +2530,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1050000000000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus NFT (Tron)", @@ -2481,6 +2549,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2800000000", 6), // Note 6 decimals vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus WIN (Tron)", @@ -2499,6 +2568,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2100000000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus TRX (Tron)", @@ -2517,6 +2587,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("7700000", 6), // Note 6 decimals vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDT (Tron)", @@ -2535,6 +2606,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, { name: "Venus USDD (Tron)", @@ -2553,6 +2625,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", + isFlashloanAllowed: false, }, ], rewards: [ @@ -2606,6 +2679,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("800000000000000", 9), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, { name: "Venus USDT (Meme)", @@ -2624,6 +2698,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("900000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", + isFlashloanAllowed: false, }, ], rewards: [ @@ -2659,6 +2734,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("5", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus weETH (Liquid Staked ETH)", @@ -2677,6 +2753,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("200", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus ETH (Liquid Staked ETH)", @@ -2695,6 +2772,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("400", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [], @@ -2890,6 +2968,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(250, 8), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Core)", @@ -2908,6 +2987,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4600, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC (Core)", @@ -2926,6 +3006,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(9_000_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -2944,6 +3025,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(9_000_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus crvUSD (Core)", @@ -2962,6 +3044,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(9_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus CRV (Core)", @@ -2980,6 +3063,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus DAI (Core)", @@ -2998,6 +3082,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus TUSD (Core)", @@ -3016,6 +3101,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_800_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD + isFlashloanAllowed: false, }, { name: "Venus Frax (Core)", @@ -3034,6 +3120,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(8_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD + isFlashloanAllowed: false, }, { name: "Venus Staked FRAX (Core)", @@ -3052,6 +3139,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD + isFlashloanAllowed: false, }, { name: "Venus eBTC", @@ -3070,6 +3158,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("12.5", 8), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus EIGEN", @@ -3088,6 +3177,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -3160,6 +3250,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4_500_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Stablecoins)", @@ -3178,6 +3269,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4_500_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus crvUSD (Stablecoins)", @@ -3196,6 +3288,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [], @@ -3224,6 +3317,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus CRV (Curve)", @@ -3242,6 +3336,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -3288,6 +3383,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Liquid Staked ETH)", @@ -3306,6 +3402,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(18_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus weETH (Liquid Staked ETH)", @@ -3324,6 +3421,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(750, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus PT-wETH-26DEC2024 (Liquid Staked ETH)", @@ -3342,6 +3440,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(375, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus rsETH (Liquid Staked ETH)", @@ -3360,6 +3459,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3_600, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus sfrxETH (Liquid Staked ETH)", @@ -3378,6 +3478,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus ezETH (Liquid Staked ETH)", @@ -3396,6 +3497,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_400, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus weETHs (Liquid Staked ETH)", @@ -3414,6 +3516,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(0, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus pufETH (Liquid Staked ETH)", @@ -3432,6 +3535,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("300", 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -3651,6 +3755,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(850, 8), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Core)", @@ -3669,6 +3774,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(18_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC (Core)", @@ -3687,6 +3793,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -3705,6 +3812,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus crvUSD (Core)", @@ -3723,6 +3831,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", + isFlashloanAllowed: false, }, { name: "Venus DAI (Core)", @@ -3741,6 +3850,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus TUSD (Core)", @@ -3759,6 +3869,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_800_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus Frax (Core)", @@ -3777,6 +3888,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(8_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", + isFlashloanAllowed: false, }, { name: "Venus Staked FRAX (Core)", @@ -3795,6 +3907,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", + isFlashloanAllowed: false, }, { name: "Venus eBTC", @@ -3813,6 +3926,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("12.5", 8), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus EIGEN", @@ -3831,6 +3945,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -3921,6 +4036,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", + isFlashloanAllowed: false, }, { name: "Venus CRV (Curve)", @@ -3939,6 +4055,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", + isFlashloanAllowed: false, }, ], rewards: [ @@ -3991,6 +4108,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Liquid Staked ETH)", @@ -4009,6 +4127,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(18_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus weETH (Liquid Staked ETH)", @@ -4027,6 +4146,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(750, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: `0xF6C612c745Ba4546075DB62902c1Eb3255CdAe28`, + isFlashloanAllowed: false, }, { name: "Venus PT-wETH-26DEC2024 (Liquid Staked ETH)", @@ -4045,6 +4165,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(0, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus rsETH (Liquid Staked ETH)", @@ -4063,6 +4184,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3_600, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7AAd74b7f0d60D5867B59dbD377a71783425af47", + isFlashloanAllowed: false, }, { name: "Venus sfrxETH (Liquid Staked ETH)", @@ -4081,6 +4203,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", + isFlashloanAllowed: false, }, { name: "Venus ezETH (Liquid Staked ETH)", @@ -4099,6 +4222,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_400, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x1E3233E8d972cfFc7D0f83aFAE4354a0Db74e34E", + isFlashloanAllowed: false, }, { name: "Venus weETHs (Liquid Staked ETH)", @@ -4117,6 +4241,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(0, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x86fBaEB3D6b5247F420590D303a6ffC9cd523790", + isFlashloanAllowed: false, }, { name: "Venus pufETH (Liquid Staked ETH)", @@ -4135,6 +4260,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("300", 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -4234,6 +4360,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(250, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus ETH (Core)", @@ -4252,6 +4379,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4600, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -4270,6 +4398,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(9_000_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WBNB (Core)", @@ -4288,6 +4417,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(56_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [], @@ -4369,6 +4499,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("0.55", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus ETH (Core)", @@ -4387,6 +4518,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -4405,6 +4537,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WBNB (Core)", @@ -4423,6 +4556,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(75, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus FDUSD (Core)", @@ -4441,6 +4575,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [], @@ -4536,6 +4671,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("0.55", 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Core)", @@ -4554,6 +4690,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC (Core)", @@ -4572,6 +4709,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -4590,6 +4728,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus ARB (Core)", @@ -4608,6 +4747,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -4643,6 +4783,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(800, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus weETH (Liquid Staked ETH)", @@ -4661,6 +4802,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_300, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Liquid Staked ETH)", @@ -4679,6 +4821,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(12_500, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [], @@ -4774,6 +4917,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500", 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Core)", @@ -4792,6 +4936,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("23500", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC (Core)", @@ -4810,6 +4955,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("49000000", 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -4828,6 +4974,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("18000000", 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus ARB (Core)", @@ -4846,6 +4993,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("9000000", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -4892,6 +5040,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(800, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: "0x5A9d695c518e95CD6Ea101f2f25fC2AE18486A61", + isFlashloanAllowed: false, }, { name: "Venus weETH (Liquid Staked ETH)", @@ -4910,6 +5059,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_300, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: "0x46cba1e9b1e5db32da28428f2fb85587bcb785e7", + isFlashloanAllowed: false, }, { name: "Venus WETH (Liquid Staked ETH)", @@ -4928,6 +5078,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(12_500, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -5030,6 +5181,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(23_500, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WBTC (Core)", @@ -5048,6 +5200,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(500, 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -5066,6 +5219,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(18_000_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC.e (Core)", @@ -5084,6 +5238,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(49_000_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, + isFlashloanAllowed: false, }, { @@ -5103,6 +5258,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_350_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC (Core)", @@ -5121,6 +5277,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -5227,6 +5384,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_700, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WBTC (Core)", @@ -5245,6 +5403,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(20, 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -5263,6 +5422,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3_300_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC.e (Core)", @@ -5281,6 +5441,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4_200_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, + isFlashloanAllowed: false, }, { @@ -5300,6 +5461,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(12_500_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC (Core)", @@ -5318,6 +5480,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -5431,6 +5594,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("0.55", 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Core)", @@ -5449,6 +5613,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC (Core)", @@ -5467,6 +5632,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -5485,6 +5651,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus OP (Core)", @@ -5503,6 +5670,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [ @@ -5603,6 +5771,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("50", 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus WETH (Core)", @@ -5621,6 +5790,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2700", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDT (Core)", @@ -5639,6 +5809,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("3600000", 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus OP (Core)", @@ -5657,6 +5828,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1500000", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, + isFlashloanAllowed: false, }, { name: "Venus USDC (Core)", @@ -5675,6 +5847,7 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("9000000", 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, + isFlashloanAllowed: false, }, ], rewards: [], diff --git a/tests/hardhat/Tokens/flashLoanSimple.ts b/tests/hardhat/Tokens/flashLoanSimple.ts index 090d5b381..b23b91032 100644 --- a/tests/hardhat/Tokens/flashLoanSimple.ts +++ b/tests/hardhat/Tokens/flashLoanSimple.ts @@ -37,7 +37,7 @@ describe.only("Flashloan Simple", () => { let comptrollerSigner: SignerWithAddress; beforeEach(async () => { - [admin, minter, alice, acmUser, receiver] = await ethers.getSigners(); + [minter, alice, acmUser, receiver] = await ethers.getSigners(); contracts = await loadFixture(vTokenTestFixture); ({ vToken, underlying, accessControlManager, comptroller } = contracts); comptrollerSigner = await initMainnetUser(comptroller.address, ethers.utils.parseUnits("2")); From b1938708bb55a99b620d528cee74a0bd9118860f Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Thu, 26 Dec 2024 18:02:15 +0530 Subject: [PATCH 09/15] chore: add flashloan fee mantissa in deployment config for vtokens --- deploy/009-deploy-vtokens.ts | 2 + helpers/deploymentConfig.ts | 173 +++++++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) diff --git a/deploy/009-deploy-vtokens.ts b/deploy/009-deploy-vtokens.ts index 39e1ac579..82f76cab6 100644 --- a/deploy/009-deploy-vtokens.ts +++ b/deploy/009-deploy-vtokens.ts @@ -65,6 +65,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { kink_, reserveFactor, isFlashloanAllowed, + flashloanFeeMantissa, } = vtoken; const token = getTokenConfig(asset, tokensConfig); @@ -145,6 +146,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { [AddressOne, protocolShareReserveAddress], reserveFactor, isFlashloanAllowed, + flashloanFeeMantissa, ]; await deploy(`VToken_${symbol}`, { from: deployer, diff --git a/helpers/deploymentConfig.ts b/helpers/deploymentConfig.ts index 3fe5f6fb4..e2b1c298c 100644 --- a/helpers/deploymentConfig.ts +++ b/helpers/deploymentConfig.ts @@ -109,6 +109,7 @@ export type VTokenConfig = { vTokenReceiver: string; reduceReservesBlockDelta: string; isFlashloanAllowed: boolean; + flashloanFeeMantissa: string; }; export type AccessControlEntry = { @@ -475,6 +476,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus BTCB", @@ -494,6 +496,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -536,6 +539,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ankrBNB", @@ -555,6 +559,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus MBOX", @@ -574,6 +579,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus NFT", @@ -593,6 +599,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus RACA", @@ -612,6 +619,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus stkBNB", @@ -631,6 +639,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD", @@ -650,6 +659,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -938,6 +948,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Stable Coins)", @@ -957,6 +968,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (Stable Coins)", @@ -976,6 +988,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus agEUR (Stablecoins)", @@ -995,6 +1008,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xc444949e0054a23c44fc45789738bdf64aed2391", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -1043,6 +1057,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x109E8083a64c7DedE513e8b580c5b08B96f9cE73", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ALPACA (DeFi)", @@ -1062,6 +1077,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xAD9CADe20100B8b945da48e1bCbd805C38d8bE77", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (DeFi)", @@ -1081,6 +1097,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (DeFi)", @@ -1100,6 +1117,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ANKR (DeFi)", @@ -1119,6 +1137,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ankrBNB (DeFi)", @@ -1138,6 +1157,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus PLANET (DeFi)", @@ -1157,6 +1177,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x0554d6079eBc222AD12405E52b264Bdb5B65D1cf", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus TWT (DeFi)", @@ -1176,6 +1197,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x0848dB7cB495E7b9aDA1D4dC972b9A526D014D84", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -1224,6 +1246,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x6Ee74536B3Ff10Ff639aa781B7220121287F6Fa5", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus FLOKI (GameFi)", @@ -1243,6 +1266,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x17e98a24f992BB7bcd62d6722d714A3C74814B94", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (GameFi)", @@ -1262,6 +1286,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (GameFi)", @@ -1281,6 +1306,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -1323,6 +1349,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus BNBx (Liquid Staked BNB)", @@ -1342,6 +1369,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xF0348E1748FCD45020151C097D234DbbD5730BE7", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus stkBNB (Liquid Staked BNB)", @@ -1361,6 +1389,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xccc022502d6c65e1166fd34147040f05880f7972", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WBNB (Liquid Staked BNB)", @@ -1380,6 +1409,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Liquid Staked BNB)", @@ -1399,6 +1429,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (Liquid Staked BNB)", @@ -1418,6 +1449,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus SnBNB (Liquid Staked BNB)", @@ -1437,6 +1469,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xDC2D855A95Ee70d7282BebD35c96f905CDE31f55", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -1497,6 +1530,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus NFT (Tron)", @@ -1516,6 +1550,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WIN (Tron)", @@ -1535,6 +1570,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus TRX (Tron)", @@ -1554,6 +1590,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Tron)", @@ -1573,6 +1610,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (Tron)", @@ -1592,6 +1630,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -1646,6 +1685,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Meme)", @@ -1665,6 +1705,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -1701,6 +1742,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -1720,6 +1762,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ETH (Liquid Staked ETH)", @@ -1739,6 +1782,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [], @@ -1970,6 +2014,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x09702Ea135d9D707DD51f530864f2B9220aAD87B", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Stablecoins)", @@ -1989,6 +2034,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (Stablecoins)", @@ -2008,6 +2054,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus agEUR (Stablecoins)", @@ -2027,6 +2074,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xc444949e0054a23c44fc45789738bdf64aed2391", // community wallet reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -2075,6 +2123,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x109E8083a64c7DedE513e8b580c5b08B96f9cE73", // biswap team treasury reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ALPACA (DeFi)", @@ -2094,6 +2143,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xAD9CADe20100B8b945da48e1bCbd805C38d8bE77", // alpaca team treasury reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (DeFi)", @@ -2113,6 +2163,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (DeFi)", @@ -2132,6 +2183,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", // tron ecosystem treasury reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ANKR (DeFi)", @@ -2151,6 +2203,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", // ankr team treasury reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { @@ -2171,6 +2224,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", // ankr team treasury reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus PLANET (DeFi)", @@ -2190,6 +2244,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x0554d6079eBc222AD12405E52b264Bdb5B65D1cf", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus TWT (DeFi)", @@ -2209,6 +2264,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x0848dB7cB495E7b9aDA1D4dC972b9A526D014D84", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -2258,6 +2314,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x6Ee74536B3Ff10Ff639aa781B7220121287F6Fa5", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus FLOKI (GameFi)", @@ -2277,6 +2334,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x17e98a24f992BB7bcd62d6722d714A3C74814B94", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (GameFi)", @@ -2296,6 +2354,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (GameFi)", @@ -2315,6 +2374,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -2357,6 +2417,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus BNBx (Liquid Staked BNB)", @@ -2376,6 +2437,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xF0348E1748FCD45020151C097D234DbbD5730BE7", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus stkBNB (Liquid Staked BNB)", @@ -2395,6 +2457,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xccc022502d6c65e1166fd34147040f05880f7972", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WBNB (Liquid Staked BNB)", @@ -2414,6 +2477,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Liquid Staked BNB)", @@ -2433,6 +2497,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (Liquid Staked BNB)", @@ -2452,6 +2517,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus SnBNB (Liquid Staked BNB)", @@ -2471,6 +2537,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0xDC2D855A95Ee70d7282BebD35c96f905CDE31f55", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -2531,6 +2598,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus NFT (Tron)", @@ -2550,6 +2618,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WIN (Tron)", @@ -2569,6 +2638,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus TRX (Tron)", @@ -2588,6 +2658,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Tron)", @@ -2607,6 +2678,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDD (Tron)", @@ -2626,6 +2698,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -2680,6 +2753,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Meme)", @@ -2699,6 +2773,7 @@ export const globalConfig: NetworkConfig = { vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -2735,6 +2810,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -2754,6 +2830,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ETH (Liquid Staked ETH)", @@ -2773,6 +2850,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [], @@ -2969,6 +3047,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -2988,6 +3067,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -3007,6 +3087,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -3026,6 +3107,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus crvUSD (Core)", @@ -3045,6 +3127,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus CRV (Core)", @@ -3064,6 +3147,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus DAI (Core)", @@ -3083,6 +3167,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus TUSD (Core)", @@ -3102,6 +3187,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus Frax (Core)", @@ -3121,6 +3207,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus Staked FRAX (Core)", @@ -3140,6 +3227,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus eBTC", @@ -3159,6 +3247,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus EIGEN", @@ -3178,6 +3267,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -3251,6 +3341,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Stablecoins)", @@ -3270,6 +3361,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus crvUSD (Stablecoins)", @@ -3289,6 +3381,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [], @@ -3318,6 +3411,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus CRV (Curve)", @@ -3337,6 +3431,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -3384,6 +3479,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Liquid Staked ETH)", @@ -3403,6 +3499,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -3422,6 +3519,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus PT-wETH-26DEC2024 (Liquid Staked ETH)", @@ -3441,6 +3539,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus rsETH (Liquid Staked ETH)", @@ -3460,6 +3559,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus sfrxETH (Liquid Staked ETH)", @@ -3479,6 +3579,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ezETH (Liquid Staked ETH)", @@ -3498,6 +3599,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus weETHs (Liquid Staked ETH)", @@ -3517,6 +3619,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus pufETH (Liquid Staked ETH)", @@ -3536,6 +3639,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -3756,6 +3860,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -3775,6 +3880,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -3794,6 +3900,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -3813,6 +3920,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus crvUSD (Core)", @@ -3832,6 +3940,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus DAI (Core)", @@ -3851,6 +3960,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus TUSD (Core)", @@ -3870,6 +3980,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus Frax (Core)", @@ -3889,6 +4000,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus Staked FRAX (Core)", @@ -3908,6 +4020,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus eBTC", @@ -3927,6 +4040,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus EIGEN", @@ -3946,6 +4060,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -4037,6 +4152,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus CRV (Curve)", @@ -4056,6 +4172,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -4109,6 +4226,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Liquid Staked ETH)", @@ -4128,6 +4246,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -4147,6 +4266,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: `0xF6C612c745Ba4546075DB62902c1Eb3255CdAe28`, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus PT-wETH-26DEC2024 (Liquid Staked ETH)", @@ -4166,6 +4286,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus rsETH (Liquid Staked ETH)", @@ -4185,6 +4306,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7AAd74b7f0d60D5867B59dbD377a71783425af47", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus sfrxETH (Liquid Staked ETH)", @@ -4204,6 +4326,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ezETH (Liquid Staked ETH)", @@ -4223,6 +4346,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x1E3233E8d972cfFc7D0f83aFAE4354a0Db74e34E", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus weETHs (Liquid Staked ETH)", @@ -4242,6 +4366,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x86fBaEB3D6b5247F420590D303a6ffC9cd523790", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus pufETH (Liquid Staked ETH)", @@ -4261,6 +4386,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -4361,6 +4487,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ETH (Core)", @@ -4380,6 +4507,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -4399,6 +4527,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WBNB (Core)", @@ -4418,6 +4547,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [], @@ -4500,6 +4630,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ETH (Core)", @@ -4519,6 +4650,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -4538,6 +4670,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WBNB (Core)", @@ -4557,6 +4690,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus FDUSD (Core)", @@ -4576,6 +4710,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [], @@ -4672,6 +4807,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -4691,6 +4827,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -4710,6 +4847,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -4729,6 +4867,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ARB (Core)", @@ -4748,6 +4887,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -4784,6 +4924,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -4803,6 +4944,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Liquid Staked ETH)", @@ -4822,6 +4964,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [], @@ -4918,6 +5061,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -4937,6 +5081,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -4956,6 +5101,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -4975,6 +5121,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus ARB (Core)", @@ -4994,6 +5141,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -5041,6 +5189,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: "0x5A9d695c518e95CD6Ea101f2f25fC2AE18486A61", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -5060,6 +5209,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: "0x46cba1e9b1e5db32da28428f2fb85587bcb785e7", isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Liquid Staked ETH)", @@ -5079,6 +5229,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -5182,6 +5333,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WBTC (Core)", @@ -5201,6 +5353,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5220,6 +5373,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC.e (Core)", @@ -5239,6 +5393,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { @@ -5259,6 +5414,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -5278,6 +5434,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -5385,6 +5542,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WBTC (Core)", @@ -5404,6 +5562,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5423,6 +5582,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC.e (Core)", @@ -5442,6 +5602,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { @@ -5462,6 +5623,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -5481,6 +5643,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -5595,6 +5758,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -5614,6 +5778,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -5633,6 +5798,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5652,6 +5818,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus OP (Core)", @@ -5671,6 +5838,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [ @@ -5772,6 +5940,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -5791,6 +5960,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5810,6 +5980,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus OP (Core)", @@ -5829,6 +6000,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -5848,6 +6020,7 @@ export const globalConfig: NetworkConfig = { reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, isFlashloanAllowed: false, + flashloanFeeMantissa: "0", }, ], rewards: [], From cf97406e4418c132633cbd4b38253fb1e3e513e2 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Thu, 26 Dec 2024 18:56:36 +0530 Subject: [PATCH 10/15] test: multiple asset flash loan tests --- tests/hardhat/{ => Comptroller}/Flashloan.ts | 131 ++++++------------- tests/hardhat/Tokens/flashLoanSimple.ts | 2 +- tests/hardhat/util/TokenTestHelpers.ts | 4 +- 3 files changed, 41 insertions(+), 96 deletions(-) rename tests/hardhat/{ => Comptroller}/Flashloan.ts (56%) diff --git a/tests/hardhat/Flashloan.ts b/tests/hardhat/Comptroller/Flashloan.ts similarity index 56% rename from tests/hardhat/Flashloan.ts rename to tests/hardhat/Comptroller/Flashloan.ts index 359213f57..f30e6d064 100644 --- a/tests/hardhat/Flashloan.ts +++ b/tests/hardhat/Comptroller/Flashloan.ts @@ -1,12 +1,12 @@ import { FakeContract, MockContract, smock } from "@defi-wonderland/smock"; import { loadFixture, setBalance } from "@nomicfoundation/hardhat-network-helpers"; import chai from "chai"; -import { BigNumberish } from "ethers"; +import { BigNumber } from "ethers"; import { parseEther, parseUnits } from "ethers/lib/utils"; import { ethers, upgrades } from "hardhat"; import { SignerWithAddress } from "hardhat-deploy-ethers/signers"; -import { convertToUnit } from "../../helpers/utils"; +import { convertToUnit } from "../../../helpers/utils"; import { AccessControlManager, Comptroller, @@ -18,19 +18,18 @@ import { ProtocolShareReserve, VTokenHarness, VTokenHarness__factory, -} from "../../typechain"; -import { makeVToken, mockUnderlying, preApprove } from "./util/TokenTestHelpers"; +} from "../../../typechain"; +import { makeVToken, mockUnderlying } from "../util/TokenTestHelpers"; const { expect } = chai; chai.use(smock.matchers); const MAX_LOOP_LIMIT = 150; -const exchangeRate = parseUnits("50000", 18).toBigInt(); -const flashloanAmount1 = parseUnits("1000", 18).toBigInt(); -const flashloanAmount2 = parseUnits("2000", 18).toBigInt(); -const mintAmount1 = parseUnits("5000", 18).toBigInt(); -const mintAmount2 = parseUnits("5000", 18).toBigInt(); +const flashloanAmount1 = parseUnits("20", 18); +const flashloanAmount2 = parseUnits("30", 18); +const feeMantissaTokenA = parseUnits("0.01", 18); +const feeMantissaTokenB = parseUnits("0.02", 18); // Declare the types here type FlashloanContractsFixture = { @@ -45,49 +44,6 @@ type FlashloanContractsFixture = { VTokenB: VTokenHarness; }; -async function preMint( - contracts: FlashloanContractsFixture, - minter: SignerWithAddress, - mintAmountA: BigNumberish, - mintAmountB: BigNumberish, - exchangeRate: BigNumberish, -) { - const { interestRateModel, underlyingA, underlyingB, VTokenA, VTokenB } = contracts; - await preApprove(underlyingA, VTokenA, minter, mintAmountA, { faucet: true }); - await preApprove(underlyingB, VTokenB, minter, mintAmountB, { faucet: true }); - - // await comptroller.premintHook.reset - interestRateModel.getBorrowRate.reset(); - interestRateModel.getSupplyRate.reset(); - - const minterAddress = minter.address; - await underlyingA.harnessSetFailTransferFromAddress(minterAddress, false); - await underlyingB.harnessSetFailTransferFromAddress(minterAddress, false); - await VTokenA.harnessSetBalance(minterAddress, 0); - await VTokenB.harnessSetBalance(minterAddress, 0); - await VTokenA.harnessSetExchangeRate(exchangeRate); - await VTokenB.harnessSetExchangeRate(exchangeRate); -} - -async function quickMint( - underlying: MockContract, - vToken: VTokenHarness, - minter: SignerWithAddress, - mintAmount: BigNumberish, - opts: { approve?: boolean; exchangeRate?: BigNumberish; faucet?: boolean } = { approve: true, faucet: true }, -) { - // make sure to accrue interest - await vToken.harnessFastForward(1); - - if (opts.approve || opts.approve === undefined) { - await preApprove(underlying, vToken, minter, mintAmount, opts); - } - if (opts.exchangeRate !== undefined) { - await vToken.harnessSetExchangeRate(opts.exchangeRate); - } - return vToken.connect(minter).mint(mintAmount); -} - // Create a fixture will deploy all the required contracts for flashloan const flashLoanTestFixture = async (): Promise => { const [admin] = await ethers.getSigners(); @@ -118,6 +74,8 @@ const flashLoanTestFixture = async (): Promise => { admin, interestRateModel, protocolShareReserve, + isFlashloanAllowed: true, + flashloanFeeMantissa: feeMantissaTokenA, }, { kind: "VTokenHarness" }, ); @@ -130,13 +88,12 @@ const flashLoanTestFixture = async (): Promise => { admin, interestRateModel, protocolShareReserve, + isFlashloanAllowed: true, + flashloanFeeMantissa: feeMantissaTokenB, }, { kind: "VTokenHarness" }, ); - console.log(`Market Name and Address ${await VTokenA.name()} & ${VTokenA.address}`); - console.log(`Market Name and Address ${await VTokenB.name()} & ${VTokenB.address}`); - await comptroller.setMarketSupplyCaps( [VTokenA.address, VTokenB.address], [convertToUnit(1, 50), convertToUnit(1, 50)], @@ -146,7 +103,6 @@ const flashLoanTestFixture = async (): Promise => { await comptroller.connect(poolRegistry.wallet).supportMarket(VTokenA.address); await comptroller.connect(poolRegistry.wallet).supportMarket(VTokenB.address); - // await comptroller.enterMarkets([VTokenA.address, VTokenB.address]); return { accessControlManager, protocolShareReserve, @@ -161,9 +117,8 @@ const flashLoanTestFixture = async (): Promise => { }; describe("Flashloan", async () => { - let admin: SignerWithAddress; - let minter: SignerWithAddress; let alice: SignerWithAddress; + let acmUser: SignerWithAddress; let contracts: FlashloanContractsFixture; let VTokenA: VTokenHarness; let VTokenB: VTokenHarness; @@ -173,7 +128,7 @@ describe("Flashloan", async () => { let mockReceiverContract: MockFlashloanReceiver; beforeEach(async () => { - [admin, minter, alice] = await ethers.getSigners(); + [alice, acmUser] = await ethers.getSigners(); contracts = await loadFixture(flashLoanTestFixture); ({ comptroller, VTokenA, VTokenB, underlyingA, underlyingB } = contracts); }); @@ -188,6 +143,9 @@ describe("Flashloan", async () => { }); it("Should revert if flashloan is not enabled", async () => { + await VTokenA.connect(acmUser).toggleFlashloan(); + expect(await VTokenA.isFlashloanEnabled()).to.be.false; + await expect( mockReceiverContract.requestFlashloan( [VTokenA.address.toString(), VTokenB.address.toString()], @@ -196,57 +154,44 @@ describe("Flashloan", async () => { ).to.be.revertedWithCustomError(comptroller, "FlashLoanNotEnabled"); }); - it("Should be able to toggle flashloan feature", async () => { - await VTokenA.connect(admin).toggleFlashloan(); - await VTokenB.connect(admin).toggleFlashloan(); - expect(await VTokenA.isFlashloanEnabled()).to.be.true; - expect(await VTokenB.isFlashloanEnabled()).to.be.true; - }); - it("Flashloan for multiple underlying", async () => { // Admin Enable flashLoan for multiple vToken - await VTokenA.toggleFlashloan(); expect(await VTokenA.isFlashloanEnabled()).to.be.true; - await VTokenB.toggleFlashloan(); expect(await VTokenB.isFlashloanEnabled()).to.be.true; - // Before Mint State Setup we need to mint for multiple vToken - await preMint(contracts, minter, mintAmount1, mintAmount2, exchangeRate); - - // Now supplying underlying to VToken1 - await quickMint(underlyingA, VTokenA, minter, mintAmount1, { approve: true, exchangeRate, faucet: false }); - await quickMint(underlyingB, VTokenB, minter, mintAmount2, { approve: true, exchangeRate, faucet: false }); - // Set the balance of mockReceiver in order to pay for flashloan fee await underlyingA.harnessSetBalance(mockReceiverContract.address, parseUnits("10", 18)); await underlyingB.harnessSetBalance(mockReceiverContract.address, parseUnits("20", 18)); - // Get the balance before the flashloan - const beforeBalanceA = await underlyingA.balanceOf(mockReceiverContract.address); - const beforeBalanceB = await underlyingA.balanceOf(mockReceiverContract.address); + await underlyingA.harnessSetBalance(VTokenA.address, parseUnits("50", 18)); + await underlyingB.harnessSetBalance(VTokenB.address, parseUnits("50", 18)); - console.log( - `Underlying Balances Alice Receiver Contract ${beforeBalanceA.toString()} & ${beforeBalanceB.toString()}`, - ); + // Get the balance before the flashloan + const beforeBalanceVTokenA = await underlyingA.balanceOf(VTokenA.address); + const beforeBalanceVTokenB = await underlyingB.balanceOf(VTokenB.address); // Execute the flashloan from the mockReceiverContract - await mockReceiverContract + const flashloan = await mockReceiverContract .connect(alice) - .requestFlashloan( - [VTokenA.address.toString(), VTokenB.address.toString()], - [flashloanAmount1, flashloanAmount2], - ); + .requestFlashloan([VTokenA.address, VTokenB.address], [flashloanAmount1, flashloanAmount2]); // Get the balance after the flashloan - const afterBalanceA = await underlyingA.balanceOf(mockReceiverContract.address); - const afterBalanceB = await underlyingA.balanceOf(mockReceiverContract.address); + const afterBalanceVTokenA = await underlyingA.balanceOf(VTokenA.address); + const afterBalanceVTokenB = await underlyingB.balanceOf(VTokenB.address); - console.log( - `Underlying Balances Alice Receiver Contract ${afterBalanceA.toString()} & ${afterBalanceB.toString()}`, - ); + const feeOnFlashLoanTokenA = BigNumber.from(flashloanAmount1).mul(feeMantissaTokenA).div(parseUnits("1", 18)); + const feeOnFlashLoanTokenB = BigNumber.from(flashloanAmount2).mul(feeMantissaTokenB).div(parseUnits("1", 18)); + + expect(afterBalanceVTokenA).to.be.equal(beforeBalanceVTokenA.add(feeOnFlashLoanTokenA)); + expect(afterBalanceVTokenB).to.be.equal(beforeBalanceVTokenB.add(feeOnFlashLoanTokenB)); - expect(afterBalanceA).to.be.equal(0); - expect(afterBalanceB).to.be.equal(0); + await expect(flashloan) + .to.emit(comptroller, "FlashloanExecuted") + .withArgs( + mockReceiverContract.address, + [VTokenA.address, VTokenB.address], + [flashloanAmount1, flashloanAmount2], + ); }); }); }); diff --git a/tests/hardhat/Tokens/flashLoanSimple.ts b/tests/hardhat/Tokens/flashLoanSimple.ts index b23b91032..d2f2fdd4e 100644 --- a/tests/hardhat/Tokens/flashLoanSimple.ts +++ b/tests/hardhat/Tokens/flashLoanSimple.ts @@ -23,7 +23,7 @@ chai.use(smock.matchers); const flashloanAmount = parseUnits("2", 18).toBigInt(); const feeMantissa = parseUnits("0.01", 18); -describe.only("Flashloan Simple", () => { +describe("Flashloan Simple", () => { let minter: SignerWithAddress; let alice: SignerWithAddress; let receiver: SignerWithAddress; diff --git a/tests/hardhat/util/TokenTestHelpers.ts b/tests/hardhat/util/TokenTestHelpers.ts index 64b6a0e11..f017eef1d 100644 --- a/tests/hardhat/util/TokenTestHelpers.ts +++ b/tests/hardhat/util/TokenTestHelpers.ts @@ -38,7 +38,7 @@ interface VTokenParameters { isTimeBased: boolean; blocksPerYear: BigNumberish; maxBorrowRateMantissa: BigNumberish; - isFlashloanEnabled: boolean; + isFlashloanAllowed: boolean; flashloanFeeMantissa: BigNumberish; } @@ -149,7 +149,7 @@ export const makeVToken = async ; From b126f3c0b1bb2f63697622c986f197bfe9c3879e Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Fri, 27 Dec 2024 15:37:44 +0530 Subject: [PATCH 11/15] test: single asset flash loan fork tests --- tests/hardhat/Fork/constants.ts | 2 +- tests/hardhat/Fork/flashloanSimple.ts | 153 ++++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 tests/hardhat/Fork/flashloanSimple.ts diff --git a/tests/hardhat/Fork/constants.ts b/tests/hardhat/Fork/constants.ts index 1c88e6133..0fd6d6789 100644 --- a/tests/hardhat/Fork/constants.ts +++ b/tests/hardhat/Fork/constants.ts @@ -181,7 +181,7 @@ export const contractAddresses = { ACC1: "0xc7f050b6F465b876c764A866d6337EabBab08Cd4", ACC2: "0xce0180B3B992649CBc3C8e1cF95b4A52Be9bA3AF", ACC3: "0x13E0a421c17Ff1e7FFccFa05714957cF530b3aa4", - BLOCK_NUMBER: 58181663, + BLOCK_NUMBER: 111100817, }, arbitrumone: { ADMIN: "0x14e0E151b33f9802b3e75b621c1457afc44DcAA0", diff --git a/tests/hardhat/Fork/flashloanSimple.ts b/tests/hardhat/Fork/flashloanSimple.ts new file mode 100644 index 000000000..9a3fc07ba --- /dev/null +++ b/tests/hardhat/Fork/flashloanSimple.ts @@ -0,0 +1,153 @@ +import { smock } from "@defi-wonderland/smock"; +import { mine } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import chai from "chai"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers, network } from "hardhat"; + +import { getMaxBorrowRateMantissa } from "../../../helpers/deploymentConfig"; +import { getBlockOrTimestampBasedDeploymentInfo } from "../../../helpers/deploymentUtils"; +import { + AccessControlManager, + AccessControlManager__factory, + IERC20, + IERC20__factory, + MockFlashloanSimpleReceiver, + MockFlashloanSimpleReceiver__factory, + UpgradeableBeacon__factory, + VToken, + VToken__factory, +} from "../../../typechain"; +import { getContractAddresses, initMainnetUser, setForkBlock } from "./utils"; + +const { expect } = chai; +chai.use(smock.matchers); + +const blocksToMine: number = 30000; + +const FORK = process.env.FORK === "true"; +const FORKED_NETWORK = process.env.FORKED_NETWORK || "bscmainnet"; + +let john: SignerWithAddress; +let impersonatedTimelock: SignerWithAddress; +let ARB: IERC20; +let vARB: VToken; +let accessControlManager: AccessControlManager; +let arbHolder: SignerWithAddress; +let mockReceiverSimpleFlashloan: MockFlashloanSimpleReceiver; + +const AddressZero = "0x0000000000000000000000000000000000000000"; +const VTOKEN_BEACON_ARB = "0x74ae9919F5866cE148c81331a5FCdE71b81c4056"; +const { isTimeBased, blocksPerYear } = getBlockOrTimestampBasedDeploymentInfo(network.name); +const MAX_BORROW_RATE_MANTISSA = getMaxBorrowRateMantissa(network.name); + +const { VTOKEN2, ACM, ACC1, TOKEN2, ADMIN, BLOCK_NUMBER, TOKEN1_HOLDER } = getContractAddresses( + FORKED_NETWORK as string, +); + +const flashloanFeeMantissa = parseUnits("0.01", 18); +const flashloanAmount = parseUnits("100", 18); + +async function configureTimelock() { + impersonatedTimelock = await initMainnetUser(ADMIN, ethers.utils.parseUnits("2")); +} + +// Giving permission to Timelock to interact with the contracts +async function grantPermissions() { + accessControlManager = AccessControlManager__factory.connect(ACM, impersonatedTimelock); + let tx = await accessControlManager + .connect(impersonatedTimelock) + .giveCallPermission(vARB.address, "toggleFlashloan()", ADMIN); + await tx.wait(); + + tx = await accessControlManager + .connect(impersonatedTimelock) + .giveCallPermission(vARB.address, "setFlashloanFeeMantissa(uint256)", ADMIN); + await tx.wait(); +} + +if (FORK) { + describe("Flashloan Fork Test", async () => { + async function setup() { + // Set the forked blockchain to a specific block number to create a consistent testing environment + await setForkBlock(BLOCK_NUMBER); + + // Configure the timelock address, typically the admin account, by funding it with tokens + await configureTimelock(); + + john = await initMainnetUser(ACC1, parseUnits("2", 18)); + arbHolder = await initMainnetUser(TOKEN1_HOLDER, parseUnits("2", 18)); + + ARB = IERC20__factory.connect(TOKEN2, impersonatedTimelock); + vARB = VToken__factory.connect(VTOKEN2, impersonatedTimelock); + + // Deploy a new VToken implementation to upgrade the current VToken contract + const VTOKEN_IMPL = await ethers.getContractFactory("VToken", impersonatedTimelock); + const upgradeImpl = await VTOKEN_IMPL.deploy(isTimeBased, blocksPerYear, MAX_BORROW_RATE_MANTISSA); + await upgradeImpl.deployed(); + + // Connect to the upgradeable beacon managing VToken implementations for ARB and upgrade it + const beaconVToken = UpgradeableBeacon__factory.connect(VTOKEN_BEACON_ARB, impersonatedTimelock); + await beaconVToken.connect(impersonatedTimelock).upgradeTo(upgradeImpl.address); + + expect(await beaconVToken.callStatic.implementation()).to.be.equal(upgradeImpl.address); + + // Grant necessary permissions to users or contracts + await grantPermissions(); + } + + beforeEach(async () => { + // Run setup before each test to reset the environment + await setup(); + + // Deploy a mock flashloan receiver to test flashloan functionality + const MockFlashloanSimpleReceiver = await ethers.getContractFactory( + "MockFlashloanSimpleReceiver", + ); + mockReceiverSimpleFlashloan = await MockFlashloanSimpleReceiver.deploy(vARB.address); + }); + + it("Should revert if flashloan not enabled", async () => { + // Attempt to take a flashloan when the flashloan feature is disabled should fail + await expect( + vARB.connect(john).executeFlashloan(mockReceiverSimpleFlashloan.address, flashloanAmount), + ).to.be.revertedWithCustomError(vARB, "FlashLoanNotEnabled"); + }); + + it("Should revert if receiver is zero address", async () => { + // Enable flashloan feature for testing + await vARB.connect(impersonatedTimelock).toggleFlashloan(); + + // Attempt to take a flashloan with zero address as receiver should fail + await expect(vARB.connect(john).executeFlashloan(AddressZero, flashloanAmount)).to.be.revertedWithCustomError( + vARB, + "ZeroAddressNotAllowed", + ); + }); + + it("Should flashloan ARB", async () => { + // Transfer ARB tokens to test users for setting up the flashloan test + await ARB.connect(arbHolder).transfer(vARB.address, parseUnits("1000", 18)); + await ARB.connect(arbHolder).transfer(mockReceiverSimpleFlashloan.address, parseUnits("50", 18)); + + // Record vARB contract's ARB balance before flashloan + const balanceBefore = await ARB.balanceOf(vARB.address); + + // Mine blocks if necessary for time-based operations + await mine(blocksToMine); + + // Enable flashloan feature by the admin + await vARB.connect(impersonatedTimelock).toggleFlashloan(); + await vARB.connect(impersonatedTimelock).setFlashloanFeeMantissa(flashloanFeeMantissa); + + // John initiates a flashloan of 2000 ARB through the mock receiver + await vARB.connect(john).executeFlashloan(mockReceiverSimpleFlashloan.address, parseUnits("100", 18)); + + // Check if the ARB balance in vARB increased, validating flashloan repayment with fees + const balanceAfter = await ARB.balanceOf(vARB.address); + const totalFlashloanFee = flashloanAmount.mul(flashloanFeeMantissa).div(parseUnits("1", 18)); + + expect(balanceAfter).to.be.equal(balanceBefore.add(totalFlashloanFee)); + }); + }); +} From a8bebee56797c0d3b76ce562896a60e6adfd2e9c Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Fri, 27 Dec 2024 16:17:21 +0530 Subject: [PATCH 12/15] test: multiple assets flash loan fork tests --- tests/hardhat/Fork/flashloan.ts | 203 ++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 tests/hardhat/Fork/flashloan.ts diff --git a/tests/hardhat/Fork/flashloan.ts b/tests/hardhat/Fork/flashloan.ts new file mode 100644 index 000000000..e67fd0037 --- /dev/null +++ b/tests/hardhat/Fork/flashloan.ts @@ -0,0 +1,203 @@ +import { mine } from "@nomicfoundation/hardhat-network-helpers"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { expect } from "chai"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers, network } from "hardhat"; + +import { getMaxBorrowRateMantissa } from "../../../helpers/deploymentConfig"; +import { getBlockOrTimestampBasedDeploymentInfo } from "../../../helpers/deploymentUtils"; +import { + AccessControlManager, + AccessControlManager__factory, + Comptroller, + Comptroller__factory, + ERC20, + ERC20__factory, + MockFlashloanReceiver, + MockFlashloanReceiver__factory, + UpgradeableBeacon__factory, + VToken, + VToken__factory, +} from "../../../typechain"; +import { getContractAddresses, initMainnetUser, setForkBlock } from "./utils"; + +const FORK = process.env.FORK === "true"; +const FORKED_NETWORK = process.env.FORKED_NETWORK || "bscmainnet"; +const { ACC2, TOKEN1, TOKEN2, VTOKEN2, ACM, VTOKEN1, POOL_REGISTRY, COMPTROLLER, TOKEN1_HOLDER, BLOCK_NUMBER, ADMIN } = + getContractAddresses(FORKED_NETWORK as string); + +const blocksToMine: number = 30000; + +const AddressZero = "0x0000000000000000000000000000000000000000"; +const WETH_HOLDER = "0xd7512902999b34af2B2940Eb8827CC8345DC77C6"; +const COMPTROLLER_BEACON = "0x12Dcb8D9F1eE7Ad7410F5B36B07bcC7891ab4cEf"; +const VTOKEN_BEACON = "0x74ae9919F5866cE148c81331a5FCdE71b81c4056"; +const { isTimeBased, blocksPerYear } = getBlockOrTimestampBasedDeploymentInfo(network.name); +const MAX_BORROW_RATE_MANTISSA = getMaxBorrowRateMantissa(network.name); + +const ARBFlashloanFeeMantissa = parseUnits("0.01", 18); +const WETHFlashloanFeeMantissa = parseUnits("0.03", 18); +const ARBFlashloanAmount = parseUnits("50", 18); +const WETHFlashloanAmount = parseUnits("20", 18); + +// Giving permission to Timelock to call chainlink setDirectPrice and setTokenConfig +async function grantPermissions() { + accessControlManager = AccessControlManager__factory.connect(ACM, impersonatedTimelock); + let tx = await accessControlManager + .connect(impersonatedTimelock) + .giveCallPermission(vARB.address, "toggleFlashloan()", ADMIN); + await tx.wait(); + + tx = await accessControlManager + .connect(impersonatedTimelock) + .giveCallPermission(vARB.address, "setFlashloanFeeMantissa(uint256)", ADMIN); + await tx.wait(); + + tx = await accessControlManager + .connect(impersonatedTimelock) + .giveCallPermission(vWETH.address, "toggleFlashloan()", ADMIN); + await tx.wait(); + + tx = await accessControlManager + .connect(impersonatedTimelock) + .giveCallPermission(vWETH.address, "setFlashloanFeeMantissa(uint256)", ADMIN); + await tx.wait(); +} + +let impersonatedTimelock: SignerWithAddress; +let john: SignerWithAddress; +let comptroller: Comptroller; +let arbHolder: SignerWithAddress; +let wETHHolder: SignerWithAddress; +let accessControlManager: AccessControlManager; +let ARB: ERC20; +let WETH: ERC20; +let vARB: VToken; +let vWETH: VToken; +let mockFlashloanReceiver: MockFlashloanReceiver; + +async function setup() { + await setForkBlock(BLOCK_NUMBER); + + impersonatedTimelock = await initMainnetUser(ADMIN, parseUnits("2")); + john = await initMainnetUser(ACC2, parseUnits("2")); + arbHolder = await initMainnetUser(TOKEN1_HOLDER, parseUnits("2")); + wETHHolder = await initMainnetUser(WETH_HOLDER, parseUnits("2")); + ARB = ERC20__factory.connect(TOKEN2, impersonatedTimelock); + WETH = ERC20__factory.connect(TOKEN1, impersonatedTimelock); + vARB = VToken__factory.connect(VTOKEN2, impersonatedTimelock); + vWETH = VToken__factory.connect(VTOKEN1, impersonatedTimelock); + comptroller = Comptroller__factory.connect(COMPTROLLER, impersonatedTimelock); + + // Deploy the comptroller and VToken + const Comptroller = await ethers.getContractFactory("Comptroller", impersonatedTimelock); + const upgradeComptrollerImpl = await Comptroller.deploy(POOL_REGISTRY); + await upgradeComptrollerImpl.deployed(); + + const VToken = await ethers.getContractFactory("VToken", impersonatedTimelock); + const upgradeVTokenImpl = await VToken.deploy(isTimeBased, blocksPerYear, MAX_BORROW_RATE_MANTISSA); + await upgradeVTokenImpl.deployed(); + + // Upgrade the comptroller implementation + const comptrollerBeacon = UpgradeableBeacon__factory.connect(COMPTROLLER_BEACON, impersonatedTimelock); + const vTokenBeacon = UpgradeableBeacon__factory.connect(VTOKEN_BEACON, impersonatedTimelock); + + await comptrollerBeacon.connect(impersonatedTimelock).upgradeTo(upgradeComptrollerImpl.address); + await vTokenBeacon.connect(impersonatedTimelock).upgradeTo(upgradeVTokenImpl.address); + + expect(await comptrollerBeacon.implementation()).to.be.equal(upgradeComptrollerImpl.address); + expect(await vTokenBeacon.implementation()).to.be.equal(upgradeVTokenImpl.address); + + await grantPermissions(); +} + +if (FORK) { + describe("Flashloan Fork Test", async () => { + beforeEach(async () => { + // Run the setup function before each test to initialize the environment + await setup(); + + // Deploy a mock flashloan receiver contract to simulate flashloan interactions in tests + const MockFlashloanReceiver = await ethers.getContractFactory( + "MockFlashloanReceiver", + ); + mockFlashloanReceiver = await MockFlashloanReceiver.deploy(comptroller.address); + }); + + it("Should revert if flashloan not enabled", async () => { + // Attempt to execute a flashloan when the flashloan feature is disabled, which should revert + await expect( + comptroller + .connect(john) + .executeFlashloan( + mockFlashloanReceiver.address, + [vARB.address, vWETH.address], + [ARBFlashloanAmount, WETHFlashloanAmount], + ), + ).to.be.revertedWithCustomError(vARB, "FlashLoanNotEnabled"); + }); + + it("Should revert if asset and amount arrays are mismatched", async () => { + // Attempt to execute a flashloan with mismatched arrays for assets and amounts, which should revert + await expect( + comptroller.connect(john).executeFlashloan( + mockFlashloanReceiver.address, + [vARB.address], // Only one asset provided + [ARBFlashloanAmount, WETHFlashloanAmount], // Two loan amounts provided + ), + ).to.be.revertedWithCustomError(comptroller, "InvalidFlashloanParams"); + }); + + it("Should revert if receiver is zero address", async () => { + // Attempt to execute a flashloan with a zero address as the receiver, which should revert + await expect( + comptroller.connect(john).executeFlashloan( + mockFlashloanReceiver.address, + [AddressZero], // Zero address as an asset, which is invalid + [ARBFlashloanAmount, WETHFlashloanAmount], + ), + ).to.be.revertedWithCustomError(comptroller, "InvalidFlashloanParams"); + }); + + it("Should be able to do flashloan for ARB & WETH", async () => { + // Transfer ARB and WETH tokens to Alice to set up initial balances + await ARB.connect(arbHolder).transfer(vARB.address, parseUnits("100", 18)); + await ARB.connect(arbHolder).transfer(mockFlashloanReceiver.address, parseUnits("10", 18)); + await WETH.connect(wETHHolder).transfer(vWETH.address, parseUnits("50", 18)); + await WETH.connect(wETHHolder).transfer(mockFlashloanReceiver.address, parseUnits("5", 18)); + + // Mine blocks as required by the test setup + await mine(blocksToMine); + + const balanceBeforeARB = await ARB.balanceOf(vARB.address); + const balanceBeforeWETH = await WETH.balanceOf(vWETH.address); + + // Enable the flashloan and set fee mantissa on vARB and vWETH contracts + await vARB.connect(impersonatedTimelock).toggleFlashloan(); + await vWETH.connect(impersonatedTimelock).toggleFlashloan(); + + await vARB.connect(impersonatedTimelock).setFlashloanFeeMantissa(ARBFlashloanFeeMantissa); + await vWETH.connect(impersonatedTimelock).setFlashloanFeeMantissa(WETHFlashloanFeeMantissa); + + // John initiates a flashloan of ARB and WETH through the comptroller contract + await comptroller + .connect(john) + .executeFlashloan( + mockFlashloanReceiver.address, + [vARB.address, vWETH.address], + [ARBFlashloanAmount, WETHFlashloanAmount], + ); + + // Record ARB and WETH balances in vARB and vWETH contracts after flashloan + const balanceAfterARB = await ARB.balanceOf(vARB.address); + const balanceAfterWETH = await WETH.balanceOf(vWETH.address); + + const ARBFlashloanFee = ARBFlashloanAmount.mul(ARBFlashloanFeeMantissa).div(parseUnits("1", 18)); + const WETHFlashloanFee = WETHFlashloanAmount.mul(WETHFlashloanFeeMantissa).div(parseUnits("1", 18)); + + // Validate that ARB and WETH balances in the contracts increased, confirming repayment plus fees + expect(balanceAfterARB).to.be.equal(balanceBeforeARB.add(ARBFlashloanFee)); + expect(balanceAfterWETH).to.be.equal(balanceBeforeWETH.add(WETHFlashloanFee)); + }); + }); +} From 673612a4f613b521693d74f0443e1b3df1908dfa Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Mon, 30 Dec 2024 19:30:36 +0530 Subject: [PATCH 13/15] refactor: reduce comptroller size --- contracts/Comptroller.sol | 63 ++++++++++++++++--- .../Comptroller/liquidateAccountTest.ts | 5 +- tests/hardhat/Comptroller/pauseTest.ts | 5 +- tests/hardhat/Comptroller/setters.ts | 20 ++++-- tests/integration/index.ts | 5 +- 5 files changed, 76 insertions(+), 22 deletions(-) diff --git a/contracts/Comptroller.sol b/contracts/Comptroller.sol index 8842fd2ec..927287884 100644 --- a/contracts/Comptroller.sol +++ b/contracts/Comptroller.sol @@ -168,6 +168,24 @@ contract Comptroller is /// @notice Thrown when collateral factor is not zero error CollateralFactorIsNotZero(); + /// @notice Thrown when the close factor is invalid + error InvalidCloseFactor(); + + /// @notice Thrown when the liquidation incentive is invalid + error InvalidLiquidationIncentive(); + + /// @notice Thrown when the VToken is invalid + error InvalidVToken(); + + /// @notice Thrown when the input is invalid + error InvalidInput(); + + /// @notice Thrown when the rewards distributor already exists + error RewardsDistributorAlreadyExists(); + + /// @notice Thrown when the market does not exist + error MarketNotExist(); + /** * @notice Thrown during the liquidation if user's total collateral amount is lower than * a predefined threshold. In this case only batch liquidations (either liquidateAccount @@ -1062,7 +1080,10 @@ contract Comptroller is for (uint256 i; i < marketsCount; ++i) { (, uint256 borrowBalance, ) = _safeGetAccountSnapshot(borrowMarkets[i], borrower); - require(borrowBalance == 0, "Nonzero borrow balance after liquidation"); + // require(borrowBalance == 0, "Nonzero borrow balance after liquidation"); + if (borrowBalance > 0) { + revert NonzeroBorrowBalance(); + } } } @@ -1074,8 +1095,11 @@ contract Comptroller is */ function setCloseFactor(uint256 newCloseFactorMantissa) external { _checkAccessAllowed("setCloseFactor(uint256)"); - require(MAX_CLOSE_FACTOR_MANTISSA >= newCloseFactorMantissa, "Close factor greater than maximum close factor"); - require(MIN_CLOSE_FACTOR_MANTISSA <= newCloseFactorMantissa, "Close factor smaller than minimum close factor"); + if (MAX_CLOSE_FACTOR_MANTISSA < newCloseFactorMantissa || MIN_CLOSE_FACTOR_MANTISSA > newCloseFactorMantissa) { + revert InvalidCloseFactor(); + } + // require(MAX_CLOSE_FACTOR_MANTISSA >= newCloseFactorMantissa, "Close factor greater than maximum close factor"); + // require(MIN_CLOSE_FACTOR_MANTISSA <= newCloseFactorMantissa, "Close factor smaller than minimum close factor"); uint256 oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; @@ -1150,7 +1174,10 @@ contract Comptroller is * @custom:access Controlled by AccessControlManager */ function setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external { - require(newLiquidationIncentiveMantissa >= MANTISSA_ONE, "liquidation incentive should be greater than 1e18"); + if (newLiquidationIncentiveMantissa < MANTISSA_ONE) { + revert InvalidLiquidationIncentive(); + } + // require(newLiquidationIncentiveMantissa >= MANTISSA_ONE, "liquidation incentive should be greater than 1e18"); _checkAccessAllowed("setLiquidationIncentive(uint256)"); @@ -1178,7 +1205,11 @@ contract Comptroller is revert MarketAlreadyListed(address(vToken)); } - require(vToken.isVToken(), "Comptroller: Invalid vToken"); // Sanity check to make sure its really a VToken + if (!vToken.isVToken()) { + revert InvalidVToken(); + } + + // require(vToken.isVToken(), "Comptroller: Invalid vToken"); // Sanity check to make sure its really a VToken Market storage newMarket = markets[address(vToken)]; newMarket.isListed = true; @@ -1212,7 +1243,10 @@ contract Comptroller is uint256 numMarkets = vTokens.length; uint256 numBorrowCaps = newBorrowCaps.length; - require(numMarkets != 0 && numMarkets == numBorrowCaps, "invalid input"); + if (numMarkets == 0 || numMarkets != numBorrowCaps) { + revert InvalidInput(); + } + // require(numMarkets != 0 && numMarkets == numBorrowCaps, "invalid input"); _ensureMaxLoops(numMarkets); @@ -1236,8 +1270,11 @@ contract Comptroller is _checkAccessAllowed("setMarketSupplyCaps(address[],uint256[])"); uint256 vTokensCount = vTokens.length; - require(vTokensCount != 0, "invalid number of markets"); - require(vTokensCount == newSupplyCaps.length, "invalid number of markets"); + if (vTokensCount == 0 || vTokensCount != newSupplyCaps.length) { + revert InvalidInput(); + } + // require(vTokensCount != 0, "invalid number of markets"); + // require(vTokensCount == newSupplyCaps.length, "invalid number of markets"); _ensureMaxLoops(vTokensCount); @@ -1295,7 +1332,10 @@ contract Comptroller is * @custom:event Emits NewRewardsDistributor with distributor address */ function addRewardsDistributor(RewardsDistributor _rewardsDistributor) external onlyOwner { - require(!rewardsDistributorExists[address(_rewardsDistributor)], "already exists"); + if (rewardsDistributorExists[address(_rewardsDistributor)]) { + revert RewardsDistributorAlreadyExists(); + } + // require(!rewardsDistributorExists[address(_rewardsDistributor)], "already exists"); uint256 rewardsDistributorsLen = rewardsDistributors.length; _ensureMaxLoops(rewardsDistributorsLen + 1); @@ -1633,7 +1673,10 @@ contract Comptroller is * @param paused The new paused state (true=paused, false=unpaused) */ function _setActionPaused(address market, Action action, bool paused) internal { - require(markets[market].isListed, "cannot pause a market that is not listed"); + if (!markets[market].isListed) { + revert MarketNotExist(); + } + // require(markets[market].isListed, "cannot pause a market that is not listed"); _actionPaused[market][action] = paused; emit ActionPausedMarket(VToken(market), action, paused); } diff --git a/tests/hardhat/Comptroller/liquidateAccountTest.ts b/tests/hardhat/Comptroller/liquidateAccountTest.ts index 75fbd4f06..6bac7ea07 100644 --- a/tests/hardhat/Comptroller/liquidateAccountTest.ts +++ b/tests/hardhat/Comptroller/liquidateAccountTest.ts @@ -338,8 +338,9 @@ describe("liquidateAccount", () => { beforeLiquidation: { supply: 0, borrows: parseUnits("1", 18) }, afterLiquidation: { supply: 0, borrows: 0 }, }); - await expect(comptroller.connect(liquidator).liquidateAccount(user.address, [])).to.be.revertedWith( - "Nonzero borrow balance after liquidation", + await expect(comptroller.connect(liquidator).liquidateAccount(user.address, [])).to.be.revertedWithCustomError( + comptroller, + "NonzeroBorrowBalance", ); }); }); diff --git a/tests/hardhat/Comptroller/pauseTest.ts b/tests/hardhat/Comptroller/pauseTest.ts index f15875109..79879ad31 100644 --- a/tests/hardhat/Comptroller/pauseTest.ts +++ b/tests/hardhat/Comptroller/pauseTest.ts @@ -101,8 +101,9 @@ describe("Comptroller", () => { }); it("reverts if the market is not listed", async () => { - await expect(comptroller.setActionsPaused([SKT.address], [1], true)).to.be.revertedWith( - "cannot pause a market that is not listed", + await expect(comptroller.setActionsPaused([SKT.address], [1], true)).to.be.revertedWithCustomError( + comptroller, + "MarketNotExist", ); }); diff --git a/tests/hardhat/Comptroller/setters.ts b/tests/hardhat/Comptroller/setters.ts index e50da4007..af440a37e 100644 --- a/tests/hardhat/Comptroller/setters.ts +++ b/tests/hardhat/Comptroller/setters.ts @@ -105,8 +105,9 @@ describe("setters", async () => { it("reverts if re-adding same rewardDistributor", async () => { await comptroller.addRewardsDistributor(newRewardsDistributor.address); - await expect(comptroller.addRewardsDistributor(newRewardsDistributor.address)).to.be.revertedWith( - "already exists", + await expect(comptroller.addRewardsDistributor(newRewardsDistributor.address)).to.be.revertedWithCustomError( + comptroller, + "RewardsDistributorAlreadyExists", ); }); }); @@ -147,17 +148,24 @@ describe("setters", async () => { describe("SupplyAndBorrowCaps", async () => { it("reverts if token data is invalid", async () => { - await expect(comptroller.setMarketSupplyCaps([], [1, 2])).to.be.revertedWith("invalid number of markets"); + await expect(comptroller.setMarketSupplyCaps([], [1, 2])).to.be.revertedWithCustomError( + comptroller, + "InvalidInput", + ); }); it("reverts if supply and token data is invalid", async () => { - await expect(comptroller.setMarketSupplyCaps([OMG.address], [1, 2])).to.be.revertedWith( - "invalid number of markets", + await expect(comptroller.setMarketSupplyCaps([OMG.address], [1, 2])).to.be.revertedWithCustomError( + comptroller, + "InvalidInput", ); }); it("reverts if borrow and token data is invalid", async () => { - await expect(comptroller.setMarketBorrowCaps([OMG.address], [1, 2])).to.be.revertedWith("invalid input"); + await expect(comptroller.setMarketBorrowCaps([OMG.address], [1, 2])).to.be.revertedWithCustomError( + comptroller, + "InvalidInput", + ); }); }); diff --git a/tests/integration/index.ts b/tests/integration/index.ts index eeac37af7..4260e1233 100644 --- a/tests/integration/index.ts +++ b/tests/integration/index.ts @@ -484,8 +484,9 @@ describe("Straight Cases For Single User Liquidation and healing", function () { dummyPriceOracle.getUnderlyingPrice.whenCalledWith(vBNX.address).returns(convertToUnit("100", 12)); dummyPriceOracle.getUnderlyingPrice.whenCalledWith(vBTCB.address).returns(convertToUnit("100", 12)); await Comptroller.setPriceOracle(dummyPriceOracle.address); - await expect(Comptroller.connect(acc1Signer).liquidateAccount(acc2, [param])).to.be.revertedWith( - "Nonzero borrow balance after liquidation", + await expect(Comptroller.connect(acc1Signer).liquidateAccount(acc2, [param])).to.be.revertedWithCustomError( + Comptroller, + "NonzeroBorrowBalance", ); }); From 39b1fdc81cac1ee91a91d0ece1ddb159bb539825 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Mon, 6 Jan 2025 23:24:00 +0530 Subject: [PATCH 14/15] refactor: use camel case for flashloan --- contracts/Comptroller.sol | 38 +- contracts/ComptrollerInterface.sol | 2 +- contracts/ErrorReporter.sol | 2 +- .../Flashloan/base/FlashloanReceiverBase.sol | 10 +- .../base/FlashloanSimpleReceiverBase.sol | 10 +- .../interfaces/IFlashloanReceiver.sol | 14 +- .../interfaces/IFlashloanSimpleReceiver.sol | 8 +- contracts/VToken.sol | 72 +- contracts/VTokenInterfaces.sol | 28 +- .../test/Mocks/MockFlashloanReceiver.sol | 24 +- .../Mocks/MockFlashloanSimpleReceiver.sol | 22 +- contracts/test/UpgradedVToken.sol | 8 +- deploy/009-deploy-vtokens.ts | 8 +- helpers/deploymentConfig.ts | 692 +++++++++--------- tests/hardhat/Comptroller/Flashloan.ts | 74 +- tests/hardhat/Fork/flashloan.ts | 96 +-- tests/hardhat/Fork/flashloanSimple.ts | 62 +- tests/hardhat/Tokens/flashLoanSimple.ts | 94 +-- tests/hardhat/util/TokenTestHelpers.ts | 12 +- 19 files changed, 639 insertions(+), 637 deletions(-) diff --git a/contracts/Comptroller.sol b/contracts/Comptroller.sol index 927287884..cf57a7955 100644 --- a/contracts/Comptroller.sol +++ b/contracts/Comptroller.sol @@ -13,7 +13,7 @@ import { VToken } from "./VToken.sol"; import { RewardsDistributor } from "./Rewards/RewardsDistributor.sol"; import { MaxLoopsLimitHelper } from "./MaxLoopsLimitHelper.sol"; import { ensureNonzeroAddress } from "./lib/validators.sol"; -import { IFlashloanReceiver } from "./Flashloan/interfaces/IFlashloanReceiver.sol"; +import { IFlashLoanReceiver } from "./FlashLoan/interfaces/IFlashLoanReceiver.sol"; /** * @title Comptroller @@ -106,7 +106,7 @@ contract Comptroller is event DelegateUpdated(address indexed approver, address indexed delegate, bool approved); /// @notice Emitted When the flash loan is successfully executed - event FlashloanExecuted(address receiver, VTokenInterface[] assets, uint256[] amounts); + event FlashLoanExecuted(address receiver, VTokenInterface[] assets, uint256[] amounts); /// @notice Thrown when collateral factor exceeds the upper bound error InvalidCollateralFactor(); @@ -222,17 +222,17 @@ contract Comptroller is /// @notice Thrown if delegate approval status is already set to the requested value error DelegationStatusUnchanged(); - /// @notice Thrown if invalid flashloan params passed - error InvalidFlashloanParams(); + /// @notice Thrown if invalid flashLoan params passed + error InvalidFlashLoanParams(); - ///@notice Thrown if the flashloan is not enabled for a particular market + ///@notice Thrown if the flashLoan is not enabled for a particular market error FlashLoanNotEnabled(address market); ///@notice Thrown if repayment amount is insufficient error InsufficientReypaymentBalance(address tokenAddress); ///@notice Thrown if executeOperation failed - error ExecuteFlashloanFailed(); + error ExecuteFlashLoanFailed(); /// @param poolRegistry_ Pool registry address /// @custom:oz-upgrades-unsafe-allow constructor @@ -955,34 +955,34 @@ contract Comptroller is } /** - * @notice Executes a flashloan operation with the specified assets and amounts. + * @notice Executes a flashLoan operation with the specified assets and amounts. * @dev Transfer the specified assets to the receiver contract and ensures that the total repayment (amount + fee) * is returned by the receiver contract after the operation for each asset. The function performs checks to ensure the validity - * of parameters, that flashloans are enabled for the given assets, and that the total repayment is sufficient. - * Reverts on invalid parameters, disabled flashloans, or insufficient repayment. - * @param receiver The address of the contract that will receive the flashloan and execute the operation. + * of parameters, that flashLoans are enabled for the given assets, and that the total repayment is sufficient. + * Reverts on invalid parameters, disabled flashLoans, or insufficient repayment. + * @param receiver The address of the contract that will receive the flashLoan and execute the operation. * @param assets The addresses of the assets to be loaned. * @param amounts The amounts of each asset to be loaned. * @custom:requirements * - `assets.length` must be equal to `amounts.length`. * - `assets.length` and `amounts.length` must not be zero. * - The `receiver` address must not be the zero address. - * - Flashloans must be enabled for each asset. + * - FlashLoans must be enabled for each asset. * - The `receiver` contract must repay the loan with the appropriate fee. * @custom:reverts - * - Reverts with `InvalidFlashloanParams()` if parameter checks fail. - * - Reverts with `FlashLoanNotEnabled(asset)` if flashloans are disabled for any of the requested assets. - * - Reverts with `ExecuteFlashloanFailed` if the receiver contract fails to execute the operation. + * - Reverts with `InvalidFlashLoanParams()` if parameter checks fail. + * - Reverts with `FlashLoanNotEnabled(asset)` if flashLoans are disabled for any of the requested assets. + * - Reverts with `ExecuteFlashLoanFailed` if the receiver contract fails to execute the operation. * - Reverts with `InsufficientReypaymentBalance(asset)` if the repayment (amount + fee) is insufficient after the operation. */ - function executeFlashloan( + function executeFlashLoan( address receiver, VTokenInterface[] calldata assets, uint256[] calldata amounts ) external override { // Asset and amount length must be equals and not be zero if (assets.length != amounts.length || assets.length == 0 || receiver == address(0)) { - revert InvalidFlashloanParams(); + revert InvalidFlashLoanParams(); } uint256 len = assets.length; @@ -1001,8 +1001,8 @@ contract Comptroller is } // Call the execute operation on receiver contract - if (!IFlashloanReceiver(receiver).executeOperation(assets, amounts, fees, receiver, "")) { - revert ExecuteFlashloanFailed(); + if (!IFlashLoanReceiver(receiver).executeOperation(assets, amounts, fees, receiver, "")) { + revert ExecuteFlashLoanFailed(); } for (uint256 k; k < len; ) { @@ -1013,7 +1013,7 @@ contract Comptroller is } } - emit FlashloanExecuted(receiver, assets, amounts); + emit FlashLoanExecuted(receiver, assets, amounts); } /** diff --git a/contracts/ComptrollerInterface.sol b/contracts/ComptrollerInterface.sol index 786599ac4..4a2ef4d1a 100644 --- a/contracts/ComptrollerInterface.sol +++ b/contracts/ComptrollerInterface.sol @@ -91,7 +91,7 @@ interface ComptrollerInterface { function preTransferHook(address vToken, address src, address dst, uint256 transferTokens) external; - function executeFlashloan(address receiver, VTokenInterface[] calldata assets, uint256[] calldata amounts) external; + function executeFlashLoan(address receiver, VTokenInterface[] calldata assets, uint256[] calldata amounts) external; function isComptroller() external view returns (bool); diff --git a/contracts/ErrorReporter.sol b/contracts/ErrorReporter.sol index e05ab34be..64b0e3d30 100644 --- a/contracts/ErrorReporter.sol +++ b/contracts/ErrorReporter.sol @@ -48,7 +48,7 @@ contract TokenErrorReporter { error SetInterestRateModelFreshCheck(); error FlashLoanNotEnabled(address); - error ExecuteFlashloanFailed(); + error ExecuteFlashLoanFailed(); error InvalidComptroller(address comptroller); error InsufficientReypaymentBalance(address tokenAddress); } diff --git a/contracts/Flashloan/base/FlashloanReceiverBase.sol b/contracts/Flashloan/base/FlashloanReceiverBase.sol index b38a13819..021842a55 100644 --- a/contracts/Flashloan/base/FlashloanReceiverBase.sol +++ b/contracts/Flashloan/base/FlashloanReceiverBase.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.8.25; -import { IFlashloanReceiver } from "../interfaces/IFlashloanReceiver.sol"; +import { IFlashLoanReceiver } from "../interfaces/IFlashLoanReceiver.sol"; import { ComptrollerInterface } from "../../ComptrollerInterface.sol"; -/// @title FlashloanReceiverBase -/// @notice A base contract for implementing flashloan receiver logic. -/// @dev This abstract contract provides the necessary structure for inheriting contracts to implement the `IFlashloanReceiver` interface. +/// @title FlashLoanReceiverBase +/// @notice A base contract for implementing flashLoan receiver logic. +/// @dev This abstract contract provides the necessary structure for inheriting contracts to implement the `IFlashLoanReceiver` interface. /// It stores a reference to the Comptroller contract, which manages various aspects of the protocol. -abstract contract FlashloanReceiverBase is IFlashloanReceiver { +abstract contract FlashLoanReceiverBase is IFlashLoanReceiver { /// @notice The Comptroller contract that governs the protocol. /// @dev This immutable variable stores the address of the Comptroller contract, which cannot be changed after deployment. ComptrollerInterface public immutable COMPTROLLER; diff --git a/contracts/Flashloan/base/FlashloanSimpleReceiverBase.sol b/contracts/Flashloan/base/FlashloanSimpleReceiverBase.sol index 0ba5c8746..ca2a39433 100644 --- a/contracts/Flashloan/base/FlashloanSimpleReceiverBase.sol +++ b/contracts/Flashloan/base/FlashloanSimpleReceiverBase.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.8.25; -import { IFlashloanSimpleReceiver } from "../interfaces/IFlashloanSimpleReceiver.sol"; +import { IFlashLoanSimpleReceiver } from "../interfaces/IFlashLoanSimpleReceiver.sol"; import { VTokenInterface } from "../../VTokenInterfaces.sol"; /** - * @title FlashloanSimpleReceiverBase + * @title FlashLoanSimpleReceiverBase * @author Venus - * @notice Base contract to develop a flashloan-receiver contract. + * @notice Base contract to develop a flashLoan-receiver contract. * @dev This contract serves as a foundational contract for implementing custom flash loan receiver logic. - * Inheritors of this contract need to implement the `executeOperation` function defined in the `IFlashloanSimpleReceiver` interface. + * Inheritors of this contract need to implement the `executeOperation` function defined in the `IFlashLoanSimpleReceiver` interface. */ -abstract contract FlashloanSimpleReceiverBase is IFlashloanSimpleReceiver { +abstract contract FlashLoanSimpleReceiverBase is IFlashLoanSimpleReceiver { /// @notice The VToken contract used to initiate and handle flash loan /// @dev This is an immutable reference to the VTokenInterface, which enables the flash loan functionality. VTokenInterface public immutable VTOKEN; diff --git a/contracts/Flashloan/interfaces/IFlashloanReceiver.sol b/contracts/Flashloan/interfaces/IFlashloanReceiver.sol index 7c2942ccd..e385f1374 100644 --- a/contracts/Flashloan/interfaces/IFlashloanReceiver.sol +++ b/contracts/Flashloan/interfaces/IFlashloanReceiver.sol @@ -1,20 +1,20 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity ^0.8.25; +pragma solidity 0.8.25; import { VTokenInterface } from "../../VTokenInterfaces.sol"; -/// @title IFlashloanReceiver -/// @notice Interface for flashloan receiver contract, which execute custom logic with flash-borrowed assets. -/// @dev This interface defines the method that must be implemented by any contract wishing to interact with the flashloan system. -/// Contracts must ensure they have the means to repay both the flashloaned amount and the associated premium (fee). -interface IFlashloanReceiver { +/// @title IFlashLoanReceiver +/// @notice Interface for flashLoan receiver contract, which execute custom logic with flash-borrowed assets. +/// @dev This interface defines the method that must be implemented by any contract wishing to interact with the flashLoan system. +/// Contracts must ensure they have the means to repay both the flashLoan amount and the associated premium (fee). +interface IFlashLoanReceiver { /** * @notice Executes an operation after receiving the flash-borrowed assets. * @dev Implementation of this function must ensure the borrowed amount plus the premium (fee) is repaid within the same transaction. * @param assets The addresses of the assets that were flash-borrowed. * @param amounts The amounts of each of the flash-borrowed assets. * @param premiums The premiums (fees) associated with each flash-borrowed asset. - * @param initiator The address that initiated the flashloan operation. + * @param initiator The address that initiated the flashLoan operation. * @param param Additional parameters encoded as bytes. These can be used to pass custom data to the receiver contract. * @return True if the operation succeeds and the borrowed amount plus the premium is repaid, false otherwise. */ diff --git a/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol b/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol index 52d0d190a..a7c000dfb 100644 --- a/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol +++ b/contracts/Flashloan/interfaces/IFlashloanSimpleReceiver.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause -pragma solidity ^0.8.25; +pragma solidity 0.8.25; -interface IFlashloanSimpleReceiver { +interface IFlashLoanSimpleReceiver { /** * @notice Executes an operation after receiving the flash-borrowed asset * @dev Ensure that the contract can return the debt + premium, e.g., has @@ -9,8 +9,8 @@ interface IFlashloanSimpleReceiver { * @param asset The address of the flash-borrowed asset * @param amount The amount of the flash-borrowed asset * @param premium The premium (fee) associated with flash-borrowed asset. - * @param initiator The address that initiated the flashloan operation - * @param param The byte-encoded param passed when initiating the flashloan + * @param initiator The address that initiated the flashLoan operation + * @param param The byte-encoded param passed when initiating the flashLoan * @return True if the execution of the operation succeeds, false otherwise */ function executeOperation( diff --git a/contracts/VToken.sol b/contracts/VToken.sol index b8256f0fa..b609e5dff 100644 --- a/contracts/VToken.sol +++ b/contracts/VToken.sol @@ -14,7 +14,7 @@ import { InterestRateModel } from "./InterestRateModel.sol"; import { ExponentialNoError } from "./ExponentialNoError.sol"; import { TimeManagerV8 } from "@venusprotocol/solidity-utilities/contracts/TimeManagerV8.sol"; import { ensureNonzeroAddress } from "./lib/validators.sol"; -import { IFlashloanSimpleReceiver } from "./Flashloan/interfaces/IFlashloanSimpleReceiver.sol"; +import { IFlashLoanSimpleReceiver } from "./FlashLoan/interfaces/IFlashLoanSimpleReceiver.sol"; /** * @title VToken @@ -107,7 +107,8 @@ contract VToken is * @param accessControlManager_ AccessControlManager contract address * @param riskManagement Addresses of risk & income related contracts * @param reserveFactorMantissa_ Percentage of borrow interest that goes to reserves (from 0 to 1e18) - * @param flashLoanEnabled_ Enable flashloan or not for this market + * @param flashLoanEnabled_ Enable flashLoan or not for this market + * @param flashLoanFeeMantissa_ FlashLoan fee mantissa * @custom:error ZeroAddressNotAllowed is thrown when admin address is zero * @custom:error ZeroAddressNotAllowed is thrown when shortfall contract address is zero * @custom:error ZeroAddressNotAllowed is thrown when protocol share reserve address is zero @@ -125,7 +126,7 @@ contract VToken is RiskManagementInit memory riskManagement, uint256 reserveFactorMantissa_, bool flashLoanEnabled_, - uint256 flashloanFeeMantissa_ + uint256 flashLoanFeeMantissa_ ) external initializer { ensureNonzeroAddress(admin_); @@ -143,7 +144,7 @@ contract VToken is riskManagement, reserveFactorMantissa_, flashLoanEnabled_, - flashloanFeeMantissa_ + flashLoanFeeMantissa_ ); } @@ -713,7 +714,7 @@ contract VToken is * - The caller must be the Comptroller contract. * @custom:reverts * - Reverts with "Only Comptroller" if the caller is not the Comptroller. - * @custom:event Emits FlashloanAmountTransferred event on successful transfer of amount to receiver + * @custom:event Emits FlashLoanAmountTransferred event on successful transfer of amount to receiver */ function transferUnderlying( address to, @@ -726,33 +727,33 @@ contract VToken is _doTransferOut(to, amount); balanceBefore = _getCashPrior(); - emit FlashloanAmountTransferred(underlying, to, amount); + emit FlashLoanAmountTransferred(underlying, to, amount); } /** - * @notice Executes a flashloan operation. + * @notice Executes a flashLoan operation. * @dev Transfers the amount to the receiver contract and ensures that the total repayment (amount + fee) * is returned by the receiver contract after the operation. The function performs checks to ensure the validity - * of parameters, that flashloan is enabled for the given asset, and that the total repayment is sufficient. - * Reverts on invalid parameters, disabled flashloans, or insufficient repayment. - * @param receiver The address of the contract that will receive the flashloan and execute the operation. + * of parameters, that flashLoan is enabled for the given asset, and that the total repayment is sufficient. + * Reverts on invalid parameters, disabled flashLoans, or insufficient repayment. + * @param receiver The address of the contract that will receive the flashLoan and execute the operation. * @param amount The amount of asset to be loaned. * @custom:requirements * - The `receiver` address must not be the zero address. - * - Flashloans must be enabled for the asset. + * - FlashLoans must be enabled for the asset. * - The `receiver` contract must repay the loan with the appropriate fee. * @custom:reverts - * - Reverts with `FlashLoanNotEnabled(asset)` if flashloans are disabled for any of the requested assets. - * - Reverts with `ExecuteFlashloanFailed` if the receiver contract fails to execute the operation. + * - Reverts with `FlashLoanNotEnabled(asset)` if flashLoans are disabled for any of the requested assets. + * - Reverts with `ExecuteFlashLoanFailed` if the receiver contract fails to execute the operation. * - Reverts with `InsufficientReypaymentBalance(asset)` if the repayment (amount + fee) is insufficient after the operation. - * @custom:event Emits FlashloanExecuted event on success + * @custom:event Emits FlashLoanExecuted event on success */ - function executeFlashloan(address receiver, uint256 amount) external override nonReentrant returns (uint256) { + function executeFlashLoan(address receiver, uint256 amount) external override nonReentrant returns (uint256) { uint256 repaymentAmount; uint256 fee; (fee, repaymentAmount) = calculateFee(receiver, amount); - IFlashloanSimpleReceiver receiverContract = IFlashloanSimpleReceiver(receiver); + IFlashLoanSimpleReceiver receiverContract = IFlashLoanSimpleReceiver(receiver); // Transfer the underlying asset to the receiver. _doTransferOut(receiver, amount); @@ -761,12 +762,12 @@ contract VToken is // Call the execute operation on receiver contract if (!receiverContract.executeOperation(underlying, amount, fee, msg.sender, "")) { - revert ExecuteFlashloanFailed(); + revert ExecuteFlashLoanFailed(); } verifyBalance(balanceBefore, repaymentAmount); - emit FlashloanExecuted(receiver, underlying, amount); + emit FlashLoanExecuted(receiver, underlying, amount); return NO_ERROR; } @@ -774,25 +775,25 @@ contract VToken is /** * @notice Enable or disable flash loan for the market * @custom:access Only Governance - * @custom:event Emits ToggleFlashloanEnabled event on success + * @custom:event Emits ToggleFlashLoanEnabled event on success */ - function toggleFlashloan() external override { - _checkAccessAllowed("toggleFlashloan()"); - isFlashloanEnabled = !isFlashloanEnabled; + function toggleFlashLoan() external override { + _checkAccessAllowed("toggleFlashLoan()"); + isFlashLoanEnabled = !isFlashLoanEnabled; - emit ToggleFlashloanEnabled(!isFlashloanEnabled, isFlashloanEnabled); + emit ToggleFlashLoanEnabled(!isFlashLoanEnabled, isFlashLoanEnabled); } /** - * @notice Update flashloan fee mantissa + * @notice Update flashLoan fee mantissa * @custom:access Only Governance - * @custom:event Emits FlashloanFeeUpdated event on success + * @custom:event Emits FlashLoanFeeUpdated event on success */ - function setFlashloanFeeMantissa(uint256 fee) external override { - _checkAccessAllowed("setFlashloanFeeMantissa(uint256)"); + function setFlashLoanFeeMantissa(uint256 fee) external override { + _checkAccessAllowed("setFlashLoanFeeMantissa(uint256)"); - emit FlashloanFeeUpdated(flashloanFeeMantissa, fee); - flashloanFeeMantissa = fee; + emit FlashLoanFeeUpdated(flashLoanFeeMantissa, fee); + flashLoanFeeMantissa = fee; } /** @@ -993,10 +994,10 @@ contract VToken is address receiver, uint256 amount ) public view override returns (uint256 fee, uint256 repaymentAmount) { - if (!isFlashloanEnabled) revert FlashLoanNotEnabled(address(this)); + if (!isFlashLoanEnabled) revert FlashLoanNotEnabled(address(this)); ensureNonzeroAddress(receiver); - fee = (amount * flashloanFeeMantissa) / MANTISSA_ONE; + fee = (amount * flashLoanFeeMantissa) / MANTISSA_ONE; repaymentAmount = amount + fee; } @@ -1671,7 +1672,8 @@ contract VToken is * @param accessControlManager_ AccessControlManager contract address * @param riskManagement Addresses of risk & income related contracts * @param reserveFactorMantissa_ Percentage of borrow interest that goes to reserves (from 0 to 1e18) - * @param flashLoanEnabled_ Enable flashloan or not for this market + * @param flashLoanEnabled_ Enable flashLoan or not for this market + * @param flashLoanFeeMantissa_ FlashLoan fee mantissa */ function _initialize( address underlying_, @@ -1686,7 +1688,7 @@ contract VToken is RiskManagementInit memory riskManagement, uint256 reserveFactorMantissa_, bool flashLoanEnabled_, - uint256 flashloanFeeMantissa_ + uint256 flashLoanFeeMantissa_ ) internal onlyInitializing { __Ownable2Step_init(); __AccessControlled_init_unchained(accessControlManager_); @@ -1713,8 +1715,8 @@ contract VToken is _setShortfallContract(riskManagement.shortfall); _setProtocolShareReserve(riskManagement.protocolShareReserve); protocolSeizeShareMantissa = DEFAULT_PROTOCOL_SEIZE_SHARE_MANTISSA; - isFlashloanEnabled = flashLoanEnabled_; - flashloanFeeMantissa = flashloanFeeMantissa_; + isFlashLoanEnabled = flashLoanEnabled_; + flashLoanFeeMantissa = flashLoanFeeMantissa_; // Set underlying and sanity check it underlying = underlying_; diff --git a/contracts/VTokenInterfaces.sol b/contracts/VTokenInterfaces.sol index cec499098..b2a6aed35 100644 --- a/contracts/VTokenInterfaces.sol +++ b/contracts/VTokenInterfaces.sol @@ -132,14 +132,14 @@ contract VTokenStorage { uint256 public reduceReservesBlockNumber; /** - * @notice flashloan is enabled for this market or not + * @notice flashLoan is enabled for this market or not */ - bool public isFlashloanEnabled; + bool public isFlashLoanEnabled; /** - * @notice fee percentage collected by protocol on flashloan + * @notice fee percentage collected by protocol on flashLoan */ - uint256 public flashloanFeeMantissa; + uint256 public flashLoanFeeMantissa; /** * @dev This empty reserved space is put in place to allow future versions to add new @@ -299,24 +299,24 @@ abstract contract VTokenInterface is VTokenStorage { event ProtocolSeize(address indexed from, address indexed to, uint256 amount); /** - * @notice Event emitted when flashloanEnabled status is changed + * @notice Event emitted when flashLoanEnabled status is changed */ - event ToggleFlashloanEnabled(bool oldEnabled, bool enabled); + event ToggleFlashLoanEnabled(bool oldEnabled, bool enabled); /** - * @notice Event emitted when flashloan is executed + * @notice Event emitted when flashLoan is executed */ - event FlashloanExecuted(address receiver, address underlying, uint256 amount); + event FlashLoanExecuted(address receiver, address underlying, uint256 amount); /** * @notice Event emitted when asset is transferred to receiver */ - event FlashloanAmountTransferred(address asset, address receiver, uint256 amount); + event FlashLoanAmountTransferred(address asset, address receiver, uint256 amount); /** - * @notice Event emitted when flashloan fee mantissa is updated + * @notice Event emitted when flashLoan fee mantissa is updated */ - event FlashloanFeeUpdated(uint256 oldFee, uint256 fee); + event FlashLoanFeeUpdated(uint256 oldFee, uint256 fee); /*** User Interface ***/ @@ -368,7 +368,7 @@ abstract contract VTokenInterface is VTokenStorage { function transferUnderlying(address receiver, uint256 amount) external virtual returns (uint256 balanceBefore); - function executeFlashloan(address receiver, uint256 amount) external virtual returns (uint256); + function executeFlashLoan(address receiver, uint256 amount) external virtual returns (uint256); /*** Admin Functions ***/ @@ -384,9 +384,9 @@ abstract contract VTokenInterface is VTokenStorage { function addReserves(uint256 addAmount) external virtual; - function toggleFlashloan() external virtual; + function toggleFlashLoan() external virtual; - function setFlashloanFeeMantissa(uint256 fee) external virtual; + function setFlashLoanFeeMantissa(uint256 fee) external virtual; function totalBorrowsCurrent() external virtual returns (uint256); diff --git a/contracts/test/Mocks/MockFlashloanReceiver.sol b/contracts/test/Mocks/MockFlashloanReceiver.sol index ceeed6718..36a5619ea 100644 --- a/contracts/test/Mocks/MockFlashloanReceiver.sol +++ b/contracts/test/Mocks/MockFlashloanReceiver.sol @@ -1,38 +1,38 @@ // SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.10; -import { FlashloanReceiverBase } from "../../Flashloan/base/FlashloanReceiverBase.sol"; +import { FlashLoanReceiverBase } from "../../FlashLoan/base/FlashLoanReceiverBase.sol"; import { ComptrollerInterface } from "../../ComptrollerInterface.sol"; import { VTokenInterface } from "../../VTokenInterfaces.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -/// @title MockFlashloanReceiver -/// @notice A mock implementation of a flashloan receiver contract that interacts with the Comptroller to request and handle flash loans. -/// @dev This contract extends `FlashloanReceiverBase` and implements custom logic to request flash loans and repay them. -contract MockFlashloanReceiver is FlashloanReceiverBase { +/// @title MockFlashLoanReceiver +/// @notice A mock implementation of a flashLoan receiver contract that interacts with the Comptroller to request and handle flash loans. +/// @dev This contract extends `FlashLoanReceiverBase` and implements custom logic to request flash loans and repay them. +contract MockFlashLoanReceiver is FlashLoanReceiverBase { /** - * @notice Constructor to initialize the flashloan receiver with the Comptroller contract. + * @notice Constructor to initialize the flashLoan receiver with the Comptroller contract. * @param comptroller The address of the Comptroller contract used to request flash loans. */ - constructor(ComptrollerInterface comptroller) FlashloanReceiverBase(comptroller) {} + constructor(ComptrollerInterface comptroller) FlashLoanReceiverBase(comptroller) {} /** * @notice Requests a flash loan from the Comptroller contract. - * @dev This function calls the `executeFlashloan` function from the Comptroller to initiate a flash loan. + * @dev This function calls the `executeFlashLoan` function from the Comptroller to initiate a flash loan. * @param assets_ An array of VToken contracts that support flash loans. * @param amount_ An array of amounts to borrow in the flash loan for each corresponding asset. */ - function requestFlashloan(VTokenInterface[] calldata assets_, uint256[] memory amount_) external { + function requestFlashLoan(VTokenInterface[] calldata assets_, uint256[] memory amount_) external { address receiver = address(this); // Receiver address is this contract itself uint256[] memory amount = amount_; // Set the requested amounts - // Request the flashloan from the Comptroller contract - COMPTROLLER.executeFlashloan(receiver, assets_, amount); + // Request the flashLoan from the Comptroller contract + COMPTROLLER.executeFlashLoan(receiver, assets_, amount); } /** * @notice Executes custom logic after receiving the flash loan. - * @dev This function is called by the Comptroller contract as part of the flashloan process. + * @dev This function is called by the Comptroller contract as part of the flashLoan process. * It must repay the loan amount plus the premium for each borrowed asset. * @param assets The addresses of the VToken contracts for the flash-borrowed assets. * @param amounts The amounts of each asset borrowed. diff --git a/contracts/test/Mocks/MockFlashloanSimpleReceiver.sol b/contracts/test/Mocks/MockFlashloanSimpleReceiver.sol index a39c19a9a..1b6bfa23b 100644 --- a/contracts/test/Mocks/MockFlashloanSimpleReceiver.sol +++ b/contracts/test/Mocks/MockFlashloanSimpleReceiver.sol @@ -1,32 +1,32 @@ // SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.10; -import { FlashloanSimpleReceiverBase } from "../../Flashloan/base/FlashloanSimpleReceiverBase.sol"; +import { FlashLoanSimpleReceiverBase } from "../../FlashLoan/base/FlashLoanSimpleReceiverBase.sol"; import { VTokenInterface } from "../../VTokenInterfaces.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -/// @title MockFlashloanSimpleReceiver +/// @title MockFlashLoanSimpleReceiver /// @notice This contract serves as a mock implementation for a flash loan receiver, utilizing the -/// FlashloanSimpleReceiverBase as a foundation. It provides the ability to request a flash loan and +/// FlashLoanSimpleReceiverBase as a foundation. It provides the ability to request a flash loan and /// defines how the loan is repaid by implementing custom logic in the `executeOperation` function. -contract MockFlashloanSimpleReceiver is FlashloanSimpleReceiverBase { +contract MockFlashLoanSimpleReceiver is FlashLoanSimpleReceiverBase { /** - * @notice Constructor that initializes the flashloan receiver with a reference to the VToken contract. - * @param vToken The address of the VTokenInterface contract that supports flashloan functionality. + * @notice Constructor that initializes the flashLoan receiver with a reference to the VToken contract. + * @param vToken The address of the VTokenInterface contract that supports flashLoan functionality. */ - constructor(VTokenInterface vToken) FlashloanSimpleReceiverBase(vToken) {} + constructor(VTokenInterface vToken) FlashLoanSimpleReceiverBase(vToken) {} /** * @notice Requests a flash loan from the VToken contract. * @param amount_ The amount of tokens to borrow through the flash loan. - * @dev This function calls the `executeFlashloan` function of the VToken contract. + * @dev This function calls the `executeFlashLoan` function of the VToken contract. */ - function requestFlashloan(uint256 amount_) external { + function requestFlashLoan(uint256 amount_) external { address receiver = address(this); // Receiver address is this contract itself uint256 amount = amount_; // Set the requested amount - // Request the flashloan from the VToken contract - VTOKEN.executeFlashloan(receiver, amount); + // Request the flashLoan from the VToken contract + VTOKEN.executeFlashLoan(receiver, amount); } /** diff --git a/contracts/test/UpgradedVToken.sol b/contracts/test/UpgradedVToken.sol index a2480b932..fe67e7cb0 100644 --- a/contracts/test/UpgradedVToken.sol +++ b/contracts/test/UpgradedVToken.sol @@ -58,8 +58,8 @@ contract UpgradedVToken is VToken { address accessControlManager_, RiskManagementInit memory riskManagement, uint256 reserveFactorMantissa_, - bool isFlashloanEnabled_, - uint256 flashloanFeeMantissa_ + bool isFlashLoanEnabled_, + uint256 flashLoanFeeMantissa_ ) public reinitializer(2) { super._initialize( underlying_, @@ -73,8 +73,8 @@ contract UpgradedVToken is VToken { accessControlManager_, riskManagement, reserveFactorMantissa_, - isFlashloanEnabled_, - flashloanFeeMantissa_ + isFlashLoanEnabled_, + flashLoanFeeMantissa_ ); } diff --git a/deploy/009-deploy-vtokens.ts b/deploy/009-deploy-vtokens.ts index 82f76cab6..35399b330 100644 --- a/deploy/009-deploy-vtokens.ts +++ b/deploy/009-deploy-vtokens.ts @@ -64,8 +64,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { jumpMultiplierPerYear, kink_, reserveFactor, - isFlashloanAllowed, - flashloanFeeMantissa, + isFlashLoanAllowed, + flashLoanFeeMantissa, } = vtoken; const token = getTokenConfig(asset, tokensConfig); @@ -145,8 +145,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { accessControlManagerAddress, [AddressOne, protocolShareReserveAddress], reserveFactor, - isFlashloanAllowed, - flashloanFeeMantissa, + isFlashLoanAllowed, + flashLoanFeeMantissa, ]; await deploy(`VToken_${symbol}`, { from: deployer, diff --git a/helpers/deploymentConfig.ts b/helpers/deploymentConfig.ts index e2b1c298c..1433127fb 100644 --- a/helpers/deploymentConfig.ts +++ b/helpers/deploymentConfig.ts @@ -108,8 +108,8 @@ export type VTokenConfig = { borrowCap: string; vTokenReceiver: string; reduceReservesBlockDelta: string; - isFlashloanAllowed: boolean; - flashloanFeeMantissa: string; + isFlashLoanAllowed: boolean; + flashLoanFeeMantissa: string; }; export type AccessControlEntry = { @@ -475,8 +475,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(478980, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus BTCB", @@ -495,8 +495,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1000, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -538,8 +538,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3000000, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ankrBNB", @@ -558,8 +558,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(100, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus MBOX", @@ -578,8 +578,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3184294, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus NFT", @@ -598,8 +598,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(24654278679, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus RACA", @@ -618,8 +618,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3805812642, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus stkBNB", @@ -638,8 +638,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(324, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD", @@ -658,8 +658,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1698253, 18), vTokenReceiver: "account:deployer", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -947,8 +947,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(200_000, 18), vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Stable Coins)", @@ -967,8 +967,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(400_000, 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (Stable Coins)", @@ -987,8 +987,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(400_000, 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus agEUR (Stablecoins)", @@ -1007,8 +1007,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(50000, 18), vTokenReceiver: "0xc444949e0054a23c44fc45789738bdf64aed2391", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -1056,8 +1056,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("10500000", 18), vTokenReceiver: "0x109E8083a64c7DedE513e8b580c5b08B96f9cE73", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ALPACA (DeFi)", @@ -1076,8 +1076,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1750000", 18), vTokenReceiver: "0xAD9CADe20100B8b945da48e1bCbd805C38d8bE77", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (DeFi)", @@ -1096,8 +1096,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (DeFi)", @@ -1116,8 +1116,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ANKR (DeFi)", @@ -1136,8 +1136,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("6656161", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ankrBNB (DeFi)", @@ -1156,8 +1156,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("4000", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus PLANET (DeFi)", @@ -1176,8 +1176,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500000000", 18), vTokenReceiver: "0x0554d6079eBc222AD12405E52b264Bdb5B65D1cf", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus TWT (DeFi)", @@ -1196,8 +1196,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500000", 18), vTokenReceiver: "0x0848dB7cB495E7b9aDA1D4dC972b9A526D014D84", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -1245,8 +1245,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2800000000", 18), vTokenReceiver: "0x6Ee74536B3Ff10Ff639aa781B7220121287F6Fa5", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus FLOKI (GameFi)", @@ -1265,8 +1265,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("28000000000", 18), // FLOKI has 18 decimals on testnet vTokenReceiver: "0x17e98a24f992BB7bcd62d6722d714A3C74814B94", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (GameFi)", @@ -1285,8 +1285,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (GameFi)", @@ -1305,8 +1305,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -1348,8 +1348,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("5600", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus BNBx (Liquid Staked BNB)", @@ -1368,8 +1368,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1272", 18), vTokenReceiver: "0xF0348E1748FCD45020151C097D234DbbD5730BE7", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus stkBNB (Liquid Staked BNB)", @@ -1388,8 +1388,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("378", 18), vTokenReceiver: "0xccc022502d6c65e1166fd34147040f05880f7972", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WBNB (Liquid Staked BNB)", @@ -1408,8 +1408,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("56000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Liquid Staked BNB)", @@ -1428,8 +1428,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (Liquid Staked BNB)", @@ -1448,8 +1448,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus SnBNB (Liquid Staked BNB)", @@ -1468,8 +1468,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("100", 18), vTokenReceiver: "0xDC2D855A95Ee70d7282BebD35c96f905CDE31f55", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -1529,8 +1529,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1050000000000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus NFT (Tron)", @@ -1549,8 +1549,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2800000000", 18), // NFT has 18 decimals on testnet vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WIN (Tron)", @@ -1569,8 +1569,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2100000000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus TRX (Tron)", @@ -1589,8 +1589,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("7700000", 6), // Note 6 decimals vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Tron)", @@ -1609,8 +1609,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 6), // USDT has 6 decimals on testnet vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (Tron)", @@ -1629,8 +1629,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -1684,8 +1684,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("800000000000000", 9), vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Meme)", @@ -1704,8 +1704,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("900000", 6), vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -1741,8 +1741,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("5", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -1761,8 +1761,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("200", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ETH (Liquid Staked ETH)", @@ -1781,8 +1781,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("400", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bsctestnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [], @@ -2013,8 +2013,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(200_000, 18), vTokenReceiver: "0x09702Ea135d9D707DD51f530864f2B9220aAD87B", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Stablecoins)", @@ -2033,8 +2033,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(400_000, 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (Stablecoins)", @@ -2053,8 +2053,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(400_000, 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus agEUR (Stablecoins)", @@ -2073,8 +2073,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(50000, 18), vTokenReceiver: "0xc444949e0054a23c44fc45789738bdf64aed2391", // community wallet reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -2122,8 +2122,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("10500000", 18), vTokenReceiver: "0x109E8083a64c7DedE513e8b580c5b08B96f9cE73", // biswap team treasury reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ALPACA (DeFi)", @@ -2142,8 +2142,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1750000", 18), vTokenReceiver: "0xAD9CADe20100B8b945da48e1bCbd805C38d8bE77", // alpaca team treasury reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (DeFi)", @@ -2162,8 +2162,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (DeFi)", @@ -2182,8 +2182,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", // tron ecosystem treasury reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ANKR (DeFi)", @@ -2202,8 +2202,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("6656161", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", // ankr team treasury reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { @@ -2223,8 +2223,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("4000", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", // ankr team treasury reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus PLANET (DeFi)", @@ -2243,8 +2243,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500000000", 18), vTokenReceiver: "0x0554d6079eBc222AD12405E52b264Bdb5B65D1cf", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus TWT (DeFi)", @@ -2263,8 +2263,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500000", 18), vTokenReceiver: "0x0848dB7cB495E7b9aDA1D4dC972b9A526D014D84", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -2313,8 +2313,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2800000000", 18), vTokenReceiver: "0x6Ee74536B3Ff10Ff639aa781B7220121287F6Fa5", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus FLOKI (GameFi)", @@ -2333,8 +2333,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("28000000000", 9), // Note 9 decimals vTokenReceiver: "0x17e98a24f992BB7bcd62d6722d714A3C74814B94", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (GameFi)", @@ -2353,8 +2353,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (GameFi)", @@ -2373,8 +2373,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -2416,8 +2416,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("5600", 18), vTokenReceiver: "0xAE1c38847Fb90A13a2a1D7E5552cCD80c62C6508", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus BNBx (Liquid Staked BNB)", @@ -2436,8 +2436,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1272", 18), vTokenReceiver: "0xF0348E1748FCD45020151C097D234DbbD5730BE7", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus stkBNB (Liquid Staked BNB)", @@ -2456,8 +2456,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("378", 18), vTokenReceiver: "0xccc022502d6c65e1166fd34147040f05880f7972", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WBNB (Liquid Staked BNB)", @@ -2476,8 +2476,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("56000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Liquid Staked BNB)", @@ -2496,8 +2496,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (Liquid Staked BNB)", @@ -2516,8 +2516,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus SnBNB (Liquid Staked BNB)", @@ -2536,8 +2536,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("100", 18), vTokenReceiver: "0xDC2D855A95Ee70d7282BebD35c96f905CDE31f55", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -2597,8 +2597,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1050000000000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus NFT (Tron)", @@ -2617,8 +2617,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2800000000", 6), // Note 6 decimals vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WIN (Tron)", @@ -2637,8 +2637,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2100000000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus TRX (Tron)", @@ -2657,8 +2657,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("7700000", 6), // Note 6 decimals vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Tron)", @@ -2677,8 +2677,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("14880000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDD (Tron)", @@ -2697,8 +2697,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1600000", 18), vTokenReceiver: "0x3DdfA8eC3052539b6C9549F12cEA2C295cfF5296", reduceReservesBlockDelta: "28800", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -2752,8 +2752,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("800000000000000", 9), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Meme)", @@ -2772,8 +2772,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("900000", 18), vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, reduceReservesBlockDelta: "100", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -2809,8 +2809,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("5", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -2829,8 +2829,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("200", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ETH (Liquid Staked ETH)", @@ -2849,8 +2849,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("400", 18), reduceReservesBlockDelta: "28800", vTokenReceiver: preconfiguredAddresses.bscmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [], @@ -3046,8 +3046,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(250, 8), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -3066,8 +3066,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4600, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -3086,8 +3086,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(9_000_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -3106,8 +3106,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(9_000_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus crvUSD (Core)", @@ -3126,8 +3126,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(9_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus CRV (Core)", @@ -3146,8 +3146,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus DAI (Core)", @@ -3166,8 +3166,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus TUSD (Core)", @@ -3186,8 +3186,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_800_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus Frax (Core)", @@ -3206,8 +3206,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(8_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus Staked FRAX (Core)", @@ -3226,8 +3226,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, // TBD - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus eBTC", @@ -3246,8 +3246,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("12.5", 8), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus EIGEN", @@ -3266,8 +3266,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -3340,8 +3340,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4_500_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Stablecoins)", @@ -3360,8 +3360,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4_500_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus crvUSD (Stablecoins)", @@ -3380,8 +3380,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [], @@ -3410,8 +3410,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus CRV (Curve)", @@ -3430,8 +3430,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -3478,8 +3478,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Liquid Staked ETH)", @@ -3498,8 +3498,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(18_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -3518,8 +3518,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(750, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus PT-wETH-26DEC2024 (Liquid Staked ETH)", @@ -3538,8 +3538,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(375, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus rsETH (Liquid Staked ETH)", @@ -3558,8 +3558,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3_600, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus sfrxETH (Liquid Staked ETH)", @@ -3578,8 +3578,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ezETH (Liquid Staked ETH)", @@ -3598,8 +3598,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_400, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus weETHs (Liquid Staked ETH)", @@ -3618,8 +3618,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(0, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus pufETH (Liquid Staked ETH)", @@ -3638,8 +3638,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("300", 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -3859,8 +3859,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(850, 8), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -3879,8 +3879,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(18_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -3899,8 +3899,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -3919,8 +3919,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 6), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus crvUSD (Core)", @@ -3939,8 +3939,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus DAI (Core)", @@ -3959,8 +3959,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(45_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus TUSD (Core)", @@ -3979,8 +3979,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_800_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus Frax (Core)", @@ -3999,8 +3999,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(8_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus Staked FRAX (Core)", @@ -4019,8 +4019,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus eBTC", @@ -4039,8 +4039,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("12.5", 8), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus EIGEN", @@ -4059,8 +4059,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_500_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -4151,8 +4151,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus CRV (Curve)", @@ -4171,8 +4171,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3_000_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7a16fF8270133F063aAb6C9977183D9e72835428", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -4225,8 +4225,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Liquid Staked ETH)", @@ -4245,8 +4245,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(18_000, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -4265,8 +4265,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(750, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: `0xF6C612c745Ba4546075DB62902c1Eb3255CdAe28`, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus PT-wETH-26DEC2024 (Liquid Staked ETH)", @@ -4285,8 +4285,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(0, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus rsETH (Liquid Staked ETH)", @@ -4305,8 +4305,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3_600, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: "0x7AAd74b7f0d60D5867B59dbD377a71783425af47", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus sfrxETH (Liquid Staked ETH)", @@ -4325,8 +4325,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x6e74053a3798e0fC9a9775F7995316b27f21c4D2", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ezETH (Liquid Staked ETH)", @@ -4345,8 +4345,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_400, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x1E3233E8d972cfFc7D0f83aFAE4354a0Db74e34E", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus weETHs (Liquid Staked ETH)", @@ -4365,8 +4365,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(0, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ETHEREUM, vTokenReceiver: "0x86fBaEB3D6b5247F420590D303a6ffC9cd523790", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus pufETH (Liquid Staked ETH)", @@ -4385,8 +4385,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("300", 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.ethereum.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -4486,8 +4486,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(250, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ETH (Core)", @@ -4506,8 +4506,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4600, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -4526,8 +4526,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(9_000_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WBNB (Core)", @@ -4546,8 +4546,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(56_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBTESTNET, vTokenReceiver: preconfiguredAddresses.opbnbtestnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [], @@ -4629,8 +4629,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("0.55", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ETH (Core)", @@ -4649,8 +4649,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -4669,8 +4669,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WBNB (Core)", @@ -4689,8 +4689,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(75, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus FDUSD (Core)", @@ -4709,8 +4709,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OPBNBMAINNET, vTokenReceiver: preconfiguredAddresses.opbnbmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [], @@ -4806,8 +4806,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("0.55", 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -4826,8 +4826,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -4846,8 +4846,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -4866,8 +4866,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ARB (Core)", @@ -4886,8 +4886,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -4923,8 +4923,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(800, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -4943,8 +4943,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_300, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_SEPOLIA, vTokenReceiver: preconfiguredAddresses.arbitrumsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Liquid Staked ETH)", @@ -4963,8 +4963,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(12_500, 18), reduceReservesBlockDelta: DEFAULT_REDUCE_RESERVES_BLOCK_DELTA, vTokenReceiver: preconfiguredAddresses.sepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [], @@ -5060,8 +5060,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("500", 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -5080,8 +5080,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("23500", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -5100,8 +5100,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("49000000", 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5120,8 +5120,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("18000000", 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus ARB (Core)", @@ -5140,8 +5140,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("9000000", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -5188,8 +5188,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(800, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: "0x5A9d695c518e95CD6Ea101f2f25fC2AE18486A61", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus weETH (Liquid Staked ETH)", @@ -5208,8 +5208,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_300, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: "0x46cba1e9b1e5db32da28428f2fb85587bcb785e7", - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Liquid Staked ETH)", @@ -5228,8 +5228,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(12_500, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ARBITRUM_ONE, vTokenReceiver: preconfiguredAddresses.arbitrumone.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -5332,8 +5332,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(23_500, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WBTC (Core)", @@ -5352,8 +5352,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(500, 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5372,8 +5372,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(18_000_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC.e (Core)", @@ -5392,8 +5392,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(49_000_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { @@ -5413,8 +5413,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(2_350_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -5433,8 +5433,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_SEPOLIA, vTokenReceiver: preconfiguredAddresses.zksyncsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -5541,8 +5541,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_700, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WBTC (Core)", @@ -5561,8 +5561,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(20, 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5581,8 +5581,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(3_300_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC.e (Core)", @@ -5601,8 +5601,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(4_200_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { @@ -5622,8 +5622,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(12_500_000, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -5642,8 +5642,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(1_000_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_ZKSYNC_MAINNET, vTokenReceiver: preconfiguredAddresses.zksyncmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -5757,8 +5757,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("0.55", 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -5777,8 +5777,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -5797,8 +5797,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5817,8 +5817,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(130_000, 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus OP (Core)", @@ -5837,8 +5837,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit(16, 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_SEPOLIA, vTokenReceiver: preconfiguredAddresses.opsepolia.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [ @@ -5939,8 +5939,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("50", 8), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus WETH (Core)", @@ -5959,8 +5959,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("2700", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDT (Core)", @@ -5979,8 +5979,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("3600000", 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus OP (Core)", @@ -5999,8 +5999,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("1500000", 18), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, { name: "Venus USDC (Core)", @@ -6019,8 +6019,8 @@ export const globalConfig: NetworkConfig = { borrowCap: convertToUnit("9000000", 6), reduceReservesBlockDelta: REDUCE_RESERVES_BLOCK_DELTA_OP_MAINNET, vTokenReceiver: preconfiguredAddresses.opmainnet.VTreasury, - isFlashloanAllowed: false, - flashloanFeeMantissa: "0", + isFlashLoanAllowed: false, + flashLoanFeeMantissa: "0", }, ], rewards: [], diff --git a/tests/hardhat/Comptroller/Flashloan.ts b/tests/hardhat/Comptroller/Flashloan.ts index f30e6d064..2cc809494 100644 --- a/tests/hardhat/Comptroller/Flashloan.ts +++ b/tests/hardhat/Comptroller/Flashloan.ts @@ -12,8 +12,8 @@ import { Comptroller, ERC20Harness, InterestRateModel, - MockFlashloanReceiver, - MockFlashloanReceiver__factory, + MockFlashLoanReceiver, + MockFlashLoanReceiver__factory, PoolRegistry, ProtocolShareReserve, VTokenHarness, @@ -26,13 +26,13 @@ chai.use(smock.matchers); const MAX_LOOP_LIMIT = 150; -const flashloanAmount1 = parseUnits("20", 18); -const flashloanAmount2 = parseUnits("30", 18); +const flashLoanAmount1 = parseUnits("20", 18); +const flashLoanAmount2 = parseUnits("30", 18); const feeMantissaTokenA = parseUnits("0.01", 18); const feeMantissaTokenB = parseUnits("0.02", 18); // Declare the types here -type FlashloanContractsFixture = { +type FlashLoanContractsFixture = { accessControlManager: FakeContract; protocolShareReserve: FakeContract; interestRateModel: FakeContract; @@ -44,8 +44,8 @@ type FlashloanContractsFixture = { VTokenB: VTokenHarness; }; -// Create a fixture will deploy all the required contracts for flashloan -const flashLoanTestFixture = async (): Promise => { +// Create a fixture will deploy all the required contracts for flashLoan +const flashLoanTestFixture = async (): Promise => { const [admin] = await ethers.getSigners(); const accessControlManager = await smock.fake("AccessControlManager"); accessControlManager.isAllowedToCall.returns(true); @@ -74,8 +74,8 @@ const flashLoanTestFixture = async (): Promise => { admin, interestRateModel, protocolShareReserve, - isFlashloanAllowed: true, - flashloanFeeMantissa: feeMantissaTokenA, + isFlashLoanAllowed: true, + flashLoanFeeMantissa: feeMantissaTokenA, }, { kind: "VTokenHarness" }, ); @@ -88,8 +88,8 @@ const flashLoanTestFixture = async (): Promise => { admin, interestRateModel, protocolShareReserve, - isFlashloanAllowed: true, - flashloanFeeMantissa: feeMantissaTokenB, + isFlashLoanAllowed: true, + flashLoanFeeMantissa: feeMantissaTokenB, }, { kind: "VTokenHarness" }, ); @@ -116,16 +116,16 @@ const flashLoanTestFixture = async (): Promise => { }; }; -describe("Flashloan", async () => { +describe("FlashLoan", async () => { let alice: SignerWithAddress; let acmUser: SignerWithAddress; - let contracts: FlashloanContractsFixture; + let contracts: FlashLoanContractsFixture; let VTokenA: VTokenHarness; let VTokenB: VTokenHarness; let underlyingA: MockContract; let underlyingB: MockContract; let comptroller: Comptroller; - let mockReceiverContract: MockFlashloanReceiver; + let mockReceiverContract: MockFlashLoanReceiver; beforeEach(async () => { [alice, acmUser] = await ethers.getSigners(); @@ -133,64 +133,64 @@ describe("Flashloan", async () => { ({ comptroller, VTokenA, VTokenB, underlyingA, underlyingB } = contracts); }); - describe("Flashloan Multi-Assets", async () => { + describe("FlashLoan Multi-Assets", async () => { beforeEach(async () => { - const MockFlashloanReceiver = await ethers.getContractFactory( - "MockFlashloanReceiver", + const MockFlashLoanReceiver = await ethers.getContractFactory( + "MockFlashLoanReceiver", ); - mockReceiverContract = await MockFlashloanReceiver.deploy(comptroller.address); + mockReceiverContract = await MockFlashLoanReceiver.deploy(comptroller.address); await mockReceiverContract.deployed(); }); - it("Should revert if flashloan is not enabled", async () => { - await VTokenA.connect(acmUser).toggleFlashloan(); - expect(await VTokenA.isFlashloanEnabled()).to.be.false; + it("Should revert if flashLoan is not enabled", async () => { + await VTokenA.connect(acmUser).toggleFlashLoan(); + expect(await VTokenA.isFlashLoanEnabled()).to.be.false; await expect( - mockReceiverContract.requestFlashloan( + mockReceiverContract.requestFlashLoan( [VTokenA.address.toString(), VTokenB.address.toString()], - [flashloanAmount1, flashloanAmount2], + [flashLoanAmount1, flashLoanAmount2], ), ).to.be.revertedWithCustomError(comptroller, "FlashLoanNotEnabled"); }); - it("Flashloan for multiple underlying", async () => { + it("FlashLoan for multiple underlying", async () => { // Admin Enable flashLoan for multiple vToken - expect(await VTokenA.isFlashloanEnabled()).to.be.true; - expect(await VTokenB.isFlashloanEnabled()).to.be.true; + expect(await VTokenA.isFlashLoanEnabled()).to.be.true; + expect(await VTokenB.isFlashLoanEnabled()).to.be.true; - // Set the balance of mockReceiver in order to pay for flashloan fee + // Set the balance of mockReceiver in order to pay for flashLoan fee await underlyingA.harnessSetBalance(mockReceiverContract.address, parseUnits("10", 18)); await underlyingB.harnessSetBalance(mockReceiverContract.address, parseUnits("20", 18)); await underlyingA.harnessSetBalance(VTokenA.address, parseUnits("50", 18)); await underlyingB.harnessSetBalance(VTokenB.address, parseUnits("50", 18)); - // Get the balance before the flashloan + // Get the balance before the flashLoan const beforeBalanceVTokenA = await underlyingA.balanceOf(VTokenA.address); const beforeBalanceVTokenB = await underlyingB.balanceOf(VTokenB.address); - // Execute the flashloan from the mockReceiverContract - const flashloan = await mockReceiverContract + // Execute the flashLoan from the mockReceiverContract + const flashLoan = await mockReceiverContract .connect(alice) - .requestFlashloan([VTokenA.address, VTokenB.address], [flashloanAmount1, flashloanAmount2]); + .requestFlashLoan([VTokenA.address, VTokenB.address], [flashLoanAmount1, flashLoanAmount2]); - // Get the balance after the flashloan + // Get the balance after the flashLoan const afterBalanceVTokenA = await underlyingA.balanceOf(VTokenA.address); const afterBalanceVTokenB = await underlyingB.balanceOf(VTokenB.address); - const feeOnFlashLoanTokenA = BigNumber.from(flashloanAmount1).mul(feeMantissaTokenA).div(parseUnits("1", 18)); - const feeOnFlashLoanTokenB = BigNumber.from(flashloanAmount2).mul(feeMantissaTokenB).div(parseUnits("1", 18)); + const feeOnFlashLoanTokenA = BigNumber.from(flashLoanAmount1).mul(feeMantissaTokenA).div(parseUnits("1", 18)); + const feeOnFlashLoanTokenB = BigNumber.from(flashLoanAmount2).mul(feeMantissaTokenB).div(parseUnits("1", 18)); expect(afterBalanceVTokenA).to.be.equal(beforeBalanceVTokenA.add(feeOnFlashLoanTokenA)); expect(afterBalanceVTokenB).to.be.equal(beforeBalanceVTokenB.add(feeOnFlashLoanTokenB)); - await expect(flashloan) - .to.emit(comptroller, "FlashloanExecuted") + await expect(flashLoan) + .to.emit(comptroller, "FlashLoanExecuted") .withArgs( mockReceiverContract.address, [VTokenA.address, VTokenB.address], - [flashloanAmount1, flashloanAmount2], + [flashLoanAmount1, flashLoanAmount2], ); }); }); diff --git a/tests/hardhat/Fork/flashloan.ts b/tests/hardhat/Fork/flashloan.ts index e67fd0037..e4de2575d 100644 --- a/tests/hardhat/Fork/flashloan.ts +++ b/tests/hardhat/Fork/flashloan.ts @@ -13,8 +13,8 @@ import { Comptroller__factory, ERC20, ERC20__factory, - MockFlashloanReceiver, - MockFlashloanReceiver__factory, + MockFlashLoanReceiver, + MockFlashLoanReceiver__factory, UpgradeableBeacon__factory, VToken, VToken__factory, @@ -35,32 +35,32 @@ const VTOKEN_BEACON = "0x74ae9919F5866cE148c81331a5FCdE71b81c4056"; const { isTimeBased, blocksPerYear } = getBlockOrTimestampBasedDeploymentInfo(network.name); const MAX_BORROW_RATE_MANTISSA = getMaxBorrowRateMantissa(network.name); -const ARBFlashloanFeeMantissa = parseUnits("0.01", 18); -const WETHFlashloanFeeMantissa = parseUnits("0.03", 18); -const ARBFlashloanAmount = parseUnits("50", 18); -const WETHFlashloanAmount = parseUnits("20", 18); +const ARBFlashLoanFeeMantissa = parseUnits("0.01", 18); +const WETHFlashLoanFeeMantissa = parseUnits("0.03", 18); +const ARBFlashLoanAmount = parseUnits("50", 18); +const WETHFlashLoanAmount = parseUnits("20", 18); // Giving permission to Timelock to call chainlink setDirectPrice and setTokenConfig async function grantPermissions() { accessControlManager = AccessControlManager__factory.connect(ACM, impersonatedTimelock); let tx = await accessControlManager .connect(impersonatedTimelock) - .giveCallPermission(vARB.address, "toggleFlashloan()", ADMIN); + .giveCallPermission(vARB.address, "toggleFlashLoan()", ADMIN); await tx.wait(); tx = await accessControlManager .connect(impersonatedTimelock) - .giveCallPermission(vARB.address, "setFlashloanFeeMantissa(uint256)", ADMIN); + .giveCallPermission(vARB.address, "setFlashLoanFeeMantissa(uint256)", ADMIN); await tx.wait(); tx = await accessControlManager .connect(impersonatedTimelock) - .giveCallPermission(vWETH.address, "toggleFlashloan()", ADMIN); + .giveCallPermission(vWETH.address, "toggleFlashLoan()", ADMIN); await tx.wait(); tx = await accessControlManager .connect(impersonatedTimelock) - .giveCallPermission(vWETH.address, "setFlashloanFeeMantissa(uint256)", ADMIN); + .giveCallPermission(vWETH.address, "setFlashLoanFeeMantissa(uint256)", ADMIN); await tx.wait(); } @@ -74,7 +74,7 @@ let ARB: ERC20; let WETH: ERC20; let vARB: VToken; let vWETH: VToken; -let mockFlashloanReceiver: MockFlashloanReceiver; +let mockFlashLoanReceiver: MockFlashLoanReceiver; async function setup() { await setForkBlock(BLOCK_NUMBER); @@ -112,59 +112,59 @@ async function setup() { } if (FORK) { - describe("Flashloan Fork Test", async () => { + describe("FlashLoan Fork Test", async () => { beforeEach(async () => { // Run the setup function before each test to initialize the environment await setup(); - // Deploy a mock flashloan receiver contract to simulate flashloan interactions in tests - const MockFlashloanReceiver = await ethers.getContractFactory( - "MockFlashloanReceiver", + // Deploy a mock flashLoan receiver contract to simulate flashLoan interactions in tests + const MockFlashLoanReceiver = await ethers.getContractFactory( + "MockFlashLoanReceiver", ); - mockFlashloanReceiver = await MockFlashloanReceiver.deploy(comptroller.address); + mockFlashLoanReceiver = await MockFlashLoanReceiver.deploy(comptroller.address); }); - it("Should revert if flashloan not enabled", async () => { - // Attempt to execute a flashloan when the flashloan feature is disabled, which should revert + it("Should revert if flashLoan not enabled", async () => { + // Attempt to execute a flashLoan when the flashLoan feature is disabled, which should revert await expect( comptroller .connect(john) - .executeFlashloan( - mockFlashloanReceiver.address, + .executeFlashLoan( + mockFlashLoanReceiver.address, [vARB.address, vWETH.address], - [ARBFlashloanAmount, WETHFlashloanAmount], + [ARBFlashLoanAmount, WETHFlashLoanAmount], ), ).to.be.revertedWithCustomError(vARB, "FlashLoanNotEnabled"); }); it("Should revert if asset and amount arrays are mismatched", async () => { - // Attempt to execute a flashloan with mismatched arrays for assets and amounts, which should revert + // Attempt to execute a flashLoan with mismatched arrays for assets and amounts, which should revert await expect( - comptroller.connect(john).executeFlashloan( - mockFlashloanReceiver.address, + comptroller.connect(john).executeFlashLoan( + mockFlashLoanReceiver.address, [vARB.address], // Only one asset provided - [ARBFlashloanAmount, WETHFlashloanAmount], // Two loan amounts provided + [ARBFlashLoanAmount, WETHFlashLoanAmount], // Two loan amounts provided ), - ).to.be.revertedWithCustomError(comptroller, "InvalidFlashloanParams"); + ).to.be.revertedWithCustomError(comptroller, "InvalidFlashLoanParams"); }); it("Should revert if receiver is zero address", async () => { - // Attempt to execute a flashloan with a zero address as the receiver, which should revert + // Attempt to execute a flashLoan with a zero address as the receiver, which should revert await expect( - comptroller.connect(john).executeFlashloan( - mockFlashloanReceiver.address, + comptroller.connect(john).executeFlashLoan( + mockFlashLoanReceiver.address, [AddressZero], // Zero address as an asset, which is invalid - [ARBFlashloanAmount, WETHFlashloanAmount], + [ARBFlashLoanAmount, WETHFlashLoanAmount], ), - ).to.be.revertedWithCustomError(comptroller, "InvalidFlashloanParams"); + ).to.be.revertedWithCustomError(comptroller, "InvalidFlashLoanParams"); }); - it("Should be able to do flashloan for ARB & WETH", async () => { + it("Should be able to do flashLoan for ARB & WETH", async () => { // Transfer ARB and WETH tokens to Alice to set up initial balances await ARB.connect(arbHolder).transfer(vARB.address, parseUnits("100", 18)); - await ARB.connect(arbHolder).transfer(mockFlashloanReceiver.address, parseUnits("10", 18)); + await ARB.connect(arbHolder).transfer(mockFlashLoanReceiver.address, parseUnits("10", 18)); await WETH.connect(wETHHolder).transfer(vWETH.address, parseUnits("50", 18)); - await WETH.connect(wETHHolder).transfer(mockFlashloanReceiver.address, parseUnits("5", 18)); + await WETH.connect(wETHHolder).transfer(mockFlashLoanReceiver.address, parseUnits("5", 18)); // Mine blocks as required by the test setup await mine(blocksToMine); @@ -172,32 +172,32 @@ if (FORK) { const balanceBeforeARB = await ARB.balanceOf(vARB.address); const balanceBeforeWETH = await WETH.balanceOf(vWETH.address); - // Enable the flashloan and set fee mantissa on vARB and vWETH contracts - await vARB.connect(impersonatedTimelock).toggleFlashloan(); - await vWETH.connect(impersonatedTimelock).toggleFlashloan(); + // Enable the flashLoan and set fee mantissa on vARB and vWETH contracts + await vARB.connect(impersonatedTimelock).toggleFlashLoan(); + await vWETH.connect(impersonatedTimelock).toggleFlashLoan(); - await vARB.connect(impersonatedTimelock).setFlashloanFeeMantissa(ARBFlashloanFeeMantissa); - await vWETH.connect(impersonatedTimelock).setFlashloanFeeMantissa(WETHFlashloanFeeMantissa); + await vARB.connect(impersonatedTimelock).setFlashLoanFeeMantissa(ARBFlashLoanFeeMantissa); + await vWETH.connect(impersonatedTimelock).setFlashLoanFeeMantissa(WETHFlashLoanFeeMantissa); - // John initiates a flashloan of ARB and WETH through the comptroller contract + // John initiates a flashLoan of ARB and WETH through the comptroller contract await comptroller .connect(john) - .executeFlashloan( - mockFlashloanReceiver.address, + .executeFlashLoan( + mockFlashLoanReceiver.address, [vARB.address, vWETH.address], - [ARBFlashloanAmount, WETHFlashloanAmount], + [ARBFlashLoanAmount, WETHFlashLoanAmount], ); - // Record ARB and WETH balances in vARB and vWETH contracts after flashloan + // Record ARB and WETH balances in vARB and vWETH contracts after flashLoan const balanceAfterARB = await ARB.balanceOf(vARB.address); const balanceAfterWETH = await WETH.balanceOf(vWETH.address); - const ARBFlashloanFee = ARBFlashloanAmount.mul(ARBFlashloanFeeMantissa).div(parseUnits("1", 18)); - const WETHFlashloanFee = WETHFlashloanAmount.mul(WETHFlashloanFeeMantissa).div(parseUnits("1", 18)); + const ARBFlashLoanFee = ARBFlashLoanAmount.mul(ARBFlashLoanFeeMantissa).div(parseUnits("1", 18)); + const WETHFlashLoanFee = WETHFlashLoanAmount.mul(WETHFlashLoanFeeMantissa).div(parseUnits("1", 18)); // Validate that ARB and WETH balances in the contracts increased, confirming repayment plus fees - expect(balanceAfterARB).to.be.equal(balanceBeforeARB.add(ARBFlashloanFee)); - expect(balanceAfterWETH).to.be.equal(balanceBeforeWETH.add(WETHFlashloanFee)); + expect(balanceAfterARB).to.be.equal(balanceBeforeARB.add(ARBFlashLoanFee)); + expect(balanceAfterWETH).to.be.equal(balanceBeforeWETH.add(WETHFlashLoanFee)); }); }); } diff --git a/tests/hardhat/Fork/flashloanSimple.ts b/tests/hardhat/Fork/flashloanSimple.ts index 9a3fc07ba..92d58681c 100644 --- a/tests/hardhat/Fork/flashloanSimple.ts +++ b/tests/hardhat/Fork/flashloanSimple.ts @@ -12,8 +12,8 @@ import { AccessControlManager__factory, IERC20, IERC20__factory, - MockFlashloanSimpleReceiver, - MockFlashloanSimpleReceiver__factory, + MockFlashLoanSimpleReceiver, + MockFlashLoanSimpleReceiver__factory, UpgradeableBeacon__factory, VToken, VToken__factory, @@ -34,7 +34,7 @@ let ARB: IERC20; let vARB: VToken; let accessControlManager: AccessControlManager; let arbHolder: SignerWithAddress; -let mockReceiverSimpleFlashloan: MockFlashloanSimpleReceiver; +let mockReceiverSimpleFlashLoan: MockFlashLoanSimpleReceiver; const AddressZero = "0x0000000000000000000000000000000000000000"; const VTOKEN_BEACON_ARB = "0x74ae9919F5866cE148c81331a5FCdE71b81c4056"; @@ -45,8 +45,8 @@ const { VTOKEN2, ACM, ACC1, TOKEN2, ADMIN, BLOCK_NUMBER, TOKEN1_HOLDER } = getCo FORKED_NETWORK as string, ); -const flashloanFeeMantissa = parseUnits("0.01", 18); -const flashloanAmount = parseUnits("100", 18); +const flashLoanFeeMantissa = parseUnits("0.01", 18); +const flashLoanAmount = parseUnits("100", 18); async function configureTimelock() { impersonatedTimelock = await initMainnetUser(ADMIN, ethers.utils.parseUnits("2")); @@ -57,17 +57,17 @@ async function grantPermissions() { accessControlManager = AccessControlManager__factory.connect(ACM, impersonatedTimelock); let tx = await accessControlManager .connect(impersonatedTimelock) - .giveCallPermission(vARB.address, "toggleFlashloan()", ADMIN); + .giveCallPermission(vARB.address, "toggleFlashLoan()", ADMIN); await tx.wait(); tx = await accessControlManager .connect(impersonatedTimelock) - .giveCallPermission(vARB.address, "setFlashloanFeeMantissa(uint256)", ADMIN); + .giveCallPermission(vARB.address, "setFlashLoanFeeMantissa(uint256)", ADMIN); await tx.wait(); } if (FORK) { - describe("Flashloan Fork Test", async () => { + describe("FlashLoan Fork Test", async () => { async function setup() { // Set the forked blockchain to a specific block number to create a consistent testing environment await setForkBlock(BLOCK_NUMBER); @@ -100,54 +100,54 @@ if (FORK) { // Run setup before each test to reset the environment await setup(); - // Deploy a mock flashloan receiver to test flashloan functionality - const MockFlashloanSimpleReceiver = await ethers.getContractFactory( - "MockFlashloanSimpleReceiver", + // Deploy a mock flashLoan receiver to test flashLoan functionality + const MockFlashLoanSimpleReceiver = await ethers.getContractFactory( + "MockFlashLoanSimpleReceiver", ); - mockReceiverSimpleFlashloan = await MockFlashloanSimpleReceiver.deploy(vARB.address); + mockReceiverSimpleFlashLoan = await MockFlashLoanSimpleReceiver.deploy(vARB.address); }); - it("Should revert if flashloan not enabled", async () => { - // Attempt to take a flashloan when the flashloan feature is disabled should fail + it("Should revert if flashLoan not enabled", async () => { + // Attempt to take a flashLoan when the flashLoan feature is disabled should fail await expect( - vARB.connect(john).executeFlashloan(mockReceiverSimpleFlashloan.address, flashloanAmount), + vARB.connect(john).executeFlashLoan(mockReceiverSimpleFlashLoan.address, flashLoanAmount), ).to.be.revertedWithCustomError(vARB, "FlashLoanNotEnabled"); }); it("Should revert if receiver is zero address", async () => { - // Enable flashloan feature for testing - await vARB.connect(impersonatedTimelock).toggleFlashloan(); + // Enable flashLoan feature for testing + await vARB.connect(impersonatedTimelock).toggleFlashLoan(); - // Attempt to take a flashloan with zero address as receiver should fail - await expect(vARB.connect(john).executeFlashloan(AddressZero, flashloanAmount)).to.be.revertedWithCustomError( + // Attempt to take a flashLoan with zero address as receiver should fail + await expect(vARB.connect(john).executeFlashLoan(AddressZero, flashLoanAmount)).to.be.revertedWithCustomError( vARB, "ZeroAddressNotAllowed", ); }); - it("Should flashloan ARB", async () => { - // Transfer ARB tokens to test users for setting up the flashloan test + it("Should flashLoan ARB", async () => { + // Transfer ARB tokens to test users for setting up the flashLoan test await ARB.connect(arbHolder).transfer(vARB.address, parseUnits("1000", 18)); - await ARB.connect(arbHolder).transfer(mockReceiverSimpleFlashloan.address, parseUnits("50", 18)); + await ARB.connect(arbHolder).transfer(mockReceiverSimpleFlashLoan.address, parseUnits("50", 18)); - // Record vARB contract's ARB balance before flashloan + // Record vARB contract's ARB balance before flashLoan const balanceBefore = await ARB.balanceOf(vARB.address); // Mine blocks if necessary for time-based operations await mine(blocksToMine); - // Enable flashloan feature by the admin - await vARB.connect(impersonatedTimelock).toggleFlashloan(); - await vARB.connect(impersonatedTimelock).setFlashloanFeeMantissa(flashloanFeeMantissa); + // Enable flashLoan feature by the admin + await vARB.connect(impersonatedTimelock).toggleFlashLoan(); + await vARB.connect(impersonatedTimelock).setFlashLoanFeeMantissa(flashLoanFeeMantissa); - // John initiates a flashloan of 2000 ARB through the mock receiver - await vARB.connect(john).executeFlashloan(mockReceiverSimpleFlashloan.address, parseUnits("100", 18)); + // John initiates a flashLoan of 2000 ARB through the mock receiver + await vARB.connect(john).executeFlashLoan(mockReceiverSimpleFlashLoan.address, parseUnits("100", 18)); - // Check if the ARB balance in vARB increased, validating flashloan repayment with fees + // Check if the ARB balance in vARB increased, validating flashLoan repayment with fees const balanceAfter = await ARB.balanceOf(vARB.address); - const totalFlashloanFee = flashloanAmount.mul(flashloanFeeMantissa).div(parseUnits("1", 18)); + const totalFlashLoanFee = flashLoanAmount.mul(flashLoanFeeMantissa).div(parseUnits("1", 18)); - expect(balanceAfter).to.be.equal(balanceBefore.add(totalFlashloanFee)); + expect(balanceAfter).to.be.equal(balanceBefore.add(totalFlashLoanFee)); }); }); } diff --git a/tests/hardhat/Tokens/flashLoanSimple.ts b/tests/hardhat/Tokens/flashLoanSimple.ts index d2f2fdd4e..e72fd6bfd 100644 --- a/tests/hardhat/Tokens/flashLoanSimple.ts +++ b/tests/hardhat/Tokens/flashLoanSimple.ts @@ -10,8 +10,8 @@ import { AccessControlManager, Comptroller, ERC20Harness, - MockFlashloanSimpleReceiver, - MockFlashloanSimpleReceiver__factory, + MockFlashLoanSimpleReceiver, + MockFlashLoanSimpleReceiver__factory, VTokenHarness, } from "../../../typechain"; import { initMainnetUser } from "../Fork/utils"; @@ -20,10 +20,10 @@ import { VTokenTestFixture, vTokenTestFixture } from "../util/TokenTestHelpers"; const { expect } = chai; chai.use(smock.matchers); -const flashloanAmount = parseUnits("2", 18).toBigInt(); +const flashLoanAmount = parseUnits("2", 18).toBigInt(); const feeMantissa = parseUnits("0.01", 18); -describe("Flashloan Simple", () => { +describe("FlashLoan Simple", () => { let minter: SignerWithAddress; let alice: SignerWithAddress; let receiver: SignerWithAddress; @@ -31,7 +31,7 @@ describe("Flashloan Simple", () => { let contracts: VTokenTestFixture; let underlying: MockContract; let vToken: VTokenHarness; - let mockReceiverSimple: MockFlashloanSimpleReceiver; + let mockReceiverSimple: MockFlashLoanSimpleReceiver; let accessControlManager: FakeContract; let comptroller: FakeContract; let comptrollerSigner: SignerWithAddress; @@ -47,57 +47,57 @@ describe("Flashloan Simple", () => { it("Should have access to toggle falsh loan feature", async () => { accessControlManager.isAllowedToCall.returns(false); - expect(await vToken.isFlashloanEnabled()).to.be.false; - await expect(vToken.connect(acmUser).toggleFlashloan()).to.be.revertedWithCustomError(vToken, "Unauthorized"); - expect(await vToken.isFlashloanEnabled()).to.be.false; + expect(await vToken.isFlashLoanEnabled()).to.be.false; + await expect(vToken.connect(acmUser).toggleFlashLoan()).to.be.revertedWithCustomError(vToken, "Unauthorized"); + expect(await vToken.isFlashLoanEnabled()).to.be.false; }); - it("Enable flashloan feature", async () => { + it("Enable flashLoan feature", async () => { accessControlManager.isAllowedToCall.returns(true); - expect(await vToken.isFlashloanEnabled()).to.be.false; - await vToken.connect(acmUser).toggleFlashloan(); - expect(await vToken.isFlashloanEnabled()).to.be.true; + expect(await vToken.isFlashLoanEnabled()).to.be.false; + await vToken.connect(acmUser).toggleFlashLoan(); + expect(await vToken.isFlashLoanEnabled()).to.be.true; }); - it("Disable flashloan feature", async () => { - expect(await vToken.isFlashloanEnabled()).to.be.false; - await vToken.connect(acmUser).toggleFlashloan(); - expect(await vToken.isFlashloanEnabled()).to.be.true; + it("Disable flashLoan feature", async () => { + expect(await vToken.isFlashLoanEnabled()).to.be.false; + await vToken.connect(acmUser).toggleFlashLoan(); + expect(await vToken.isFlashLoanEnabled()).to.be.true; - await vToken.connect(acmUser).toggleFlashloan(); - expect(await vToken.isFlashloanEnabled()).to.be.false; + await vToken.connect(acmUser).toggleFlashLoan(); + expect(await vToken.isFlashLoanEnabled()).to.be.false; }); - it("Emit ToggleFlashloanEnabled event on toggle flashloan feature", async () => { - let result = await vToken.connect(acmUser).toggleFlashloan(); - await expect(result).to.emit(vToken, "ToggleFlashloanEnabled").withArgs(false, true); + it("Emit ToggleFlashLoanEnabled event on toggle flashLoan feature", async () => { + let result = await vToken.connect(acmUser).toggleFlashLoan(); + await expect(result).to.emit(vToken, "ToggleFlashLoanEnabled").withArgs(false, true); - result = await vToken.connect(acmUser).toggleFlashloan(); - await expect(result).to.emit(vToken, "ToggleFlashloanEnabled").withArgs(true, false); + result = await vToken.connect(acmUser).toggleFlashLoan(); + await expect(result).to.emit(vToken, "ToggleFlashLoanEnabled").withArgs(true, false); }); }); - describe("Set fee on flashloan", () => { - it("Should have access to set fee on flashloan", async () => { + describe("Set fee on flashLoan", () => { + it("Should have access to set fee on flashLoan", async () => { accessControlManager.isAllowedToCall.returns(false); - await expect(vToken.connect(acmUser).setFlashloanFeeMantissa(feeMantissa)).to.be.revertedWithCustomError( + await expect(vToken.connect(acmUser).setFlashLoanFeeMantissa(feeMantissa)).to.be.revertedWithCustomError( vToken, "Unauthorized", ); }); - it("Set fee on flashloan", async () => { + it("Set fee on flashLoan", async () => { accessControlManager.isAllowedToCall.returns(true); - await vToken.connect(acmUser).setFlashloanFeeMantissa(feeMantissa); - expect(await vToken.flashloanFeeMantissa()).to.be.equal(feeMantissa); + await vToken.connect(acmUser).setFlashLoanFeeMantissa(feeMantissa); + expect(await vToken.flashLoanFeeMantissa()).to.be.equal(feeMantissa); }); - it("Emit FlashloanFeeUpdated event on set fee on flashloan", async () => { - const result = await vToken.connect(acmUser).setFlashloanFeeMantissa(feeMantissa); - await expect(result).to.emit(vToken, "FlashloanFeeUpdated").withArgs(0, feeMantissa); + it("Emit FlashLoanFeeUpdated event on set fee on flashLoan", async () => { + const result = await vToken.connect(acmUser).setFlashLoanFeeMantissa(feeMantissa); + await expect(result).to.emit(vToken, "FlashLoanFeeUpdated").withArgs(0, feeMantissa); }); }); @@ -120,44 +120,44 @@ describe("Flashloan Simple", () => { it("Emit TransferUnderlying event on transfer underlying assets to receiver contract", async () => { const result = await vToken.connect(comptrollerSigner).transferUnderlying(receiver.address, parseUnits("1", 18)); await expect(result) - .to.emit(vToken, "FlashloanAmountTransferred") + .to.emit(vToken, "FlashLoanAmountTransferred") .withArgs(underlying.address, receiver.address, parseUnits("1", 18)); }); }); - describe("Flashloan Single Asset", () => { + describe("FlashLoan Single Asset", () => { beforeEach(async () => { - const MockFlashloanSimpleReceiver = await ethers.getContractFactory( - "MockFlashloanSimpleReceiver", + const MockFlashLoanSimpleReceiver = await ethers.getContractFactory( + "MockFlashLoanSimpleReceiver", ); - mockReceiverSimple = await MockFlashloanSimpleReceiver.deploy(vToken.address); + mockReceiverSimple = await MockFlashLoanSimpleReceiver.deploy(vToken.address); await mockReceiverSimple.deployed(); - await vToken.connect(acmUser).setFlashloanFeeMantissa(feeMantissa); + await vToken.connect(acmUser).setFlashLoanFeeMantissa(feeMantissa); await underlying.harnessSetBalance(mockReceiverSimple.address, parseUnits("1", 18)); await underlying.harnessSetBalance(vToken.address, parseUnits("10", 18)); }); - it("Should revert if the flashloan is not enabled", async () => { - await expect(mockReceiverSimple.requestFlashloan(flashloanAmount)).to.be.revertedWithCustomError( + it("Should revert if the flashLoan is not enabled", async () => { + await expect(mockReceiverSimple.requestFlashLoan(flashLoanAmount)).to.be.revertedWithCustomError( vToken, "FlashLoanNotEnabled", ); }); - it("Flashloan for single underlying", async () => { - await vToken.connect(acmUser).toggleFlashloan(); + it("FlashLoan for single underlying", async () => { + await vToken.connect(acmUser).toggleFlashLoan(); const balanceBeforeflashLoan = await underlying.balanceOf(vToken.address); - const flashloan = await mockReceiverSimple.connect(alice).requestFlashloan(flashloanAmount); + const flashLoan = await mockReceiverSimple.connect(alice).requestFlashLoan(flashLoanAmount); const balanceAfterflashLoan = await underlying.balanceOf(vToken.address); - const fee = BigNumber.from(flashloanAmount).mul(feeMantissa).div(parseUnits("1", 18)); + const fee = BigNumber.from(flashLoanAmount).mul(feeMantissa).div(parseUnits("1", 18)); expect(balanceAfterflashLoan).to.be.equal(balanceBeforeflashLoan.add(fee)); - await expect(flashloan) - .to.emit(vToken, "FlashloanExecuted") - .withArgs(mockReceiverSimple.address, underlying.address, flashloanAmount); + await expect(flashLoan) + .to.emit(vToken, "FlashLoanExecuted") + .withArgs(mockReceiverSimple.address, underlying.address, flashLoanAmount); }); }); }); diff --git a/tests/hardhat/util/TokenTestHelpers.ts b/tests/hardhat/util/TokenTestHelpers.ts index f017eef1d..eb676c410 100644 --- a/tests/hardhat/util/TokenTestHelpers.ts +++ b/tests/hardhat/util/TokenTestHelpers.ts @@ -38,8 +38,8 @@ interface VTokenParameters { isTimeBased: boolean; blocksPerYear: BigNumberish; maxBorrowRateMantissa: BigNumberish; - isFlashloanAllowed: boolean; - flashloanFeeMantissa: BigNumberish; + isFlashLoanAllowed: boolean; + flashLoanFeeMantissa: BigNumberish; } const getNameAndSymbol = async (underlying: AddressOrContract): Promise<[string, string]> => { @@ -111,8 +111,8 @@ const deployVTokenDependencies = async ( @@ -149,8 +149,8 @@ export const makeVToken = async ; return vToken; From 59b46cca9243609faa8c20f1f74af985a4e595e9 Mon Sep 17 00:00:00 2001 From: Debugger022 Date: Mon, 6 Jan 2025 23:28:01 +0530 Subject: [PATCH 15/15] chore: fix typo --- tests/hardhat/Tokens/flashLoanSimple.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hardhat/Tokens/flashLoanSimple.ts b/tests/hardhat/Tokens/flashLoanSimple.ts index e72fd6bfd..8ffb9b205 100644 --- a/tests/hardhat/Tokens/flashLoanSimple.ts +++ b/tests/hardhat/Tokens/flashLoanSimple.ts @@ -44,7 +44,7 @@ describe("FlashLoan Simple", () => { }); describe("Enable/disable flash loan feature", () => { - it("Should have access to toggle falsh loan feature", async () => { + it("Should have access to toggle flash loan feature", async () => { accessControlManager.isAllowedToCall.returns(false); expect(await vToken.isFlashLoanEnabled()).to.be.false;