Add Prettier for linting and fix Solhint config (#2697)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
@ -15,7 +15,7 @@ import "../ERC20.sol";
|
||||
* _Available since v4.1._
|
||||
*/
|
||||
abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender {
|
||||
bytes32 constant private RETURN_VALUE = keccak256("ERC3156FlashBorrower.onFlashLoan");
|
||||
bytes32 private constant _RETURN_VALUE = keccak256("ERC3156FlashBorrower.onFlashLoan");
|
||||
|
||||
/**
|
||||
* @dev Returns the maximum amount of tokens available for loan.
|
||||
@ -60,12 +60,13 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender {
|
||||
address token,
|
||||
uint256 amount,
|
||||
bytes calldata data
|
||||
)
|
||||
public virtual override returns (bool)
|
||||
{
|
||||
) public virtual override returns (bool) {
|
||||
uint256 fee = flashFee(token, amount);
|
||||
_mint(address(receiver), amount);
|
||||
require(receiver.onFlashLoan(msg.sender, token, amount, fee, data) == RETURN_VALUE, "ERC20FlashMint: invalid return value");
|
||||
require(
|
||||
receiver.onFlashLoan(msg.sender, token, amount, fee, data) == _RETURN_VALUE,
|
||||
"ERC20FlashMint: invalid return value"
|
||||
);
|
||||
uint256 currentAllowance = allowance(address(receiver), address(this));
|
||||
require(currentAllowance >= amount + fee, "ERC20FlashMint: allowance does not allow refund");
|
||||
_approve(address(receiver), address(this), currentAllowance - amount - fee);
|
||||
|
||||
Reference in New Issue
Block a user