@@ -23,6 +23,8 @@ interface IVToken is IERC20Upgradeable {
2323
2424 function repayBorrowBehalf (address borrower , uint repayAmount ) external returns (uint256 );
2525
26+ function redeemUnderlyingBehalf (address redeemer , uint redeemAmount ) external returns (uint );
27+
2628 function comptroller () external view returns (IComptroller);
2729
2830 function borrowBalanceStored (address account ) external view returns (uint256 );
@@ -53,6 +55,8 @@ interface IComptroller {
5355
5456 function enterMarkets (address [] calldata vTokens ) external returns (uint256 [] memory );
5557
58+ function enterMarketBehalf (address onBehalf , address vToken ) external returns (uint256 );
59+
5660 function enterMarket (address user , address vToken ) external returns (uint256 );
5761
5862 function liquidationIncentiveMantissa () external view returns (uint256 );
@@ -74,10 +78,60 @@ interface IComptroller {
7478 function getAccountLiquidity (address account ) external view returns (uint256 , uint256 , uint256 );
7579
7680 function checkMembership (address account , IVToken vToken ) external view returns (bool );
81+
82+ function getBorrowingPower (
83+ address account
84+ ) external view returns (uint256 error , uint256 liquidity , uint256 shortfall );
85+
86+ function treasuryPercent () external view returns (uint256 );
87+
88+ function executeFlashLoan (
89+ address payable onBehalf ,
90+ address payable receiver ,
91+ IVToken[] memory vTokens ,
92+ uint256 [] memory underlyingAmounts ,
93+ bytes memory param
94+ ) external ;
95+ }
96+
97+ interface IFlashLoanReceiver {
98+ /**
99+ * @notice Executes an operation after receiving the flash-borrowed assets.
100+ * @dev Implementation of this function must ensure at least the premium (fee) is repaid within the same transaction.
101+ * Any unpaid balance (principal + premium - repaid amount) will be added to the onBehalf address's borrow balance.
102+ * @param vTokens The vToken contracts corresponding to the flash-borrowed underlying assets.
103+ * @param amounts The amounts of each underlying asset that were flash-borrowed.
104+ * @param premiums The premiums (fees) associated with each flash-borrowed asset.
105+ * @param initiator The address that initiated the flash loan.
106+ * @param onBehalf The address of the user whose debt position will be used for any unpaid flash loan balance.
107+ * @param param Additional parameters encoded as bytes. These can be used to pass custom data to the receiver contract.
108+ * @return success True if the operation succeeds (regardless of repayment amount), false if the operation fails.
109+ * @return repayAmounts Array of uint256 representing the amounts to be repaid for each asset. The receiver contract
110+ * must approve these amounts to the respective vToken contracts before this function returns.
111+ */
112+ function executeOperation (
113+ IVToken[] calldata vTokens ,
114+ uint256 [] calldata amounts ,
115+ uint256 [] calldata premiums ,
116+ address initiator ,
117+ address onBehalf ,
118+ bytes calldata param
119+ ) external returns (bool success , uint256 [] memory repayAmounts );
77120}
78121
79122interface IWBNB is IERC20Upgradeable {
80123 function deposit () external payable ;
81124
82125 function withdraw (uint256 amount ) external ;
83126}
127+
128+ interface IProtocolShareReserve {
129+ enum IncomeType {
130+ SPREAD,
131+ LIQUIDATION,
132+ ERC4626_WRAPPER_REWARDS ,
133+ FLASHLOAN
134+ }
135+
136+ function updateAssetsState (address comptroller , address asset , IncomeType incomeType ) external ;
137+ }
0 commit comments