mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fix _getDecimals function
Added a limit on number of decimals and changed return type to uint8. Fixes MixBytes Warning 5 and ABDK CVF-30.
This commit is contained in:
parent
11d0367d3c
commit
d26b1beb68
|
@ -56,8 +56,11 @@ abstract contract BaseParaSwapAdapter is FlashLoanReceiverBase, Ownable {
|
|||
* @dev Get the decimals of an asset
|
||||
* @return number of decimals of the asset
|
||||
*/
|
||||
function _getDecimals(address asset) internal view returns (uint256) {
|
||||
return IERC20Detailed(asset).decimals();
|
||||
function _getDecimals(address asset) internal view returns (uint8) {
|
||||
uint8 decimals = IERC20Detailed(asset).decimals();
|
||||
// Ensure 10**decimals won't overflow a uint256
|
||||
require(decimals <= 77, 'TOO_MANY_DECIMALS_ON_TOKEN');
|
||||
return decimals;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user