git.delta.rocks / unique-network / refs/commits / a94c6b63634a

difftreelog

feat add sponsoring fee limit

Grigoriy Simonov2022-09-13parent: #848ef93.patch.diff
in: master

37 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -117,7 +117,7 @@
 version = "0.1.0"
 dependencies = [
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
  "parity-scale-codec 3.1.5",
  "sp-api",
  "sp-core",
@@ -2324,7 +2324,7 @@
 [[package]]
 name = "fc-consensus"
 version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "async-trait",
  "fc-db",
@@ -2343,7 +2343,7 @@
 [[package]]
 name = "fc-db"
 version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "fp-storage",
  "kvdb-rocksdb",
@@ -2359,7 +2359,7 @@
 [[package]]
 name = "fc-mapping-sync"
 version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "fc-db",
  "fp-consensus",
@@ -2376,7 +2376,7 @@
 [[package]]
 name = "fc-rpc"
 version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "ethereum",
  "ethereum-types",
@@ -2416,7 +2416,7 @@
 [[package]]
 name = "fc-rpc-core"
 version = "1.1.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "ethereum",
  "ethereum-types",
@@ -2557,7 +2557,7 @@
 [[package]]
 name = "fp-consensus"
 version = "2.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "ethereum",
  "parity-scale-codec 3.1.5",
@@ -2581,6 +2581,20 @@
 ]
 
 [[package]]
+name = "fp-evm"
+version = "3.0.0-dev"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
+dependencies = [
+ "evm",
+ "frame-support",
+ "impl-trait-for-tuples",
+ "parity-scale-codec 3.1.5",
+ "serde",
+ "sp-core",
+ "sp-std",
+]
+
+[[package]]
 name = "fp-evm-mapping"
 version = "0.1.0"
 source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
@@ -2590,13 +2604,22 @@
 ]
 
 [[package]]
+name = "fp-evm-mapping"
+version = "0.1.0"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
+dependencies = [
+ "frame-support",
+ "sp-core",
+]
+
+[[package]]
 name = "fp-rpc"
 version = "3.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "ethereum",
  "ethereum-types",
- "fp-evm",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "parity-scale-codec 3.1.5",
  "scale-info",
  "sp-api",
@@ -2609,7 +2632,7 @@
 [[package]]
 name = "fp-self-contained"
 version = "1.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "ethereum",
  "frame-support",
@@ -2625,7 +2648,7 @@
 [[package]]
 name = "fp-storage"
 version = "2.0.0"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "parity-scale-codec 3.1.5",
 ]
@@ -5152,7 +5175,7 @@
  "cumulus-primitives-utility",
  "derivative",
  "evm-coder",
- "fp-evm-mapping",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "fp-rpc",
  "fp-self-contained",
  "frame-benchmarking",
@@ -5172,7 +5195,7 @@
  "pallet-common",
  "pallet-configuration",
  "pallet-ethereum",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "pallet-evm-contract-helpers",
  "pallet-evm-migration",
@@ -5320,7 +5343,7 @@
  "frame-system",
  "pallet-balances",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
  "pallet-evm-contract-helpers",
  "pallet-evm-migration",
  "pallet-randomness-collective-flip",
@@ -5445,9 +5468,9 @@
 [[package]]
 name = "pallet-base-fee"
 version = "1.0.0"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
- "fp-evm",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "frame-support",
  "frame-system",
  "parity-scale-codec 3.1.5",
@@ -5556,11 +5579,11 @@
 dependencies = [
  "ethereum",
  "evm-coder",
- "fp-evm-mapping",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "frame-benchmarking",
  "frame-support",
  "frame-system",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "parity-scale-codec 3.1.5",
  "scale-info",
@@ -5575,7 +5598,7 @@
 name = "pallet-configuration"
 version = "0.1.1"
 dependencies = [
- "fp-evm",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "frame-support",
  "frame-system",
  "parity-scale-codec 3.1.5",
@@ -5660,21 +5683,21 @@
 [[package]]
 name = "pallet-ethereum"
 version = "4.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
 dependencies = [
  "ethereum",
  "ethereum-types",
  "evm",
  "fp-consensus",
- "fp-evm",
- "fp-evm-mapping",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "fp-rpc",
  "fp-self-contained",
  "fp-storage",
  "frame-support",
  "frame-system",
  "log",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-timestamp",
  "parity-scale-codec 3.1.5",
  "rlp",
@@ -5692,8 +5715,35 @@
 source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
 dependencies = [
  "evm",
- "fp-evm",
- "fp-evm-mapping",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "hex",
+ "impl-trait-for-tuples",
+ "log",
+ "pallet-timestamp",
+ "parity-scale-codec 3.1.5",
+ "primitive-types",
+ "rlp",
+ "scale-info",
+ "serde",
+ "sha3 0.10.2",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
+name = "pallet-evm"
+version = "6.0.0-dev"
+source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
+dependencies = [
+ "evm",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "frame-benchmarking",
  "frame-support",
  "frame-system",
@@ -5723,7 +5773,7 @@
  "frame-support",
  "frame-system",
  "pallet-ethereum",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "parity-scale-codec 3.1.5",
  "scale-info",
  "sp-core",
@@ -5737,12 +5787,12 @@
 dependencies = [
  "ethereum",
  "evm-coder",
- "fp-evm-mapping",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "frame-support",
  "frame-system",
  "log",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "parity-scale-codec 3.1.5",
  "scale-info",
@@ -5757,11 +5807,11 @@
 name = "pallet-evm-migration"
 version = "0.1.1"
 dependencies = [
- "fp-evm",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "frame-benchmarking",
  "frame-support",
  "frame-system",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "parity-scale-codec 3.1.5",
  "scale-info",
  "sp-core",
@@ -5774,12 +5824,12 @@
 name = "pallet-evm-transaction-payment"
 version = "0.1.1"
 dependencies = [
- "fp-evm",
- "fp-evm-mapping",
+ "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "frame-support",
  "frame-system",
  "pallet-ethereum",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "parity-scale-codec 3.1.5",
  "scale-info",
  "sp-core",
@@ -5799,7 +5849,7 @@
  "frame-support",
  "frame-system",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "pallet-structure",
  "parity-scale-codec 3.1.5",
@@ -6041,7 +6091,7 @@
  "frame-support",
  "frame-system",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "pallet-structure",
  "parity-scale-codec 3.1.5",
@@ -6164,7 +6214,7 @@
  "frame-support",
  "frame-system",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "pallet-structure",
  "parity-scale-codec 3.1.5",
@@ -6185,7 +6235,7 @@
  "frame-support",
  "frame-system",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-nonfungible",
  "pallet-structure",
  "parity-scale-codec 3.1.5",
@@ -6205,7 +6255,7 @@
  "frame-support",
  "frame-system",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-nonfungible",
  "pallet-rmrk-core",
  "parity-scale-codec 3.1.5",
@@ -6335,7 +6385,7 @@
  "frame-support",
  "frame-system",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "parity-scale-codec 3.1.5",
  "scale-info",
  "sp-std",
@@ -6359,7 +6409,7 @@
 [[package]]
 name = "pallet-template-transaction-payment"
 version = "3.0.0"
-source = "git+https://github.com/uniquenetwork/pallet-sponsoring?branch=polkadot-v0.9.27#853766d6033ceb68a2bef196790b962dd0663a04"
+source = "git+https://github.com/uniquenetwork/pallet-sponsoring?rev=a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3#a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
@@ -6482,7 +6532,7 @@
  "frame-support",
  "frame-system",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "pallet-nonfungible",
  "pallet-refungible",
@@ -8385,7 +8435,7 @@
  "cumulus-primitives-utility",
  "derivative",
  "evm-coder",
- "fp-evm-mapping",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "fp-rpc",
  "fp-self-contained",
  "frame-benchmarking",
@@ -8405,7 +8455,7 @@
  "pallet-common",
  "pallet-configuration",
  "pallet-ethereum",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "pallet-evm-contract-helpers",
  "pallet-evm-migration",
@@ -11650,13 +11700,13 @@
 version = "0.1.1"
 dependencies = [
  "evm-coder",
- "fp-evm-mapping",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "frame-support",
  "frame-system",
  "pallet-balances",
  "pallet-common",
  "pallet-ethereum",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "pallet-fungible",
  "pallet-nonfungible",
@@ -12153,7 +12203,7 @@
  "app-promotion-rpc",
  "jsonrpsee",
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "parity-scale-codec 3.1.5",
  "rmrk-rpc",
  "sp-api",
@@ -12379,7 +12429,7 @@
  "cumulus-primitives-utility",
  "derivative",
  "evm-coder",
- "fp-evm-mapping",
+ "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "fp-rpc",
  "fp-self-contained",
  "frame-benchmarking",
@@ -12399,7 +12449,7 @@
  "pallet-common",
  "pallet-configuration",
  "pallet-ethereum",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "pallet-evm-coder-substrate",
  "pallet-evm-contract-helpers",
  "pallet-evm-migration",
@@ -12485,7 +12535,7 @@
 dependencies = [
  "fp-rpc",
  "frame-support",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "sp-consensus-aura",
  "sp-core",
  "sp-runtime",
@@ -12499,7 +12549,7 @@
  "derivative",
  "frame-support",
  "frame-system",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "parity-scale-codec 3.1.5",
  "rmrk-traits",
  "scale-info",
@@ -12515,7 +12565,7 @@
 version = "0.1.3"
 dependencies = [
  "pallet-common",
- "pallet-evm",
+ "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
  "parity-scale-codec 3.1.5",
  "sp-api",
  "sp-core",
@@ -12527,7 +12577,7 @@
 [[package]]
 name = "up-sponsorship"
 version = "0.1.0"
-source = "git+https://github.com/uniquenetwork/pallet-sponsoring?branch=polkadot-v0.9.27#853766d6033ceb68a2bef196790b962dd0663a04"
+source = "git+https://github.com/uniquenetwork/pallet-sponsoring?rev=a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3#a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3"
 dependencies = [
  "impl-trait-for-tuples",
 ]
modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
--- a/client/rpc/Cargo.toml
+++ b/client/rpc/Cargo.toml
@@ -19,4 +19,4 @@
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-rpc = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -309,13 +309,13 @@
 jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }
 tokio = { version = "1.19.2", features = ["time"] }
 
-fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fc-consensus = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fc-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fc-db = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fc-consensus = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fc-rpc = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fc-db = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-rpc = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 unique-rpc = { default-features = false, path = "../rpc" }
 app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -40,13 +40,13 @@
 substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 tokio = { version = "1.19.2", features = ["macros", "sync"] }
 
-pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 pallet-common = { default-features = false, path = "../../pallets/common" }
 up-common = { path = "../../primitives/common" }
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -17,12 +17,12 @@
 sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
 pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
 ethereum = { version = "0.12.0", default-features = false }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 serde = { version = "1.0.130", default-features = false }
 scale-info = { version = "2.0.1", default-features = false, features = [
modifiedpallets/configuration/Cargo.tomldiffbeforeafterboth
--- a/pallets/configuration/Cargo.toml
+++ b/pallets/configuration/Cargo.toml
@@ -16,7 +16,7 @@
 sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 smallvec = "1.6.1"
 
 [features]
modifiedpallets/evm-coder-substrate/Cargo.tomldiffbeforeafterboth
--- a/pallets/evm-coder-substrate/Cargo.toml
+++ b/pallets/evm-coder-substrate/Cargo.toml
@@ -12,8 +12,8 @@
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 ethereum = { version = "0.12.0", default-features = false }
 evm-coder = { default-features = false, path = "../../crates/evm-coder" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
modifiedpallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth
--- a/pallets/evm-contract-helpers/Cargo.toml
+++ b/pallets/evm-contract-helpers/Cargo.toml
@@ -19,9 +19,9 @@
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 
 # Unique
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
 
 # Locals
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -25,11 +25,11 @@
 	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,
 	account::CrossAccountId,
 };
-use sp_core::H160;
+use sp_core::{H160, U256};
 use up_data_structs::SponsorshipState;
 use crate::{
-	AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringRateLimit, SponsoringModeT,
-	Sponsoring,
+	AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringFeeLimit,
+	SponsoringRateLimit, SponsoringModeT, Sponsoring,
 };
 use frame_support::traits::Get;
 use up_sponsorship::SponsorshipHandler;
@@ -250,6 +250,23 @@
 		Ok(())
 	}
 
+	fn set_sponsoring_fee_limit(
+		&mut self,
+		caller: caller,
+		contract_address: address,
+		fee_limit: uint128,
+	) -> Result<void> {
+		<Pallet<T>>::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::<T>)?;
+		<Pallet<T>>::set_sponsoring_fee_limit(contract_address, fee_limit.into());
+		Ok(())
+	}
+
+	fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint128> {
+		Ok(<SponsoringFeeLimit<T>>::get(contract_address)
+			.try_into()
+			.map_err(|_| "fee limit > u128::MAX")?)
+	}
+
 	/// Is specified user present in contract allow list
 	/// @dev Contract owner always implicitly included
 	/// @param contractAddress Contract to check allowlist of
@@ -363,10 +380,14 @@
 
 /// Bridge to pallet-sponsoring
 pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);
-impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)>
+impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>), u128>
 	for HelpersContractSponsoring<T>
 {
-	fn get_sponsor(who: &T::CrossAccountId, call: &(H160, Vec<u8>)) -> Option<T::CrossAccountId> {
+	fn get_sponsor(
+		who: &T::CrossAccountId,
+		call: &(H160, Vec<u8>),
+		fee_limit: &u128,
+	) -> Option<T::CrossAccountId> {
 		let (contract_address, _) = call;
 		let mode = <Pallet<T>>::sponsoring_mode(*contract_address);
 		if mode == SponsoringModeT::Disabled {
@@ -394,6 +415,12 @@
 			}
 		}
 
+		let sponsored_fee_limit = <SponsoringFeeLimit<T>>::get(contract_address);
+
+		if *fee_limit > sponsored_fee_limit {
+			return None;
+		}
+
 		<SponsorBasket<T>>::insert(contract_address, who.as_eth(), block_number);
 
 		Some(sponsor)
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/lib.rs
+++ b/pallets/evm-contract-helpers/src/lib.rs
@@ -48,6 +48,9 @@
 		/// In case of enabled sponsoring, but no sponsoring rate limit set,
 		/// this value will be used implicitly
 		type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;
+		/// In case of enabled sponsoring, but no sponsoring fee limit set,
+		/// this value will be used implicitly
+		type DefaultSponsoringFeeLimit: Get<u128>;
 	}
 
 	#[pallet::error]
@@ -118,6 +121,15 @@
 	/// * **Key2** - sponsored user address.
 	/// * **Value** - last sponsored block number.
 	#[pallet::storage]
+	pub(super) type SponsoringFeeLimit<T: Config> = StorageMap<
+		Hasher = Twox128,
+		Key = H160,
+		Value = u128,
+		QueryKind = ValueQuery,
+		OnEmpty = T::DefaultSponsoringFeeLimit,
+	>;
+
+	#[pallet::storage]
 	pub(super) type SponsorBasket<T: Config> = StorageDoubleMap<
 		Hasher1 = Twox128,
 		Key1 = H160,
@@ -353,6 +365,11 @@
 			<SponsoringRateLimit<T>>::insert(contract, rate_limit);
 		}
 
+		/// Set maximum for gas limit of transaction
+		pub fn set_sponsoring_fee_limit(contract: H160, fee_limit: u128) {
+			<SponsoringFeeLimit<T>>::insert(contract, fee_limit);
+		}
+
 		/// Is user added to allowlist, or he is owner of specified contract
 		pub fn allowed(contract: H160, user: H160) -> bool {
 			<Allowlist<T>>::get(&contract, &user) || <Owner<T>>::get(&contract) == user
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
+++ b/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
@@ -203,6 +203,30 @@
 		dummy = 0;
 	}
 
+	/// @dev EVM selector for this function is: 0x1c362eb4,
+	///  or in textual repr: setSponsoringFeeLimit(address,uint128)
+	function setSponsoringFeeLimit(address contractAddress, uint128 feeLimit)
+		public
+	{
+		require(false, stub_error);
+		contractAddress;
+		feeLimit;
+		dummy = 0;
+	}
+
+	/// @dev EVM selector for this function is: 0xc3fdc9ee,
+	///  or in textual repr: getSponsoringFeeLimit(address)
+	function getSponsoringFeeLimit(address contractAddress)
+		public
+		view
+		returns (uint128)
+	{
+		require(false, stub_error);
+		contractAddress;
+		dummy;
+		return 0;
+	}
+
 	/// Is specified user present in contract allow list
 	/// @dev Contract owner always implicitly included
 	/// @param contractAddress Contract to check allowlist of
modifiedpallets/evm-migration/Cargo.tomldiffbeforeafterboth
--- a/pallets/evm-migration/Cargo.toml
+++ b/pallets/evm-migration/Cargo.toml
@@ -15,8 +15,8 @@
 sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 [dependencies.codec]
 default-features = false
modifiedpallets/evm-transaction-payment/Cargo.tomldiffbeforeafterboth
--- a/pallets/evm-transaction-payment/Cargo.toml
+++ b/pallets/evm-transaction-payment/Cargo.toml
@@ -14,11 +14,11 @@
 sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
-fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev = "a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
+fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 [dependencies.codec]
 default-features = false
modifiedpallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-transaction-payment/src/lib.rs
+++ b/pallets/evm-transaction-payment/src/lib.rs
@@ -22,8 +22,8 @@
 use fp_evm::WithdrawReason;
 use frame_support::traits::IsSubType;
 pub use pallet::*;
-use pallet_evm::{EnsureAddressOrigin, account::CrossAccountId};
-use sp_core::H160;
+use pallet_evm::{account::CrossAccountId, EnsureAddressOrigin, FeeCalculator};
+use sp_core::{H160, U256};
 use sp_runtime::{TransactionOutcome, DispatchError};
 use up_sponsorship::SponsorshipHandler;
 
@@ -36,7 +36,7 @@
 	#[pallet::config]
 	pub trait Config: frame_system::Config + pallet_evm::account::Config {
 		/// Loosly-coupled handlers for evm call sponsoring
-		type EvmSponsorshipHandler: SponsorshipHandler<Self::CrossAccountId, (H160, Vec<u8>)>;
+		type EvmSponsorshipHandler: SponsorshipHandler<Self::CrossAccountId, (H160, Vec<u8>), u128>;
 	}
 
 	#[pallet::pallet]
@@ -47,11 +47,19 @@
 /// Implements [`fp_evm::TransactionValidityHack`], which provides sponsor address to pallet-evm
 pub struct TransactionValidityHack<T: Config>(PhantomData<*const T>);
 impl<T: Config> fp_evm::TransactionValidityHack<T::CrossAccountId> for TransactionValidityHack<T> {
-	fn who_pays_fee(origin: H160, reason: &WithdrawReason) -> Option<T::CrossAccountId> {
+	fn who_pays_fee(
+		origin: H160,
+		max_fee: U256,
+		reason: &WithdrawReason,
+	) -> Option<T::CrossAccountId> {
 		match reason {
 			WithdrawReason::Call { target, input } => {
 				let origin_sub = T::CrossAccountId::from_eth(origin);
-				T::EvmSponsorshipHandler::get_sponsor(&origin_sub, &(*target, input.clone()))
+				T::EvmSponsorshipHandler::get_sponsor(
+					&origin_sub,
+					&(*target, input.clone()),
+					&max_fee.as_u128(),
+				)
 			}
 			_ => None,
 		}
@@ -60,17 +68,19 @@
 
 /// Implements sponsoring for evm calls performed from pallet-evm (via api.tx.ethereum.transact/api.tx.evm.call)
 pub struct BridgeSponsorshipHandler<T>(PhantomData<T>);
-impl<T, C> SponsorshipHandler<T::AccountId, C> for BridgeSponsorshipHandler<T>
+impl<T, C> SponsorshipHandler<T::AccountId, C, u128> for BridgeSponsorshipHandler<T>
 where
 	T: Config + pallet_evm::Config,
 	C: IsSubType<pallet_evm::Call<T>>,
 {
-	fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
+	fn get_sponsor(who: &T::AccountId, call: &C, _fee_limit: &u128) -> Option<T::AccountId> {
 		match call.is_sub_type()? {
 			pallet_evm::Call::call {
 				source,
 				target,
 				input,
+				gas_limit,
+				max_fee_per_gas,
 				..
 			} => {
 				let _ = T::CallOrigin::ensure_address_origin(
@@ -79,11 +89,16 @@
 				)
 				.ok()?;
 				let who = T::CrossAccountId::from_sub(who.clone());
+				let max_fee = max_fee_per_gas.saturating_mul((*gas_limit).into());
 				// Effects from EvmSponsorshipHandler are applied by pallet_evm::runner
 				// TODO: Should we implement simulation mode (test, but do not apply effects) in `up-sponsorship`?
 				let sponsor = frame_support::storage::with_transaction(|| {
 					TransactionOutcome::Rollback(Ok::<_, DispatchError>(
-						T::EvmSponsorshipHandler::get_sponsor(&who, &(*target, input.clone())),
+						T::EvmSponsorshipHandler::get_sponsor(
+							&who,
+							&(*target, input.clone()),
+							&max_fee.try_into().unwrap(),
+						),
 					))
 				})
 				// FIXME: it may fail with DispatchError in case of depth limit
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/fungible/Cargo.toml
+++ b/pallets/fungible/Cargo.toml
@@ -23,7 +23,7 @@
 pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
 ethereum = { version = "0.12.0", default-features = false }
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 scale-info = { version = "2.0.1", default-features = false, features = [
     "derive",
 ] }
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -16,7 +16,7 @@
 sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 pallet-common = { default-features = false, path = '../common' }
 pallet-structure = { default-features = false, path = '../structure' }
 up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
modifiedpallets/proxy-rmrk-core/Cargo.tomldiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/Cargo.toml
+++ b/pallets/proxy-rmrk-core/Cargo.toml
@@ -20,7 +20,7 @@
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
 pallet-structure = { default-features = false, path = "../../pallets/structure" }
 up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 rmrk-traits = { default-features = false, path = "../../primitives/rmrk-traits" }
 scale-info = { version = "2.0.1", default-features = false, features = [
modifiedpallets/proxy-rmrk-equip/Cargo.tomldiffbeforeafterboth
--- a/pallets/proxy-rmrk-equip/Cargo.toml
+++ b/pallets/proxy-rmrk-equip/Cargo.toml
@@ -19,7 +19,7 @@
 pallet-common = { default-features = false, path = '../common' }
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
 up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 rmrk-traits = { default-features = false, path = "../../primitives/rmrk-traits" }
 scale-info = { version = "2.0.1", default-features = false, features = [
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/refungible/Cargo.toml
+++ b/pallets/refungible/Cargo.toml
@@ -16,7 +16,7 @@
 sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
 pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
 pallet-common = { default-features = false, path = '../common' }
modifiedpallets/scheduler/Cargo.tomldiffbeforeafterboth
--- a/pallets/scheduler/Cargo.toml
+++ b/pallets/scheduler/Cargo.toml
@@ -24,7 +24,7 @@
 sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.27' }
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
 log = { version = "0.4.14", default-features = false }
 
 [dev-dependencies]
modifiedpallets/structure/Cargo.tomldiffbeforeafterboth
--- a/pallets/structure/Cargo.toml
+++ b/pallets/structure/Cargo.toml
@@ -16,7 +16,7 @@
 	"derive",
 ] }
 up-data-structs = { path = "../../primitives/data-structs", default-features = false }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 [features]
 default = ["std"]
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
--- a/pallets/unique/Cargo.toml
+++ b/pallets/unique/Cargo.toml
@@ -98,7 +98,7 @@
 scale-info = { version = "2.0.1", default-features = false, features = [
     "derive",
 ] }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 pallet-common = { default-features = false, path = "../common" }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
 pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
modifiedprimitives/common/Cargo.tomldiffbeforeafterboth
--- a/primitives/common/Cargo.toml
+++ b/primitives/common/Cargo.toml
@@ -48,9 +48,9 @@
 [dependencies.fp-rpc]
 default-features = false
 git = "https://github.com/uniquenetwork/frontier"
-branch = "unique-polkadot-v0.9.27"
+rev = "89a37c5a489f426cc7a42d7b94019974093a052d"
 
 [dependencies.pallet-evm]
 default-features = false
 git = "https://github.com/uniquenetwork/frontier"
-branch = "unique-polkadot-v0.9.27"
+rev = "89a37c5a489f426cc7a42d7b94019974093a052d"
modifiedprimitives/data-structs/Cargo.tomldiffbeforeafterboth
--- a/primitives/data-structs/Cargo.toml
+++ b/primitives/data-structs/Cargo.toml
@@ -25,7 +25,7 @@
 sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 derivative = { version = "2.2.0", features = ["use_core"] }
 struct-versioning = { path = "../../crates/struct-versioning" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 rmrk-traits = { default-features = false, path = "../rmrk-traits" }
 
 [features]
modifiedprimitives/rpc/Cargo.tomldiffbeforeafterboth
--- a/primitives/rpc/Cargo.toml
+++ b/primitives/rpc/Cargo.toml
@@ -14,7 +14,7 @@
 sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 [features]
 default = ["std"]
modifiedruntime/common/config/ethereum.rsdiffbeforeafterboth
--- a/runtime/common/config/ethereum.rs
+++ b/runtime/common/config/ethereum.rs
@@ -7,8 +7,10 @@
 use sp_runtime::{RuntimeAppPublic, Perbill};
 use crate::{
 	runtime_common::{
-		dispatch::CollectionDispatchT, ethereum::sponsoring::EvmSponsorshipHandler,
-		config::sponsoring::DefaultSponsoringRateLimit, DealWithFees,
+		dispatch::CollectionDispatchT,
+		ethereum::sponsoring::EvmSponsorshipHandler,
+		config::sponsoring::{DefaultSponsoringFeeLimit, DefaultSponsoringRateLimit},
+		DealWithFees,
 	},
 	Runtime, Aura, Balances, Event, ChainId,
 };
@@ -115,6 +117,7 @@
 	type Event = Event;
 	type ContractAddress = HelpersContractAddress;
 	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
+	type DefaultSponsoringFeeLimit = DefaultSponsoringFeeLimit;
 }
 
 impl pallet_evm_coder_substrate::Config for Runtime {}
modifiedruntime/common/config/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/config/sponsoring.rs
+++ b/runtime/common/config/sponsoring.rs
@@ -23,6 +23,7 @@
 
 parameter_types! {
 	pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;
+	pub const DefaultSponsoringFeeLimit: u128 = u128::MAX;
 }
 
 type SponsorshipHandler = (
modifiedruntime/common/ethereum/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/ethereum/sponsoring.rs
+++ b/runtime/common/ethereum/sponsoring.rs
@@ -44,9 +44,13 @@
 
 pub struct UniqueEthSponsorshipHandler<T: UniqueConfig>(PhantomData<*const T>);
 impl<T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig>
-	SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)> for UniqueEthSponsorshipHandler<T>
+	SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>), u128> for UniqueEthSponsorshipHandler<T>
 {
-	fn get_sponsor(who: &T::CrossAccountId, call: &(H160, Vec<u8>)) -> Option<T::CrossAccountId> {
+	fn get_sponsor(
+		who: &T::CrossAccountId,
+		call: &(H160, Vec<u8>),
+		_fee_limit: &u128,
+	) -> Option<T::CrossAccountId> {
 		let collection_id = map_eth_to_id(&call.0)?;
 		let collection = <CollectionHandle<T>>::new(collection_id)?;
 		let sponsor = collection.sponsorship.sponsor()?.clone();
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -48,7 +48,8 @@
         };
         use pallet_evm::{
             Runner, account::CrossAccountId as _,
-            Account as EVMAccount, FeeCalculator,
+            Account as EVMAccount,
+            FeeCalculator
         };
         use runtime_common::{
             sponsoring::{SponsorshipPredict, UniqueSponsorshipPredict},
modifiedruntime/common/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/sponsoring.rs
+++ b/runtime/common/sponsoring.rs
@@ -224,12 +224,12 @@
 }
 
 pub struct UniqueSponsorshipHandler<T>(PhantomData<T>);
-impl<T, C> SponsorshipHandler<T::AccountId, C> for UniqueSponsorshipHandler<T>
+impl<T, C> SponsorshipHandler<T::AccountId, C, u128> for UniqueSponsorshipHandler<T>
 where
 	T: Config,
 	C: IsSubType<UniqueCall<T>>,
 {
-	fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {
+	fn get_sponsor(who: &T::AccountId, call: &C, _fee_limit: &u128) -> Option<T::AccountId> {
 		match IsSubType::<UniqueCall<T>>::is_sub_type(call)? {
 			UniqueCall::set_token_properties {
 				collection_id,
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -417,7 +417,7 @@
 up-rpc = { path = "../../primitives/rpc", default-features = false }
 app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
 rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
-fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 pallet-inflation = { path = '../../pallets/inflation', default-features = false }
 pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
 up-data-structs = { path = '../../primitives/data-structs', default-features = false }
@@ -431,18 +431,18 @@
 pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
 pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
+pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
 pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
 pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
 pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.27' }
+up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
 
 ################################################################################
 # Build Dependencies
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -418,7 +418,7 @@
 pallet-unique = { path = '../../pallets/unique', default-features = false }
 up-rpc = { path = "../../primitives/rpc", default-features = false }
 app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
-fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 pallet-inflation = { path = '../../pallets/inflation', default-features = false }
 pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
 up-data-structs = { path = '../../primitives/data-structs', default-features = false }
@@ -432,18 +432,18 @@
 pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
 pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
+pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
 pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
 pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
 pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.27' }
+up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
 
 ################################################################################
 # Build Dependencies
modifiedruntime/tests/Cargo.tomldiffbeforeafterboth
--- a/runtime/tests/Cargo.toml
+++ b/runtime/tests/Cargo.toml
@@ -16,7 +16,7 @@
 sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 
-fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
@@ -25,8 +25,8 @@
 pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 
 pallet-common = { path = '../../pallets/common' }
 pallet-structure = { path = '../../pallets/structure' }
@@ -43,4 +43,4 @@
 scale-info = "*"
 
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.27' }
+up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -425,19 +425,19 @@
 pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
 pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
+pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
 pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
 pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
 pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
-fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
+fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.27' }
+up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
 
 ################################################################################
 # Build Dependencies
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -131,6 +131,18 @@
 	function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)
 		external;
 
+	/// @dev EVM selector for this function is: 0x1c362eb4,
+	///  or in textual repr: setSponsoringFeeLimit(address,uint128)
+	function setSponsoringFeeLimit(address contractAddress, uint128 feeLimit)
+		external;
+
+	/// @dev EVM selector for this function is: 0xc3fdc9ee,
+	///  or in textual repr: getSponsoringFeeLimit(address)
+	function getSponsoringFeeLimit(address contractAddress)
+		external
+		view
+		returns (uint128);
+
 	/// Is specified user present in contract allow list
 	/// @dev Contract owner always implicitly included
 	/// @param contractAddress Contract to check allowlist of
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
before · tests/src/eth/contractSponsoring.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {expect} from 'chai';18import {expectSubstrateEventsAtBlock} from '../util/helpers';19import {20  contractHelpers,21  createEthAccountWithBalance,22  transferBalanceToEth,23  deployFlipper,24  itWeb3,25  SponsoringMode,26  createEthAccount,27  ethBalanceViaSub,28  normalizeEvents,29} from './util/helpers';3031describe('Sponsoring EVM contracts', () => {32  itWeb3('Self sponsored can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {33    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);34    const flipper = await deployFlipper(web3, owner);35    const helpers = contractHelpers(web3, owner);36    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;37    await expect(helpers.methods.selfSponsoredEnable(flipper.options.address).send()).to.be.not.rejected;38    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;39  });4041  itWeb3('Set self sponsored events', async ({api, web3, privateKeyWrapper}) => {42    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);43    const flipper = await deployFlipper(web3, owner);44    const helpers = contractHelpers(web3, owner);45    46    const result = await helpers.methods.selfSponsoredEnable(flipper.options.address).send();47    // console.log(result);48    const ethEvents = normalizeEvents(result.events);49    expect(ethEvents).to.be.deep.equal([50      {51        address: flipper.options.address,52        event: 'ContractSponsorSet',53        args: {54          contractAddress: flipper.options.address,55          sponsor: flipper.options.address,56        },57      },58      {59        address: flipper.options.address,60        event: 'ContractSponsorshipConfirmed',61        args: {62          contractAddress: flipper.options.address,63          sponsor: flipper.options.address,64        },65      },66    ]);6768    await expectSubstrateEventsAtBlock(69      api, 70      result.blockNumber,71      'evmContractHelpers',72      ['ContractSponsorSet','ContractSponsorshipConfirmed'],73    );74  });7576  itWeb3('Self sponsored can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {77    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);78    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);79    const flipper = await deployFlipper(web3, owner);80    const helpers = contractHelpers(web3, owner);81    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;82    await expect(helpers.methods.selfSponsoredEnable(flipper.options.address).call({from: notOwner})).to.be.rejectedWith('NoPermission');83    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;84  });8586  itWeb3('Sponsoring can be set by the address that has deployed the contract', async ({api, web3, privateKeyWrapper}) => {87    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);88    const flipper = await deployFlipper(web3, owner);89    const helpers = contractHelpers(web3, owner);90    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;91    await expect(helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner})).to.be.not.rejected;92    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.true;93  });9495  itWeb3('Sponsoring cannot be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {96    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);97    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);98    const flipper = await deployFlipper(web3, owner);99    const helpers = contractHelpers(web3, owner);100    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;101    await expect(helpers.methods.setSponsoringMode(notOwner, SponsoringMode.Allowlisted).call({from: notOwner})).to.be.rejectedWith('NoPermission');102    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;103  });104  105  itWeb3('Sponsor can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {106    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);107    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);108    const flipper = await deployFlipper(web3, owner);109    const helpers = contractHelpers(web3, owner);110    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;111    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;112    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.true;113  });114  115  itWeb3('Set sponsor event', async ({api, web3, privateKeyWrapper}) => {116    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);117    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);118    const flipper = await deployFlipper(web3, owner);119    const helpers = contractHelpers(web3, owner);120    121    const result = await helpers.methods.setSponsor(flipper.options.address, sponsor).send();122    const events = normalizeEvents(result.events);123    expect(events).to.be.deep.equal([124      {125        address: flipper.options.address,126        event: 'ContractSponsorSet',127        args: {128          contractAddress: flipper.options.address,129          sponsor: sponsor,130        },131      },132    ]);133134    await expectSubstrateEventsAtBlock(135      api, 136      result.blockNumber,137      'evmContractHelpers',138      ['ContractSponsorSet'],139    );140  });141  142  itWeb3('Sponsor can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {143    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);144    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);145    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);146    const flipper = await deployFlipper(web3, owner);147    const helpers = contractHelpers(web3, owner);148    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;149    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).call({from: notOwner})).to.be.rejectedWith('NoPermission');150    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;151  });152153  itWeb3('Sponsorship can be confirmed by the address that pending as sponsor', async ({api, web3, privateKeyWrapper}) => {154    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);155    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);156    const flipper = await deployFlipper(web3, owner);157    const helpers = contractHelpers(web3, owner);158    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;159    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;160    await expect(helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor})).to.be.not.rejected;161    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;162  });163164  itWeb3('Confirm sponsorship event', async ({api, web3, privateKeyWrapper}) => {165    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);166    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);167    const flipper = await deployFlipper(web3, owner);168    const helpers = contractHelpers(web3, owner);169    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;170    const result = await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});171    const events = normalizeEvents(result.events);172    expect(events).to.be.deep.equal([173      {174        address: flipper.options.address,175        event: 'ContractSponsorshipConfirmed',176        args: {177          contractAddress: flipper.options.address,178          sponsor: sponsor,179        },180      },181    ]);182183    await expectSubstrateEventsAtBlock(184      api, 185      result.blockNumber,186      'evmContractHelpers',187      ['ContractSponsorshipConfirmed'],188    );189  });190191  itWeb3('Sponsorship can not be confirmed by the address that not pending as sponsor', async ({api, web3, privateKeyWrapper}) => {192    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);193    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);194    const notSponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);195    const flipper = await deployFlipper(web3, owner);196    const helpers = contractHelpers(web3, owner);197    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;198    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;199    await expect(helpers.methods.confirmSponsorship(flipper.options.address).call({from: notSponsor})).to.be.rejectedWith('NoPermission');200    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;201  });202203  itWeb3('Sponsorship can not be confirmed by the address that not set as sponsor', async ({api, web3, privateKeyWrapper}) => {204    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);205    const notSponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);206    const flipper = await deployFlipper(web3, owner);207    const helpers = contractHelpers(web3, owner);208    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;209    await expect(helpers.methods.confirmSponsorship(flipper.options.address).call({from: notSponsor})).to.be.rejectedWith('NoPendingSponsor');210    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;211  });212213  itWeb3('Get self sponsored sponsor', async ({api, web3, privateKeyWrapper}) => {214    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);215    const flipper = await deployFlipper(web3, owner);216    const helpers = contractHelpers(web3, owner);217    await helpers.methods.selfSponsoredEnable(flipper.options.address).send();218    219    const result = await helpers.methods.getSponsor(flipper.options.address).call();220221    expect(result[0]).to.be.eq(flipper.options.address);222    expect(result[1]).to.be.eq('0');223  });224225  itWeb3('Get confirmed sponsor', async ({api, web3, privateKeyWrapper}) => {226    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);227    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);228    const flipper = await deployFlipper(web3, owner);229    const helpers = contractHelpers(web3, owner);230    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();231    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});232    233    const result = await helpers.methods.getSponsor(flipper.options.address).call();234235    expect(result[0]).to.be.eq(sponsor);236    expect(result[1]).to.be.eq('0');237  });238239  itWeb3('Sponsor can be removed by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {240    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);241    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);242    const flipper = await deployFlipper(web3, owner);243    const helpers = contractHelpers(web3, owner);244245    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;246    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();247    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});248    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;249    250    await helpers.methods.removeSponsor(flipper.options.address).send();251    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;252  });253254  itWeb3('Remove sponsor event', async ({api, web3, privateKeyWrapper}) => {255    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);256    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);257    const flipper = await deployFlipper(web3, owner);258    const helpers = contractHelpers(web3, owner);259260    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();261    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});262    263    const result = await helpers.methods.removeSponsor(flipper.options.address).send();264    const events = normalizeEvents(result.events);265    expect(events).to.be.deep.equal([266      {267        address: flipper.options.address,268        event: 'ContractSponsorRemoved',269        args: {270          contractAddress: flipper.options.address,271        },272      },273    ]);274275    await expectSubstrateEventsAtBlock(276      api, 277      result.blockNumber,278      'evmContractHelpers',279      ['ContractSponsorRemoved'],280    );281  });282283  itWeb3('Sponsor can not be removed by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {284    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);285    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);286    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);287    const flipper = await deployFlipper(web3, owner);288    const helpers = contractHelpers(web3, owner);289290    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;291    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();292    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});293    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;294    295    await expect(helpers.methods.removeSponsor(flipper.options.address).call({from: notOwner})).to.be.rejectedWith('NoPermission');296    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;297  });298299  itWeb3('In generous mode, non-allowlisted user transaction will be sponsored', async ({api, web3, privateKeyWrapper}) => {300    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);301    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);302    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);303304    const flipper = await deployFlipper(web3, owner);305306    const helpers = contractHelpers(web3, owner);307308    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();309    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});310311    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: owner});312    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});313314    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);315    const callerBalanceBefore = await ethBalanceViaSub(api, caller);316317    await flipper.methods.flip().send({from: caller});318    expect(await flipper.methods.getValue().call()).to.be.true;319320    // Balance should be taken from sponsor instead of caller321    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);322    const callerBalanceAfter = await ethBalanceViaSub(api, caller);323    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;324    expect(callerBalanceAfter).to.be.eq(callerBalanceBefore);325  });326327  itWeb3('In generous mode, non-allowlisted user transaction will be self sponsored', async ({api, web3, privateKeyWrapper}) => {328    const alice = privateKeyWrapper('//Alice');329330    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);331    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);332333    const flipper = await deployFlipper(web3, owner);334335    const helpers = contractHelpers(web3, owner);336337    await helpers.methods.selfSponsoredEnable(flipper.options.address).send();338339    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: owner});340    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});341342    await transferBalanceToEth(api, alice, flipper.options.address);343344    const contractBalanceBefore = await ethBalanceViaSub(api, flipper.options.address);345    const callerBalanceBefore = await ethBalanceViaSub(api, caller);346347    await flipper.methods.flip().send({from: caller});348    expect(await flipper.methods.getValue().call()).to.be.true;349350    // Balance should be taken from sponsor instead of caller351    const contractBalanceAfter = await ethBalanceViaSub(api, flipper.options.address);352    const callerBalanceAfter = await ethBalanceViaSub(api, caller);353    expect(contractBalanceAfter < contractBalanceBefore).to.be.true;354    expect(callerBalanceAfter).to.be.eq(callerBalanceBefore);355  });356357  itWeb3('Sponsoring is set, an address that has no UNQ can send a transaction and it works. Sponsor balance should decrease (allowlisted)', async ({api, web3, privateKeyWrapper}) => {358    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);359    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);360    const caller = createEthAccount(web3);361362    const flipper = await deployFlipper(web3, owner);363364    const helpers = contractHelpers(web3, owner);365    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});366    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});367368    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});369    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});370371    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();372    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});373374    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);375    expect(sponsorBalanceBefore).to.be.not.equal('0');376377    await flipper.methods.flip().send({from: caller});378    expect(await flipper.methods.getValue().call()).to.be.true;379380    // Balance should be taken from flipper instead of caller381    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);382    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;383  });384385  itWeb3('Sponsoring is set, an address that has no UNQ can send a transaction and it works. Sponsor balance should not decrease (non-allowlisted)', async ({api, web3, privateKeyWrapper}) => {386    const alice = privateKeyWrapper('//Alice');387388    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);389    const caller = createEthAccount(web3);390391    const flipper = await deployFlipper(web3, owner);392393    const helpers = contractHelpers(web3, owner);394395    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});396    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});397398    await transferBalanceToEth(api, alice, flipper.options.address);399400    const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);401    expect(originalFlipperBalance).to.be.not.equal('0');402403    await expect(flipper.methods.flip().send({from: caller})).to.be.rejectedWith(/InvalidTransaction::Payment/);404    expect(await flipper.methods.getValue().call()).to.be.false;405406    // Balance should be taken from flipper instead of caller407    const balanceAfter = await web3.eth.getBalance(flipper.options.address);408    expect(+balanceAfter).to.be.equals(+originalFlipperBalance);409  });410411  itWeb3('Sponsoring is set, an address that has UNQ can send a transaction and it works. User balance should not change', async ({api, web3, privateKeyWrapper}) => {412    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);413    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);414    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);415416    const flipper = await deployFlipper(web3, owner);417418    const helpers = contractHelpers(web3, owner);419    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});420    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});421422    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});423    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});424425    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();426    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});427428    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);429    const callerBalanceBefore = await ethBalanceViaSub(api, caller);430431    await flipper.methods.flip().send({from: caller});432    expect(await flipper.methods.getValue().call()).to.be.true;433434    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);435    const callerBalanceAfter = await ethBalanceViaSub(api, caller);436    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;437    expect(callerBalanceAfter).to.be.equals(callerBalanceBefore);438  });439440  itWeb3('Sponsoring is limited, with setContractRateLimit. The limitation is working if transactions are sent more often, the sender pays the commission.', async ({api, web3, privateKeyWrapper}) => {441    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);442    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);443    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);444    const originalCallerBalance = await web3.eth.getBalance(caller);445446    const flipper = await deployFlipper(web3, owner);447448    const helpers = contractHelpers(web3, owner);449    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});450    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});451452    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});453    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 10).send({from: owner});454455    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();456    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});457458    const originalFlipperBalance = await web3.eth.getBalance(sponsor);459    expect(originalFlipperBalance).to.be.not.equal('0');460461    await flipper.methods.flip().send({from: caller});462    expect(await flipper.methods.getValue().call()).to.be.true;463    expect(await web3.eth.getBalance(caller)).to.be.equals(originalCallerBalance);464465    const newFlipperBalance = await web3.eth.getBalance(sponsor);466    expect(newFlipperBalance).to.be.not.equals(originalFlipperBalance);467468    await flipper.methods.flip().send({from: caller});469    expect(await web3.eth.getBalance(sponsor)).to.be.equal(newFlipperBalance);470    expect(await web3.eth.getBalance(caller)).to.be.not.equals(originalCallerBalance);471  });472473  // TODO: Find a way to calculate default rate limit474  itWeb3('Default rate limit equals 7200', async ({api, web3, privateKeyWrapper}) => {475    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);476    const flipper = await deployFlipper(web3, owner);477    const helpers = contractHelpers(web3, owner);478    expect(await helpers.methods.getSponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');479  });480});
after · tests/src/eth/contractSponsoring.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import * as solc from 'solc';18import {expect} from 'chai';19import {expectSubstrateEventsAtBlock} from '../util/helpers';20import Web3 from 'web3';2122import {23  contractHelpers,24  createEthAccountWithBalance,25  transferBalanceToEth,26  deployFlipper,27  itWeb3,28  SponsoringMode,29  createEthAccount,30  ethBalanceViaSub,31  normalizeEvents,32  CompiledContract,33  GAS_ARGS,34  subToEth,35} from './util/helpers';36import { submitTransactionAsync } from '../substrate/substrate-api';3738describe('Sponsoring EVM contracts', () => {39  itWeb3('Self sponsored can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {40    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);41    const flipper = await deployFlipper(web3, owner);42    const helpers = contractHelpers(web3, owner);43    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;44    await expect(helpers.methods.selfSponsoredEnable(flipper.options.address).send()).to.be.not.rejected;45    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;46  });4748  itWeb3('Set self sponsored events', async ({api, web3, privateKeyWrapper}) => {49    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);50    const flipper = await deployFlipper(web3, owner);51    const helpers = contractHelpers(web3, owner);52    53    const result = await helpers.methods.selfSponsoredEnable(flipper.options.address).send();54    // console.log(result);55    const ethEvents = normalizeEvents(result.events);56    expect(ethEvents).to.be.deep.equal([57      {58        address: flipper.options.address,59        event: 'ContractSponsorSet',60        args: {61          contractAddress: flipper.options.address,62          sponsor: flipper.options.address,63        },64      },65      {66        address: flipper.options.address,67        event: 'ContractSponsorshipConfirmed',68        args: {69          contractAddress: flipper.options.address,70          sponsor: flipper.options.address,71        },72      },73    ]);7475    await expectSubstrateEventsAtBlock(76      api, 77      result.blockNumber,78      'evmContractHelpers',79      ['ContractSponsorSet','ContractSponsorshipConfirmed'],80    );81  });8283  itWeb3('Self sponsored can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {84    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);85    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);86    const flipper = await deployFlipper(web3, owner);87    const helpers = contractHelpers(web3, owner);88    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;89    await expect(helpers.methods.selfSponsoredEnable(flipper.options.address).call({from: notOwner})).to.be.rejectedWith('NoPermission');90    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;91  });9293  itWeb3('Sponsoring can be set by the address that has deployed the contract', async ({api, web3, privateKeyWrapper}) => {94    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);95    const flipper = await deployFlipper(web3, owner);96    const helpers = contractHelpers(web3, owner);97    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;98    await expect(helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner})).to.be.not.rejected;99    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.true;100  });101102  itWeb3('Sponsoring cannot be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {103    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);104    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);105    const flipper = await deployFlipper(web3, owner);106    const helpers = contractHelpers(web3, owner);107    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;108    await expect(helpers.methods.setSponsoringMode(notOwner, SponsoringMode.Allowlisted).call({from: notOwner})).to.be.rejectedWith('NoPermission');109    expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;110  });111  112  itWeb3('Sponsor can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {113    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);114    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);115    const flipper = await deployFlipper(web3, owner);116    const helpers = contractHelpers(web3, owner);117    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;118    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;119    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.true;120  });121  122  itWeb3('Set sponsor event', async ({api, web3, privateKeyWrapper}) => {123    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);124    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);125    const flipper = await deployFlipper(web3, owner);126    const helpers = contractHelpers(web3, owner);127    128    const result = await helpers.methods.setSponsor(flipper.options.address, sponsor).send();129    const events = normalizeEvents(result.events);130    expect(events).to.be.deep.equal([131      {132        address: flipper.options.address,133        event: 'ContractSponsorSet',134        args: {135          contractAddress: flipper.options.address,136          sponsor: sponsor,137        },138      },139    ]);140141    await expectSubstrateEventsAtBlock(142      api, 143      result.blockNumber,144      'evmContractHelpers',145      ['ContractSponsorSet'],146    );147  });148  149  itWeb3('Sponsor can not be set by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {150    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);151    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);152    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);153    const flipper = await deployFlipper(web3, owner);154    const helpers = contractHelpers(web3, owner);155    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;156    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).call({from: notOwner})).to.be.rejectedWith('NoPermission');157    expect(await helpers.methods.hasPendingSponsor(flipper.options.address).call()).to.be.false;158  });159160  itWeb3('Sponsorship can be confirmed by the address that pending as sponsor', async ({api, web3, privateKeyWrapper}) => {161    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);162    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);163    const flipper = await deployFlipper(web3, owner);164    const helpers = contractHelpers(web3, owner);165    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;166    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;167    await expect(helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor})).to.be.not.rejected;168    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;169  });170171  itWeb3('Confirm sponsorship event', async ({api, web3, privateKeyWrapper}) => {172    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);173    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);174    const flipper = await deployFlipper(web3, owner);175    const helpers = contractHelpers(web3, owner);176    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;177    const result = await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});178    const events = normalizeEvents(result.events);179    expect(events).to.be.deep.equal([180      {181        address: flipper.options.address,182        event: 'ContractSponsorshipConfirmed',183        args: {184          contractAddress: flipper.options.address,185          sponsor: sponsor,186        },187      },188    ]);189190    await expectSubstrateEventsAtBlock(191      api, 192      result.blockNumber,193      'evmContractHelpers',194      ['ContractSponsorshipConfirmed'],195    );196  });197198  itWeb3('Sponsorship can not be confirmed by the address that not pending as sponsor', async ({api, web3, privateKeyWrapper}) => {199    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);200    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);201    const notSponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);202    const flipper = await deployFlipper(web3, owner);203    const helpers = contractHelpers(web3, owner);204    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;205    await expect(helpers.methods.setSponsor(flipper.options.address, sponsor).send()).to.be.not.rejected;206    await expect(helpers.methods.confirmSponsorship(flipper.options.address).call({from: notSponsor})).to.be.rejectedWith('NoPermission');207    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;208  });209210  itWeb3('Sponsorship can not be confirmed by the address that not set as sponsor', async ({api, web3, privateKeyWrapper}) => {211    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);212    const notSponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);213    const flipper = await deployFlipper(web3, owner);214    const helpers = contractHelpers(web3, owner);215    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;216    await expect(helpers.methods.confirmSponsorship(flipper.options.address).call({from: notSponsor})).to.be.rejectedWith('NoPendingSponsor');217    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;218  });219220  itWeb3('Get self sponsored sponsor', async ({api, web3, privateKeyWrapper}) => {221    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);222    const flipper = await deployFlipper(web3, owner);223    const helpers = contractHelpers(web3, owner);224    await helpers.methods.selfSponsoredEnable(flipper.options.address).send();225    226    const result = await helpers.methods.getSponsor(flipper.options.address).call();227228    expect(result[0]).to.be.eq(flipper.options.address);229    expect(result[1]).to.be.eq('0');230  });231232  itWeb3('Get confirmed sponsor', async ({api, web3, privateKeyWrapper}) => {233    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);234    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);235    const flipper = await deployFlipper(web3, owner);236    const helpers = contractHelpers(web3, owner);237    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();238    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});239    240    const result = await helpers.methods.getSponsor(flipper.options.address).call();241242    expect(result[0]).to.be.eq(sponsor);243    expect(result[1]).to.be.eq('0');244  });245246  itWeb3('Sponsor can be removed by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {247    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);248    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);249    const flipper = await deployFlipper(web3, owner);250    const helpers = contractHelpers(web3, owner);251252    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;253    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();254    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});255    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;256    257    await helpers.methods.removeSponsor(flipper.options.address).send();258    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;259  });260261  itWeb3('Remove sponsor event', async ({api, web3, privateKeyWrapper}) => {262    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);263    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);264    const flipper = await deployFlipper(web3, owner);265    const helpers = contractHelpers(web3, owner);266267    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();268    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});269    270    const result = await helpers.methods.removeSponsor(flipper.options.address).send();271    const events = normalizeEvents(result.events);272    expect(events).to.be.deep.equal([273      {274        address: flipper.options.address,275        event: 'ContractSponsorRemoved',276        args: {277          contractAddress: flipper.options.address,278        },279      },280    ]);281282    await expectSubstrateEventsAtBlock(283      api, 284      result.blockNumber,285      'evmContractHelpers',286      ['ContractSponsorRemoved'],287    );288  });289290  itWeb3('Sponsor can not be removed by the address that did not deployed the contract', async ({api, web3, privateKeyWrapper}) => {291    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);292    const notOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);293    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);294    const flipper = await deployFlipper(web3, owner);295    const helpers = contractHelpers(web3, owner);296297    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.false;298    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();299    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});300    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;301    302    await expect(helpers.methods.removeSponsor(flipper.options.address).call({from: notOwner})).to.be.rejectedWith('NoPermission');303    expect(await helpers.methods.hasSponsor(flipper.options.address).call()).to.be.true;304  });305306  itWeb3('In generous mode, non-allowlisted user transaction will be sponsored', async ({api, web3, privateKeyWrapper}) => {307    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);308    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);309    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);310311    const flipper = await deployFlipper(web3, owner);312313    const helpers = contractHelpers(web3, owner);314315    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();316    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});317318    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: owner});319    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});320321    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);322    const callerBalanceBefore = await ethBalanceViaSub(api, caller);323324    await flipper.methods.flip().send({from: caller});325    expect(await flipper.methods.getValue().call()).to.be.true;326327    // Balance should be taken from sponsor instead of caller328    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);329    const callerBalanceAfter = await ethBalanceViaSub(api, caller);330    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;331    expect(callerBalanceAfter).to.be.eq(callerBalanceBefore);332  });333334  itWeb3('In generous mode, non-allowlisted user transaction will be self sponsored', async ({api, web3, privateKeyWrapper}) => {335    const alice = privateKeyWrapper('//Alice');336337    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);338    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);339340    const flipper = await deployFlipper(web3, owner);341342    const helpers = contractHelpers(web3, owner);343344    await helpers.methods.selfSponsoredEnable(flipper.options.address).send();345346    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: owner});347    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});348349    await transferBalanceToEth(api, alice, flipper.options.address);350351    const contractBalanceBefore = await ethBalanceViaSub(api, flipper.options.address);352    const callerBalanceBefore = await ethBalanceViaSub(api, caller);353354    await flipper.methods.flip().send({from: caller});355    expect(await flipper.methods.getValue().call()).to.be.true;356357    // Balance should be taken from sponsor instead of caller358    const contractBalanceAfter = await ethBalanceViaSub(api, flipper.options.address);359    const callerBalanceAfter = await ethBalanceViaSub(api, caller);360    expect(contractBalanceAfter < contractBalanceBefore).to.be.true;361    expect(callerBalanceAfter).to.be.eq(callerBalanceBefore);362  });363364  itWeb3('Sponsoring is set, an address that has no UNQ can send a transaction and it works. Sponsor balance should decrease (allowlisted)', async ({api, web3, privateKeyWrapper}) => {365    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);366    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);367    const caller = createEthAccount(web3);368369    const flipper = await deployFlipper(web3, owner);370371    const helpers = contractHelpers(web3, owner);372    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});373    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});374375    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});376    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});377378    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();379    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});380381    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);382    expect(sponsorBalanceBefore).to.be.not.equal('0');383384    await flipper.methods.flip().send({from: caller});385    expect(await flipper.methods.getValue().call()).to.be.true;386387    // Balance should be taken from flipper instead of caller388    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);389    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;390  });391392  itWeb3('Sponsoring is set, an address that has no UNQ can send a transaction and it works. Sponsor balance should not decrease (non-allowlisted)', async ({api, web3, privateKeyWrapper}) => {393    const alice = privateKeyWrapper('//Alice');394395    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);396    const caller = createEthAccount(web3);397398    const flipper = await deployFlipper(web3, owner);399400    const helpers = contractHelpers(web3, owner);401402    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});403    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});404405    await transferBalanceToEth(api, alice, flipper.options.address);406407    const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);408    expect(originalFlipperBalance).to.be.not.equal('0');409410    await expect(flipper.methods.flip().send({from: caller})).to.be.rejectedWith(/InvalidTransaction::Payment/);411    expect(await flipper.methods.getValue().call()).to.be.false;412413    // Balance should be taken from flipper instead of caller414    const balanceAfter = await web3.eth.getBalance(flipper.options.address);415    expect(+balanceAfter).to.be.equals(+originalFlipperBalance);416  });417418  itWeb3('Sponsoring is set, an address that has UNQ can send a transaction and it works. User balance should not change', async ({api, web3, privateKeyWrapper}) => {419    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);420    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);421    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);422423    const flipper = await deployFlipper(web3, owner);424425    const helpers = contractHelpers(web3, owner);426    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});427    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});428429    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});430    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});431432    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();433    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});434435    const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);436    const callerBalanceBefore = await ethBalanceViaSub(api, caller);437438    await flipper.methods.flip().send({from: caller});439    expect(await flipper.methods.getValue().call()).to.be.true;440441    const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);442    const callerBalanceAfter = await ethBalanceViaSub(api, caller);443    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;444    expect(callerBalanceAfter).to.be.equals(callerBalanceBefore);445  });446447  itWeb3('Sponsoring is limited, with setContractRateLimit. The limitation is working if transactions are sent more often, the sender pays the commission.', async ({api, web3, privateKeyWrapper}) => {448    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);449    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);450    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);451    const originalCallerBalance = await web3.eth.getBalance(caller);452453    const flipper = await deployFlipper(web3, owner);454455    const helpers = contractHelpers(web3, owner);456    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});457    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});458459    await helpers.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Allowlisted).send({from: owner});460    await helpers.methods.setSponsoringRateLimit(flipper.options.address, 10).send({from: owner});461462    await helpers.methods.setSponsor(flipper.options.address, sponsor).send();463    await helpers.methods.confirmSponsorship(flipper.options.address).send({from: sponsor});464465    const originalFlipperBalance = await web3.eth.getBalance(sponsor);466    expect(originalFlipperBalance).to.be.not.equal('0');467468    await flipper.methods.flip().send({from: caller});469    expect(await flipper.methods.getValue().call()).to.be.true;470    expect(await web3.eth.getBalance(caller)).to.be.equals(originalCallerBalance);471472    const newFlipperBalance = await web3.eth.getBalance(sponsor);473    expect(newFlipperBalance).to.be.not.equals(originalFlipperBalance);474475    await flipper.methods.flip().send({from: caller});476    expect(await web3.eth.getBalance(sponsor)).to.be.equal(newFlipperBalance);477    expect(await web3.eth.getBalance(caller)).to.be.not.equals(originalCallerBalance);478  });479480  // TODO: Find a way to calculate default rate limit481  itWeb3('Default rate limit equals 7200', async ({api, web3, privateKeyWrapper}) => {482    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);483    const flipper = await deployFlipper(web3, owner);484    const helpers = contractHelpers(web3, owner);485    expect(await helpers.methods.getSponsoringRateLimit(flipper.options.address).call()).to.be.equals('7200');486  });487});488489describe('Sponsoring Fee Limit', () => {490491  let testContract: CompiledContract;492  493  function compileTestContract() {494    if (!testContract) {495      const input = {496        language: 'Solidity',497        sources: {498          ['TestContract.sol']: {499            content:500            `501            // SPDX-License-Identifier: MIT502            pragma solidity ^0.8.0;503            504            contract TestContract {505              event Result(bool);506              function test1() public {507                uint256 counter = 0;508                while(true) {509                  counter ++;510                }511                emit Result(true);512              }513514              function test2() public {515                uint256 counter = 0;516                while(true) {517                  counter ++;518                  if (counter > 1){519                    break;520                  }521                }522                emit Result(true);523              }524            }525            `,526          },527        },528        settings: {529          outputSelection: {530            '*': {531              '*': ['*'],532            },533          },534        },535      };536      const json = JSON.parse(solc.compile(JSON.stringify(input)));537      const out = json.contracts['TestContract.sol']['TestContract'];538  539      testContract = {540        abi: out.abi,541        object: '0x' + out.evm.bytecode.object,542      };543    }544    return testContract;545  }546  547  async function deployTestContract(web3: Web3, owner: string) {548    const compiled = compileTestContract();549    const testContract = new web3.eth.Contract(compiled.abi, undefined, {550      data: compiled.object,551      from: owner,552      ...GAS_ARGS,553    });554    return await testContract.deploy({data: compiled.object}).send({from: owner});555  }556557  itWeb3('Default fee limit', async ({api, web3, privateKeyWrapper}) => {558    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);559    const flipper = await deployFlipper(web3, owner);560    const helpers = contractHelpers(web3, owner);561    expect(await helpers.methods.getSponsoringFeeLimit(flipper.options.address).call()).to.be.equals('340282366920938463463374607431768211455');562  });563564  itWeb3('Set fee limit', async ({api, web3, privateKeyWrapper}) => {565    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);566    const flipper = await deployFlipper(web3, owner);567    const helpers = contractHelpers(web3, owner);568    await helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send();569    expect(await helpers.methods.getSponsoringFeeLimit(flipper.options.address).call()).to.be.equals('100');570  });571572  itWeb3('Negative test - set fee limit by non-owner', async ({api, web3, privateKeyWrapper}) => {573    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);574    const stranger = await createEthAccountWithBalance(api, web3, privateKeyWrapper);575    const flipper = await deployFlipper(web3, owner);576    const helpers = contractHelpers(web3, owner);577    await expect(helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send({from: stranger})).to.be.rejected;578  });579580  itWeb3('Negative test - check that eth transactions exceeding fee limit are not executed', async ({api, web3, privateKeyWrapper}) => {581    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);582    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);583    const user = await createEthAccountWithBalance(api, web3, privateKeyWrapper);584585    const testContract = await deployTestContract(web3, owner);586    const helpers = contractHelpers(web3, owner);587    588    await helpers.methods.setSponsoringMode(testContract.options.address, SponsoringMode.Generous).send({from: owner});589    await helpers.methods.setSponsoringRateLimit(testContract.options.address, 0).send({from: owner});590    591    await helpers.methods.setSponsor(testContract.options.address, sponsor).send();592    await helpers.methods.confirmSponsorship(testContract.options.address).send({from: sponsor});593594    const gasPrice = BigInt(await web3.eth.getGasPrice());595596    await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 30000n * gasPrice).send();597598    const originalUserBalance = await web3.eth.getBalance(user);599    await testContract.methods.test2().send({from: user, gas: 30000});600    expect(await web3.eth.getBalance(user)).to.be.equal(originalUserBalance);601602    await testContract.methods.test2().send({from: user, gas: 40000});603    expect(await web3.eth.getBalance(user)).to.not.be.equal(originalUserBalance);604  });605606  itWeb3('Negative test - check that evm.call transactions exceeding fee limit are not executed', async ({api, web3, privateKeyWrapper}) => {607    const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);608    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);609610    const testContract = await deployTestContract(web3, owner);611    const helpers = contractHelpers(web3, owner);612    613    await helpers.methods.setSponsoringMode(testContract.options.address, SponsoringMode.Generous).send({from: owner});614    await helpers.methods.setSponsoringRateLimit(testContract.options.address, 0).send({from: owner});615    616    await helpers.methods.setSponsor(testContract.options.address, sponsor).send();617    await helpers.methods.confirmSponsorship(testContract.options.address).send({from: sponsor});618619    const gasPrice = BigInt(await web3.eth.getGasPrice());620621    await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 30000n * gasPrice).send();622623    const alice = privateKeyWrapper('//Alice');624    const originalAliceBalance = (await api.query.system.account(alice.address)).data.free.toBigInt();625    626    await submitTransactionAsync(627      alice,628      api.tx.evm.call(629        subToEth(alice.address),630        testContract.options.address,631        testContract.methods.test2().encodeABI(),632        Uint8Array.from([]),633        30000n,634        gasPrice,635        null,636        null,637        [],638      ),639    );640    expect((await api.query.system.account(alice.address)).data.free.toBigInt()).to.be.equal(originalAliceBalance);641    642    await submitTransactionAsync(643      alice,644      api.tx.evm.call(645        subToEth(alice.address),646        testContract.options.address,647        testContract.methods.test2().encodeABI(),648        Uint8Array.from([]),649        40000n,650        gasPrice,651        null,652        null,653        [],654      ),655    );656    expect((await api.query.system.account(alice.address)).data.free.toBigInt()).to.not.be.equal(originalAliceBalance);657  });658});
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/util/contractHelpersAbi.json
+++ b/tests/src/eth/util/contractHelpersAbi.json
@@ -134,6 +134,19 @@
         "type": "address"
       }
     ],
+    "name": "getSponsoringFeeLimit",
+    "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      }
+    ],
     "name": "getSponsoringRateLimit",
     "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
     "stateMutability": "view",
@@ -212,6 +225,20 @@
         "name": "contractAddress",
         "type": "address"
       },
+      { "internalType": "uint128", "name": "feeLimit", "type": "uint128" }
+    ],
+    "name": "setSponsoringFeeLimit",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "contractAddress",
+        "type": "address"
+      },
       { "internalType": "uint8", "name": "mode", "type": "uint8" }
     ],
     "name": "setSponsoringMode",