# Payment

**Inherits:** [State](/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/paymentbase/state.md), [PayableMulticall](/technical-reference/maverick-v2/v2-contracts/maverick-v2-common-contracts/base/payablemulticall.md), [SelfPermit](/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/paymentbase/selfpermit.md), [IPayment](/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/paymentbase/ipayment.md)

Payment helper function that lets user sweep ERC20 tokens off the router and liquidity manager. Also provides mechanism to wrap and unwrap ETH/WETH so that it can be used in the Maverick pools.

### Functions <a href="#functions" id="functions"></a>

#### receive <a href="#receive" id="receive"></a>

```solidity
receive() external payable;
```

#### unwrapWETH9 <a href="#unwrapweth9" id="unwrapweth9"></a>

Unwrap WETH9 tokens into ETH and send that balance to recipient. If less than amountMinimum WETH is avialble, then revert.

```solidity
function unwrapWETH9(uint256 amountMinimum, address recipient) public payable;
```

#### sweepToken <a href="#sweeptoken" id="sweeptoken"></a>

Sweep entire ERC20 token balance on this contract to recipient. If less than amountMinimum balance is avialble, then revert.

```solidity
function sweepToken(IERC20 token, uint256 amountMinimum, address recipient) public payable;
```

#### sweepTokenAmount <a href="#sweeptokenamount" id="sweeptokenamount"></a>

Transfers specified token amount to recipient

```solidity
function sweepTokenAmount(IERC20 token, uint256 amount, address recipient) public payable;
```

#### unwrapAndSweep <a href="#unwrapandsweep" id="unwrapandsweep"></a>

For tokenA and tokenB, sweep all of the non-WETH tokens to msg.sender. Any WETH balance is unwrapped to ETH and then all the ETH on this contract is sent to msg.sender.

```solidity
function unwrapAndSweep(IERC20 tokenA, IERC20 tokenB, uint256 tokenAAmountMin, uint256 tokenBAmountMin)
    public
    payable;
```

#### refundETH <a href="#refundeth" id="refundeth"></a>

Send any ETH on this contract to msg.sender.

```solidity
function refundETH() public payable;
```

#### pay <a href="#pay" id="pay"></a>

Internal function to pay tokens or eth.

```solidity
function pay(IERC20 token, address payer, address recipient, uint256 value) internal;
```

**Parameters**

| Name        | Type      | Description               |
| ----------- | --------- | ------------------------- |
| `token`     | `IERC20`  | ERC20 token to pay.       |
| `payer`     | `address` | Address of the payer.     |
| `recipient` | `address` | Address of the recipient. |
| `value`     | `uint256` | Amount of tokens to pay.  |

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-supplemental-contracts/paymentbase/payment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
