diff --git a/Cargo.lock b/Cargo.lock
index d7e52881..e9472a95 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -711,7 +711,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -750,6 +750,18 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "auto_impl"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89"
+dependencies = [
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
[[package]]
name = "autocfg"
version = "1.1.0"
@@ -876,13 +888,13 @@ dependencies = [
"lazy_static",
"lazycell",
"peeking_take_while",
- "prettyplease 0.2.6",
+ "prettyplease 0.2.16",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -1108,6 +1120,17 @@ dependencies = [
"tinyvec",
]
+[[package]]
+name = "bstr"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
+dependencies = [
+ "lazy_static",
+ "memchr",
+ "regex-automata",
+]
+
[[package]]
name = "bstr"
version = "1.5.0"
@@ -1216,6 +1239,12 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "case"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c"
+
[[package]]
name = "cc"
version = "1.0.79"
@@ -1418,7 +1447,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -2110,7 +2139,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -2406,7 +2435,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -2446,7 +2475,7 @@ dependencies = [
"proc-macro2",
"quote",
"scratch",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -2463,7 +2492,7 @@ checksum = "50c49547d73ba8dcfd4ad7325d64c6d5391ff4224d498fc39a6f3f49825a530d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -2734,7 +2763,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -2781,7 +2810,7 @@ dependencies = [
"proc-macro2",
"quote",
"regex",
- "syn 2.0.39",
+ "syn 2.0.48",
"termcolor",
"toml 0.7.6",
"walkdir",
@@ -2993,7 +3022,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -3004,7 +3033,7 @@ checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -3053,12 +3082,119 @@ dependencies = [
"libc",
]
+[[package]]
+name = "ethbloom"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60"
+dependencies = [
+ "crunchy",
+ "fixed-hash",
+ "impl-codec",
+ "impl-rlp",
+ "impl-serde",
+ "scale-info",
+ "tiny-keccak",
+]
+
+[[package]]
+name = "ethereum"
+version = "0.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e04d24d20b8ff2235cffbf242d5092de3aa45f77c5270ddbfadd2778ca13fea"
+dependencies = [
+ "bytes",
+ "ethereum-types",
+ "hash-db",
+ "hash256-std-hasher",
+ "parity-scale-codec",
+ "rlp",
+ "scale-info",
+ "serde",
+ "sha3",
+ "trie-root",
+]
+
+[[package]]
+name = "ethereum-types"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee"
+dependencies = [
+ "ethbloom",
+ "fixed-hash",
+ "impl-codec",
+ "impl-rlp",
+ "impl-serde",
+ "primitive-types",
+ "scale-info",
+ "uint",
+]
+
[[package]]
name = "event-listener"
version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
+[[package]]
+name = "evm"
+version = "0.41.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "767f43e9630cc36cf8ff2777cbb0121b055f0d1fd6eaaa13b46a1808f0d0e7e9"
+dependencies = [
+ "auto_impl",
+ "environmental",
+ "ethereum",
+ "evm-core",
+ "evm-gasometer",
+ "evm-runtime",
+ "log",
+ "parity-scale-codec",
+ "primitive-types",
+ "rlp",
+ "scale-info",
+ "serde",
+ "sha3",
+]
+
+[[package]]
+name = "evm-core"
+version = "0.41.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1da6cedc5cedb4208e59467106db0d1f50db01b920920589f8e672c02fdc04f"
+dependencies = [
+ "parity-scale-codec",
+ "primitive-types",
+ "scale-info",
+ "serde",
+]
+
+[[package]]
+name = "evm-gasometer"
+version = "0.41.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1dc0eb591abc5cd7b05bef6a036c2bb6c66ab6c5e0c5ce94bfe377ab670b1fd7"
+dependencies = [
+ "environmental",
+ "evm-core",
+ "evm-runtime",
+ "primitive-types",
+]
+
+[[package]]
+name = "evm-runtime"
+version = "0.41.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84bbe09b64ae13a29514048c1bb6fda6374ac0b4f6a1f15a443348ab88ef42cd"
+dependencies = [
+ "auto_impl",
+ "environmental",
+ "evm-core",
+ "primitive-types",
+ "sha3",
+]
+
[[package]]
name = "exit-future"
version = "0.2.0"
@@ -3090,7 +3226,7 @@ dependencies = [
"fs-err",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -3105,6 +3241,12 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
+[[package]]
+name = "faster-hex"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51e2ce894d53b295cf97b05685aa077950ff3e8541af83217fc720a6437169f8"
+
[[package]]
name = "fastrand"
version = "1.9.0"
@@ -3299,6 +3441,41 @@ dependencies = [
"percent-encoding",
]
+[[package]]
+name = "fp-account"
+version = "1.0.0-dev"
+source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.3.0#e262e80f3083ea8df90bd71a827789bef810f6aa"
+dependencies = [
+ "hex",
+ "impl-serde",
+ "libsecp256k1",
+ "log",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-runtime-interface",
+ "sp-std",
+]
+
+[[package]]
+name = "fp-evm"
+version = "3.0.0-dev"
+source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.3.0#e262e80f3083ea8df90bd71a827789bef810f6aa"
+dependencies = [
+ "evm",
+ "frame-support",
+ "num_enum",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "fragile"
version = "2.0.0"
@@ -3386,7 +3563,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -3513,7 +3690,7 @@ dependencies = [
"proc-macro2",
"quote",
"sp-core-hashing",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -3525,7 +3702,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -3535,7 +3712,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -3745,7 +3922,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -3912,7 +4089,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
dependencies = [
"aho-corasick 0.7.20",
- "bstr",
+ "bstr 1.5.0",
"fnv",
"log",
"regex",
@@ -4324,6 +4501,15 @@ dependencies = [
"parity-scale-codec",
]
+[[package]]
+name = "impl-rlp"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808"
+dependencies = [
+ "rlp",
+]
+
[[package]]
name = "impl-serde"
version = "0.4.0"
@@ -5443,7 +5629,7 @@ dependencies = [
"macro_magic_core",
"macro_magic_macros",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -5457,7 +5643,7 @@ dependencies = [
"macro_magic_core_macros",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -5468,7 +5654,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -5479,7 +5665,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3"
dependencies = [
"macro_magic_core",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -6235,6 +6421,27 @@ dependencies = [
"libc",
]
+[[package]]
+name = "num_enum"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845"
+dependencies = [
+ "num_enum_derive",
+]
+
+[[package]]
+name = "num_enum_derive"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
+dependencies = [
+ "proc-macro-crate",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.48",
+]
+
[[package]]
name = "number_prefix"
version = "0.4.0"
@@ -6781,6 +6988,147 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-evm"
+version = "6.0.0-dev"
+source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.3.0#e262e80f3083ea8df90bd71a827789bef810f6aa"
+dependencies = [
+ "environmental",
+ "evm",
+ "fp-account",
+ "fp-evm",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "hash-db",
+ "hex",
+ "hex-literal 0.4.1",
+ "impl-trait-for-tuples",
+ "log",
+ "parity-scale-codec",
+ "rlp",
+ "scale-info",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
+name = "pallet-evm-precompile-balances-erc20"
+version = "0.1.0"
+dependencies = [
+ "derive_more",
+ "fp-evm",
+ "frame-support",
+ "frame-system",
+ "hex-literal 0.3.4",
+ "libsecp256k1",
+ "log",
+ "num_enum",
+ "pallet-balances",
+ "pallet-evm",
+ "pallet-timestamp",
+ "parity-scale-codec",
+ "paste",
+ "precompile-utils",
+ "scale-info",
+ "serde",
+ "sha3",
+ "slices",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
+name = "pallet-evm-precompile-batch"
+version = "0.1.0"
+dependencies = [
+ "derive_more",
+ "evm",
+ "fp-evm",
+ "frame-support",
+ "frame-system",
+ "hex-literal 0.3.4",
+ "log",
+ "num_enum",
+ "pallet-balances",
+ "pallet-evm",
+ "pallet-timestamp",
+ "parity-scale-codec",
+ "paste",
+ "precompile-utils",
+ "scale-info",
+ "serde",
+ "sha3",
+ "slices",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
+name = "pallet-evm-precompile-call-permit"
+version = "0.1.0"
+dependencies = [
+ "derive_more",
+ "evm",
+ "fp-evm",
+ "frame-support",
+ "frame-system",
+ "hex-literal 0.3.4",
+ "libsecp256k1",
+ "log",
+ "num_enum",
+ "pallet-balances",
+ "pallet-evm",
+ "pallet-timestamp",
+ "parity-scale-codec",
+ "paste",
+ "precompile-utils",
+ "scale-info",
+ "serde",
+ "sha3",
+ "slices",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
+name = "pallet-evm-precompile-xcm-utils"
+version = "0.1.0"
+dependencies = [
+ "cumulus-primitives-core",
+ "derive_more",
+ "fp-evm",
+ "frame-support",
+ "frame-system",
+ "num_enum",
+ "pallet-balances",
+ "pallet-evm",
+ "pallet-timestamp",
+ "pallet-xcm",
+ "parity-scale-codec",
+ "precompile-utils",
+ "scale-info",
+ "serde",
+ "sha3",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "sp-weights",
+ "staging-xcm",
+ "staging-xcm-builder",
+ "staging-xcm-executor",
+ "xcm-primitives",
+]
+
[[package]]
name = "pallet-fast-unstake"
version = "4.0.0-dev"
@@ -7367,7 +7715,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -7759,9 +8107,9 @@ checksum = "7924d1d0ad836f665c9065e26d016c673ece3993f30d340068b16f282afc1156"
[[package]]
name = "paste"
-version = "1.0.12"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
+checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]]
name = "pbkdf2"
@@ -7850,7 +8198,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -7891,7 +8239,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -9061,6 +9409,50 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
+[[package]]
+name = "precompile-utils"
+version = "0.1.0"
+source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.3.0#e262e80f3083ea8df90bd71a827789bef810f6aa"
+dependencies = [
+ "derive_more",
+ "environmental",
+ "evm",
+ "fp-evm",
+ "frame-support",
+ "frame-system",
+ "hex",
+ "hex-literal 0.4.1",
+ "impl-trait-for-tuples",
+ "log",
+ "num_enum",
+ "pallet-evm",
+ "parity-scale-codec",
+ "precompile-utils-macro",
+ "scale-info",
+ "serde",
+ "similar-asserts",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "sp-weights",
+ "staging-xcm",
+]
+
+[[package]]
+name = "precompile-utils-macro"
+version = "0.1.0"
+source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.3.0#e262e80f3083ea8df90bd71a827789bef810f6aa"
+dependencies = [
+ "case",
+ "num_enum",
+ "prettyplease 0.2.16",
+ "proc-macro2",
+ "quote",
+ "sp-core-hashing",
+ "syn 1.0.109",
+]
+
[[package]]
name = "predicates"
version = "2.1.5"
@@ -9115,12 +9507,12 @@ dependencies = [
[[package]]
name = "prettyplease"
-version = "0.2.6"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b69d39aab54d069e7f2fe8cb970493e7834601ca2d8c65fd7bbd183578080d1"
+checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5"
dependencies = [
"proc-macro2",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -9131,6 +9523,7 @@ checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66"
dependencies = [
"fixed-hash",
"impl-codec",
+ "impl-rlp",
"impl-serde",
"scale-info",
"uint",
@@ -9200,14 +9593,14 @@ checksum = "9b698b0b09d40e9b7c1a47b132d66a8b54bcd20583d9b6d06e4535e383b4405c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
name = "proc-macro2"
-version = "1.0.69"
+version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
+checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
@@ -9371,9 +9764,9 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.33"
+version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
@@ -9586,7 +9979,7 @@ checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -9695,6 +10088,28 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "rlp"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec"
+dependencies = [
+ "bytes",
+ "rlp-derive",
+ "rustc-hex",
+]
+
+[[package]]
+name = "rlp-derive"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
[[package]]
name = "rocksdb"
version = "0.21.0"
@@ -10195,7 +10610,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -11188,7 +11603,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -11500,7 +11915,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -11679,6 +12094,26 @@ dependencies = [
"wide",
]
+[[package]]
+name = "similar"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21"
+dependencies = [
+ "bstr 0.2.17",
+ "unicode-segmentation",
+]
+
+[[package]]
+name = "similar-asserts"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e041bb827d1bfca18f213411d51b665309f1afb37a04a5d1464530e13779fc0f"
+dependencies = [
+ "console",
+ "similar",
+]
+
[[package]]
name = "siphasher"
version = "0.3.10"
@@ -11700,6 +12135,18 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7"
+[[package]]
+name = "slices"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2086e458a369cdca838e9f6ed04b4cc2e3ce636d99abb80c9e2eada107749cf"
+dependencies = [
+ "faster-hex",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
[[package]]
name = "slot-range-helper"
version = "1.0.0"
@@ -11926,7 +12373,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -12165,7 +12612,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot
dependencies = [
"quote",
"sp-core-hashing",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -12184,7 +12631,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -12413,7 +12860,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -12606,7 +13053,7 @@ dependencies = [
"parity-scale-codec",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -13006,9 +13453,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.39"
+version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
+checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [
"proc-macro2",
"quote",
@@ -13126,7 +13573,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -13295,7 +13742,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -13462,7 +13909,7 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -13506,7 +13953,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -13760,6 +14207,12 @@ dependencies = [
"tinyvec",
]
+[[package]]
+name = "unicode-segmentation"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
+
[[package]]
name = "unicode-width"
version = "0.1.10"
@@ -13951,7 +14404,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
"wasm-bindgen-shared",
]
@@ -13985,7 +14438,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -15018,7 +15471,7 @@ dependencies = [
"Inflector",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
@@ -15067,7 +15520,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.48",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index b218b4f0..b92faadc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,7 @@
[workspace]
members = [
"client/consensus/nimbus-consensus",
+ "precompiles/*",
"pallets/*",
"primitives/*",
"template/node",
@@ -36,6 +37,11 @@ schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backen
serde = { version = "1.0.101", default-features = false }
smallvec = "1.6.1"
tracing = "0.1.22"
+num_enum = { version = "0.7.2", default-features = false }
+paste = "1.0.14"
+slices = "0.2.0"
+libsecp256k1 = { version = "0.7.1", default-features = false }
+sha3 = { version = "0.10.8", default-features = false }
# Crates.io (template only)
clap = { version = "4.0.9" }
@@ -96,6 +102,7 @@ sp-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "rel
sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-version = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
+sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
sp-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
@@ -176,6 +183,9 @@ polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sd
staging-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
staging-xcm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
staging-xcm-executor = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
+xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
+xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
+xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false }
# Polkadot (client)
kusama-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
@@ -187,7 +197,19 @@ rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch =
westend-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
xcm-simulator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" }
+# Frontier (wasm)
+fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.3.0", default-features = false }
+pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.3.0", default-features = false }
+precompile-utils = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.3.0", default-features = false }
+
+# EVM
+evm = { version = "0.41.1", default-features = false }
+
# Local (wasm)
+pallet-evm-precompile-balances-erc20 = { path = "precompiles/balances-erc20", default-features = false }
+pallet-evm-precompile-batch = { path = "precompiles/batch", default-features = false }
+pallet-evm-precompile-call-permit = { path = "precompiles/call-permit", default-features = false }
+pallet-evm-precompile-xcm-utils = { path = "precompiles/xcm-utils", default-features = false }
async-backing-primitives = { path = "primitives/async-backing", default-features = false }
pallet-author-inherent = { path = "pallets/author-inherent", default-features = false }
pallet-author-mapping = { path = "pallets/author-mapping", default-features = false }
diff --git a/precompiles/balances-erc20/Cargo.toml b/precompiles/balances-erc20/Cargo.toml
new file mode 100644
index 00000000..8d622e0d
--- /dev/null
+++ b/precompiles/balances-erc20/Cargo.toml
@@ -0,0 +1,59 @@
+[package]
+name = "pallet-evm-precompile-balances-erc20"
+authors = { workspace = true }
+description = "A Precompile to expose a Balances pallet through an ERC20-compliant interface."
+edition = "2021"
+version = "0.1.0"
+
+[dependencies]
+log = { workspace = true }
+num_enum = { workspace = true }
+paste = { workspace = true }
+slices = { workspace = true }
+
+# Moonbeam
+precompile-utils = { workspace = true }
+
+# Substrate
+frame-support = { workspace = true }
+frame-system = { workspace = true }
+pallet-balances = { workspace = true }
+pallet-timestamp = { workspace = true }
+parity-scale-codec = { workspace = true, features = [ "max-encoded-len" ] }
+sp-core = { workspace = true }
+sp-io = { workspace = true }
+sp-runtime = { workspace = true }
+sp-std = { workspace = true }
+
+# Frontier
+fp-evm = { workspace = true }
+pallet-evm = { workspace = true, features = [ "forbid-evm-reentrancy" ] }
+
+[dev-dependencies]
+derive_more = { workspace = true }
+hex-literal = { workspace = true }
+libsecp256k1 = { workspace = true }
+serde = { workspace = true }
+sha3 = { workspace = true }
+
+# Moonbeam
+precompile-utils = { workspace = true, features = [ "std", "testing" ] }
+
+pallet-timestamp = { workspace = true, features = [ "std" ] }
+scale-info = { workspace = true, features = [ "derive" ] }
+sp-runtime = { workspace = true, features = [ "std" ] }
+
+[features]
+default = [ "std" ]
+std = [
+ "fp-evm/std",
+ "frame-support/std",
+ "frame-system/std",
+ "pallet-balances/std",
+ "pallet-evm/std",
+ "parity-scale-codec/std",
+ "precompile-utils/std",
+ "sp-core/std",
+ "sp-io/std",
+ "sp-std/std",
+]
diff --git a/precompiles/balances-erc20/ERC20.sol b/precompiles/balances-erc20/ERC20.sol
new file mode 100644
index 00000000..1f5e3f5a
--- /dev/null
+++ b/precompiles/balances-erc20/ERC20.sol
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-3.0-only
+pragma solidity >=0.8.3;
+
+/// @title ERC20 interface
+/// @dev see https://github.com/ethereum/EIPs/issues/20
+/// @dev copied from https://github.com/OpenZeppelin/openzeppelin-contracts
+interface IERC20 {
+ /// @dev Returns the name of the token.
+ /// @custom:selector 06fdde03
+ function name() external view returns (string memory);
+
+ /// @dev Returns the symbol of the token.
+ /// @custom:selector 95d89b41
+ function symbol() external view returns (string memory);
+
+ /// @dev Returns the decimals places of the token.
+ /// @custom:selector 313ce567
+ function decimals() external view returns (uint8);
+
+ /// @dev Total number of tokens in existence
+ /// @custom:selector 18160ddd
+ function totalSupply() external view returns (uint256);
+
+ /// @dev Gets the balance of the specified address.
+ /// @custom:selector 70a08231
+ /// @param owner The address to query the balance of.
+ /// @return An uint256 representing the amount owned by the passed address.
+ function balanceOf(address owner) external view returns (uint256);
+
+ /// @dev Function to check the amount of tokens that an owner allowed to a spender.
+ /// @custom:selector dd62ed3e
+ /// @param owner address The address which owns the funds.
+ /// @param spender address The address which will spend the funds.
+ /// @return A uint256 specifying the amount of tokens still available for the spender.
+ function allowance(address owner, address spender)
+ external
+ view
+ returns (uint256);
+
+ /// @dev Transfer token for a specified address
+ /// @custom:selector a9059cbb
+ /// @param to The address to transfer to.
+ /// @param value The amount to be transferred.
+ /// @return true if the transfer was succesful, revert otherwise.
+ function transfer(address to, uint256 value) external returns (bool);
+
+ /// @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
+ /// Beware that changing an allowance with this method brings the risk that someone may use both the old
+ /// and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
+ /// race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
+ /// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
+ /// @custom:selector 095ea7b3
+ /// @param spender The address which will spend the funds.
+ /// @param value The amount of tokens to be spent.
+ /// @return true, this cannot fail
+ function approve(address spender, uint256 value) external returns (bool);
+
+ /// @dev Transfer tokens from one address to another
+ /// @custom:selector 23b872dd
+ /// @param from address The address which you want to send tokens from
+ /// @param to address The address which you want to transfer to
+ /// @param value uint256 the amount of tokens to be transferred
+ /// @return true if the transfer was succesful, revert otherwise.
+ function transferFrom(
+ address from,
+ address to,
+ uint256 value
+ ) external returns (bool);
+
+ /// @dev Event emited when a transfer has been performed.
+ /// @custom:selector ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
+ /// @param from address The address sending the tokens
+ /// @param to address The address receiving the tokens.
+ /// @param value uint256 The amount of tokens transfered.
+ event Transfer(address indexed from, address indexed to, uint256 value);
+
+ /// @dev Event emited when an approval has been registered.
+ /// @custom:selector 8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925
+ /// @param owner address Owner of the tokens.
+ /// @param spender address Allowed spender.
+ /// @param value uint256 Amount of tokens approved.
+ event Approval(
+ address indexed owner,
+ address indexed spender,
+ uint256 value
+ );
+}
+
+/// @title Native currency wrapper interface.
+/// @dev Allow compatibility with dApps expecting this precompile to be
+/// a WETH-like contract.
+/// Moonbase address : 0x0000000000000000000000000000000000000802
+interface WrappedNativeCurrency {
+ /// @dev Provide compatibility for contracts that expect wETH design.
+ /// Returns funds to sender as this precompile tokens and the native tokens are the same.
+ /// @custom:selector d0e30db0
+ function deposit() external payable;
+
+ /// @dev Provide compatibility for contracts that expect wETH design.
+ /// Does nothing.
+ /// @custom:selector 2e1a7d4d
+ /// @param value uint256 The amount to withdraw/unwrap.
+ function withdraw(uint256 value) external;
+
+ /// @dev Event emited when deposit() has been called.
+ /// @custom:selector e1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c
+ /// @param owner address Owner of the tokens
+ /// @param value uint256 The amount of tokens "wrapped".
+ event Deposit(address indexed owner, uint256 value);
+
+ /// @dev Event emited when withdraw(uint256) has been called.
+ /// @custom:selector 7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65
+ /// @param owner address Owner of the tokens
+ /// @param value uint256 The amount of tokens "unwrapped".
+ event Withdrawal(address indexed owner, uint256 value);
+}
diff --git a/precompiles/balances-erc20/Permit.sol b/precompiles/balances-erc20/Permit.sol
new file mode 100644
index 00000000..fe781547
--- /dev/null
+++ b/precompiles/balances-erc20/Permit.sol
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-3.0-only
+pragma solidity >=0.8.3;
+
+/// @author The Moonbeam Team
+/// @title Extension of the ERC20 interface that allows users to
+/// @dev Sign permit messages to interact with contracts without needing to
+/// make a first approve transaction.
+interface Permit {
+ /// @dev Consumes an approval permit.
+ /// Anyone can call this function for a permit.
+ /// @custom:selector d505accf
+ /// @param owner Owner of the tokens issuing the permit
+ /// @param spender Address whose allowance will be increased.
+ /// @param value Allowed value.
+ /// @param deadline Timestamp after which the permit will no longer be valid.
+ /// @param v V component of the signature.
+ /// @param r R component of the signature.
+ /// @param s S component of the signature.
+ function permit(
+ address owner,
+ address spender,
+ uint256 value,
+ uint256 deadline,
+ uint8 v,
+ bytes32 r,
+ bytes32 s
+ ) external;
+
+ /// @dev Returns the current nonce for given owner.
+ /// A permit must have this nonce to be consumed, which will
+ /// increase the nonce by one.
+ /// @custom:selector 7ecebe00
+ function nonces(address owner) external view returns (uint256);
+
+ /// @dev Returns the EIP712 domain separator. It is used to avoid replay
+ /// attacks accross assets or other similar EIP712 message structures.
+ /// @custom:selector 3644e515
+ function DOMAIN_SEPARATOR() external view returns (bytes32);
+}
diff --git a/precompiles/balances-erc20/src/eip2612.rs b/precompiles/balances-erc20/src/eip2612.rs
new file mode 100644
index 00000000..ccc7ec45
--- /dev/null
+++ b/precompiles/balances-erc20/src/eip2612.rs
@@ -0,0 +1,181 @@
+// Copyright Moonsong Labs
+// This file is part of Moonkit.
+
+// Moonkit is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Moonkit is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Moonkit. If not, see .
+
+use super::*;
+use frame_support::{
+ ensure,
+ traits::{Get, Time},
+};
+use sp_core::H256;
+use sp_io::hashing::keccak_256;
+use sp_runtime::traits::UniqueSaturatedInto;
+use sp_std::vec::Vec;
+
+/// EIP2612 permit typehash.
+pub const PERMIT_TYPEHASH: [u8; 32] = keccak256!(
+ "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
+);
+
+/// EIP2612 permit domain used to compute an individualized domain separator.
+const PERMIT_DOMAIN: [u8; 32] = keccak256!(
+ "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
+);
+
+pub struct Eip2612(PhantomData<(Runtime, Metadata, Instance)>);
+
+impl Eip2612
+where
+ Runtime: pallet_balances::Config + pallet_evm::Config,
+ Runtime::RuntimeCall: Dispatchable + GetDispatchInfo,
+ Runtime::RuntimeCall: From>,
+ ::RuntimeOrigin: From