> For the complete documentation index, see [llms.txt](https://docs.gnoswap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gnoswap.io/contracts/router/swap_callback.gno.md).

# swap\_callback.gno

{% embed url="<https://github.com/gnoswap-labs/gnoswap/blob/main/contract/r/gnoswap/router/v1/swap_callback.gno>" %}

## SwapCallback

```go
func SwapCallback(
	token0Path string,
	token1Path string,
	amount0Delta int64,
	amount1Delta int64,
	payer address
) error
```

SwapCallback is called by pools to transfer tokens during a swap.

#### Parameters

| Name           | Type    | Description                        |
| -------------- | ------- | ---------------------------------- |
| `token0Path`   | string  | path of token0                     |
| `token1Path`   | string  | path of token1                     |
| `amount0Delta` | int64   | amount change for token0           |
| `amount1Delta` | int64   | amount change for token1           |
| `payer`        | address | address that will pay for the swap |

#### Return Values

| Name  | Type  | Description             |
| ----- | ----- | ----------------------- |
| `err` | error | error if callback fails |
