Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Last active May 15, 2023 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulRBerg/7415a407fd5209d781163aa015c8f517 to your computer and use it in GitHub Desktop.
Save PaulRBerg/7415a407fd5209d781163aa015c8f517 to your computer and use it in GitHub Desktop.
Generic interface for wrapping native assets into ERC-20 form
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19;
import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
/// @notice An interface for contracts that wrap native assets in ERC-20 form, such as WETH.
/// @dev A generic name is used instead of "WETH" to accommodate chains with different native assets.
interface IWrappedNativeAsset is IERC20 {
/// @notice Deposits native assets to receive ERC-20 wrapped assets.
function deposit() external payable;
/// @notice Withdraws ERC-20 wrapped assets to obtain native assets.
/// @param amount The amount of ERC-20 wrapped assets to withdraw.
function withdraw(uint256 amount) external;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment