@@ -114,7 +114,7 @@ abstract contract ERC4626 is ERC20, IERC4626 {
114
114
115
115
/** @dev See {IERC4626-totalAssets}. */
116
116
function totalAssets () public view virtual returns (uint256 ) {
117
- return _asset .balanceOf (address (this ));
117
+ return IERC20 ( asset ()) .balanceOf (address (this ));
118
118
}
119
119
120
120
/** @dev See {IERC4626-convertToShares}. */
@@ -237,14 +237,14 @@ abstract contract ERC4626 is ERC20, IERC4626 {
237
237
* @dev Deposit/mint common workflow.
238
238
*/
239
239
function _deposit (address caller , address receiver , uint256 assets , uint256 shares ) internal virtual {
240
- // If _asset is ERC-777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the
240
+ // If asset() is ERC-777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the
241
241
// `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
242
242
// calls the vault, which is assumed not malicious.
243
243
//
244
244
// Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the
245
245
// assets are transferred and before the shares are minted, which is a valid state.
246
246
// slither-disable-next-line reentrancy-no-eth
247
- SafeERC20.safeTransferFrom (_asset , caller, address (this ), assets);
247
+ SafeERC20.safeTransferFrom (IERC20 ( asset ()) , caller, address (this ), assets);
248
248
_mint (receiver, shares);
249
249
250
250
emit Deposit (caller, receiver, assets, shares);
@@ -264,14 +264,14 @@ abstract contract ERC4626 is ERC20, IERC4626 {
264
264
_spendAllowance (owner, caller, shares);
265
265
}
266
266
267
- // If _asset is ERC-777, `transfer` can trigger a reentrancy AFTER the transfer happens through the
267
+ // If asset() is ERC-777, `transfer` can trigger a reentrancy AFTER the transfer happens through the
268
268
// `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,
269
269
// calls the vault, which is assumed not malicious.
270
270
//
271
271
// Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the
272
272
// shares are burned and after the assets are transferred, which is a valid state.
273
273
_burn (owner, shares);
274
- SafeERC20.safeTransfer (_asset , receiver, assets);
274
+ SafeERC20.safeTransfer (IERC20 ( asset ()) , receiver, assets);
275
275
276
276
emit Withdraw (caller, receiver, owner, assets, shares);
277
277
}
0 commit comments