mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Solve non-used return values.
- Use safeApprove() and gas optimization on constructor.
This commit is contained in:
parent
c4bcddbaf5
commit
b1bc1d5168
|
|
@ -51,10 +51,10 @@ contract StaticAToken is IStaticAToken, ERC20 {
|
||||||
) public ERC20(wrappedTokenName, wrappedTokenSymbol) {
|
) public ERC20(wrappedTokenName, wrappedTokenSymbol) {
|
||||||
LENDING_POOL = lendingPool;
|
LENDING_POOL = lendingPool;
|
||||||
ATOKEN = IERC20(aToken);
|
ATOKEN = IERC20(aToken);
|
||||||
|
(ASSET = IERC20(IAToken(aToken).UNDERLYING_ASSET_ADDRESS())).safeApprove(
|
||||||
IERC20 underlyingAsset = IERC20(IAToken(aToken).UNDERLYING_ASSET_ADDRESS());
|
address(lendingPool),
|
||||||
ASSET = underlyingAsset;
|
type(uint256).max
|
||||||
underlyingAsset.approve(address(lendingPool), type(uint256).max);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -206,7 +206,7 @@ contract StaticAToken is IStaticAToken, ERC20 {
|
||||||
'INVALID_SIGNATURE'
|
'INVALID_SIGNATURE'
|
||||||
);
|
);
|
||||||
_nonces[depositor] = currentValidNonce.add(1);
|
_nonces[depositor] = currentValidNonce.add(1);
|
||||||
_deposit(depositor, recipient, value, referralCode, fromUnderlying);
|
return _deposit(depositor, recipient, value, referralCode, fromUnderlying);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -370,7 +370,10 @@ contract StaticAToken is IStaticAToken, ERC20 {
|
||||||
_burn(owner, amountToBurn);
|
_burn(owner, amountToBurn);
|
||||||
|
|
||||||
if (toUnderlying) {
|
if (toUnderlying) {
|
||||||
LENDING_POOL.withdraw(address(ASSET), amountToWithdraw, recipient);
|
require(
|
||||||
|
LENDING_POOL.withdraw(address(ASSET), amountToWithdraw, recipient) == amountToWithdraw,
|
||||||
|
'INCONSISTENT_WITHDRAWN_AMOUNT'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
ATOKEN.safeTransfer(recipient, amountToWithdraw);
|
ATOKEN.safeTransfer(recipient, amountToWithdraw);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user