# Swap Tokens on Uniswap

{% hint style="info" %}
Swapping tokens on Uniswap likely requires some interaction with the [Uniswap SDK](https://uniswap.org/docs/v2/javascript-SDK/quick-start/) in order to generate the `path` and `assetAmount`parameters shown below.&#x20;
{% endhint %}

```typescript
import {  
		callOnIntegrationArgs, 
		uniswapV2TakeOrderArgs, 
		IntegrationManagerActionId,
		takeOrderSelector, 
		ComptrollerLib 
} from '@enzymefinance/protocol';

// create a local signer connected to your chosen Ethereum node
const provider = providers.StaticJsonRpcProvider(ethNodeAddress, ethNetwork); 
const signer = new Wallet(managerEthPrivateKey, provider);

// the address of the adapter for the extension you wish to use
const uniswapV2Adapter = '0x23sdfsn...'; // for example only

// the address of the protocol release's integration manager contract
const integrationManagerAddress = '0x32sdf...'; // for example only

// the address of your vault's comptroller
const comptrollerAddress = '0x8syweo...'; // for example only

// assemble the arguments for the integration
const takeOrderArgs = uniswapV2TakeOrderArgs({
      path: aPath, // for example only
      minIncomingAssetAmount: aMinIncomingAssetAmount, // for example only
      outgoingAssetAmount: anOutgoingAssetAmount, // for example only
});

// assemble and encode the arguments for callOnExtension()
const callArgs = callOnIntegrationArgs({
      adapter: uniswapV2Adapter,
      selector: takeOrderSelector,
      encodedCallArgs: takeOrderArgs,
});

// instantiate your comptroller
const vaultComptroller = new ComptrollerLib(comptrollerAddress, signer);

const swapTx = vaultComptroller.callOnExtension.args(
		integrationManagerAddress, 
		IntegrationManagerActionId.CallOnIntegration, 
		callArgs
);

const swapTxReceipt = await swapTx.send();

console.log('Pending transaction:', swapTxReceipt.transactionHash);
console.log('Transaction included in block number:', swapTxReceipt.blockNumber);

```


---

# 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.enzyme.finance/enzyme-blue-sdk/examples/uniswap-trade.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.
