MCPcopy Index your code
hub / github.com/Uniswap/v3-core

github.com/Uniswap/v3-core @v1.0.0 sqlite

repository ↗ · DeepWiki ↗ · release v1.0.0 ↗
70 symbols 260 edges 23 files 0 documented · 0%
README

Uniswap V3

Lint Tests Fuzz Testing Mythx npm version

This repository contains the core smart contracts for the Uniswap V3 Protocol. For higher level contracts, see the uniswap-v3-periphery repository.

Bug bounty

This repository is subject to the Uniswap V3 bug bounty program, per the terms defined here.

Local deployment

In order to deploy this code to a local testnet, you should install the npm package @uniswap/v3-core and import the factory bytecode located at @uniswap/v3-core/artifacts/contracts/UniswapV3Factory.sol/UniswapV3Factory.json. For example:

import {
  abi as FACTORY_ABI,
  bytecode as FACTORY_BYTECODE,
} from '@uniswap/v3-core/artifacts/contracts/UniswapV3Factory.sol/UniswapV3Factory.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 Uniswap v3 interfaces are available for import into solidity smart contracts via the npm artifact @uniswap/v3-core, e.g.:

import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';

contract MyContract {
  IUniswapV3Pool pool;

  function doSomethingWithPool() {
    // pool.swap(...);
  }
}

Licensing

The primary license for Uniswap V3 Core is the Business Source License 1.1 (BUSL-1.1), see LICENSE.

Exceptions

  • All files in contracts/interfaces/ are licensed under GPL-2.0-or-later (as indicated in their SPDX headers), see contracts/interfaces/LICENSE
  • Several files in contracts/libraries/ are licensed under GPL-2.0-or-later (as indicated in their SPDX headers), see contracts/libraries/LICENSE_GPL
  • contracts/libraries/FullMath.sol is licensed under MIT (as indicated in its SPDX header), see contracts/libraries/LICENSE_MIT
  • All files in contracts/test remain unlicensed.

Extension points exported contracts — how you extend this code

BaseSwapTestCase (Interface)
(no doc)
test/UniswapV3Pool.swaps.spec.ts
PoolFunctions (Interface)
(no doc)
test/shared/utilities.ts
SwapExact0For1TestCase (Interface)
(no doc)
test/UniswapV3Pool.swaps.spec.ts
MultiPoolFunctions (Interface)
(no doc)
test/shared/utilities.ts
SwapExact1For0TestCase (Interface)
(no doc)
test/UniswapV3Pool.swaps.spec.ts
FactoryFixture (Interface)
(no doc)
test/shared/fixtures.ts
Swap0ForExact1TestCase (Interface)
(no doc)
test/UniswapV3Pool.swaps.spec.ts
TokensFixture (Interface)
(no doc)
test/shared/fixtures.ts

Core symbols most depended-on inside this repo

expandTo18Decimals
called by 230
test/shared/utilities.ts
encodePriceSqrt
called by 145
test/shared/utilities.ts
mint
called by 113
test/shared/utilities.ts
snapshotGasCost
called by 84
test/shared/snapshotGasCost.ts
swapExact0For1
called by 44
test/shared/utilities.ts
flash
called by 41
test/shared/utilities.ts
formatTokenAmount
called by 27
test/shared/format.ts
getMinTick
called by 24
test/shared/utilities.ts

Shape

Function 54
Interface 14
Enum 1
Method 1

Languages

TypeScript100%

Modules by API surface

test/shared/utilities.ts24 symbols
test/UniswapV3Pool.swaps.spec.ts12 symbols
test/shared/fixtures.ts7 symbols
test/Oracle.spec.ts6 symbols
test/UniswapV3Pool.spec.ts4 symbols
test/UniswapV3Pool.arbitrage.spec.ts4 symbols
test/shared/format.ts2 symbols
test/UniswapV3Factory.spec.ts2 symbols
test/shared/snapshotGasCost.ts1 symbols
test/shared/checkObservationEquals.ts1 symbols
test/UniswapV3Router.spec.ts1 symbols
test/UniswapV3Pool.gas.spec.ts1 symbols

Dependencies from manifests, versioned

@nomiclabs/hardhat-ethers2.0.2 · 1×
@nomiclabs/hardhat-etherscan2.1.1 · 1×
@nomiclabs/hardhat-waffle2.0.1 · 1×
@typechain/ethers-v54.0.0 · 1×
@types/chai4.2.6 · 1×
@types/mocha5.2.7 · 1×
chai4.2.0 · 1×
decimal.js10.2.1 · 1×
ethereum-waffle3.0.2 · 1×
ethers5.0.8 · 1×
hardhat2.2.0 · 1×
hardhat-typechain0.3.5 · 1×

For agents

$ claude mcp add v3-core \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact