Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add to CI #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/dockerize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Update docker image

on:
push:
workflow_dispatch:
env:
IMAGE_NAME: neonlabsorg/uniswap-v4
jobs:
dockerize:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- run: |
git submodule update --init --remote --recursive
- name: Define tag
id: define-env
run: |
if [[ "${{ github.ref_name }}" == 'main' ]]; then
tag='latest'
else
tag='${{ github.ref_name }}'
fi
echo "tag=${tag}"
echo "tag=${tag}" >> $GITHUB_OUTPUT
- name: Build image
run: |
docker build -t $IMAGE_NAME:${{ steps.define-env.outputs.tag }} .
- name: Push image
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p "${{ secrets.DOCKER_PASSWORD }}"
echo "Push image $IMAGE_NAME:${{ steps.define-env.outputs.tag }} to Docker registry"
docker push --all-tags $IMAGE_NAME
22 changes: 0 additions & 22 deletions .github/workflows/semgrep.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/test.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "lib/v4-core"]
path = lib/v4-core
url = https://github.com/Uniswap/v4-core
[submodule "lib/permit2"]
path = lib/permit2
url = https://github.com/Uniswap/permit2
[submodule "lib/v4-core"]
path = lib/v4-core
url = https://github.com/neonlabsorg/uniswap-v4-core
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.10

COPY . /app

WORKDIR /app

RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
104 changes: 104 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import os

import pytest

from utils import EthAccounts, Faucet, NeonChainWeb3Client


@pytest.fixture(scope="class")
def web3_client():
print(f"Proxy IP: {os.environ.get('PROXY_IP', '')}")
return NeonChainWeb3Client(f"http://{os.environ.get('PROXY_IP', '')}:9090/solana")


@pytest.fixture(scope="class")
def faucet(web3_client) -> Faucet:
return Faucet(f"http://{os.environ.get('PROXY_IP', '')}:3333", web3_client)


@pytest.fixture(scope="class")
def accounts(web3_client, faucet):
return EthAccounts(web3_client, faucet)


@pytest.fixture(scope="function")
def pool_manager(accounts, web3_client):
contract, _ = web3_client.deploy_and_get_contract(
contract="lib/v4-core/src/PoolManager.sol",
version="0.8.26",
contract_name="PoolManager",
account=accounts[0],
import_remapping={
"solmate/": f"{os.getcwd()}/lib/permit2/lib/solmate/",
},
)
print(f"Pool manager address: {contract.address}")
yield contract


@pytest.fixture(scope="function")
def v4_router(accounts, pool_manager, web3_client):
contract, _ = web3_client.deploy_and_get_contract(
contract="test/mocks/MockV4Router.sol",
version="0.8.26",
contract_name="MockV4Router",
account=accounts[0],
constructor_args=[pool_manager.address],
import_remapping={
"solmate/": f"{os.getcwd()}/lib/permit2/lib/solmate/",
},
)
print(f"V4 Router address: {contract.address}")
yield contract, pool_manager


@pytest.fixture(scope="function")
def position_manager(accounts, pool_manager, web3_client):
contract, _ = web3_client.deploy_and_get_contract(
contract="lib/v4-core/src/test/PoolModifyLiquidityTest.sol",
version="0.8.26",
contract_name="PoolModifyLiquidityTest",
account=accounts[0],
constructor_args=[pool_manager.address],
)
print(f"Position manager address: {contract.address}")
yield contract


v4_router_test_contracts = [
"V4Router.t.sol",
"V4Router2.t.sol",
"V4Router3.t.sol",
"V4Router4.t.sol",
"V4Router5.t.sol",
"V4Router6.t.sol",
"V4Router7.t.sol",
"V4Router8.t.sol",
"V4Router9.t.sol",
]


@pytest.fixture(scope="function")
def v4_router_test(request, accounts, v4_router, position_manager, web3_client):
v4, pool_manager = v4_router
deployed_contracts = dict()

contract_name = ""
if request.node.get_closest_marker("contract_filename"):
contract_name = request.node.get_closest_marker("contract_filename").kwargs.get("name", "")

for name in v4_router_test_contracts if contract_name == "" else [contract_name]:
contract, _ = web3_client.deploy_and_get_contract(
contract=f"test/router/{name}",
version="0.8.26",
contract_name="V4RouterTest",
account=accounts[0],
constructor_args=[v4.address, pool_manager.address, position_manager.address],
import_remapping={
"forge-std": f"{os.getcwd()}/lib/v4-core/lib/forge-std/src",
"solmate/": f"{os.getcwd()}/lib/permit2/lib/solmate/",
"permit2/": f"{os.getcwd()}/lib/permit2/",
},
)
deployed_contracts[name] = contract
yield deployed_contracts
2 changes: 1 addition & 1 deletion lib/v4-core
Submodule v4-core updated 33 files
+1 −1 .forge-snapshots/add liquidity to already existing position with salt.snap
+1 −1 .forge-snapshots/addLiquidity CA fee.snap
+1 −1 .forge-snapshots/addLiquidity with empty hook.snap
+1 −1 .forge-snapshots/addLiquidity with native token.snap
+1 −1 .forge-snapshots/create new liquidity to a position with salt.snap
+1 −1 .forge-snapshots/donate gas with 1 token.snap
+1 −1 .forge-snapshots/donate gas with 2 tokens.snap
+1 −1 .forge-snapshots/initialize.snap
+1 −1 .forge-snapshots/removeLiquidity CA fee.snap
+1 −1 .forge-snapshots/removeLiquidity with empty hook.snap
+1 −1 .forge-snapshots/removeLiquidity with native token.snap
+1 −1 .forge-snapshots/simple addLiquidity second addition same range.snap
+1 −1 .forge-snapshots/simple addLiquidity.snap
+1 −1 .forge-snapshots/simple removeLiquidity some liquidity remains.snap
+1 −1 .forge-snapshots/simple removeLiquidity.snap
+1 −1 .forge-snapshots/simple swap with native.snap
+1 −1 .forge-snapshots/simple swap.snap
+1 −1 .forge-snapshots/swap CA custom curve + swap noop.snap
+1 −1 .forge-snapshots/swap CA fee on unspecified.snap
+1 −1 .forge-snapshots/swap against liquidity with native token.snap
+1 −1 .forge-snapshots/swap against liquidity.snap
+1 −1 .forge-snapshots/swap burn 6909 for input.snap
+1 −1 .forge-snapshots/swap burn native 6909 for input.snap
+1 −1 .forge-snapshots/swap mint native output as 6909.snap
+1 −1 .forge-snapshots/swap mint output as 6909.snap
+1 −1 .forge-snapshots/swap skips hook call if hook is caller.snap
+1 −1 .forge-snapshots/swap with dynamic fee.snap
+1 −1 .forge-snapshots/swap with hooks.snap
+1 −1 .forge-snapshots/swap with lp fee and protocol fee.snap
+1 −1 .forge-snapshots/swap with return dynamic fee.snap
+1 −1 .forge-snapshots/update dynamic fee in before swap.snap
+1 −1 README.md
+8 −6 src/types/Currency.sol
62 changes: 62 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
aiohappyeyeballs==2.4.0
aiohttp==3.10.5
aiosignal==1.3.1
annotated-types==0.7.0
anyio==4.4.0
async-timeout==4.0.3
attrs==24.2.0
base58==2.1.1
bitarray==2.9.2
black==24.8.0
certifi==2024.8.30
charset-normalizer==3.3.2
ckzg==2.0.1
click==8.1.7
construct==2.10.68
construct-typing==0.5.6
cytoolz==0.12.3
eth-account==0.13.3
eth-hash==0.7.0
eth-keyfile==0.8.1
eth-keys==0.5.1
eth-rlp==2.1.0
eth-typing==5.0.0
eth-utils==5.0.0
eth_abi==5.1.0
exceptiongroup==1.2.2
frozenlist==1.4.1
h11==0.14.0
hexbytes==1.2.1
httpcore==1.0.5
httpx==0.27.2
idna==3.8
iniconfig==2.0.0
isort==5.13.2
jsonalias==0.1.1
multidict==6.1.0
mypy-extensions==1.0.0
packaging==23.2
parsimonious==0.10.0
pathspec==0.12.1
platformdirs==4.3.6
pluggy==1.5.0
py-solc-x==2.0.3
pycryptodome==3.20.0
pydantic==2.9.1
pydantic_core==2.23.3
pytest==8.3.3
pyunormalize==15.1.0
regex==2024.7.24
requests==2.32.3
rlp==4.0.1
sniffio==1.3.1
solana==0.34.3
solders==0.21.0
tomli==2.0.1
toolz==0.12.1
types-requests==2.32.0.20240907
typing_extensions==4.12.2
urllib3==2.2.2
web3==7.2.0
websockets==11.0.3
yarl==1.11.1
18 changes: 9 additions & 9 deletions src/PositionManager.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.26;

import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol";
import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol";
import {Position} from "@uniswap/v4-core/src/libraries/Position.sol";
import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol";
import {TransientStateLibrary} from "@uniswap/v4-core/src/libraries/TransientStateLibrary.sol";
import {IPoolManager} from "../lib/v4-core/src/interfaces/IPoolManager.sol";
import {PoolKey} from "../lib/v4-core/src/types/PoolKey.sol";
import {PoolIdLibrary} from "../lib/v4-core/src/types/PoolId.sol";
import {Currency} from "../lib/v4-core/src/types/Currency.sol";
import {BalanceDelta} from "../lib/v4-core/src/types/BalanceDelta.sol";
import {SafeCast} from "../lib/v4-core/src/libraries/SafeCast.sol";
import {Position} from "../lib/v4-core/src/libraries/Position.sol";
import {StateLibrary} from "../lib/v4-core/src/libraries/StateLibrary.sol";
import {TransientStateLibrary} from "../lib/v4-core/src/libraries/TransientStateLibrary.sol";
import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol";

import {ERC721Permit_v4} from "./base/ERC721Permit_v4.sol";
Expand Down
14 changes: 7 additions & 7 deletions src/V4Router.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.26;

import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol";
import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol";
import {BipsLibrary} from "@uniswap/v4-core/src/libraries/BipsLibrary.sol";
import {IPoolManager} from "../lib/v4-core/src/interfaces/IPoolManager.sol";
import {BalanceDelta} from "../lib/v4-core/src/types/BalanceDelta.sol";
import {PoolKey} from "../lib/v4-core/src/types/PoolKey.sol";
import {Currency} from "../lib/v4-core/src/types/Currency.sol";
import {TickMath} from "../lib/v4-core/src/libraries/TickMath.sol";
import {SafeCast} from "../lib/v4-core/src/libraries/SafeCast.sol";
import {BipsLibrary} from "../lib/v4-core/src/libraries/BipsLibrary.sol";

import {PathKey, PathKeyLibrary} from "./libraries/PathKey.sol";
import {CalldataDecoder} from "./libraries/CalldataDecoder.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/base/BaseActionsRouter.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {IPoolManager} from "../../lib/v4-core/src/interfaces/IPoolManager.sol";
import {SafeCallback} from "./SafeCallback.sol";
import {CalldataDecoder} from "../libraries/CalldataDecoder.sol";
import {ActionConstants} from "../libraries/ActionConstants.sol";
Expand Down
6 changes: 3 additions & 3 deletions src/base/DeltaResolver.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.8.24;

import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
import {TransientStateLibrary} from "@uniswap/v4-core/src/libraries/TransientStateLibrary.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {Currency} from "../../lib/v4-core/src/types/Currency.sol";
import {TransientStateLibrary} from "../../lib/v4-core/src/libraries/TransientStateLibrary.sol";
import {IPoolManager} from "../../lib/v4-core/src/interfaces/IPoolManager.sol";
import {ImmutableState} from "./ImmutableState.sol";
import {ActionConstants} from "../libraries/ActionConstants.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/base/ImmutableState.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.8.0;

import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {IPoolManager} from "../../lib/v4-core/src/interfaces/IPoolManager.sol";

/// @title Immutable State
/// @notice A collection of immutable state variables, commonly used across multiple contracts
Expand Down
4 changes: 2 additions & 2 deletions src/base/Notifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.0;

import {ISubscriber} from "../interfaces/ISubscriber.sol";
import {INotifier} from "../interfaces/INotifier.sol";
import {CustomRevert} from "@uniswap/v4-core/src/libraries/CustomRevert.sol";
import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
import {CustomRevert} from "../../lib/v4-core/src/libraries/CustomRevert.sol";
import {BalanceDelta} from "../../lib/v4-core/src/types/BalanceDelta.sol";
import {PositionInfo} from "../libraries/PositionInfoLibrary.sol";

/// @notice Notifier is used to opt in to sending updates to external contracts about position modifications or transfers
Expand Down
2 changes: 1 addition & 1 deletion src/base/PoolInitializer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import {ImmutableState} from "./ImmutableState.sol";

import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {PoolKey} from "../../lib/v4-core/src/types/PoolKey.sol";

/// @title Pool Initializer
/// @notice Initializes a Uniswap v4 Pool
Expand Down
4 changes: 2 additions & 2 deletions src/base/SafeCallback.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import {IUnlockCallback} from "@uniswap/v4-core/src/interfaces/callback/IUnlockCallback.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {IUnlockCallback} from "../../lib/v4-core/src/interfaces/callback/IUnlockCallback.sol";
import {IPoolManager} from "../../lib/v4-core/src/interfaces/IPoolManager.sol";
import {ImmutableState} from "./ImmutableState.sol";

/// @title Safe Callback
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IPositionManager.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {PoolKey} from "../../lib/v4-core/src/types/PoolKey.sol";
import {PositionInfo} from "../libraries/PositionInfoLibrary.sol";

import {INotifier} from "./INotifier.sol";
Expand Down
Loading
Loading