Skip to main content

EqualSwap

EqualSwap

initialize

function initialize(contract IERC20Upgradeable erc20_, address owner_) public

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

_Function that should revert when msg.sender is not authorized to upgrade the contract. Called by {upgradeTo} and {upgradeToAndCall}.

Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.

function _authorizeUpgrade(address) internal override onlyOwner {}
```_

### receive

```solidity
receive() external payable

swapNativeForERC20

function swapNativeForERC20() external payable

use native token to get erc20 token

swapERC20ForNative

function swapERC20ForNative(uint256 amount) external

use erc20 token to get native token use nonReentrant to defend reentry

withdraw

function withdraw() external

withdraw all native token and erc20