Make ERC4626 _deposit and _withdraw internal virtual (#3504)
(cherry picked from commit 74738721dc)
This commit is contained in:
committed by
Francisco Giordano
parent
4307d74966
commit
b9710923a8
@ -176,7 +176,7 @@ abstract contract ERC4626 is ERC20, IERC4626 {
|
|||||||
address receiver,
|
address receiver,
|
||||||
uint256 assets,
|
uint256 assets,
|
||||||
uint256 shares
|
uint256 shares
|
||||||
) private {
|
) internal virtual {
|
||||||
// If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the
|
// If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the
|
||||||
// `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
|
// `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
|
||||||
// calls the vault, which is assumed not malicious.
|
// calls the vault, which is assumed not malicious.
|
||||||
@ -199,7 +199,7 @@ abstract contract ERC4626 is ERC20, IERC4626 {
|
|||||||
address owner,
|
address owner,
|
||||||
uint256 assets,
|
uint256 assets,
|
||||||
uint256 shares
|
uint256 shares
|
||||||
) private {
|
) internal virtual {
|
||||||
if (caller != owner) {
|
if (caller != owner) {
|
||||||
_spendAllowance(owner, caller, shares);
|
_spendAllowance(owner, caller, shares);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user