diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68dc0f4..fcb7793 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-rc.1"] steps: - uses: actions/checkout@v4 @@ -33,6 +33,8 @@ jobs: run: poetry run pytest -s --cov=web3_input_decoder tests --cov-report xml - name: Upload to codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} - run: poetry build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 798620f..389d33f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.0 + rev: v0.6.3 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.1 + rev: v1.11.2 hooks: - id: mypy entry: mypy web3_input_decoder/ diff --git a/poetry.lock b/poetry.lock index 67c415d..93c9eb6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -456,38 +456,38 @@ traitlets = "*" [[package]] name = "mypy" -version = "1.11.1" +version = "1.11.2" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.11.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a32fc80b63de4b5b3e65f4be82b4cfa362a46702672aa6a0f443b4689af7008c"}, - {file = "mypy-1.11.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c1952f5ea8a5a959b05ed5f16452fddadbaae48b5d39235ab4c3fc444d5fd411"}, - {file = "mypy-1.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e1e30dc3bfa4e157e53c1d17a0dad20f89dc433393e7702b813c10e200843b03"}, - {file = "mypy-1.11.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2c63350af88f43a66d3dfeeeb8d77af34a4f07d760b9eb3a8697f0386c7590b4"}, - {file = "mypy-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:a831671bad47186603872a3abc19634f3011d7f83b083762c942442d51c58d58"}, - {file = "mypy-1.11.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7b6343d338390bb946d449677726edf60102a1c96079b4f002dedff375953fc5"}, - {file = "mypy-1.11.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e4fe9f4e5e521b458d8feb52547f4bade7ef8c93238dfb5bbc790d9ff2d770ca"}, - {file = "mypy-1.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:886c9dbecc87b9516eff294541bf7f3655722bf22bb898ee06985cd7269898de"}, - {file = "mypy-1.11.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:fca4a60e1dd9fd0193ae0067eaeeb962f2d79e0d9f0f66223a0682f26ffcc809"}, - {file = "mypy-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:0bd53faf56de9643336aeea1c925012837432b5faf1701ccca7fde70166ccf72"}, - {file = "mypy-1.11.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f39918a50f74dc5969807dcfaecafa804fa7f90c9d60506835036cc1bc891dc8"}, - {file = "mypy-1.11.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0bc71d1fb27a428139dd78621953effe0d208aed9857cb08d002280b0422003a"}, - {file = "mypy-1.11.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b868d3bcff720dd7217c383474008ddabaf048fad8d78ed948bb4b624870a417"}, - {file = "mypy-1.11.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a707ec1527ffcdd1c784d0924bf5cb15cd7f22683b919668a04d2b9c34549d2e"}, - {file = "mypy-1.11.1-cp312-cp312-win_amd64.whl", hash = "sha256:64f4a90e3ea07f590c5bcf9029035cf0efeae5ba8be511a8caada1a4893f5525"}, - {file = "mypy-1.11.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:749fd3213916f1751fff995fccf20c6195cae941dc968f3aaadf9bb4e430e5a2"}, - {file = "mypy-1.11.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b639dce63a0b19085213ec5fdd8cffd1d81988f47a2dec7100e93564f3e8fb3b"}, - {file = "mypy-1.11.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c956b49c5d865394d62941b109728c5c596a415e9c5b2be663dd26a1ff07bc0"}, - {file = "mypy-1.11.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:45df906e8b6804ef4b666af29a87ad9f5921aad091c79cc38e12198e220beabd"}, - {file = "mypy-1.11.1-cp38-cp38-win_amd64.whl", hash = "sha256:d44be7551689d9d47b7abc27c71257adfdb53f03880841a5db15ddb22dc63edb"}, - {file = "mypy-1.11.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2684d3f693073ab89d76da8e3921883019ea8a3ec20fa5d8ecca6a2db4c54bbe"}, - {file = "mypy-1.11.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:79c07eb282cb457473add5052b63925e5cc97dfab9812ee65a7c7ab5e3cb551c"}, - {file = "mypy-1.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11965c2f571ded6239977b14deebd3f4c3abd9a92398712d6da3a772974fad69"}, - {file = "mypy-1.11.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a2b43895a0f8154df6519706d9bca8280cda52d3d9d1514b2d9c3e26792a0b74"}, - {file = "mypy-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:1a81cf05975fd61aec5ae16501a091cfb9f605dc3e3c878c0da32f250b74760b"}, - {file = "mypy-1.11.1-py3-none-any.whl", hash = "sha256:0624bdb940255d2dd24e829d99a13cfeb72e4e9031f9492148f410ed30bcab54"}, - {file = "mypy-1.11.1.tar.gz", hash = "sha256:f404a0b069709f18bbdb702eb3dcfe51910602995de00bd39cea3050b5772d08"}, + {file = "mypy-1.11.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d42a6dd818ffce7be66cce644f1dff482f1d97c53ca70908dff0b9ddc120b77a"}, + {file = "mypy-1.11.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:801780c56d1cdb896eacd5619a83e427ce436d86a3bdf9112527f24a66618fef"}, + {file = "mypy-1.11.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:41ea707d036a5307ac674ea172875f40c9d55c5394f888b168033177fce47383"}, + {file = "mypy-1.11.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6e658bd2d20565ea86da7d91331b0eed6d2eee22dc031579e6297f3e12c758c8"}, + {file = "mypy-1.11.2-cp310-cp310-win_amd64.whl", hash = "sha256:478db5f5036817fe45adb7332d927daa62417159d49783041338921dcf646fc7"}, + {file = "mypy-1.11.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:75746e06d5fa1e91bfd5432448d00d34593b52e7e91a187d981d08d1f33d4385"}, + {file = "mypy-1.11.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a976775ab2256aadc6add633d44f100a2517d2388906ec4f13231fafbb0eccca"}, + {file = "mypy-1.11.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cd953f221ac1379050a8a646585a29574488974f79d8082cedef62744f0a0104"}, + {file = "mypy-1.11.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:57555a7715c0a34421013144a33d280e73c08df70f3a18a552938587ce9274f4"}, + {file = "mypy-1.11.2-cp311-cp311-win_amd64.whl", hash = "sha256:36383a4fcbad95f2657642a07ba22ff797de26277158f1cc7bd234821468b1b6"}, + {file = "mypy-1.11.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e8960dbbbf36906c5c0b7f4fbf2f0c7ffb20f4898e6a879fcf56a41a08b0d318"}, + {file = "mypy-1.11.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:06d26c277962f3fb50e13044674aa10553981ae514288cb7d0a738f495550b36"}, + {file = "mypy-1.11.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6e7184632d89d677973a14d00ae4d03214c8bc301ceefcdaf5c474866814c987"}, + {file = "mypy-1.11.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:3a66169b92452f72117e2da3a576087025449018afc2d8e9bfe5ffab865709ca"}, + {file = "mypy-1.11.2-cp312-cp312-win_amd64.whl", hash = "sha256:969ea3ef09617aff826885a22ece0ddef69d95852cdad2f60c8bb06bf1f71f70"}, + {file = "mypy-1.11.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:37c7fa6121c1cdfcaac97ce3d3b5588e847aa79b580c1e922bb5d5d2902df19b"}, + {file = "mypy-1.11.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4a8a53bc3ffbd161b5b2a4fff2f0f1e23a33b0168f1c0778ec70e1a3d66deb86"}, + {file = "mypy-1.11.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2ff93107f01968ed834f4256bc1fc4475e2fecf6c661260066a985b52741ddce"}, + {file = "mypy-1.11.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:edb91dded4df17eae4537668b23f0ff6baf3707683734b6a818d5b9d0c0c31a1"}, + {file = "mypy-1.11.2-cp38-cp38-win_amd64.whl", hash = "sha256:ee23de8530d99b6db0573c4ef4bd8f39a2a6f9b60655bf7a1357e585a3486f2b"}, + {file = "mypy-1.11.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:801ca29f43d5acce85f8e999b1e431fb479cb02d0e11deb7d2abb56bdaf24fd6"}, + {file = "mypy-1.11.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:af8d155170fcf87a2afb55b35dc1a0ac21df4431e7d96717621962e4b9192e70"}, + {file = "mypy-1.11.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f7821776e5c4286b6a13138cc935e2e9b6fde05e081bdebf5cdb2bb97c9df81d"}, + {file = "mypy-1.11.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:539c570477a96a4e6fb718b8d5c3e0c0eba1f485df13f86d2970c91f0673148d"}, + {file = "mypy-1.11.2-cp39-cp39-win_amd64.whl", hash = "sha256:3f14cd3d386ac4d05c5a39a51b84387403dadbd936e17cb35882134d4f8f0d24"}, + {file = "mypy-1.11.2-py3-none-any.whl", hash = "sha256:b499bc07dbdcd3de92b0a8b29fdf592c111276f6a12fe29c30f6c417dd546d12"}, + {file = "mypy-1.11.2.tar.gz", hash = "sha256:7f9993ad3e0ffdc95c2a14b66dee63729f021968bff8ad911867579c65d13a79"}, ] [package.dependencies] @@ -882,29 +882,29 @@ files = [ [[package]] name = "ruff" -version = "0.6.0" +version = "0.6.3" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.6.0-py3-none-linux_armv6l.whl", hash = "sha256:92dcce923e5df265781e5fc76f9a1edad52201a7aafe56e586b90988d5239013"}, - {file = "ruff-0.6.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:31b90ff9dc79ed476c04e957ba7e2b95c3fceb76148f2079d0d68a908d2cfae7"}, - {file = "ruff-0.6.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6d834a9ec9f8287dd6c3297058b3a265ed6b59233db22593379ee38ebc4b9768"}, - {file = "ruff-0.6.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f2089267692696aba342179471831a085043f218706e642564812145df8b8d0d"}, - {file = "ruff-0.6.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:aa62b423ee4bbd8765f2c1dbe8f6aac203e0583993a91453dc0a449d465c84da"}, - {file = "ruff-0.6.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7344e1a964b16b1137ea361d6516ce4ee61a0403fa94252a1913ecc1311adcae"}, - {file = "ruff-0.6.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:487f3a35c3f33bf82be212ce15dc6278ea854e35573a3f809442f73bec8b2760"}, - {file = "ruff-0.6.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:75db409984077a793cf344d499165298a6f65449e905747ac65983b12e3e64b1"}, - {file = "ruff-0.6.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:84908bd603533ecf1db456d8fc2665d1f4335d722e84bc871d3bbd2d1116c272"}, - {file = "ruff-0.6.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f1749a0aef3ec41ed91a0e2127a6ae97d2e2853af16dbd4f3c00d7a3af726c5"}, - {file = "ruff-0.6.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:016fea751e2bcfbbd2f8cb19b97b37b3fd33148e4df45b526e87096f4e17354f"}, - {file = "ruff-0.6.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:6ae80f141b53b2e36e230017e64f5ea2def18fac14334ffceaae1b780d70c4f7"}, - {file = "ruff-0.6.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:eaaaf33ea4b3f63fd264d6a6f4a73fa224bbfda4b438ffea59a5340f4afa2bb5"}, - {file = "ruff-0.6.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:7667ddd1fc688150a7ca4137140867584c63309695a30016880caf20831503a0"}, - {file = "ruff-0.6.0-py3-none-win32.whl", hash = "sha256:ae48365aae60d40865a412356f8c6f2c0be1c928591168111eaf07eaefa6bea3"}, - {file = "ruff-0.6.0-py3-none-win_amd64.whl", hash = "sha256:774032b507c96f0c803c8237ce7d2ef3934df208a09c40fa809c2931f957fe5e"}, - {file = "ruff-0.6.0-py3-none-win_arm64.whl", hash = "sha256:a5366e8c3ae6b2dc32821749b532606c42e609a99b0ae1472cf601da931a048c"}, - {file = "ruff-0.6.0.tar.gz", hash = "sha256:272a81830f68f9bd19d49eaf7fa01a5545c5a2e86f32a9935bb0e4bb9a1db5b8"}, + {file = "ruff-0.6.3-py3-none-linux_armv6l.whl", hash = "sha256:97f58fda4e309382ad30ede7f30e2791d70dd29ea17f41970119f55bdb7a45c3"}, + {file = "ruff-0.6.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:3b061e49b5cf3a297b4d1c27ac5587954ccb4ff601160d3d6b2f70b1622194dc"}, + {file = "ruff-0.6.3-py3-none-macosx_11_0_arm64.whl", hash = "sha256:34e2824a13bb8c668c71c1760a6ac7d795ccbd8d38ff4a0d8471fdb15de910b1"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bddfbb8d63c460f4b4128b6a506e7052bad4d6f3ff607ebbb41b0aa19c2770d1"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ced3eeb44df75353e08ab3b6a9e113b5f3f996bea48d4f7c027bc528ba87b672"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:47021dff5445d549be954eb275156dfd7c37222acc1e8014311badcb9b4ec8c1"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:7d7bd20dc07cebd68cc8bc7b3f5ada6d637f42d947c85264f94b0d1cd9d87384"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:500f166d03fc6d0e61c8e40a3ff853fa8a43d938f5d14c183c612df1b0d6c58a"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:42844ff678f9b976366b262fa2d1d1a3fe76f6e145bd92c84e27d172e3c34500"}, + {file = "ruff-0.6.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70452a10eb2d66549de8e75f89ae82462159855e983ddff91bc0bce6511d0470"}, + {file = "ruff-0.6.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:65a533235ed55f767d1fc62193a21cbf9e3329cf26d427b800fdeacfb77d296f"}, + {file = "ruff-0.6.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d2e2c23cef30dc3cbe9cc5d04f2899e7f5e478c40d2e0a633513ad081f7361b5"}, + {file = "ruff-0.6.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8a136aa7d228975a6aee3dd8bea9b28e2b43e9444aa678fb62aeb1956ff2351"}, + {file = "ruff-0.6.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:f92fe93bc72e262b7b3f2bba9879897e2d58a989b4714ba6a5a7273e842ad2f8"}, + {file = "ruff-0.6.3-py3-none-win32.whl", hash = "sha256:7a62d3b5b0d7f9143d94893f8ba43aa5a5c51a0ffc4a401aa97a81ed76930521"}, + {file = "ruff-0.6.3-py3-none-win_amd64.whl", hash = "sha256:746af39356fee2b89aada06c7376e1aa274a23493d7016059c3a72e3b296befb"}, + {file = "ruff-0.6.3-py3-none-win_arm64.whl", hash = "sha256:14a9528a8b70ccc7a847637c29e56fd1f9183a9db743bbc5b8e0c4ad60592a82"}, + {file = "ruff-0.6.3.tar.gz", hash = "sha256:183b99e9edd1ef63be34a3b51fee0a9f4ab95add123dbf89a71f7b1f0c991983"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index b055617..f5fea52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "web3-input-decoder" -version = "0.1.12" +version = "0.1.13" # doc authors = ["Weiliang Li "] description = "A simple offline web3 transaction input decoder for functions and constructors" diff --git a/tests/data/storage.py b/tests/data/storage.py index ebdc63e..4ff4192 100644 --- a/tests/data/storage.py +++ b/tests/data/storage.py @@ -6,6 +6,8 @@ contract Storage { uint256[] numbers; + struct S {uint a; uint b;} + struct T {uint a; S s;} constructor (uint256[] memory _nums) { numbers = _nums; @@ -14,6 +16,10 @@ function retrieve() public view returns (uint256[] memory){ return numbers; } + + function parseT(T memory t) public pure returns (uint, uint, uint) { + return (t.a, t.s.a, t.s.b); + } } """ @@ -30,7 +36,38 @@ "stateMutability": "view", "type": "function", }, + { + "inputs": [ + { + "components": [ + {"internalType": "uint256", "name": "a", "type": "uint256"}, + { + "components": [ + {"internalType": "uint256", "name": "a", "type": "uint256"}, + {"internalType": "uint256", "name": "b", "type": "uint256"}, + ], + "internalType": "struct Storage.S", + "name": "s", + "type": "tuple", + }, + ], + "internalType": "struct Storage.T", + "name": "t", + "type": "tuple", + } + ], + "name": "parseT", + "outputs": [ + {"internalType": "uint256", "name": "", "type": "uint256"}, + {"internalType": "uint256", "name": "", "type": "uint256"}, + {"internalType": "uint256", "name": "", "type": "uint256"}, + ], + "stateMutability": "pure", + "type": "function", + }, ] -STORAGE_BYTECODE = "0x608060405234801561001057600080fd5b506040516104813803806104818339818101604052810190610032919061016c565b806000908051906020019061004892919061004f565b50506102ac565b82805482825590600052602060002090810192821561008b579160200282015b8281111561008a57825182559160200191906001019061006f565b5b509050610098919061009c565b5090565b5b808211156100b557600081600090555060010161009d565b5090565b60006100cc6100c7846101da565b6101b5565b905080838252602082019050828560208602820111156100ef576100ee610275565b5b60005b8581101561011f57816101058882610157565b8452602084019350602083019250506001810190506100f2565b5050509392505050565b600082601f83011261013e5761013d610270565b5b815161014e8482602086016100b9565b91505092915050565b60008151905061016681610295565b92915050565b6000602082840312156101825761018161027f565b5b600082015167ffffffffffffffff8111156101a05761019f61027a565b5b6101ac84828501610129565b91505092915050565b60006101bf6101d0565b90506101cb8282610210565b919050565b6000604051905090565b600067ffffffffffffffff8211156101f5576101f4610241565b5b602082029050602081019050919050565b6000819050919050565b61021982610284565b810181811067ffffffffffffffff8211171561023857610237610241565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61029e81610206565b81146102a957600080fd5b50565b6101c6806102bb6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80632e64cec114610030575b600080fd5b61003861004e565b604051610045919061012b565b60405180910390f35b6060600080548060200260200160405190810160405280929190818152602001828054801561009c57602002820191906000526020600020905b815481526020019060010190808311610088575b5050505050905090565b60006100b2838361011c565b60208301905092915050565b60006100c98261015d565b6100d38185610175565b93506100de8361014d565b8060005b8381101561010f5781516100f688826100a6565b975061010183610168565b9250506001810190506100e2565b5085935050505092915050565b61012581610186565b82525050565b6000602082019050818103600083015261014581846100be565b905092915050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905091905056fea26469706673582212209414c410f7b7ebbe78b90880f5478a19e5ff8b6ff64816f86b5bdaa2a8854ee564736f6c63430008070033" -STORAGE_CONSTRUCTOR_CALL_INPUT = "0x608060405234801561001057600080fd5b506040516104813803806104818339818101604052810190610032919061016c565b806000908051906020019061004892919061004f565b50506102ac565b82805482825590600052602060002090810192821561008b579160200282015b8281111561008a57825182559160200191906001019061006f565b5b509050610098919061009c565b5090565b5b808211156100b557600081600090555060010161009d565b5090565b60006100cc6100c7846101da565b6101b5565b905080838252602082019050828560208602820111156100ef576100ee610275565b5b60005b8581101561011f57816101058882610157565b8452602084019350602083019250506001810190506100f2565b5050509392505050565b600082601f83011261013e5761013d610270565b5b815161014e8482602086016100b9565b91505092915050565b60008151905061016681610295565b92915050565b6000602082840312156101825761018161027f565b5b600082015167ffffffffffffffff8111156101a05761019f61027a565b5b6101ac84828501610129565b91505092915050565b60006101bf6101d0565b90506101cb8282610210565b919050565b6000604051905090565b600067ffffffffffffffff8211156101f5576101f4610241565b5b602082029050602081019050919050565b6000819050919050565b61021982610284565b810181811067ffffffffffffffff8211171561023857610237610241565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61029e81610206565b81146102a957600080fd5b50565b6101c6806102bb6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80632e64cec114610030575b600080fd5b61003861004e565b604051610045919061012b565b60405180910390f35b6060600080548060200260200160405190810160405280929190818152602001828054801561009c57602002820191906000526020600020905b815481526020019060010190808311610088575b5050505050905090565b60006100b2838361011c565b60208301905092915050565b60006100c98261015d565b6100d38185610175565b93506100de8361014d565b8060005b8381101561010f5781516100f688826100a6565b975061010183610168565b9250506001810190506100e2565b5085935050505092915050565b61012581610186565b82525050565b6000602082019050818103600083015261014581846100be565b905092915050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905091905056fea26469706673582212209414c410f7b7ebbe78b90880f5478a19e5ff8b6ff64816f86b5bdaa2a8854ee564736f6c6343000807003300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003" +STORAGE_BYTECODE = "0x608060405234801561000f575f80fd5b5060405161067f38038061067f83398181016040528101906100319190610247565b805f908051906020019061004692919061004d565b505061028e565b828054828255905f5260205f20908101928215610087579160200282015b8281111561008657825182559160200191906001019061006b565b5b5090506100949190610098565b5090565b5b808211156100af575f815f905550600101610099565b5090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61010e826100c8565b810181811067ffffffffffffffff8211171561012d5761012c6100d8565b5b80604052505050565b5f61013f6100b3565b905061014b8282610105565b919050565b5f67ffffffffffffffff82111561016a576101696100d8565b5b602082029050602081019050919050565b5f80fd5b5f819050919050565b6101918161017f565b811461019b575f80fd5b50565b5f815190506101ac81610188565b92915050565b5f6101c46101bf84610150565b610136565b905080838252602082019050602084028301858111156101e7576101e661017b565b5b835b8181101561021057806101fc888261019e565b8452602084019350506020810190506101e9565b5050509392505050565b5f82601f83011261022e5761022d6100c4565b5b815161023e8482602086016101b2565b91505092915050565b5f6020828403121561025c5761025b6100bc565b5b5f82015167ffffffffffffffff811115610279576102786100c0565b5b6102858482850161021a565b91505092915050565b6103e48061029b5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c80630aca78a8146100385780632e64cec11461006a575b5f80fd5b610052600480360381019061004d9190610268565b610088565b604051610061939291906102a2565b60405180910390f35b6100726100ad565b60405161007f919061038e565b60405180910390f35b5f805f835f015184602001515f01518560200151602001519250925092509193909250565b60605f8054806020026020016040519081016040528092919081815260200182805480156100f857602002820191905f5260205f20905b8154815260200190600101908083116100e4575b5050505050905090565b5f604051905090565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61015982610113565b810181811067ffffffffffffffff8211171561017857610177610123565b5b80604052505050565b5f61018a610102565b90506101968282610150565b919050565b5f819050919050565b6101ad8161019b565b81146101b7575f80fd5b50565b5f813590506101c8816101a4565b92915050565b5f604082840312156101e3576101e261010f565b5b6101ed6040610181565b90505f6101fc848285016101ba565b5f83015250602061020f848285016101ba565b60208301525092915050565b5f606082840312156102305761022f61010f565b5b61023a6040610181565b90505f610249848285016101ba565b5f83015250602061025c848285016101ce565b60208301525092915050565b5f6060828403121561027d5761027c61010b565b5b5f61028a8482850161021b565b91505092915050565b61029c8161019b565b82525050565b5f6060820190506102b55f830186610293565b6102c26020830185610293565b6102cf6040830184610293565b949350505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6103098161019b565b82525050565b5f61031a8383610300565b60208301905092915050565b5f602082019050919050565b5f61033c826102d7565b61034681856102e1565b9350610351836102f1565b805f5b83811015610381578151610368888261030f565b975061037383610326565b925050600181019050610354565b5085935050505092915050565b5f6020820190508181035f8301526103a68184610332565b90509291505056fea2646970667358221220d40a0e14d7f370dda379502e5cde13639a3ed587e0ab469b95bff1612929212764736f6c634300081a0033" +STORAGE_CONSTRUCTOR_CALL_INPUT = "0x608060405234801561000f575f80fd5b5060405161067f38038061067f83398181016040528101906100319190610247565b805f908051906020019061004692919061004d565b505061028e565b828054828255905f5260205f20908101928215610087579160200282015b8281111561008657825182559160200191906001019061006b565b5b5090506100949190610098565b5090565b5b808211156100af575f815f905550600101610099565b5090565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61010e826100c8565b810181811067ffffffffffffffff8211171561012d5761012c6100d8565b5b80604052505050565b5f61013f6100b3565b905061014b8282610105565b919050565b5f67ffffffffffffffff82111561016a576101696100d8565b5b602082029050602081019050919050565b5f80fd5b5f819050919050565b6101918161017f565b811461019b575f80fd5b50565b5f815190506101ac81610188565b92915050565b5f6101c46101bf84610150565b610136565b905080838252602082019050602084028301858111156101e7576101e661017b565b5b835b8181101561021057806101fc888261019e565b8452602084019350506020810190506101e9565b5050509392505050565b5f82601f83011261022e5761022d6100c4565b5b815161023e8482602086016101b2565b91505092915050565b5f6020828403121561025c5761025b6100bc565b5b5f82015167ffffffffffffffff811115610279576102786100c0565b5b6102858482850161021a565b91505092915050565b6103e48061029b5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c80630aca78a8146100385780632e64cec11461006a575b5f80fd5b610052600480360381019061004d9190610268565b610088565b604051610061939291906102a2565b60405180910390f35b6100726100ad565b60405161007f919061038e565b60405180910390f35b5f805f835f015184602001515f01518560200151602001519250925092509193909250565b60605f8054806020026020016040519081016040528092919081815260200182805480156100f857602002820191905f5260205f20905b8154815260200190600101908083116100e4575b5050505050905090565b5f604051905090565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61015982610113565b810181811067ffffffffffffffff8211171561017857610177610123565b5b80604052505050565b5f61018a610102565b90506101968282610150565b919050565b5f819050919050565b6101ad8161019b565b81146101b7575f80fd5b50565b5f813590506101c8816101a4565b92915050565b5f604082840312156101e3576101e261010f565b5b6101ed6040610181565b90505f6101fc848285016101ba565b5f83015250602061020f848285016101ba565b60208301525092915050565b5f606082840312156102305761022f61010f565b5b61023a6040610181565b90505f610249848285016101ba565b5f83015250602061025c848285016101ce565b60208301525092915050565b5f6060828403121561027d5761027c61010b565b5b5f61028a8482850161021b565b91505092915050565b61029c8161019b565b82525050565b5f6060820190506102b55f830186610293565b6102c26020830185610293565b6102cf6040830184610293565b949350505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6103098161019b565b82525050565b5f61031a8383610300565b60208301905092915050565b5f602082019050919050565b5f61033c826102d7565b61034681856102e1565b9350610351836102f1565b805f5b83811015610381578151610368888261030f565b975061037383610326565b925050600181019050610354565b5085935050505092915050565b5f6020820190508181035f8301526103a68184610332565b90509291505056fea2646970667358221220d40a0e14d7f370dda379502e5cde13639a3ed587e0ab469b95bff1612929212764736f6c634300081a003300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003" STORAGE_CONSTRUCTOR_CALL_ARGUMENT = [("uint256[]", "_nums", (1, 2, 3))] +STORAGE_FUNCTION_CALL_INPUT = "0x0aca78a8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003" +STORAGE_FUNCTION_CALL_ARGUMENT = [("(uint256,(uint256,uint256))", "t", (1, (2, 3)))] diff --git a/tests/test_decode_function.py b/tests/test_decode_function.py index f01376f..29c06d7 100644 --- a/tests/test_decode_function.py +++ b/tests/test_decode_function.py @@ -14,6 +14,11 @@ SEAPORT_FULFILL_ORDER_CALL_ARGUMENT, SEAPORT_FULFILL_ORDER_CALL_INPUT, ) +from .data.storage import ( + STORAGE_ABI, + STORAGE_FUNCTION_CALL_ARGUMENT, + STORAGE_FUNCTION_CALL_INPUT, +) from .data.tether import ( TETHER_ABI, TETHER_TRANSFER_CALL_ARGUMENT, @@ -24,6 +29,7 @@ @pytest.mark.parametrize( "abi,input,expected", [ + (STORAGE_ABI, STORAGE_FUNCTION_CALL_INPUT, STORAGE_FUNCTION_CALL_ARGUMENT), (TETHER_ABI, TETHER_TRANSFER_CALL_INPUT, TETHER_TRANSFER_CALL_ARGUMENT), (ROUTER_ABI, ROUTER_SWAP_CALL_INPUT, ROUTER_SWAP_CALL_ARGUMENT), (ROUTER_ABI, ROUTER_TOKENS_SWAP_CALL_INPUT, ROUTER_TOKENS_SWAP_CALL_ARGUMENT), @@ -33,7 +39,13 @@ SEAPORT_FULFILL_ORDER_CALL_ARGUMENT, ), ], - ids=["tether", "router-swap", "router-tokens-swap", "seaport-fulfill-order"], + ids=[ + "storage", + "tether", + "router-swap", + "router-tokens-swap", + "seaport-fulfill-order", + ], ) def test_decode_function(abi, input, expected): assert decode_function(abi, input) == expected