Skip to content

Commit

Permalink
feat(repository): Reformat contract imports for package publish (#3)
Browse files Browse the repository at this point in the history
* feat(repo-format): Check in format files and some contracts

* feat(repo-format): Change imports

* feat(repo-format): Remove brittle gas tests

* feat(repo-format): Remove unnecessary environment token

* Revert "feat(repo-format): Remove unnecessary environment token"

This reverts commit 0760412.

* feat(repo-format): Add env var for unit test workflow

* feat(repo-format): Set env var in step

* feat(repo-format): Change v3 core repository

* feat(repo-format): Remove unnecessary env var

* feat(repo-format): Revert removal

* feat(repo-format): Change scope of env var

* feat(repo-format): Update readme

* feat(repo-format): Remove unnecessary test
  • Loading branch information
weiyuan95 authored Sep 27, 2022
1 parent 37b1464 commit 35dbef5
Show file tree
Hide file tree
Showing 70 changed files with 4,235 additions and 2,199 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
name: Release NPM
runs-on: ubuntu-latest
needs: Version
env:
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

Expand All @@ -36,13 +38,13 @@ jobs:

- run: yarn install --frozen-lockfile

- run: yarn compile

- run: npm version ${{ needs.version.outputs.result }} --git-tag-version=false

- run: npm config set "//npm.pkg.github.com/:_authToken" "\${NPM_AUTH_TOKEN}" --location=project

- run: yarn publish --tag latest --no-git-checks
env:
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: npm config delete "//npm.pkg.github.com/:_authToken" --location=project
if: always()
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
env:
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
registry-url: https://registry.npmjs.org
node-version: 18.x

- id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@birthdayresearch:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_AUTH_TOKEN}
//npm.pkg.github.com/:always-auth=true
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ This repository contains the periphery smart contracts for the Uniswap V3 Protoc
For the lower level core contracts, see the [uniswap-v3-core](https://github.com/Uniswap/uniswap-v3-core)
repository.

## Usage
Projects installing this as a dependency need to ensure that they have installed an aliased version of openzepellin.
The openzeppelin dependency should resolve to `@openzeppelin3.4.2/contracts`. The version should be `3.4.2-solc-0.7`.

## Bug bounty

This repository is subject to the Uniswap V3 bug bounty program,
Expand Down
6 changes: 3 additions & 3 deletions contracts/NonfungiblePositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity =0.7.6;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/v3-core/contracts/libraries/FixedPoint128.sol';
import '@uniswap/v3-core/contracts/libraries/FullMath.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/FixedPoint128.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/FullMath.sol';

import './interfaces/INonfungiblePositionManager.sol';
import './interfaces/INonfungibleTokenPositionDescriptor.sol';
Expand Down
4 changes: 2 additions & 2 deletions contracts/NonfungibleTokenPositionDescriptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity =0.7.6;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/lib/contracts/libraries/SafeERC20Namer.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import './libraries/external/SafeERC20Namer.sol';

import './libraries/ChainId.sol';
import './interfaces/INonfungiblePositionManager.sol';
Expand Down
6 changes: 3 additions & 3 deletions contracts/SwapRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity =0.7.6;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/libraries/SafeCast.sol';
import '@uniswap/v3-core/contracts/libraries/TickMath.sol';
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/SafeCast.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/TickMath.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/IUniswapV3Pool.sol';

import './interfaces/ISwapRouter.sol';
import './base/PeripheryImmutableState.sol';
Expand Down
4 changes: 2 additions & 2 deletions contracts/V3Migrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity =0.7.6;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/libraries/LowGasSafeMath.sol';
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/LowGasSafeMath.sol';
import './interfaces/external/IUniswapV2Pair.sol';

import './interfaces/INonfungiblePositionManager.sol';

Expand Down
4 changes: 2 additions & 2 deletions contracts/base/ERC721Permit.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;

import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin3.4.2/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin3.4.2/contracts/utils/Address.sol';

import '../libraries/ChainId.sol';
import '../interfaces/external/IERC1271.sol';
Expand Down
6 changes: 3 additions & 3 deletions contracts/base/LiquidityManagement.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity =0.7.6;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol';
import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol';
import '@uniswap/v3-core/contracts/libraries/TickMath.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/IUniswapV3Factory.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/TickMath.sol';

import '../libraries/PoolAddress.sol';
import '../libraries/CallbackValidation.sol';
Expand Down
4 changes: 2 additions & 2 deletions contracts/base/PeripheryPayments.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin3.4.2/contracts/token/ERC20/IERC20.sol';

import '../interfaces/IPeripheryPayments.sol';
import '../interfaces/external/IWETH9.sol';
Expand Down
6 changes: 3 additions & 3 deletions contracts/base/PeripheryPaymentsWithFee.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@uniswap/v3-core/contracts/libraries/LowGasSafeMath.sol';
import '@openzeppelin3.4.2/contracts/token/ERC20/IERC20.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/LowGasSafeMath.sol';

import './PeripheryPayments.sol';
import '../interfaces/IPeripheryPaymentsWithFee.sol';
Expand Down
4 changes: 2 additions & 2 deletions contracts/base/PoolInitializer.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;

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

import './PeripheryImmutableState.sol';
import '../interfaces/IPoolInitializer.sol';
Expand Down
6 changes: 3 additions & 3 deletions contracts/base/SelfPermit.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma solidity =0.7.6;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/drafts/IERC20Permit.sol';
import '@openzeppelin3.4.2/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin3.4.2/contracts/drafts/IERC20Permit.sol';

import '../interfaces/ISelfPermit.sol';
import '../interfaces/external/IERC20PermitAllowed.sol';
Expand Down
4 changes: 2 additions & 2 deletions contracts/examples/PairFlash.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity =0.7.6;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3FlashCallback.sol';
import '@uniswap/v3-core/contracts/libraries/LowGasSafeMath.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/callback/IUniswapV3FlashCallback.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/LowGasSafeMath.sol';

import '../base/PeripheryPayments.sol';
import '../base/PeripheryImmutableState.sol';
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IERC20Metadata.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.7.0;
pragma solidity =0.7.6;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin3.4.2/contracts/token/ERC20/IERC20.sol';

/// @title IERC20Metadata
/// @title Interface for ERC20 Metadata
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IERC721Permit.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;

import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin3.4.2/contracts/token/ERC721/IERC721.sol';

/// @title ERC721 with permit
/// @notice Extension to ERC721 that includes a permit function for signature based approvals
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IMulticall.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;
pragma abicoder v2;

/// @title Multicall interface
Expand Down
6 changes: 3 additions & 3 deletions contracts/interfaces/INonfungiblePositionManager.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;
pragma abicoder v2;

import '@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol';
import '@openzeppelin3.4.2/contracts/token/ERC721/IERC721Metadata.sol';
import '@openzeppelin3.4.2/contracts/token/ERC721/IERC721Enumerable.sol';

import './IPoolInitializer.sol';
import './IERC721Permit.sol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma solidity =0.7.6;

import './INonfungiblePositionManager.sol';

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IPeripheryImmutableState.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma solidity =0.7.6;

/// @title Immutable state
/// @notice Functions that return immutable state of the router
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IPeripheryPayments.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;

/// @title Periphery Payments
/// @notice Functions to ease deposits and withdrawals of ETH
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IPeripheryPaymentsWithFee.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;

import './IPeripheryPayments.sol';

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IPoolInitializer.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;
pragma abicoder v2;

/// @title Creates and initializes V3 Pools
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IQuoter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;
pragma abicoder v2;

/// @title Quoter Interface
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IQuoterV2.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;
pragma abicoder v2;

/// @title QuoterV2 Interface
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ISelfPermit.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;

/// @title Self Permit
/// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/ISwapRouter.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';

/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ITickLens.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;
pragma abicoder v2;

/// @title Tick Lens
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IV3Migrator.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma solidity =0.7.6;
pragma abicoder v2;

import './IMulticall.sol';
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/external/IERC1271.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma solidity =0.7.6;

/// @title Interface for verifying contract-based account signatures
/// @notice Interface that verifies provided signature for the data
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/external/IERC20PermitAllowed.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma solidity =0.7.6;

/// @title Interface for permit
/// @notice Interface used by DAI/CHAI for permit
Expand Down
53 changes: 53 additions & 0 deletions contracts/interfaces/external/IUniswapV2Pair.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copied from: https://github.com/Uniswap/v2-core/blob/master/contracts/interfaces/IUniswapV2Pair.sol
pragma solidity =0.7.6;

interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);

function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);

function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);

function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);

function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);

function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);

function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;

function initialize(address, address) external;
}
2 changes: 1 addition & 1 deletion contracts/interfaces/external/IWETH9.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin3.4.2/contracts/token/ERC20/IERC20.sol';

/// @title Interface for WETH9
interface IWETH9 is IERC20 {
Expand Down
8 changes: 4 additions & 4 deletions contracts/lens/Quoter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
pragma solidity =0.7.6;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/libraries/SafeCast.sol';
import '@uniswap/v3-core/contracts/libraries/TickMath.sol';
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/SafeCast.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/libraries/TickMath.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@birthdayresearch/uniswap-v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';

import '../interfaces/IQuoter.sol';
import '../base/PeripheryImmutableState.sol';
Expand Down
Loading

0 comments on commit 35dbef5

Please sign in to comment.