@ -21,7 +21,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender {
|
|||||||
/**
|
/**
|
||||||
* @dev Returns the maximum amount of tokens available for loan.
|
* @dev Returns the maximum amount of tokens available for loan.
|
||||||
* @param token The address of the token that is requested.
|
* @param token The address of the token that is requested.
|
||||||
* @return The amont of token that can be loaned.
|
* @return The amount of token that can be loaned.
|
||||||
*/
|
*/
|
||||||
function maxFlashLoan(address token) public view virtual override returns (uint256) {
|
function maxFlashLoan(address token) public view virtual override returns (uint256) {
|
||||||
return token == address(this) ? type(uint256).max - ERC20.totalSupply() : 0;
|
return token == address(this) ? type(uint256).max - ERC20.totalSupply() : 0;
|
||||||
@ -54,7 +54,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender {
|
|||||||
* supported.
|
* supported.
|
||||||
* @param amount The amount of tokens to be loaned.
|
* @param amount The amount of tokens to be loaned.
|
||||||
* @param data An arbitrary datafield that is passed to the receiver.
|
* @param data An arbitrary datafield that is passed to the receiver.
|
||||||
* @return `true` is the flash loan was successful.
|
* @return `true` if the flash loan was successful.
|
||||||
*/
|
*/
|
||||||
// This function can reenter, but it doesn't pose a risk because it always preserves the property that the amount
|
// This function can reenter, but it doesn't pose a risk because it always preserves the property that the amount
|
||||||
// minted at the beginning is always recovered and burned at the end, or else the entire function will revert.
|
// minted at the beginning is always recovered and burned at the end, or else the entire function will revert.
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import "../../../utils/Counters.sol";
|
|||||||
* and the account address.
|
* and the account address.
|
||||||
*
|
*
|
||||||
* NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it
|
* NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it
|
||||||
* return `block.number` will trigger the creation of snapshot at the begining of each new block. When overridding this
|
* return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this
|
||||||
* function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.
|
* function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.
|
||||||
*
|
*
|
||||||
* Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient
|
* Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient
|
||||||
|
|||||||
@ -41,7 +41,7 @@ abstract contract ERC20Wrapper is ERC20 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Mint wrapped token to cover any underlyingTokens that would have been transfered by mistake. Internal
|
* @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal
|
||||||
* function that can be exposed with access control if desired.
|
* function that can be exposed with access control if desired.
|
||||||
*/
|
*/
|
||||||
function _recover(address account) internal virtual returns (uint256) {
|
function _recover(address account) internal virtual returns (uint256) {
|
||||||
|
|||||||
Reference in New Issue
Block a user