# @uniswap/swap-router-contracts

> Smart contracts for swapping on Uniswap V2 and V3

Latest version **1.3.1** (published 2023-10-02) · GPL-2.0-or-later license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @uniswap/swap-router-contracts
pnpm add @uniswap/swap-router-contracts
yarn add @uniswap/swap-router-contracts
bun add @uniswap/swap-router-contracts
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2023-10-02 |
| First published | 2021-10-26 |
| Weekly downloads | 0 |
| License | GPL-2.0-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 6 |
| Unpacked size | 388.2 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 145 |
| Maintainers | cmcewen, mtoda, alicehenshaw, sarareynolds, emag3m, willpote, akarys01, ezhong1900, zachyang_uniswap |
| Keywords | uniswap, v2, v3 |

## Links

- npm: https://www.npmjs.com/package/@uniswap/swap-router-contracts
- Repository: https://github.com/Uniswap/swap-router-contracts
- Homepage: https://uniswap.org
- Issues: https://github.com/Uniswap/swap-router-contracts/issues
- npm.io page: https://npm.io/package/@uniswap/swap-router-contracts

## Dependencies (6)

- [dotenv](https://npm.io/package/dotenv.md) ^14.2.0
- [hardhat-watcher](https://npm.io/package/hardhat-watcher.md) ^2.1.1
- [@uniswap/v2-core](https://npm.io/package/@uniswap/v2-core.md) ^1.0.1
- [@uniswap/v3-core](https://npm.io/package/@uniswap/v3-core.md) ^1.0.0
- [@uniswap/v3-periphery](https://npm.io/package/@uniswap/v3-periphery.md) ^1.4.4
- [@openzeppelin/contracts](https://npm.io/package/@openzeppelin/contracts.md) 3.4.2-solc-0.7

## Recent versions

- 1.3.1 (latest) — 2023-10-02
- 1.3.0 — 2022-08-08
- 1.2.1 — 2022-04-22
- 1.2.0 — 2022-01-30
- 1.1.0 — 2021-12-14
- 1.0.0 — 2021-12-01
- 1.0.0-beta.5 — 2021-11-24
- 1.0.0-beta.4 — 2021-11-19
- 1.0.0-beta.3 — 2021-11-11
- 1.0.0-beta.2 — 2021-10-26
- 1.0.0-beta.1 — 2021-10-26

## README

# Uniswap Swap Router

[![Tests](https://github.com/Uniswap/swap-router-contracts/workflows/Tests/badge.svg)](https://github.com/Uniswap/swap-router-contracts/actions?query=workflow%3ATests)
[![Lint](https://github.com/Uniswap/swap-router-contracts/workflows/Lint/badge.svg)](https://github.com/Uniswap/swap-router-contracts/actions?query=workflow%3ALint)

This repository contains smart contracts for swapping on the Uniswap V2 and V3 protocols.

## Bug bounty

This repository is subject to the Uniswap V3 bug bounty program,
per the terms defined [here](./bug-bounty.md).

## Local deployment

In order to deploy this code to a local testnet, you should install the npm package
`@uniswap/swap-router-contracts`
and import bytecode imported from artifacts located at
`@uniswap/swap-router-contracts/artifacts/contracts/*/*.json`.
For example:

```typescript
import {
  abi as SWAP_ROUTER_ABI,
  bytecode as SWAP_ROUTER_BYTECODE,
} from '@uniswap/swap-router-contracts/artifacts/contracts/SwapRouter02.sol/SwapRouter02.json'

// deploy the bytecode
```

This will ensure that you are testing against the same bytecode that is deployed to
mainnet and public testnets, and all Uniswap code will correctly interoperate with
your local deployment.

## Using solidity interfaces

The swap router contract interfaces are available for import into solidity smart contracts
via the npm artifact `@uniswap/swap-router-contracts`, e.g.:

```solidity
import '@uniswap/swap-router-contracts/contracts/interfaces/ISwapRouter02.sol';

contract MyContract {
  ISwapRouter02 router;

  function doSomethingWithSwapRouter() {
    // router.exactInput(...);
  }
}

```

## Tests

Some tests use Hardhat mainnet forking and therefore require an archive node.
Either create a `.env` file in the workspace root containing:

```
ARCHIVE_RPC_URL='...'
```

Or set the variable when running tests:

```
export ARCHIVE_RPC_URL='...' && npm run test
```

---
_Source: https://npm.io/package/@uniswap/swap-router-contracts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
