mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Remove _usePermit function
Just use a simple check if deadline is set or not. Fixes ABDK CVF-34 and CVF-35.
This commit is contained in:
parent
5b45be6a44
commit
afeb5fb996
|
@ -86,7 +86,8 @@ abstract contract BaseParaSwapAdapter is FlashLoanReceiverBase, Ownable {
|
||||||
uint256 amount,
|
uint256 amount,
|
||||||
PermitSignature memory permitSignature
|
PermitSignature memory permitSignature
|
||||||
) internal {
|
) internal {
|
||||||
if (_usePermit(permitSignature)) {
|
// If deadline is set to zero, assume there is no signature for permit
|
||||||
|
if (permitSignature.deadline != 0) {
|
||||||
IERC20WithPermit(reserveAToken).permit(
|
IERC20WithPermit(reserveAToken).permit(
|
||||||
user,
|
user,
|
||||||
address(this),
|
address(this),
|
||||||
|
@ -108,17 +109,6 @@ abstract contract BaseParaSwapAdapter is FlashLoanReceiverBase, Ownable {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Tells if the permit method should be called by inspecting if there is a valid signature.
|
|
||||||
* If signature params are set to 0, then permit won't be called.
|
|
||||||
* @param signature struct containing the permit signature
|
|
||||||
* @return whether or not permit should be called
|
|
||||||
*/
|
|
||||||
function _usePermit(PermitSignature memory signature) internal pure returns (bool) {
|
|
||||||
return
|
|
||||||
!(uint256(signature.deadline) == uint256(signature.v) && uint256(signature.deadline) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Emergency rescue for token stucked on this contract, as failsafe mechanism
|
* @dev Emergency rescue for token stucked on this contract, as failsafe mechanism
|
||||||
* - Funds should never remain in this contract more time than during transactions
|
* - Funds should never remain in this contract more time than during transactions
|
||||||
|
|
Loading…
Reference in New Issue
Block a user