From fff85a8c6f05a4b3b43b526987c35e4ae5eac5c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ribeiro?= Date: Tue, 10 Sep 2024 10:54:25 -0300 Subject: [PATCH] tests(e2e): use gnosis mainnet for e2e test --- .env.example | 2 +- examples/order_posting_e2e.py | 8 +- poetry.lock | 139 ++------------- pyproject.toml | 1 - .../test_post_and_cancel_order_live_e2e.yaml | 166 ------------------ .../test_post_and_cancel_order_live_e2e.py | 54 +++--- 6 files changed, 44 insertions(+), 326 deletions(-) delete mode 100644 tests/e2e/cassettes/test_post_and_cancel_order_live_e2e/test_post_and_cancel_order_live_e2e.yaml diff --git a/.env.example b/.env.example index e796206..4fd7e99 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ PRIVATE_KEY= -E2E_SEPOLIA_TESTING_EOA_PRIVATE_KEY= +E2E_GNOSIS_MAINNET_TESTING_EOA_PRIVATE_KEY= diff --git a/examples/order_posting_e2e.py b/examples/order_posting_e2e.py index e0e97ef..5a8d97d 100644 --- a/examples/order_posting_e2e.py +++ b/examples/order_posting_e2e.py @@ -5,7 +5,6 @@ import asyncio import json import os -from dataclasses import asdict from dotenv import load_dotenv from web3 import Account @@ -56,12 +55,9 @@ async def get_order_quote( def sign_order(order: Order) -> EcdsaSignature: - order_domain = asdict( - domain( - chain=CHAIN, verifying_contract=CowContractAddress.SETTLEMENT_CONTRACT.value - ) + order_domain = domain( + chain=CHAIN, verifying_contract=CowContractAddress.SETTLEMENT_CONTRACT.value ) - del order_domain["salt"] # TODO: improve interfaces return _sign_order(order_domain, order, ACCOUNT, SigningScheme.EIP712) diff --git a/poetry.lock b/poetry.lock index 562667b..ae89dcf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2520,13 +2520,13 @@ dev = ["twine (>=3.4.1)"] [[package]] name = "pytest" -version = "8.3.2" +version = "8.3.3" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, - {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, + {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"}, + {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"}, ] [package.dependencies] @@ -2611,25 +2611,6 @@ pytest = ">=6.2.5" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] -[[package]] -name = "pytest-recording" -version = "0.13.2" -description = "A pytest plugin that allows you recording of network interactions via VCR.py" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pytest_recording-0.13.2-py3-none-any.whl", hash = "sha256:3820fe5743d1ac46e807989e11d073cb776a60bdc544cf43ebca454051b22d13"}, - {file = "pytest_recording-0.13.2.tar.gz", hash = "sha256:000c3babbb466681457fd65b723427c1779a0c6c17d9e381c3142a701e124877"}, -] - -[package.dependencies] -pytest = ">=3.5.0" -vcrpy = ">=2.0.1" - -[package.extras] -dev = ["pytest-httpbin", "pytest-mock", "requests", "werkzeug (==3.0.3)"] -tests = ["pytest-httpbin", "pytest-mock", "requests", "werkzeug (==3.0.3)"] - [[package]] name = "python-dotenv" version = "1.0.1" @@ -3239,39 +3220,20 @@ files = [ [[package]] name = "urllib3" -version = "1.26.20" +version = "2.2.2" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" -files = [ - {file = "urllib3-1.26.20-py2.py3-none-any.whl", hash = "sha256:0ed14ccfbf1c30a9072c7ca157e4319b70d65f623e91e7b32fadb2853431016e"}, - {file = "urllib3-1.26.20.tar.gz", hash = "sha256:40c2dc0c681e47eb8f90e7e27bf6ff7df2e677421fd46756da1161c39ca70d32"}, -] - -[package.extras] -brotli = ["brotli (==1.0.9)", "brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] -secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] -socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] - -[[package]] -name = "vcrpy" -version = "6.0.1" -description = "Automatically mock your HTTP interactions to simplify and speed up testing" -optional = false python-versions = ">=3.8" files = [ - {file = "vcrpy-6.0.1-py2.py3-none-any.whl", hash = "sha256:621c3fb2d6bd8aa9f87532c688e4575bcbbde0c0afeb5ebdb7e14cac409edfdd"}, - {file = "vcrpy-6.0.1.tar.gz", hash = "sha256:9e023fee7f892baa0bbda2f7da7c8ac51165c1c6e38ff8688683a12a4bde9278"}, + {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, + {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, ] -[package.dependencies] -PyYAML = "*" -urllib3 = {version = "<2", markers = "platform_python_implementation == \"PyPy\""} -wrapt = "*" -yarl = "*" - [package.extras] -tests = ["Werkzeug (==2.0.3)", "aiohttp", "boto3", "httplib2", "httpx", "pytest", "pytest-aiohttp", "pytest-asyncio", "pytest-cov", "pytest-httpbin", "requests (>=2.22.0)", "tornado", "urllib3"] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +h2 = ["h2 (>=4,<5)"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] [[package]] name = "virtualenv" @@ -3436,85 +3398,6 @@ files = [ {file = "websockets-13.0.1.tar.gz", hash = "sha256:4d6ece65099411cfd9a48d13701d7438d9c34f479046b34c50ff60bb8834e43e"}, ] -[[package]] -name = "wrapt" -version = "1.16.0" -description = "Module for decorators, wrappers and monkey patching." -optional = false -python-versions = ">=3.6" -files = [ - {file = "wrapt-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ffa565331890b90056c01db69c0fe634a776f8019c143a5ae265f9c6bc4bd6d4"}, - {file = "wrapt-1.16.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e4fdb9275308292e880dcbeb12546df7f3e0f96c6b41197e0cf37d2826359020"}, - {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb2dee3874a500de01c93d5c71415fcaef1d858370d405824783e7a8ef5db440"}, - {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2a88e6010048489cda82b1326889ec075a8c856c2e6a256072b28eaee3ccf487"}, - {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac83a914ebaf589b69f7d0a1277602ff494e21f4c2f743313414378f8f50a4cf"}, - {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:73aa7d98215d39b8455f103de64391cb79dfcad601701a3aa0dddacf74911d72"}, - {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:807cc8543a477ab7422f1120a217054f958a66ef7314f76dd9e77d3f02cdccd0"}, - {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bf5703fdeb350e36885f2875d853ce13172ae281c56e509f4e6eca049bdfb136"}, - {file = "wrapt-1.16.0-cp310-cp310-win32.whl", hash = "sha256:f6b2d0c6703c988d334f297aa5df18c45e97b0af3679bb75059e0e0bd8b1069d"}, - {file = "wrapt-1.16.0-cp310-cp310-win_amd64.whl", hash = "sha256:decbfa2f618fa8ed81c95ee18a387ff973143c656ef800c9f24fb7e9c16054e2"}, - {file = "wrapt-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1a5db485fe2de4403f13fafdc231b0dbae5eca4359232d2efc79025527375b09"}, - {file = "wrapt-1.16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:75ea7d0ee2a15733684badb16de6794894ed9c55aa5e9903260922f0482e687d"}, - {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a452f9ca3e3267cd4d0fcf2edd0d035b1934ac2bd7e0e57ac91ad6b95c0c6389"}, - {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:43aa59eadec7890d9958748db829df269f0368521ba6dc68cc172d5d03ed8060"}, - {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72554a23c78a8e7aa02abbd699d129eead8b147a23c56e08d08dfc29cfdddca1"}, - {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d2efee35b4b0a347e0d99d28e884dfd82797852d62fcd7ebdeee26f3ceb72cf3"}, - {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6dcfcffe73710be01d90cae08c3e548d90932d37b39ef83969ae135d36ef3956"}, - {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:eb6e651000a19c96f452c85132811d25e9264d836951022d6e81df2fff38337d"}, - {file = "wrapt-1.16.0-cp311-cp311-win32.whl", hash = "sha256:66027d667efe95cc4fa945af59f92c5a02c6f5bb6012bff9e60542c74c75c362"}, - {file = "wrapt-1.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:aefbc4cb0a54f91af643660a0a150ce2c090d3652cf4052a5397fb2de549cd89"}, - {file = "wrapt-1.16.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:5eb404d89131ec9b4f748fa5cfb5346802e5ee8836f57d516576e61f304f3b7b"}, - {file = "wrapt-1.16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9090c9e676d5236a6948330e83cb89969f433b1943a558968f659ead07cb3b36"}, - {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94265b00870aa407bd0cbcfd536f17ecde43b94fb8d228560a1e9d3041462d73"}, - {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f2058f813d4f2b5e3a9eb2eb3faf8f1d99b81c3e51aeda4b168406443e8ba809"}, - {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98b5e1f498a8ca1858a1cdbffb023bfd954da4e3fa2c0cb5853d40014557248b"}, - {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:14d7dc606219cdd7405133c713f2c218d4252f2a469003f8c46bb92d5d095d81"}, - {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:49aac49dc4782cb04f58986e81ea0b4768e4ff197b57324dcbd7699c5dfb40b9"}, - {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:418abb18146475c310d7a6dc71143d6f7adec5b004ac9ce08dc7a34e2babdc5c"}, - {file = "wrapt-1.16.0-cp312-cp312-win32.whl", hash = "sha256:685f568fa5e627e93f3b52fda002c7ed2fa1800b50ce51f6ed1d572d8ab3e7fc"}, - {file = "wrapt-1.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:dcdba5c86e368442528f7060039eda390cc4091bfd1dca41e8046af7c910dda8"}, - {file = "wrapt-1.16.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d462f28826f4657968ae51d2181a074dfe03c200d6131690b7d65d55b0f360f8"}, - {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a33a747400b94b6d6b8a165e4480264a64a78c8a4c734b62136062e9a248dd39"}, - {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3646eefa23daeba62643a58aac816945cadc0afaf21800a1421eeba5f6cfb9c"}, - {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ebf019be5c09d400cf7b024aa52b1f3aeebeff51550d007e92c3c1c4afc2a40"}, - {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:0d2691979e93d06a95a26257adb7bfd0c93818e89b1406f5a28f36e0d8c1e1fc"}, - {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:1acd723ee2a8826f3d53910255643e33673e1d11db84ce5880675954183ec47e"}, - {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:bc57efac2da352a51cc4658878a68d2b1b67dbe9d33c36cb826ca449d80a8465"}, - {file = "wrapt-1.16.0-cp36-cp36m-win32.whl", hash = "sha256:da4813f751142436b075ed7aa012a8778aa43a99f7b36afe9b742d3ed8bdc95e"}, - {file = "wrapt-1.16.0-cp36-cp36m-win_amd64.whl", hash = "sha256:6f6eac2360f2d543cc875a0e5efd413b6cbd483cb3ad7ebf888884a6e0d2e966"}, - {file = "wrapt-1.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a0ea261ce52b5952bf669684a251a66df239ec6d441ccb59ec7afa882265d593"}, - {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bd2d7ff69a2cac767fbf7a2b206add2e9a210e57947dd7ce03e25d03d2de292"}, - {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9159485323798c8dc530a224bd3ffcf76659319ccc7bbd52e01e73bd0241a0c5"}, - {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a86373cf37cd7764f2201b76496aba58a52e76dedfaa698ef9e9688bfd9e41cf"}, - {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:73870c364c11f03ed072dda68ff7aea6d2a3a5c3fe250d917a429c7432e15228"}, - {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:b935ae30c6e7400022b50f8d359c03ed233d45b725cfdd299462f41ee5ffba6f"}, - {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:db98ad84a55eb09b3c32a96c576476777e87c520a34e2519d3e59c44710c002c"}, - {file = "wrapt-1.16.0-cp37-cp37m-win32.whl", hash = "sha256:9153ed35fc5e4fa3b2fe97bddaa7cbec0ed22412b85bcdaf54aeba92ea37428c"}, - {file = "wrapt-1.16.0-cp37-cp37m-win_amd64.whl", hash = "sha256:66dfbaa7cfa3eb707bbfcd46dab2bc6207b005cbc9caa2199bcbc81d95071a00"}, - {file = "wrapt-1.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1dd50a2696ff89f57bd8847647a1c363b687d3d796dc30d4dd4a9d1689a706f0"}, - {file = "wrapt-1.16.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:44a2754372e32ab315734c6c73b24351d06e77ffff6ae27d2ecf14cf3d229202"}, - {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e9723528b9f787dc59168369e42ae1c3b0d3fadb2f1a71de14531d321ee05b0"}, - {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dbed418ba5c3dce92619656802cc5355cb679e58d0d89b50f116e4a9d5a9603e"}, - {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:941988b89b4fd6b41c3f0bfb20e92bd23746579736b7343283297c4c8cbae68f"}, - {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6a42cd0cfa8ffc1915aef79cb4284f6383d8a3e9dcca70c445dcfdd639d51267"}, - {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:1ca9b6085e4f866bd584fb135a041bfc32cab916e69f714a7d1d397f8c4891ca"}, - {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d5e49454f19ef621089e204f862388d29e6e8d8b162efce05208913dde5b9ad6"}, - {file = "wrapt-1.16.0-cp38-cp38-win32.whl", hash = "sha256:c31f72b1b6624c9d863fc095da460802f43a7c6868c5dda140f51da24fd47d7b"}, - {file = "wrapt-1.16.0-cp38-cp38-win_amd64.whl", hash = "sha256:490b0ee15c1a55be9c1bd8609b8cecd60e325f0575fc98f50058eae366e01f41"}, - {file = "wrapt-1.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9b201ae332c3637a42f02d1045e1d0cccfdc41f1f2f801dafbaa7e9b4797bfc2"}, - {file = "wrapt-1.16.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2076fad65c6736184e77d7d4729b63a6d1ae0b70da4868adeec40989858eb3fb"}, - {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c5cd603b575ebceca7da5a3a251e69561bec509e0b46e4993e1cac402b7247b8"}, - {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b47cfad9e9bbbed2339081f4e346c93ecd7ab504299403320bf85f7f85c7d46c"}, - {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8212564d49c50eb4565e502814f694e240c55551a5f1bc841d4fcaabb0a9b8a"}, - {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:5f15814a33e42b04e3de432e573aa557f9f0f56458745c2074952f564c50e664"}, - {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:db2e408d983b0e61e238cf579c09ef7020560441906ca990fe8412153e3b291f"}, - {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:edfad1d29c73f9b863ebe7082ae9321374ccb10879eeabc84ba3b69f2579d537"}, - {file = "wrapt-1.16.0-cp39-cp39-win32.whl", hash = "sha256:ed867c42c268f876097248e05b6117a65bcd1e63b779e916fe2e33cd6fd0d3c3"}, - {file = "wrapt-1.16.0-cp39-cp39-win_amd64.whl", hash = "sha256:eb1b046be06b0fce7249f1d025cd359b4b80fc1c3e24ad9eca33e0dcdb2e4a35"}, - {file = "wrapt-1.16.0-py3-none-any.whl", hash = "sha256:6906c4100a8fcbf2fa735f6059214bb13b97f75b1a61777fcf6432121ef12ef1"}, - {file = "wrapt-1.16.0.tar.gz", hash = "sha256:5f370f952971e7d17c7d1ead40e49f32345a7f7a5373571ef44d800d06b1899d"}, -] - [[package]] name = "yarl" version = "1.11.1" @@ -3623,4 +3506,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = ">=3.10,<4.0" -content-hash = "ff0c6247f098617dfa7e05c0a2c8f60cde29bcda5890dd86e2433c8279d4a044" +content-hash = "b560a5c3845be211a0319c912867980bc038e467912ae8cb16ef93a15ce87604" diff --git a/pyproject.toml b/pyproject.toml index 40596d7..91e733c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,6 @@ pytest-asyncio = "^0.23.6" web3 = { extras = ["tester"], version = "^6.17.0" } pycln = "^2.4.0" pytest-cov = "^5.0.0" -pytest-recording = "^0.13.2" python-dotenv = "^1.0.1" [tool.poetry.scripts] diff --git a/tests/e2e/cassettes/test_post_and_cancel_order_live_e2e/test_post_and_cancel_order_live_e2e.yaml b/tests/e2e/cassettes/test_post_and_cancel_order_live_e2e/test_post_and_cancel_order_live_e2e.yaml deleted file mode 100644 index ca218d7..0000000 --- a/tests/e2e/cassettes/test_post_and_cancel_order_live_e2e/test_post_and_cancel_order_live_e2e.yaml +++ /dev/null @@ -1,166 +0,0 @@ -interactions: -- request: - body: '{"sellToken": "0x0625aFB445C3B6B7B929342a04A22599fd5dBB59", "buyToken": - "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14", "receiver": "0x892d6077223df8c2383aFA34CFeD21bA639b2927", - "appData": null, "appDataHash": null, "sellTokenBalance": "erc20", "buyTokenBalance": - "erc20", "from": "0x892d6077223df8c2383aFA34CFeD21bA639b2927", "priceQuality": - "verified", "signingScheme": "eip712", "onchainOrder": false, "kind": "sell", - "sellAmountBeforeFee": "1000000000000000000", "validTo": null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '481' - content-type: - - application/json - host: - - api.cow.fi - user-agent: - - python-httpx/0.27.0 - method: POST - uri: https://api.cow.fi/sepolia/api/v1/quote - response: - content: '{"quote":{"sellToken":"0x0625afb445c3b6b7b929342a04a22599fd5dbb59","buyToken":"0xfff9976782d46cc05630d1f6ebab18b2324d6b14","receiver":"0x892d6077223df8c2383afa34cfed21ba639b2927","sellAmount":"961196089917761152","buyAmount":"675996250398808","validTo":1725927548,"appData":"0x0000000000000000000000000000000000000000000000000000000000000000","feeAmount":"38803910082238848","kind":"sell","partiallyFillable":false,"sellTokenBalance":"erc20","buyTokenBalance":"erc20","signingScheme":"eip712"},"from":"0x892d6077223df8c2383afa34cfed21ba639b2927","expiration":"2024-09-09T23:51:08.689550666Z","id":422926,"verified":true}' - headers: - Access-Control-Allow-Credentials: - - 'true' - Access-Control-Allow-Headers: - - Origin, Content-Type, X-Auth-Token, X-AppId - Access-Control-Allow-Methods: - - OPTIONS, GET, HEAD, PUT, PATCH, POST, DELETE - Access-Control-Allow-Origin: - - '*' - Access-Control-Max-Age: - - '1728000' - Connection: - - keep-alive - Content-Length: - - '620' - Content-Type: - - application/json - Date: - - Mon, 09 Sep 2024 23:49:08 GMT - Via: - - 1.1 30e9e339e417a709dfcc6c99448e6ca2.cloudfront.net (CloudFront) - X-Amz-Cf-Id: - - yVUnfhjm0yyXxwm_o59jWsHPu-CezYassL6pO6rmIxuJFA_iIPLi-Q== - X-Amz-Cf-Pop: - - GRU3-P2 - X-Cache: - - Miss from cloudfront - http_version: HTTP/1.1 - status_code: 200 -- request: - body: '{"sellToken": "0x0625aFB445C3B6B7B929342a04A22599fd5dBB59", "buyToken": - "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14", "receiver": "0x892d6077223df8c2383aFA34CFeD21bA639b2927", - "sellAmount": "10000000000000000", "buyAmount": "10000000000000000", "validTo": - 1725927548, "feeAmount": "0", "kind": "sell", "partiallyFillable": false, "sellTokenBalance": - "erc20", "buyTokenBalance": "erc20", "signingScheme": "eip712", "signature": - "0xd11eaedde7c48fe265ce63ebd47eda4f7cde1671d748cedaf91d769cc81a0c7a06b9042daaf0254c206cde255642655a84b5eecc14252022a8e70b33b68fbcc31c", - "from": null, "quoteId": null, "appData": "0x0000000000000000000000000000000000000000000000000000000000000000", - "appDataHash": null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '695' - content-type: - - application/json - host: - - api.cow.fi - user-agent: - - python-httpx/0.27.0 - method: POST - uri: https://api.cow.fi/sepolia/api/v1/orders - response: - content: '"0x0cef30cd4690c53ba61f9822e28eaeec3dc93429d3794cb8a04883975d553e99892d6077223df8c2383afa34cfed21ba639b292766df907c"' - headers: - Access-Control-Allow-Credentials: - - 'true' - Access-Control-Allow-Headers: - - Origin, Content-Type, X-Auth-Token, X-AppId - Access-Control-Allow-Methods: - - OPTIONS, GET, HEAD, PUT, PATCH, POST, DELETE - Access-Control-Allow-Origin: - - '*' - Access-Control-Max-Age: - - '1728000' - Connection: - - keep-alive - Content-Length: - - '116' - Content-Type: - - application/json - Date: - - Mon, 09 Sep 2024 23:49:10 GMT - Via: - - 1.1 9caac25c8c498f297ecf950fa18827f0.cloudfront.net (CloudFront) - X-Amz-Cf-Id: - - A_RSLoGmJVxVHz0ep5yHhNeP008gc9_8fpKLOWWjxVRDtGPT84sFBw== - X-Amz-Cf-Pop: - - GRU3-P2 - X-Cache: - - Miss from cloudfront - http_version: HTTP/1.1 - status_code: 201 -- request: - body: '{"orderUids": ["0x0cef30cd4690c53ba61f9822e28eaeec3dc93429d3794cb8a04883975d553e99892d6077223df8c2383afa34cfed21ba639b292766df907c"], - "signature": "0x387c4e788319629f670eb0b0d4d035c3252b7e4dbb8ad4aac095a7e0c5463f3a6ce9632986b90a49567c8755e4dade8d21781fe2c8a832ee8825b4373cf5409e1c", - "signingScheme": "eip712"}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '309' - content-type: - - application/json - host: - - api.cow.fi - user-agent: - - python-httpx/0.27.0 - method: DELETE - uri: https://api.cow.fi/sepolia/api/v1/orders - response: - content: '"Cancelled"' - headers: - Access-Control-Allow-Credentials: - - 'true' - Access-Control-Allow-Headers: - - Origin, Content-Type, X-Auth-Token, X-AppId - Access-Control-Allow-Methods: - - OPTIONS, GET, HEAD, PUT, PATCH, POST, DELETE - Access-Control-Allow-Origin: - - '*' - Access-Control-Max-Age: - - '1728000' - Connection: - - keep-alive - Content-Length: - - '11' - Content-Type: - - application/json - Date: - - Mon, 09 Sep 2024 23:49:11 GMT - Via: - - 1.1 e1679114dda40d9fe7c9c23d6686657a.cloudfront.net (CloudFront) - X-Amz-Cf-Id: - - 88ozeqqBiqjeJ6p3slTrIhFU4CsnQG3_1TArGSjdCbyYU15Q6IJ97Q== - X-Amz-Cf-Pop: - - GRU3-P2 - X-Cache: - - Miss from cloudfront - http_version: HTTP/1.1 - status_code: 200 -version: 1 diff --git a/tests/e2e/test_post_and_cancel_order_live_e2e.py b/tests/e2e/test_post_and_cancel_order_live_e2e.py index 2f1e8a7..bc7b627 100644 --- a/tests/e2e/test_post_and_cancel_order_live_e2e.py +++ b/tests/e2e/test_post_and_cancel_order_live_e2e.py @@ -1,4 +1,7 @@ -import logging +# To run this test you will need to fill the .env file with the necessary variables (see .env.example). +# You will also need to have enough funds in you wallet of the sell token to create the order. +# The funds have to already be approved to the CoW Swap Vault Relayer + import os from dataclasses import asdict @@ -27,34 +30,34 @@ TokenAmount, ) -# Setup logging -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) -E2E_SEPOLIA_TESTING_EOA_PRIVATE_KEY = os.getenv( - "E2E_SEPOLIA_TESTING_EOA_PRIVATE_KEY", "" +E2E_GNOSIS_MAINNET_TESTING_EOA_PRIVATE_KEY = os.getenv( + "E2E_GNOSIS_MAINNET_TESTING_EOA_PRIVATE_KEY", "" ) -COW_TOKEN_SEPOLIA_ADDRESS = "0x0625aFB445C3B6B7B929342a04A22599fd5dBB59" -WETH_SEPOLIA_ADDRESS = "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14" +COW_TOKEN_GNOSIS_MAINNET_ADDRESS = "0x177127622c4A00F3d409B75571e12cB3c8973d3c" +WXDAI_GNOSIS_MAINNET_ADDRESS = "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d" -E2E_SEPOLIA_TESTING_EOA = Account.from_key(E2E_SEPOLIA_TESTING_EOA_PRIVATE_KEY) -E2E_SEPOLIA_TESTING_EOA_ADDRESS: Address = E2E_SEPOLIA_TESTING_EOA.address +E2E_GNOSIS_MAINNET_TESTING_EOA = Account.from_key( + E2E_GNOSIS_MAINNET_TESTING_EOA_PRIVATE_KEY +) +E2E_GNOSIS_MAINNET_TESTING_EOA_ADDRESS: Address = E2E_GNOSIS_MAINNET_TESTING_EOA.address -@pytest.mark.vcr @pytest.mark.asyncio async def test_post_and_cancel_order_live_e2e(): order_book_api = OrderBookApi( - config=OrderBookAPIConfigFactory.get_config("prod", SupportedChainId.SEPOLIA) + config=OrderBookAPIConfigFactory.get_config( + "prod", SupportedChainId.GNOSIS_CHAIN + ) ) mock_order_quote_request = OrderQuoteRequest( **{ - "sellToken": COW_TOKEN_SEPOLIA_ADDRESS, - "buyToken": WETH_SEPOLIA_ADDRESS, - "receiver": E2E_SEPOLIA_TESTING_EOA_ADDRESS, - "from": E2E_SEPOLIA_TESTING_EOA_ADDRESS, + "sellToken": WXDAI_GNOSIS_MAINNET_ADDRESS, + "buyToken": COW_TOKEN_GNOSIS_MAINNET_ADDRESS, + "receiver": E2E_GNOSIS_MAINNET_TESTING_EOA_ADDRESS, + "from": E2E_GNOSIS_MAINNET_TESTING_EOA_ADDRESS, "onchainOrder": False, } ) @@ -70,11 +73,11 @@ async def test_post_and_cancel_order_live_e2e(): order = Order( **{ - "sell_token": COW_TOKEN_SEPOLIA_ADDRESS, - "buy_token": WETH_SEPOLIA_ADDRESS, - "receiver": E2E_SEPOLIA_TESTING_EOA_ADDRESS, - "sell_amount": (10**16).__str__(), - "buy_amount": (10**16).__str__(), + "sell_token": WXDAI_GNOSIS_MAINNET_ADDRESS, + "buy_token": COW_TOKEN_GNOSIS_MAINNET_ADDRESS, + "receiver": E2E_GNOSIS_MAINNET_TESTING_EOA_ADDRESS, + "sell_amount": (10**15).__str__(), + "buy_amount": (10**18).__str__(), "valid_to": quote.quote.validTo, "fee_amount": "0", "kind": "sell", @@ -86,12 +89,12 @@ async def test_post_and_cancel_order_live_e2e(): ) order_domain = domain( - chain=Chain.SEPOLIA, + chain=Chain.GNOSIS, verifying_contract=CowContractAddress.SETTLEMENT_CONTRACT.value, ) signature = sign_order( - order_domain, order, E2E_SEPOLIA_TESTING_EOA, SigningScheme.EIP712 + order_domain, order, E2E_GNOSIS_MAINNET_TESTING_EOA, SigningScheme.EIP712 ) order_uid = await order_book_api.post_order( @@ -105,7 +108,10 @@ async def test_post_and_cancel_order_live_e2e(): ) order_cancellation_signature = sign_order_cancellation( - order_domain, order_uid.root, E2E_SEPOLIA_TESTING_EOA, SigningScheme.EIP712 + order_domain, + order_uid.root, + E2E_GNOSIS_MAINNET_TESTING_EOA, + SigningScheme.EIP712, ) cancellation_result = await order_book_api.delete_order(