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
117version = "0.1.0"117version = "0.1.0"
118dependencies = [118dependencies = [
119 "pallet-common",119 "pallet-common",
120 "pallet-evm",120 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
121 "parity-scale-codec 3.1.5",121 "parity-scale-codec 3.1.5",
122 "sp-api",122 "sp-api",
123 "sp-core",123 "sp-core",
2324[[package]]2324[[package]]
2325name = "fc-consensus"2325name = "fc-consensus"
2326version = "2.0.0-dev"2326version = "2.0.0-dev"
2327source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2327source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2328dependencies = [2328dependencies = [
2329 "async-trait",2329 "async-trait",
2330 "fc-db",2330 "fc-db",
2343[[package]]2343[[package]]
2344name = "fc-db"2344name = "fc-db"
2345version = "2.0.0-dev"2345version = "2.0.0-dev"
2346source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2346source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2347dependencies = [2347dependencies = [
2348 "fp-storage",2348 "fp-storage",
2349 "kvdb-rocksdb",2349 "kvdb-rocksdb",
2359[[package]]2359[[package]]
2360name = "fc-mapping-sync"2360name = "fc-mapping-sync"
2361version = "2.0.0-dev"2361version = "2.0.0-dev"
2362source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2362source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2363dependencies = [2363dependencies = [
2364 "fc-db",2364 "fc-db",
2365 "fp-consensus",2365 "fp-consensus",
2376[[package]]2376[[package]]
2377name = "fc-rpc"2377name = "fc-rpc"
2378version = "2.0.0-dev"2378version = "2.0.0-dev"
2379source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2379source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2380dependencies = [2380dependencies = [
2381 "ethereum",2381 "ethereum",
2382 "ethereum-types",2382 "ethereum-types",
2416[[package]]2416[[package]]
2417name = "fc-rpc-core"2417name = "fc-rpc-core"
2418version = "1.1.0-dev"2418version = "1.1.0-dev"
2419source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2419source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2420dependencies = [2420dependencies = [
2421 "ethereum",2421 "ethereum",
2422 "ethereum-types",2422 "ethereum-types",
2557[[package]]2557[[package]]
2558name = "fp-consensus"2558name = "fp-consensus"
2559version = "2.0.0-dev"2559version = "2.0.0-dev"
2560source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2560source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2561dependencies = [2561dependencies = [
2562 "ethereum",2562 "ethereum",
2563 "parity-scale-codec 3.1.5",2563 "parity-scale-codec 3.1.5",
2580 "sp-std",2580 "sp-std",
2581]2581]
2582
2583[[package]]
2584name = "fp-evm"
2585version = "3.0.0-dev"
2586source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2587dependencies = [
2588 "evm",
2589 "frame-support",
2590 "impl-trait-for-tuples",
2591 "parity-scale-codec 3.1.5",
2592 "serde",
2593 "sp-core",
2594 "sp-std",
2595]
25822596
2583[[package]]2597[[package]]
2584name = "fp-evm-mapping"2598name = "fp-evm-mapping"
2589 "sp-core",2603 "sp-core",
2590]2604]
2605
2606[[package]]
2607name = "fp-evm-mapping"
2608version = "0.1.0"
2609source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2610dependencies = [
2611 "frame-support",
2612 "sp-core",
2613]
25912614
2592[[package]]2615[[package]]
2593name = "fp-rpc"2616name = "fp-rpc"
2594version = "3.0.0-dev"2617version = "3.0.0-dev"
2595source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2618source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2596dependencies = [2619dependencies = [
2597 "ethereum",2620 "ethereum",
2598 "ethereum-types",2621 "ethereum-types",
2599 "fp-evm",2622 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
2600 "parity-scale-codec 3.1.5",2623 "parity-scale-codec 3.1.5",
2601 "scale-info",2624 "scale-info",
2602 "sp-api",2625 "sp-api",
2609[[package]]2632[[package]]
2610name = "fp-self-contained"2633name = "fp-self-contained"
2611version = "1.0.0-dev"2634version = "1.0.0-dev"
2612source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2635source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2613dependencies = [2636dependencies = [
2614 "ethereum",2637 "ethereum",
2615 "frame-support",2638 "frame-support",
2625[[package]]2648[[package]]
2626name = "fp-storage"2649name = "fp-storage"
2627version = "2.0.0"2650version = "2.0.0"
2628source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2651source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
2629dependencies = [2652dependencies = [
2630 "parity-scale-codec 3.1.5",2653 "parity-scale-codec 3.1.5",
2631]2654]
5152 "cumulus-primitives-utility",5175 "cumulus-primitives-utility",
5153 "derivative",5176 "derivative",
5154 "evm-coder",5177 "evm-coder",
5155 "fp-evm-mapping",5178 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5156 "fp-rpc",5179 "fp-rpc",
5157 "fp-self-contained",5180 "fp-self-contained",
5158 "frame-benchmarking",5181 "frame-benchmarking",
5172 "pallet-common",5195 "pallet-common",
5173 "pallet-configuration",5196 "pallet-configuration",
5174 "pallet-ethereum",5197 "pallet-ethereum",
5175 "pallet-evm",5198 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5176 "pallet-evm-coder-substrate",5199 "pallet-evm-coder-substrate",
5177 "pallet-evm-contract-helpers",5200 "pallet-evm-contract-helpers",
5178 "pallet-evm-migration",5201 "pallet-evm-migration",
5320 "frame-system",5343 "frame-system",
5321 "pallet-balances",5344 "pallet-balances",
5322 "pallet-common",5345 "pallet-common",
5323 "pallet-evm",5346 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
5324 "pallet-evm-contract-helpers",5347 "pallet-evm-contract-helpers",
5325 "pallet-evm-migration",5348 "pallet-evm-migration",
5326 "pallet-randomness-collective-flip",5349 "pallet-randomness-collective-flip",
5445[[package]]5468[[package]]
5446name = "pallet-base-fee"5469name = "pallet-base-fee"
5447version = "1.0.0"5470version = "1.0.0"
5448source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"5471source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
5449dependencies = [5472dependencies = [
5450 "fp-evm",5473 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5451 "frame-support",5474 "frame-support",
5452 "frame-system",5475 "frame-system",
5453 "parity-scale-codec 3.1.5",5476 "parity-scale-codec 3.1.5",
5556dependencies = [5579dependencies = [
5557 "ethereum",5580 "ethereum",
5558 "evm-coder",5581 "evm-coder",
5559 "fp-evm-mapping",5582 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5560 "frame-benchmarking",5583 "frame-benchmarking",
5561 "frame-support",5584 "frame-support",
5562 "frame-system",5585 "frame-system",
5563 "pallet-evm",5586 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5564 "pallet-evm-coder-substrate",5587 "pallet-evm-coder-substrate",
5565 "parity-scale-codec 3.1.5",5588 "parity-scale-codec 3.1.5",
5566 "scale-info",5589 "scale-info",
5575name = "pallet-configuration"5598name = "pallet-configuration"
5576version = "0.1.1"5599version = "0.1.1"
5577dependencies = [5600dependencies = [
5578 "fp-evm",5601 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5579 "frame-support",5602 "frame-support",
5580 "frame-system",5603 "frame-system",
5581 "parity-scale-codec 3.1.5",5604 "parity-scale-codec 3.1.5",
5660[[package]]5683[[package]]
5661name = "pallet-ethereum"5684name = "pallet-ethereum"
5662version = "4.0.0-dev"5685version = "4.0.0-dev"
5663source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"5686source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
5664dependencies = [5687dependencies = [
5665 "ethereum",5688 "ethereum",
5666 "ethereum-types",5689 "ethereum-types",
5667 "evm",5690 "evm",
5668 "fp-consensus",5691 "fp-consensus",
5669 "fp-evm",5692 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5670 "fp-evm-mapping",5693 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5671 "fp-rpc",5694 "fp-rpc",
5672 "fp-self-contained",5695 "fp-self-contained",
5673 "fp-storage",5696 "fp-storage",
5674 "frame-support",5697 "frame-support",
5675 "frame-system",5698 "frame-system",
5676 "log",5699 "log",
5677 "pallet-evm",5700 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5678 "pallet-timestamp",5701 "pallet-timestamp",
5679 "parity-scale-codec 3.1.5",5702 "parity-scale-codec 3.1.5",
5680 "rlp",5703 "rlp",
5692source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"5715source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
5693dependencies = [5716dependencies = [
5694 "evm",5717 "evm",
5695 "fp-evm",5718 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
5696 "fp-evm-mapping",5719 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
5697 "frame-benchmarking",5720 "frame-benchmarking",
5698 "frame-support",5721 "frame-support",
5699 "frame-system",5722 "frame-system",
5713 "sp-std",5736 "sp-std",
5714]5737]
5738
5739[[package]]
5740name = "pallet-evm"
5741version = "6.0.0-dev"
5742source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
5743dependencies = [
5744 "evm",
5745 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5746 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5747 "frame-benchmarking",
5748 "frame-support",
5749 "frame-system",
5750 "hex",
5751 "impl-trait-for-tuples",
5752 "log",
5753 "pallet-timestamp",
5754 "parity-scale-codec 3.1.5",
5755 "primitive-types",
5756 "rlp",
5757 "scale-info",
5758 "serde",
5759 "sha3 0.10.2",
5760 "sp-core",
5761 "sp-io",
5762 "sp-runtime",
5763 "sp-std",
5764]
57155765
5716[[package]]5766[[package]]
5717name = "pallet-evm-coder-substrate"5767name = "pallet-evm-coder-substrate"
5723 "frame-support",5773 "frame-support",
5724 "frame-system",5774 "frame-system",
5725 "pallet-ethereum",5775 "pallet-ethereum",
5726 "pallet-evm",5776 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5727 "parity-scale-codec 3.1.5",5777 "parity-scale-codec 3.1.5",
5728 "scale-info",5778 "scale-info",
5729 "sp-core",5779 "sp-core",
5737dependencies = [5787dependencies = [
5738 "ethereum",5788 "ethereum",
5739 "evm-coder",5789 "evm-coder",
5740 "fp-evm-mapping",5790 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5741 "frame-support",5791 "frame-support",
5742 "frame-system",5792 "frame-system",
5743 "log",5793 "log",
5744 "pallet-common",5794 "pallet-common",
5745 "pallet-evm",5795 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5746 "pallet-evm-coder-substrate",5796 "pallet-evm-coder-substrate",
5747 "parity-scale-codec 3.1.5",5797 "parity-scale-codec 3.1.5",
5748 "scale-info",5798 "scale-info",
5757name = "pallet-evm-migration"5807name = "pallet-evm-migration"
5758version = "0.1.1"5808version = "0.1.1"
5759dependencies = [5809dependencies = [
5760 "fp-evm",5810 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5761 "frame-benchmarking",5811 "frame-benchmarking",
5762 "frame-support",5812 "frame-support",
5763 "frame-system",5813 "frame-system",
5764 "pallet-evm",5814 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5765 "parity-scale-codec 3.1.5",5815 "parity-scale-codec 3.1.5",
5766 "scale-info",5816 "scale-info",
5767 "sp-core",5817 "sp-core",
5774name = "pallet-evm-transaction-payment"5824name = "pallet-evm-transaction-payment"
5775version = "0.1.1"5825version = "0.1.1"
5776dependencies = [5826dependencies = [
5777 "fp-evm",5827 "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5778 "fp-evm-mapping",5828 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5779 "frame-support",5829 "frame-support",
5780 "frame-system",5830 "frame-system",
5781 "pallet-ethereum",5831 "pallet-ethereum",
5782 "pallet-evm",5832 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5783 "parity-scale-codec 3.1.5",5833 "parity-scale-codec 3.1.5",
5784 "scale-info",5834 "scale-info",
5785 "sp-core",5835 "sp-core",
5799 "frame-support",5849 "frame-support",
5800 "frame-system",5850 "frame-system",
5801 "pallet-common",5851 "pallet-common",
5802 "pallet-evm",5852 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
5803 "pallet-evm-coder-substrate",5853 "pallet-evm-coder-substrate",
5804 "pallet-structure",5854 "pallet-structure",
5805 "parity-scale-codec 3.1.5",5855 "parity-scale-codec 3.1.5",
6041 "frame-support",6091 "frame-support",
6042 "frame-system",6092 "frame-system",
6043 "pallet-common",6093 "pallet-common",
6044 "pallet-evm",6094 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
6045 "pallet-evm-coder-substrate",6095 "pallet-evm-coder-substrate",
6046 "pallet-structure",6096 "pallet-structure",
6047 "parity-scale-codec 3.1.5",6097 "parity-scale-codec 3.1.5",
6164 "frame-support",6214 "frame-support",
6165 "frame-system",6215 "frame-system",
6166 "pallet-common",6216 "pallet-common",
6167 "pallet-evm",6217 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
6168 "pallet-evm-coder-substrate",6218 "pallet-evm-coder-substrate",
6169 "pallet-structure",6219 "pallet-structure",
6170 "parity-scale-codec 3.1.5",6220 "parity-scale-codec 3.1.5",
6185 "frame-support",6235 "frame-support",
6186 "frame-system",6236 "frame-system",
6187 "pallet-common",6237 "pallet-common",
6188 "pallet-evm",6238 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
6189 "pallet-nonfungible",6239 "pallet-nonfungible",
6190 "pallet-structure",6240 "pallet-structure",
6191 "parity-scale-codec 3.1.5",6241 "parity-scale-codec 3.1.5",
6205 "frame-support",6255 "frame-support",
6206 "frame-system",6256 "frame-system",
6207 "pallet-common",6257 "pallet-common",
6208 "pallet-evm",6258 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
6209 "pallet-nonfungible",6259 "pallet-nonfungible",
6210 "pallet-rmrk-core",6260 "pallet-rmrk-core",
6211 "parity-scale-codec 3.1.5",6261 "parity-scale-codec 3.1.5",
6335 "frame-support",6385 "frame-support",
6336 "frame-system",6386 "frame-system",
6337 "pallet-common",6387 "pallet-common",
6338 "pallet-evm",6388 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
6339 "parity-scale-codec 3.1.5",6389 "parity-scale-codec 3.1.5",
6340 "scale-info",6390 "scale-info",
6341 "sp-std",6391 "sp-std",
6359[[package]]6409[[package]]
6360name = "pallet-template-transaction-payment"6410name = "pallet-template-transaction-payment"
6361version = "3.0.0"6411version = "3.0.0"
6362source = "git+https://github.com/uniquenetwork/pallet-sponsoring?branch=polkadot-v0.9.27#853766d6033ceb68a2bef196790b962dd0663a04"6412source = "git+https://github.com/uniquenetwork/pallet-sponsoring?rev=a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3#a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3"
6363dependencies = [6413dependencies = [
6364 "frame-benchmarking",6414 "frame-benchmarking",
6365 "frame-support",6415 "frame-support",
6482 "frame-support",6532 "frame-support",
6483 "frame-system",6533 "frame-system",
6484 "pallet-common",6534 "pallet-common",
6485 "pallet-evm",6535 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
6486 "pallet-evm-coder-substrate",6536 "pallet-evm-coder-substrate",
6487 "pallet-nonfungible",6537 "pallet-nonfungible",
6488 "pallet-refungible",6538 "pallet-refungible",
8385 "cumulus-primitives-utility",8435 "cumulus-primitives-utility",
8386 "derivative",8436 "derivative",
8387 "evm-coder",8437 "evm-coder",
8388 "fp-evm-mapping",8438 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
8389 "fp-rpc",8439 "fp-rpc",
8390 "fp-self-contained",8440 "fp-self-contained",
8391 "frame-benchmarking",8441 "frame-benchmarking",
8405 "pallet-common",8455 "pallet-common",
8406 "pallet-configuration",8456 "pallet-configuration",
8407 "pallet-ethereum",8457 "pallet-ethereum",
8408 "pallet-evm",8458 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
8409 "pallet-evm-coder-substrate",8459 "pallet-evm-coder-substrate",
8410 "pallet-evm-contract-helpers",8460 "pallet-evm-contract-helpers",
8411 "pallet-evm-migration",8461 "pallet-evm-migration",
11650version = "0.1.1"11700version = "0.1.1"
11651dependencies = [11701dependencies = [
11652 "evm-coder",11702 "evm-coder",
11653 "fp-evm-mapping",11703 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
11654 "frame-support",11704 "frame-support",
11655 "frame-system",11705 "frame-system",
11656 "pallet-balances",11706 "pallet-balances",
11657 "pallet-common",11707 "pallet-common",
11658 "pallet-ethereum",11708 "pallet-ethereum",
11659 "pallet-evm",11709 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
11660 "pallet-evm-coder-substrate",11710 "pallet-evm-coder-substrate",
11661 "pallet-fungible",11711 "pallet-fungible",
11662 "pallet-nonfungible",11712 "pallet-nonfungible",
12153 "app-promotion-rpc",12203 "app-promotion-rpc",
12154 "jsonrpsee",12204 "jsonrpsee",
12155 "pallet-common",12205 "pallet-common",
12156 "pallet-evm",12206 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
12157 "parity-scale-codec 3.1.5",12207 "parity-scale-codec 3.1.5",
12158 "rmrk-rpc",12208 "rmrk-rpc",
12159 "sp-api",12209 "sp-api",
12379 "cumulus-primitives-utility",12429 "cumulus-primitives-utility",
12380 "derivative",12430 "derivative",
12381 "evm-coder",12431 "evm-coder",
12382 "fp-evm-mapping",12432 "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
12383 "fp-rpc",12433 "fp-rpc",
12384 "fp-self-contained",12434 "fp-self-contained",
12385 "frame-benchmarking",12435 "frame-benchmarking",
12399 "pallet-common",12449 "pallet-common",
12400 "pallet-configuration",12450 "pallet-configuration",
12401 "pallet-ethereum",12451 "pallet-ethereum",
12402 "pallet-evm",12452 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
12403 "pallet-evm-coder-substrate",12453 "pallet-evm-coder-substrate",
12404 "pallet-evm-contract-helpers",12454 "pallet-evm-contract-helpers",
12405 "pallet-evm-migration",12455 "pallet-evm-migration",
12485dependencies = [12535dependencies = [
12486 "fp-rpc",12536 "fp-rpc",
12487 "frame-support",12537 "frame-support",
12488 "pallet-evm",12538 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
12489 "sp-consensus-aura",12539 "sp-consensus-aura",
12490 "sp-core",12540 "sp-core",
12491 "sp-runtime",12541 "sp-runtime",
12499 "derivative",12549 "derivative",
12500 "frame-support",12550 "frame-support",
12501 "frame-system",12551 "frame-system",
12502 "pallet-evm",12552 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
12503 "parity-scale-codec 3.1.5",12553 "parity-scale-codec 3.1.5",
12504 "rmrk-traits",12554 "rmrk-traits",
12505 "scale-info",12555 "scale-info",
12515version = "0.1.3"12565version = "0.1.3"
12516dependencies = [12566dependencies = [
12517 "pallet-common",12567 "pallet-common",
12518 "pallet-evm",12568 "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
12519 "parity-scale-codec 3.1.5",12569 "parity-scale-codec 3.1.5",
12520 "sp-api",12570 "sp-api",
12521 "sp-core",12571 "sp-core",
12527[[package]]12577[[package]]
12528name = "up-sponsorship"12578name = "up-sponsorship"
12529version = "0.1.0"12579version = "0.1.0"
12530source = "git+https://github.com/uniquenetwork/pallet-sponsoring?branch=polkadot-v0.9.27#853766d6033ceb68a2bef196790b962dd0663a04"12580source = "git+https://github.com/uniquenetwork/pallet-sponsoring?rev=a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3#a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3"
12531dependencies = [12581dependencies = [
12532 "impl-trait-for-tuples",12582 "impl-trait-for-tuples",
12533]12583]
modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
19sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }19sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
20sp-rpc = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }20sp-rpc = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
21sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }21sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
2323
modifiednode/cli/Cargo.tomldiffbeforeafterboth
309jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }309jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }
310tokio = { version = "1.19.2", features = ["time"] }310tokio = { version = "1.19.2", features = ["time"] }
311311
312fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }312fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
313fc-consensus = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }313fc-consensus = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
314fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }314fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
315fc-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }315fc-rpc = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
316fc-db = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }316fc-db = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
317fp-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }317fp-rpc = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
318pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }318pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
319319
320unique-rpc = { default-features = false, path = "../rpc" }320unique-rpc = { default-features = false, path = "../rpc" }
321app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}321app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
40substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }40substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
41tokio = { version = "1.19.2", features = ["macros", "sync"] }41tokio = { version = "1.19.2", features = ["macros", "sync"] }
4242
43pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }43pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
44fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }44fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
45fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }45fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
46fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }46fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
47fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }47fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
48fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }48fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
49fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }49fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
5050
51pallet-common = { default-features = false, path = "../../pallets/common" }51pallet-common = { default-features = false, path = "../../pallets/common" }
52up-common = { path = "../../primitives/common" }52up-common = { path = "../../primitives/common" }
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
19frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }19frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
20fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }20fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
21up-data-structs = { default-features = false, path = '../../primitives/data-structs' }21up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
22pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }22pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
23evm-coder = { default-features = false, path = '../../crates/evm-coder' }23evm-coder = { default-features = false, path = '../../crates/evm-coder' }
24ethereum = { version = "0.12.0", default-features = false }24ethereum = { version = "0.12.0", default-features = false }
25pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }25pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
2626
27serde = { version = "1.0.130", default-features = false }27serde = { version = "1.0.130", default-features = false }
28scale-info = { version = "2.0.1", default-features = false, features = [28scale-info = { version = "2.0.1", default-features = false, features = [
modifiedpallets/configuration/Cargo.tomldiffbeforeafterboth
16sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }16sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
17sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }17sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
18sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }18sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
19fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }19fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
20smallvec = "1.6.1"20smallvec = "1.6.1"
2121
22[features]22[features]
modifiedpallets/evm-coder-substrate/Cargo.tomldiffbeforeafterboth
12sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }12sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
13ethereum = { version = "0.12.0", default-features = false }13ethereum = { version = "0.12.0", default-features = false }
14evm-coder = { default-features = false, path = "../../crates/evm-coder" }14evm-coder = { default-features = false, path = "../../crates/evm-coder" }
15pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }15pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
16pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }16pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
17frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }17frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
18frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }18frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
19frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }19frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
modifiedpallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth
19sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }19sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
2020
21# Unique21# Unique
22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
23fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }23fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
24up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }24up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
2525
26# Locals26# Locals
27evm-coder = { default-features = false, path = '../../crates/evm-coder' }27evm-coder = { default-features = false, path = '../../crates/evm-coder' }
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
25 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,25 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,
26 account::CrossAccountId,26 account::CrossAccountId,
27};27};
28use sp_core::H160;28use sp_core::{H160, U256};
29use up_data_structs::SponsorshipState;29use up_data_structs::SponsorshipState;
30use crate::{30use crate::{
31 AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringRateLimit, SponsoringModeT,31 AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringFeeLimit,
32 Sponsoring,32 SponsoringRateLimit, SponsoringModeT, Sponsoring,
33};33};
34use frame_support::traits::Get;34use frame_support::traits::Get;
250 Ok(())250 Ok(())
251 }251 }
252
253 fn set_sponsoring_fee_limit(
254 &mut self,
255 caller: caller,
256 contract_address: address,
257 fee_limit: uint128,
258 ) -> Result<void> {
259 <Pallet<T>>::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::<T>)?;
260 <Pallet<T>>::set_sponsoring_fee_limit(contract_address, fee_limit.into());
261 Ok(())
262 }
263
264 fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint128> {
265 Ok(<SponsoringFeeLimit<T>>::get(contract_address)
266 .try_into()
267 .map_err(|_| "fee limit > u128::MAX")?)
268 }
252269
253 /// Is specified user present in contract allow list270 /// Is specified user present in contract allow list
254 /// @dev Contract owner always implicitly included271 /// @dev Contract owner always implicitly included
363380
364/// Bridge to pallet-sponsoring381/// Bridge to pallet-sponsoring
365pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);382pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);
366impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)>383impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>), u128>
367 for HelpersContractSponsoring<T>384 for HelpersContractSponsoring<T>
368{385{
369 fn get_sponsor(who: &T::CrossAccountId, call: &(H160, Vec<u8>)) -> Option<T::CrossAccountId> {386 fn get_sponsor(
387 who: &T::CrossAccountId,
388 call: &(H160, Vec<u8>),
389 fee_limit: &u128,
390 ) -> Option<T::CrossAccountId> {
370 let (contract_address, _) = call;391 let (contract_address, _) = call;
371 let mode = <Pallet<T>>::sponsoring_mode(*contract_address);392 let mode = <Pallet<T>>::sponsoring_mode(*contract_address);
394 }415 }
395 }416 }
417
418 let sponsored_fee_limit = <SponsoringFeeLimit<T>>::get(contract_address);
419
420 if *fee_limit > sponsored_fee_limit {
421 return None;
422 }
396423
397 <SponsorBasket<T>>::insert(contract_address, who.as_eth(), block_number);424 <SponsorBasket<T>>::insert(contract_address, who.as_eth(), block_number);
398425
modifiedpallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth
48 /// In case of enabled sponsoring, but no sponsoring rate limit set,48 /// In case of enabled sponsoring, but no sponsoring rate limit set,
49 /// this value will be used implicitly49 /// this value will be used implicitly
50 type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;50 type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;
51 /// In case of enabled sponsoring, but no sponsoring fee limit set,
52 /// this value will be used implicitly
53 type DefaultSponsoringFeeLimit: Get<u128>;
51 }54 }
5255
53 #[pallet::error]56 #[pallet::error]
118 /// * **Key2** - sponsored user address.121 /// * **Key2** - sponsored user address.
119 /// * **Value** - last sponsored block number.122 /// * **Value** - last sponsored block number.
120 #[pallet::storage]123 #[pallet::storage]
121 pub(super) type SponsorBasket<T: Config> = StorageDoubleMap<124 pub(super) type SponsoringFeeLimit<T: Config> = StorageMap<
125 Hasher = Twox128,
126 Key = H160,
127 Value = u128,
128 QueryKind = ValueQuery,
129 OnEmpty = T::DefaultSponsoringFeeLimit,
130 >;
131
132 #[pallet::storage]
133 pub(super) type SponsorBasket<T: Config> = StorageDoubleMap<
122 Hasher1 = Twox128,134 Hasher1 = Twox128,
123 Key1 = H160,135 Key1 = H160,
124 Hasher2 = Twox128,136 Hasher2 = Twox128,
353 <SponsoringRateLimit<T>>::insert(contract, rate_limit);365 <SponsoringRateLimit<T>>::insert(contract, rate_limit);
354 }366 }
367
368 /// Set maximum for gas limit of transaction
369 pub fn set_sponsoring_fee_limit(contract: H160, fee_limit: u128) {
370 <SponsoringFeeLimit<T>>::insert(contract, fee_limit);
371 }
355372
356 /// Is user added to allowlist, or he is owner of specified contract373 /// Is user added to allowlist, or he is owner of specified contract
357 pub fn allowed(contract: H160, user: H160) -> bool {374 pub fn allowed(contract: H160, user: H160) -> bool {
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth
203 dummy = 0;203 dummy = 0;
204 }204 }
205
206 /// @dev EVM selector for this function is: 0x1c362eb4,
207 /// or in textual repr: setSponsoringFeeLimit(address,uint128)
208 function setSponsoringFeeLimit(address contractAddress, uint128 feeLimit)
209 public
210 {
211 require(false, stub_error);
212 contractAddress;
213 feeLimit;
214 dummy = 0;
215 }
216
217 /// @dev EVM selector for this function is: 0xc3fdc9ee,
218 /// or in textual repr: getSponsoringFeeLimit(address)
219 function getSponsoringFeeLimit(address contractAddress)
220 public
221 view
222 returns (uint128)
223 {
224 require(false, stub_error);
225 contractAddress;
226 dummy;
227 return 0;
228 }
205229
206 /// Is specified user present in contract allow list230 /// Is specified user present in contract allow list
207 /// @dev Contract owner always implicitly included231 /// @dev Contract owner always implicitly included
modifiedpallets/evm-migration/Cargo.tomldiffbeforeafterboth
15sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }15sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
16sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }16sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
17sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }17sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
18pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }18pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
19fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }19fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
2020
21[dependencies.codec]21[dependencies.codec]
22default-features = false22default-features = false
modifiedpallets/evm-transaction-payment/Cargo.tomldiffbeforeafterboth
14sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }14sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
15sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }15sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
16sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }16sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
17pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }17pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
18fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }18fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
19pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }19pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
20up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }20up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev = "a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
21fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }21fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
2222
23[dependencies.codec]23[dependencies.codec]
24default-features = false24default-features = false
modifiedpallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth
22use fp_evm::WithdrawReason;22use fp_evm::WithdrawReason;
23use frame_support::traits::IsSubType;23use frame_support::traits::IsSubType;
24pub use pallet::*;24pub use pallet::*;
25use pallet_evm::{EnsureAddressOrigin, account::CrossAccountId};25use pallet_evm::{account::CrossAccountId, EnsureAddressOrigin, FeeCalculator};
26use sp_core::H160;26use sp_core::{H160, U256};
27use sp_runtime::{TransactionOutcome, DispatchError};27use sp_runtime::{TransactionOutcome, DispatchError};
28use up_sponsorship::SponsorshipHandler;28use up_sponsorship::SponsorshipHandler;
2929
36 #[pallet::config]36 #[pallet::config]
37 pub trait Config: frame_system::Config + pallet_evm::account::Config {37 pub trait Config: frame_system::Config + pallet_evm::account::Config {
38 /// Loosly-coupled handlers for evm call sponsoring38 /// Loosly-coupled handlers for evm call sponsoring
39 type EvmSponsorshipHandler: SponsorshipHandler<Self::CrossAccountId, (H160, Vec<u8>)>;39 type EvmSponsorshipHandler: SponsorshipHandler<Self::CrossAccountId, (H160, Vec<u8>), u128>;
40 }40 }
4141
42 #[pallet::pallet]42 #[pallet::pallet]
49impl<T: Config> fp_evm::TransactionValidityHack<T::CrossAccountId> for TransactionValidityHack<T> {49impl<T: Config> fp_evm::TransactionValidityHack<T::CrossAccountId> for TransactionValidityHack<T> {
50 fn who_pays_fee(origin: H160, reason: &WithdrawReason) -> Option<T::CrossAccountId> {50 fn who_pays_fee(
51 origin: H160,
52 max_fee: U256,
53 reason: &WithdrawReason,
54 ) -> Option<T::CrossAccountId> {
51 match reason {55 match reason {
52 WithdrawReason::Call { target, input } => {56 WithdrawReason::Call { target, input } => {
53 let origin_sub = T::CrossAccountId::from_eth(origin);57 let origin_sub = T::CrossAccountId::from_eth(origin);
54 T::EvmSponsorshipHandler::get_sponsor(&origin_sub, &(*target, input.clone()))58 T::EvmSponsorshipHandler::get_sponsor(
59 &origin_sub,
60 &(*target, input.clone()),
61 &max_fee.as_u128(),
62 )
55 }63 }
56 _ => None,64 _ => None,
6068
61/// Implements sponsoring for evm calls performed from pallet-evm (via api.tx.ethereum.transact/api.tx.evm.call)69/// Implements sponsoring for evm calls performed from pallet-evm (via api.tx.ethereum.transact/api.tx.evm.call)
62pub struct BridgeSponsorshipHandler<T>(PhantomData<T>);70pub struct BridgeSponsorshipHandler<T>(PhantomData<T>);
63impl<T, C> SponsorshipHandler<T::AccountId, C> for BridgeSponsorshipHandler<T>71impl<T, C> SponsorshipHandler<T::AccountId, C, u128> for BridgeSponsorshipHandler<T>
64where72where
65 T: Config + pallet_evm::Config,73 T: Config + pallet_evm::Config,
66 C: IsSubType<pallet_evm::Call<T>>,74 C: IsSubType<pallet_evm::Call<T>>,
67{75{
68 fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {76 fn get_sponsor(who: &T::AccountId, call: &C, _fee_limit: &u128) -> Option<T::AccountId> {
69 match call.is_sub_type()? {77 match call.is_sub_type()? {
70 pallet_evm::Call::call {78 pallet_evm::Call::call {
71 source,79 source,
72 target,80 target,
73 input,81 input,
82 gas_limit,
83 max_fee_per_gas,
74 ..84 ..
75 } => {85 } => {
76 let _ = T::CallOrigin::ensure_address_origin(86 let _ = T::CallOrigin::ensure_address_origin(
79 )89 )
80 .ok()?;90 .ok()?;
81 let who = T::CrossAccountId::from_sub(who.clone());91 let who = T::CrossAccountId::from_sub(who.clone());
92 let max_fee = max_fee_per_gas.saturating_mul((*gas_limit).into());
82 // Effects from EvmSponsorshipHandler are applied by pallet_evm::runner93 // Effects from EvmSponsorshipHandler are applied by pallet_evm::runner
83 // TODO: Should we implement simulation mode (test, but do not apply effects) in `up-sponsorship`?94 // TODO: Should we implement simulation mode (test, but do not apply effects) in `up-sponsorship`?
84 let sponsor = frame_support::storage::with_transaction(|| {95 let sponsor = frame_support::storage::with_transaction(|| {
85 TransactionOutcome::Rollback(Ok::<_, DispatchError>(96 TransactionOutcome::Rollback(Ok::<_, DispatchError>(
86 T::EvmSponsorshipHandler::get_sponsor(&who, &(*target, input.clone())),97 T::EvmSponsorshipHandler::get_sponsor(
98 &who,
99 &(*target, input.clone()),
100 &max_fee.try_into().unwrap(),
101 ),
87 ))102 ))
88 })103 })
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
23pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }23pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
24ethereum = { version = "0.12.0", default-features = false }24ethereum = { version = "0.12.0", default-features = false }
25frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }25frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
26pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }26pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
27scale-info = { version = "2.0.1", default-features = false, features = [27scale-info = { version = "2.0.1", default-features = false, features = [
28 "derive",28 "derive",
29] }29] }
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
20pallet-common = { default-features = false, path = '../common' }20pallet-common = { default-features = false, path = '../common' }
21pallet-structure = { default-features = false, path = '../structure' }21pallet-structure = { default-features = false, path = '../structure' }
22up-data-structs = { default-features = false, path = '../../primitives/data-structs' }22up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
modifiedpallets/proxy-rmrk-core/Cargo.tomldiffbeforeafterboth
20pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }20pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
21pallet-structure = { default-features = false, path = "../../pallets/structure" }21pallet-structure = { default-features = false, path = "../../pallets/structure" }
22up-data-structs = { default-features = false, path = '../../primitives/data-structs' }22up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
23pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }23pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
24frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }24frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
25rmrk-traits = { default-features = false, path = "../../primitives/rmrk-traits" }25rmrk-traits = { default-features = false, path = "../../primitives/rmrk-traits" }
26scale-info = { version = "2.0.1", default-features = false, features = [26scale-info = { version = "2.0.1", default-features = false, features = [
modifiedpallets/proxy-rmrk-equip/Cargo.tomldiffbeforeafterboth
19pallet-common = { default-features = false, path = '../common' }19pallet-common = { default-features = false, path = '../common' }
20pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }20pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
21up-data-structs = { default-features = false, path = '../../primitives/data-structs' }21up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
23frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }23frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
24rmrk-traits = { default-features = false, path = "../../primitives/rmrk-traits" }24rmrk-traits = { default-features = false, path = "../../primitives/rmrk-traits" }
25scale-info = { version = "2.0.1", default-features = false, features = [25scale-info = { version = "2.0.1", default-features = false, features = [
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
20evm-coder = { default-features = false, path = '../../crates/evm-coder' }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }
21pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }21pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
22pallet-common = { default-features = false, path = '../common' }22pallet-common = { default-features = false, path = '../common' }
modifiedpallets/scheduler/Cargo.tomldiffbeforeafterboth
24sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.27' }24sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.27' }
25frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }25frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
2626
27up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.27" }27up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
28log = { version = "0.4.14", default-features = false }28log = { version = "0.4.14", default-features = false }
2929
30[dev-dependencies]30[dev-dependencies]
modifiedpallets/structure/Cargo.tomldiffbeforeafterboth
16 "derive",16 "derive",
17] }17] }
18up-data-structs = { path = "../../primitives/data-structs", default-features = false }18up-data-structs = { path = "../../primitives/data-structs", default-features = false }
19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
2020
21[features]21[features]
22default = ["std"]22default = ["std"]
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
98scale-info = { version = "2.0.1", default-features = false, features = [98scale-info = { version = "2.0.1", default-features = false, features = [
99 "derive",99 "derive",
100] }100] }
101pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }101pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
102pallet-common = { default-features = false, path = "../common" }102pallet-common = { default-features = false, path = "../common" }
103evm-coder = { default-features = false, path = '../../crates/evm-coder' }103evm-coder = { default-features = false, path = '../../crates/evm-coder' }
104pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }104pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
modifiedprimitives/common/Cargo.tomldiffbeforeafterboth
48[dependencies.fp-rpc]48[dependencies.fp-rpc]
49default-features = false49default-features = false
50git = "https://github.com/uniquenetwork/frontier"50git = "https://github.com/uniquenetwork/frontier"
51branch = "unique-polkadot-v0.9.27"51rev = "89a37c5a489f426cc7a42d7b94019974093a052d"
5252
53[dependencies.pallet-evm]53[dependencies.pallet-evm]
54default-features = false54default-features = false
55git = "https://github.com/uniquenetwork/frontier"55git = "https://github.com/uniquenetwork/frontier"
56branch = "unique-polkadot-v0.9.27"56rev = "89a37c5a489f426cc7a42d7b94019974093a052d"
5757
modifiedprimitives/data-structs/Cargo.tomldiffbeforeafterboth
25sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }25sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
26derivative = { version = "2.2.0", features = ["use_core"] }26derivative = { version = "2.2.0", features = ["use_core"] }
27struct-versioning = { path = "../../crates/struct-versioning" }27struct-versioning = { path = "../../crates/struct-versioning" }
28pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }28pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
29rmrk-traits = { default-features = false, path = "../rmrk-traits" }29rmrk-traits = { default-features = false, path = "../rmrk-traits" }
3030
31[features]31[features]
modifiedprimitives/rpc/Cargo.tomldiffbeforeafterboth
14sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }14sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
15sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }15sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
17pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }17pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
1818
19[features]19[features]
20default = ["std"]20default = ["std"]
modifiedruntime/common/config/ethereum.rsdiffbeforeafterboth
9 runtime_common::{9 runtime_common::{
10 dispatch::CollectionDispatchT, ethereum::sponsoring::EvmSponsorshipHandler,10 dispatch::CollectionDispatchT,
11 ethereum::sponsoring::EvmSponsorshipHandler,
11 config::sponsoring::DefaultSponsoringRateLimit, DealWithFees,12 config::sponsoring::{DefaultSponsoringFeeLimit, DefaultSponsoringRateLimit},
13 DealWithFees,
12 },14 },
13 Runtime, Aura, Balances, Event, ChainId,15 Runtime, Aura, Balances, Event, ChainId,
115 type Event = Event;117 type Event = Event;
116 type ContractAddress = HelpersContractAddress;118 type ContractAddress = HelpersContractAddress;
117 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;119 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
120 type DefaultSponsoringFeeLimit = DefaultSponsoringFeeLimit;
118}121}
119122
120impl pallet_evm_coder_substrate::Config for Runtime {}123impl pallet_evm_coder_substrate::Config for Runtime {}
modifiedruntime/common/config/sponsoring.rsdiffbeforeafterboth
2323
24parameter_types! {24parameter_types! {
25 pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;25 pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;
26 pub const DefaultSponsoringFeeLimit: u128 = u128::MAX;
26}27}
2728
28type SponsorshipHandler = (29type SponsorshipHandler = (
modifiedruntime/common/ethereum/sponsoring.rsdiffbeforeafterboth
4444
45pub struct UniqueEthSponsorshipHandler<T: UniqueConfig>(PhantomData<*const T>);45pub struct UniqueEthSponsorshipHandler<T: UniqueConfig>(PhantomData<*const T>);
46impl<T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig>46impl<T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig>
47 SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)> for UniqueEthSponsorshipHandler<T>47 SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>), u128> for UniqueEthSponsorshipHandler<T>
48{48{
49 fn get_sponsor(who: &T::CrossAccountId, call: &(H160, Vec<u8>)) -> Option<T::CrossAccountId> {49 fn get_sponsor(
50 who: &T::CrossAccountId,
51 call: &(H160, Vec<u8>),
52 _fee_limit: &u128,
53 ) -> Option<T::CrossAccountId> {
50 let collection_id = map_eth_to_id(&call.0)?;54 let collection_id = map_eth_to_id(&call.0)?;
51 let collection = <CollectionHandle<T>>::new(collection_id)?;55 let collection = <CollectionHandle<T>>::new(collection_id)?;
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth

no syntactic changes

modifiedruntime/common/sponsoring.rsdiffbeforeafterboth
224}224}
225225
226pub struct UniqueSponsorshipHandler<T>(PhantomData<T>);226pub struct UniqueSponsorshipHandler<T>(PhantomData<T>);
227impl<T, C> SponsorshipHandler<T::AccountId, C> for UniqueSponsorshipHandler<T>227impl<T, C> SponsorshipHandler<T::AccountId, C, u128> for UniqueSponsorshipHandler<T>
228where228where
229 T: Config,229 T: Config,
230 C: IsSubType<UniqueCall<T>>,230 C: IsSubType<UniqueCall<T>>,
231{231{
232 fn get_sponsor(who: &T::AccountId, call: &C) -> Option<T::AccountId> {232 fn get_sponsor(who: &T::AccountId, call: &C, _fee_limit: &u128) -> Option<T::AccountId> {
233 match IsSubType::<UniqueCall<T>>::is_sub_type(call)? {233 match IsSubType::<UniqueCall<T>>::is_sub_type(call)? {
234 UniqueCall::set_token_properties {234 UniqueCall::set_token_properties {
235 collection_id,235 collection_id,
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
417up-rpc = { path = "../../primitives/rpc", default-features = false }417up-rpc = { path = "../../primitives/rpc", default-features = false }
418app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}418app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
419rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }419rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
420fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }420fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
421pallet-inflation = { path = '../../pallets/inflation', default-features = false }421pallet-inflation = { path = '../../pallets/inflation', default-features = false }
422pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }422pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
423up-data-structs = { path = '../../primitives/data-structs', default-features = false }423up-data-structs = { path = '../../primitives/data-structs', default-features = false }
431pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }431pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
432pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }432pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
433# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }433# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
434pallet-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" }434pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
435pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }435pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
436pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }436pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
437pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }437pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
438pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }438pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
439pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }439pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
440pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }440pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
441pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }441pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
442fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }442fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
443fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }443fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
444evm-coder = { default-features = false, path = '../../crates/evm-coder' }444evm-coder = { default-features = false, path = '../../crates/evm-coder' }
445up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.27' }445up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
446446
447################################################################################447################################################################################
448# Build Dependencies448# Build Dependencies
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
418pallet-unique = { path = '../../pallets/unique', default-features = false }418pallet-unique = { path = '../../pallets/unique', default-features = false }
419up-rpc = { path = "../../primitives/rpc", default-features = false }419up-rpc = { path = "../../primitives/rpc", default-features = false }
420app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}420app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false}
421fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }421fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
422pallet-inflation = { path = '../../pallets/inflation', default-features = false }422pallet-inflation = { path = '../../pallets/inflation', default-features = false }
423pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }423pallet-app-promotion = { path = '../../pallets/app-promotion', default-features = false }
424up-data-structs = { path = '../../primitives/data-structs', default-features = false }424up-data-structs = { path = '../../primitives/data-structs', default-features = false }
432pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }432pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
433pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }433pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
434# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }434# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
435pallet-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" }435pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
436pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }436pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
437pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }437pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
438pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }438pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
439pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }439pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
440pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }440pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
441pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }441pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
442pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }442pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
443fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }443fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
444fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }444fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
445evm-coder = { default-features = false, path = '../../crates/evm-coder' }445evm-coder = { default-features = false, path = '../../crates/evm-coder' }
446up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.27' }446up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
447447
448################################################################################448################################################################################
449# Build Dependencies449# Build Dependencies
modifiedruntime/tests/Cargo.tomldiffbeforeafterboth
16sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }16sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
17sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }17sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
1818
19fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }19fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
2020
21frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }21frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
22frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }22frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
25pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }25pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
26pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }26pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
2727
28pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }28pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
29pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }29pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
3030
31pallet-common = { path = '../../pallets/common' }31pallet-common = { path = '../../pallets/common' }
32pallet-structure = { path = '../../pallets/structure' }32pallet-structure = { path = '../../pallets/structure' }
43scale-info = "*"43scale-info = "*"
4444
45evm-coder = { default-features = false, path = '../../crates/evm-coder' }45evm-coder = { default-features = false, path = '../../crates/evm-coder' }
46up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.27' }46up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
4747
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
425pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }425pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
426pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }426pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
427# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }427# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
428pallet-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" }428pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
429pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }429pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
430pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }430pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
431pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }431pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
432pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }432pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
433pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }433pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
434pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }434pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
435pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }435pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
436fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }436fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
437fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }437fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
438fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }438fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
439evm-coder = { default-features = false, path = '../../crates/evm-coder' }439evm-coder = { default-features = false, path = '../../crates/evm-coder' }
440up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.27' }440up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", rev="a8ec4bf8d5ded662d96da6d8fb211b0bbf6617b3" }
441441
442################################################################################442################################################################################
443# Build Dependencies443# Build Dependencies
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
131 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)131 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)
132 external;132 external;
133
134 /// @dev EVM selector for this function is: 0x1c362eb4,
135 /// or in textual repr: setSponsoringFeeLimit(address,uint128)
136 function setSponsoringFeeLimit(address contractAddress, uint128 feeLimit)
137 external;
138
139 /// @dev EVM selector for this function is: 0xc3fdc9ee,
140 /// or in textual repr: getSponsoringFeeLimit(address)
141 function getSponsoringFeeLimit(address contractAddress)
142 external
143 view
144 returns (uint128);
133145
134 /// Is specified user present in contract allow list146 /// Is specified user present in contract allow list
135 /// @dev Contract owner always implicitly included147 /// @dev Contract owner always implicitly included
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import * as solc from 'solc';
17import {expect} from 'chai';18import {expect} from 'chai';
18import {expectSubstrateEventsAtBlock} from '../util/helpers';19import {expectSubstrateEventsAtBlock} from '../util/helpers';
20import Web3 from 'web3';
21
19import {22import {
20 contractHelpers,23 contractHelpers,
26 createEthAccount,29 createEthAccount,
27 ethBalanceViaSub,30 ethBalanceViaSub,
28 normalizeEvents,31 normalizeEvents,
32 CompiledContract,
33 GAS_ARGS,
34 subToEth,
29} from './util/helpers';35} from './util/helpers';
36import { submitTransactionAsync } from '../substrate/substrate-api';
3037
31describe('Sponsoring EVM contracts', () => {38describe('Sponsoring EVM contracts', () => {
32 itWeb3('Self sponsored can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {39 itWeb3('Self sponsored can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {
479 });486 });
480});487});
488
489describe('Sponsoring Fee Limit', () => {
490
491 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: MIT
502 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 }
513
514 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 }
556
557 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 });
563
564 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 });
571
572 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 });
579
580 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);
584
585 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});
593
594 const gasPrice = BigInt(await web3.eth.getGasPrice());
595
596 await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 30000n * gasPrice).send();
597
598 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);
601
602 await testContract.methods.test2().send({from: user, gas: 40000});
603 expect(await web3.eth.getBalance(user)).to.not.be.equal(originalUserBalance);
604 });
605
606 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);
609
610 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});
618
619 const gasPrice = BigInt(await web3.eth.getGasPrice());
620
621 await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 30000n * gasPrice).send();
622
623 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});
481659
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
126 "stateMutability": "view",126 "stateMutability": "view",
127 "type": "function"127 "type": "function"
128 },128 },
129 {
130 "inputs": [
131 {
132 "internalType": "address",
133 "name": "contractAddress",
134 "type": "address"
135 }
136 ],
137 "name": "getSponsoringFeeLimit",
138 "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }],
139 "stateMutability": "view",
140 "type": "function"
141 },
129 {142 {
130 "inputs": [143 "inputs": [
131 {144 {
205 "stateMutability": "nonpayable",218 "stateMutability": "nonpayable",
206 "type": "function"219 "type": "function"
207 },220 },
221 {
222 "inputs": [
223 {
224 "internalType": "address",
225 "name": "contractAddress",
226 "type": "address"
227 },
228 { "internalType": "uint128", "name": "feeLimit", "type": "uint128" }
229 ],
230 "name": "setSponsoringFeeLimit",
231 "outputs": [],
232 "stateMutability": "nonpayable",
233 "type": "function"
234 },
208 {235 {
209 "inputs": [236 "inputs": [
210 {237 {