difftreelog
Merge pull request #570 from UniqueNetwork/feature/sponsoring-fee-limit
in: master
38 files changed
Cargo.lockdiffbeforeafterboth2324[[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?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"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?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"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?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"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?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"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?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"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?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"2561dependencies = [2561dependencies = [2562 "ethereum",2562 "ethereum",2563 "parity-scale-codec 3.1.5",2563 "parity-scale-codec 3.1.5",2569[[package]]2569[[package]]2570name = "fp-evm"2570name = "fp-evm"2571version = "3.0.0-dev"2571version = "3.0.0-dev"2572source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2572source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"2573dependencies = [2573dependencies = [2574 "evm",2574 "evm",2575 "frame-support",2575 "frame-support",2583[[package]]2583[[package]]2584name = "fp-evm-mapping"2584name = "fp-evm-mapping"2585version = "0.1.0"2585version = "0.1.0"2586source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2586source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"2587dependencies = [2587dependencies = [2588 "frame-support",2588 "frame-support",2589 "sp-core",2589 "sp-core",2592[[package]]2592[[package]]2593name = "fp-rpc"2593name = "fp-rpc"2594version = "3.0.0-dev"2594version = "3.0.0-dev"2595source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2595source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"2596dependencies = [2596dependencies = [2597 "ethereum",2597 "ethereum",2598 "ethereum-types",2598 "ethereum-types",2609[[package]]2609[[package]]2610name = "fp-self-contained"2610name = "fp-self-contained"2611version = "1.0.0-dev"2611version = "1.0.0-dev"2612source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2612source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"2613dependencies = [2613dependencies = [2614 "ethereum",2614 "ethereum",2615 "frame-support",2615 "frame-support",2625[[package]]2625[[package]]2626name = "fp-storage"2626name = "fp-storage"2627version = "2.0.0"2627version = "2.0.0"2628source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"2628source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"2629dependencies = [2629dependencies = [2630 "parity-scale-codec 3.1.5",2630 "parity-scale-codec 3.1.5",2631]2631]5445[[package]]5445[[package]]5446name = "pallet-base-fee"5446name = "pallet-base-fee"5447version = "1.0.0"5447version = "1.0.0"5448source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"5448source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"5449dependencies = [5449dependencies = [5450 "fp-evm",5450 "fp-evm",5451 "frame-support",5451 "frame-support",5660[[package]]5660[[package]]5661name = "pallet-ethereum"5661name = "pallet-ethereum"5662version = "4.0.0-dev"5662version = "4.0.0-dev"5663source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"5663source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"5664dependencies = [5664dependencies = [5665 "ethereum",5665 "ethereum",5666 "ethereum-types",5666 "ethereum-types",5689[[package]]5689[[package]]5690name = "pallet-evm"5690name = "pallet-evm"5691version = "6.0.0-dev"5691version = "6.0.0-dev"5692source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"5692source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27-fee-limit#0ae36821312f4a26e7f96225f1b2cb16216cddf5"5693dependencies = [5693dependencies = [5694 "evm",5694 "evm",5695 "fp-evm",5695 "fp-evm",5744 "pallet-common",5744 "pallet-common",5745 "pallet-evm",5745 "pallet-evm",5746 "pallet-evm-coder-substrate",5746 "pallet-evm-coder-substrate",5747 "pallet-evm-transaction-payment",5747 "parity-scale-codec 3.1.5",5748 "parity-scale-codec 3.1.5",5748 "scale-info",5749 "scale-info",5749 "sp-core",5750 "sp-core",client/rpc/Cargo.tomldiffbeforeafterboth19sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }2323client/rpc/src/lib.rsdiffbeforeafterboth577 BlockNumber: Decode + Member + AtLeast32BitUnsigned,577 BlockNumber: Decode + Member + AtLeast32BitUnsigned,578 AccountId: Decode,578 AccountId: Decode,579 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,579 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,580 C::Api: AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,581 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,580 CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,581 C::Api: AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,582{582{583 pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);583 pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);584 pass_method!(total_staked_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>584 pass_method!(total_staked_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>node/cli/Cargo.tomldiffbeforeafterboth309jsonrpsee = { 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"] }311311312fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }312fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }313fc-consensus = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }313fc-consensus = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }314fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }314fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }315fc-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }315fc-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }316fc-db = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }316fc-db = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }317fp-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }317fp-rpc = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }318pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }318pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }319319320unique-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}node/rpc/Cargo.tomldiffbeforeafterboth40substrate-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"] }424243pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }43pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }505051pallet-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" }pallets/app-promotion/Cargo.tomldiffbeforeafterboth52pallet-balances ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }52pallet-balances ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }53pallet-timestamp ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }53pallet-timestamp ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }54pallet-randomness-collective-flip ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }54pallet-randomness-collective-flip ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }55pallet-evm ={ default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }55pallet-evm ={ default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27-fee-limit" }56sp-std ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }56sp-std ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }57sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }57sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }58sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }58sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }pallets/common/Cargo.tomldiffbeforeafterboth17sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }262627serde = { 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 = [pallets/configuration/Cargo.tomldiffbeforeafterboth16sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }20smallvec = "1.6.1"20smallvec = "1.6.1"212122[features]22[features]pallets/evm-coder-substrate/Cargo.tomldiffbeforeafterboth12sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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" }pallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth19sp-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" }202021# Unique21# Unique22pallet-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "polkadot-v0.9.27" }252526# Locals26# Locals27evm-coder = { default-features = false, path = '../../crates/evm-coder' }27evm-coder = { default-features = false, path = '../../crates/evm-coder' }28pallet-common = { default-features = false, path = '../../pallets/common' }28pallet-common = { default-features = false, path = '../../pallets/common' }29pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }29pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }30pallet-evm-transaction-payment = { default-features = false, path = '../../pallets/evm-transaction-payment' }30up-data-structs = { default-features = false, path = '../../primitives/data-structs', features = [31up-data-structs = { default-features = false, path = '../../primitives/data-structs', features = [31 'serde1',32 'serde1',32] }33] }pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth20use evm_coder::{20use evm_coder::{21 abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*, ToLog,21 abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*, ToLog,22};22};23use pallet_evm::{24 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,25 account::CrossAccountId,26};23use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder, dispatch_to_evm};27use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder, dispatch_to_evm};24use pallet_evm::{28use pallet_evm_transaction_payment::CallContext;25 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,26 account::CrossAccountId,27};28use sp_core::H160;29use sp_core::{H160, U256};29use up_data_structs::SponsorshipState;30use up_data_structs::SponsorshipState;30use crate::{31use crate::{31 AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringRateLimit, SponsoringModeT,32 AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringFeeLimit,32 Sponsoring,33 SponsoringRateLimit, SponsoringModeT, Sponsoring,33};34};34use frame_support::traits::Get;35use frame_support::traits::Get;222 }223 }223224224 /// Get current contract sponsoring rate limit225 /// Get current contract sponsoring rate limit225 /// @param contractAddress Contract to get sponsoring mode of226 /// @param contractAddress Contract to get sponsoring rate limit of226 /// @return uint32 Amount of blocks between two sponsored transactions227 /// @return uint32 Amount of blocks between two sponsored transactions227 fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {228 fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {229 self.recorder().consume_sload()?;230228 Ok(<SponsoringRateLimit<T>>::get(contract_address)231 Ok(<SponsoringRateLimit<T>>::get(contract_address)229 .try_into()232 .try_into()250 Ok(())253 Ok(())251 }254 }255256 /// Set contract sponsoring fee limit257 /// @dev Sponsoring fee limit - is maximum fee that could be spent by258 /// single transaction259 /// @param contractAddress Contract to change sponsoring fee limit of260 /// @param feeLimit Fee limit261 /// @dev Only contract owner can change this setting262 fn set_sponsoring_fee_limit(263 &mut self,264 caller: caller,265 contract_address: address,266 fee_limit: uint256,267 ) -> Result<void> {268 self.recorder().consume_sload()?;269 self.recorder().consume_sstore()?;270271 <Pallet<T>>::ensure_owner(contract_address, caller).map_err(dispatch_to_evm::<T>)?;272 <Pallet<T>>::set_sponsoring_fee_limit(contract_address, fee_limit.into())273 .map_err(dispatch_to_evm::<T>)?;274 Ok(())275 }276277 /// Get current contract sponsoring fee limit278 /// @param contractAddress Contract to get sponsoring fee limit of279 /// @return uint256 Maximum amount of fee that could be spent by single280 /// transaction281 fn get_sponsoring_fee_limit(&self, contract_address: address) -> Result<uint256> {282 self.recorder().consume_sload()?;283284 Ok(get_sponsoring_fee_limit::<T>(contract_address))285 }252286253 /// Is specified user present in contract allow list287 /// Is specified user present in contract allow list254 /// @dev Contract owner always implicitly included288 /// @dev Contract owner always implicitly included363397364/// Bridge to pallet-sponsoring398/// Bridge to pallet-sponsoring365pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);399pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);366impl<T: Config> SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)>400impl<T: Config> SponsorshipHandler<T::CrossAccountId, CallContext>367 for HelpersContractSponsoring<T>401 for HelpersContractSponsoring<T>368{402{369 fn get_sponsor(who: &T::CrossAccountId, call: &(H160, Vec<u8>)) -> Option<T::CrossAccountId> {403 fn get_sponsor(404 who: &T::CrossAccountId,405 call_context: &CallContext,406 ) -> Option<T::CrossAccountId> {370 let (contract_address, _) = call;407 let contract_address = call_context.contract_address;371 let mode = <Pallet<T>>::sponsoring_mode(*contract_address);408 let mode = <Pallet<T>>::sponsoring_mode(contract_address);372 if mode == SponsoringModeT::Disabled {409 if mode == SponsoringModeT::Disabled {373 return None;410 return None;374 }411 }375412376 let sponsor = match <Pallet<T>>::get_sponsor(*contract_address) {413 let sponsor = match <Pallet<T>>::get_sponsor(contract_address) {377 Some(sponsor) => sponsor,414 Some(sponsor) => sponsor,378 None => return None,415 None => return None,379 };416 };380417381 if mode == SponsoringModeT::Allowlisted418 if mode == SponsoringModeT::Allowlisted382 && !<Pallet<T>>::allowed(*contract_address, *who.as_eth())419 && !<Pallet<T>>::allowed(contract_address, *who.as_eth())383 {420 {384 return None;421 return None;385 }422 }394 }431 }395 }432 }433434 let sponsored_fee_limit = get_sponsoring_fee_limit::<T>(contract_address);435436 if call_context.max_fee > sponsored_fee_limit {437 return None;438 }396439397 <SponsorBasket<T>>::insert(contract_address, who.as_eth(), block_number);440 <SponsorBasket<T>>::insert(contract_address, who.as_eth(), block_number);398441399 Some(sponsor)442 Some(sponsor)400 }443 }401}444}445446fn get_sponsoring_fee_limit<T: Config>(contract_address: address) -> uint256 {447 <SponsoringFeeLimit<T>>::get(contract_address)448 .get(&0xffffffff)449 .cloned()450 .unwrap_or(U256::MAX)451}402452403generate_stubgen!(contract_helpers_impl, ContractHelpersCall<()>, true);453generate_stubgen!(contract_helpers_impl, ContractHelpersCall<()>, true);404generate_stubgen!(contract_helpers_iface, ContractHelpersCall<()>, false);454generate_stubgen!(contract_helpers_iface, ContractHelpersCall<()>, false);pallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth22pub use pallet::*;22pub use pallet::*;23pub use eth::*;23pub use eth::*;24use scale_info::TypeInfo;24use scale_info::TypeInfo;25use frame_support::storage::bounded_btree_map::BoundedBTreeMap;25pub mod eth;26pub mod eth;2728/// Maximum number of methods per contract that could have fee limit29pub const MAX_FEE_LIMITED_METHODS: u32 = 5;263027#[frame_support::pallet]31#[frame_support::pallet]28pub mod pallet {32pub mod pallet {29 pub use super::*;33 pub use super::*;30 use crate::eth::ContractHelpersEvents;34 use crate::eth::ContractHelpersEvents;31 use frame_support::pallet_prelude::*;35 use frame_support::pallet_prelude::*;32 use pallet_evm_coder_substrate::DispatchResult;36 use pallet_evm_coder_substrate::DispatchResult;33 use sp_core::H160;37 use sp_core::{H160, U256};34 use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};38 use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};35 use up_data_structs::SponsorshipState;39 use up_data_structs::SponsorshipState;36 use evm_coder::ToLog;40 use evm_coder::ToLog;58 /// No pending sponsor for contract.62 /// No pending sponsor for contract.59 NoPendingSponsor,63 NoPendingSponsor,6465 /// Number of methods that sponsored limit is defined for exceeds maximum.66 TooManyMethodsHaveSponsoredLimit,60 }67 }616862 #[pallet::pallet]69 #[pallet::pallet]118 /// * **Key2** - sponsored user address.125 /// * **Key2** - sponsored user address.119 /// * **Value** - last sponsored block number.126 /// * **Value** - last sponsored block number.120 #[pallet::storage]127 #[pallet::storage]121 pub(super) type SponsorBasket<T: Config> = StorageDoubleMap<128 pub(super) type SponsoringFeeLimit<T: Config> = StorageMap<129 Hasher = Twox128,130 Key = H160,131 Value = BoundedBTreeMap<u32, U256, ConstU32<MAX_FEE_LIMITED_METHODS>>,132 QueryKind = ValueQuery,133 >;134135 #[pallet::storage]136 pub(super) type SponsorBasket<T: Config> = StorageDoubleMap<122 Hasher1 = Twox128,137 Hasher1 = Twox128,123 Key1 = H160,138 Key1 = H160,124 Hasher2 = Twox128,139 Hasher2 = Twox128,355 <SponsoringRateLimit<T>>::insert(contract, rate_limit);370 <SponsoringRateLimit<T>>::insert(contract, rate_limit);356 }371 }372373 /// Set maximum for gas limit of transaction374 pub fn set_sponsoring_fee_limit(contract: H160, fee_limit: U256) -> DispatchResult {375 <SponsoringFeeLimit<T>>::try_mutate(contract, |limits_map| {376 limits_map377 .try_insert(0xffffffff, fee_limit)378 .map_err(|_| <Error<T>>::TooManyMethodsHaveSponsoredLimit)379 })?;380 Ok(())381 }357382358 /// Is user added to allowlist, or he is owner of specified contract383 /// Is user added to allowlist, or he is owner of specified contract359 pub fn allowed(contract: H160, user: H160) -> bool {384 pub fn allowed(contract: H160, user: H160) -> bool {pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth32}32}333334/// @title Magic contract, which allows users to reconfigure other contracts34/// @title Magic contract, which allows users to reconfigure other contracts35/// @dev the ERC-165 identifier for this interface is 0xd77fab7035/// @dev the ERC-165 identifier for this interface is 0x172cb4fb36contract ContractHelpers is Dummy, ERC165, ContractHelpersEvents {36contract ContractHelpers is Dummy, ERC165, ContractHelpersEvents {37 /// Get user, which deployed specified contract37 /// Get user, which deployed specified contract38 /// @dev May return zero address in case if contract is deployed38 /// @dev May return zero address in case if contract is deployed171 }171 }172172173 /// Get current contract sponsoring rate limit173 /// Get current contract sponsoring rate limit174 /// @param contractAddress Contract to get sponsoring mode of174 /// @param contractAddress Contract to get sponsoring rate limit of175 /// @return uint32 Amount of blocks between two sponsored transactions175 /// @return uint32 Amount of blocks between two sponsored transactions176 /// @dev EVM selector for this function is: 0x610cfabd,176 /// @dev EVM selector for this function is: 0x610cfabd,177 /// or in textual repr: getSponsoringRateLimit(address)177 /// or in textual repr: getSponsoringRateLimit(address)203 dummy = 0;203 dummy = 0;204 }204 }205206 /// Set contract sponsoring fee limit207 /// @dev Sponsoring fee limit - is maximum fee that could be spent by208 /// single transaction209 /// @param contractAddress Contract to change sponsoring fee limit of210 /// @param feeLimit Fee limit211 /// @dev Only contract owner can change this setting212 /// @dev EVM selector for this function is: 0x03aed665,213 /// or in textual repr: setSponsoringFeeLimit(address,uint256)214 function setSponsoringFeeLimit(address contractAddress, uint256 feeLimit)215 public216 {217 require(false, stub_error);218 contractAddress;219 feeLimit;220 dummy = 0;221 }222223 /// Get current contract sponsoring fee limit224 /// @param contractAddress Contract to get sponsoring fee limit of225 /// @return uint256 Maximum amount of fee that could be spent by single226 /// transaction227 /// @dev EVM selector for this function is: 0xc3fdc9ee,228 /// or in textual repr: getSponsoringFeeLimit(address)229 function getSponsoringFeeLimit(address contractAddress)230 public231 view232 returns (uint256)233 {234 require(false, stub_error);235 contractAddress;236 dummy;237 return 0;238 }205239206 /// Is specified user present in contract allow list240 /// Is specified user present in contract allow list207 /// @dev Contract owner always implicitly included241 /// @dev Contract owner always implicitly includedpallets/evm-migration/Cargo.tomldiffbeforeafterboth15sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }202021[dependencies.codec]21[dependencies.codec]22default-features = false22default-features = falsepallets/evm-transaction-payment/Cargo.tomldiffbeforeafterboth14sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "polkadot-v0.9.27" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }222223[dependencies.codec]23[dependencies.codec]24default-features = false24default-features = falsepallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth22use 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};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;2929333334 use sp_std::vec::Vec;34 use sp_std::vec::Vec;3536 /// Contains call data37 pub struct CallContext {38 /// Contract address39 pub contract_address: H160,40 /// Transaction data41 pub input: Vec<u8>,42 /// Max fee for transaction - gasLimit * gasPrice43 pub max_fee: U256,44 }354536 #[pallet::config]46 #[pallet::config]37 pub trait Config: frame_system::Config + pallet_evm::account::Config {47 pub trait Config: frame_system::Config + pallet_evm::account::Config {38 /// Loosly-coupled handlers for evm call sponsoring48 /// Loosly-coupled handlers for evm call sponsoring39 type EvmSponsorshipHandler: SponsorshipHandler<Self::CrossAccountId, (H160, Vec<u8>)>;49 type EvmSponsorshipHandler: SponsorshipHandler<Self::CrossAccountId, CallContext>;40 }50 }415142 #[pallet::pallet]52 #[pallet::pallet]49impl<T: Config> fp_evm::TransactionValidityHack<T::CrossAccountId> for TransactionValidityHack<T> {59impl<T: Config> fp_evm::TransactionValidityHack<T::CrossAccountId> for TransactionValidityHack<T> {50 fn who_pays_fee(origin: H160, reason: &WithdrawReason) -> Option<T::CrossAccountId> {60 fn who_pays_fee(61 origin: H160,62 max_fee: U256,63 reason: &WithdrawReason,64 ) -> Option<T::CrossAccountId> {51 match reason {65 match reason {52 WithdrawReason::Call { target, input } => {66 WithdrawReason::Call { target, input } => {53 let origin_sub = T::CrossAccountId::from_eth(origin);67 let origin_sub = T::CrossAccountId::from_eth(origin);68 let call_context = CallContext {69 contract_address: *target,70 input: input.clone(),71 max_fee,72 };54 T::EvmSponsorshipHandler::get_sponsor(&origin_sub, &(*target, input.clone()))73 T::EvmSponsorshipHandler::get_sponsor(&origin_sub, &call_context)55 }74 }56 _ => None,75 _ => None,57 }76 }71 source,90 source,72 target,91 target,73 input,92 input,93 gas_limit,94 max_fee_per_gas,74 ..95 ..75 } => {96 } => {76 let _ = T::CallOrigin::ensure_address_origin(97 let _ = T::CallOrigin::ensure_address_origin(79 )100 )80 .ok()?;101 .ok()?;81 let who = T::CrossAccountId::from_sub(who.clone());102 let who = T::CrossAccountId::from_sub(who.clone());103 let max_fee = max_fee_per_gas.saturating_mul((*gas_limit).into());104 let call_context = CallContext {105 contract_address: *target,106 input: input.clone(),107 max_fee,108 };82 // Effects from EvmSponsorshipHandler are applied by pallet_evm::runner109 // Effects from EvmSponsorshipHandler are applied by pallet_evm::runner83 // TODO: Should we implement simulation mode (test, but do not apply effects) in `up-sponsorship`?110 // TODO: Should we implement simulation mode (test, but do not apply effects) in `up-sponsorship`?84 let sponsor = frame_support::storage::with_transaction(|| {111 let sponsor = frame_support::storage::with_transaction(|| {85 TransactionOutcome::Rollback(Ok::<_, DispatchError>(112 TransactionOutcome::Rollback(Ok::<_, DispatchError>(86 T::EvmSponsorshipHandler::get_sponsor(&who, &(*target, input.clone())),113 T::EvmSponsorshipHandler::get_sponsor(&who, &call_context),87 ))114 ))88 })115 })89 // FIXME: it may fail with DispatchError in case of depth limit116 // FIXME: it may fail with DispatchError in case of depth limitpallets/fungible/Cargo.tomldiffbeforeafterboth23pallet-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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] }pallets/nonfungible/Cargo.tomldiffbeforeafterboth16sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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' }pallets/proxy-rmrk-core/Cargo.tomldiffbeforeafterboth20pallet-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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 = [pallets/proxy-rmrk-equip/Cargo.tomldiffbeforeafterboth19pallet-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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 = [pallets/refungible/Cargo.tomldiffbeforeafterboth16sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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' }pallets/structure/Cargo.tomldiffbeforeafterboth16 "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", branch = "unique-polkadot-v0.9.27-fee-limit" }202021[features]21[features]22default = ["std"]22default = ["std"]pallets/unique/Cargo.tomldiffbeforeafterboth98scale-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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' }pallets/unique/src/eth/mod.rsdiffbeforeafterboth21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};21use evm_coder::{execution::*, generate_stubgen, solidity_interface, solidity, weight, types::*};22use frame_support::traits::Get;22use frame_support::traits::Get;23use pallet_common::{23use pallet_common::{24 CollectionById, CollectionHandle,24 CollectionById,25 dispatch::CollectionDispatch,25 dispatch::CollectionDispatch,26 erc::{26 erc::{27 CollectionHelpersEvents,27 CollectionHelpersEvents,28 static_property::{key, value as property_value},28 static_property::{key, value as property_value},29 },29 },30 Pallet as PalletCommon,31};30};32use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};31use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};33use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};32use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};34use pallet_evm_coder_substrate::dispatch_to_evm;35use up_data_structs::{33use up_data_structs::{36 CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,34 CollectionName, CollectionDescription, CollectionTokenPrefix, CreateCollectionData,37 CollectionMode, PropertyKeyPermission, PropertyPermission, PropertyScope, PropertyValue,35 CollectionMode, PropertyValue,38};36};393740use crate::{Config, SelfWeightOf, weights::WeightInfo};38use crate::{Config, SelfWeightOf, weights::WeightInfo};413942use sp_std::{vec, vec::Vec};40use sp_std::vec::Vec;43use alloc::format;41use alloc::format;444245/// See [`CollectionHelpersCall`]43/// See [`CollectionHelpersCall`]primitives/app_promotion_rpc/Cargo.tomldiffbeforeafterboth14sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }181819[features]19[features]20default = ["std"]20default = ["std"]primitives/common/Cargo.tomldiffbeforeafterboth48[dependencies.fp-rpc]48[dependencies.fp-rpc]49default-features = false49default-features = false50git = "https://github.com/uniquenetwork/frontier"50git = "https://github.com/uniquenetwork/frontier"51branch = "unique-polkadot-v0.9.27"51branch = "unique-polkadot-v0.9.27-fee-limit"525253[dependencies.pallet-evm]53[dependencies.pallet-evm]54default-features = false54default-features = false55git = "https://github.com/uniquenetwork/frontier"55git = "https://github.com/uniquenetwork/frontier"56branch = "unique-polkadot-v0.9.27"56branch = "unique-polkadot-v0.9.27-fee-limit"5757primitives/data-structs/Cargo.tomldiffbeforeafterboth25sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }29rmrk-traits = { default-features = false, path = "../rmrk-traits" }29rmrk-traits = { default-features = false, path = "../rmrk-traits" }303031[features]31[features]primitives/rpc/Cargo.tomldiffbeforeafterboth14sp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }181819[features]19[features]20default = ["std"]20default = ["std"]runtime/common/config/sponsoring.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// 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/>.161617use frame_support::parameter_types;18use crate::{17use crate::{19 runtime_common::{sponsoring::UniqueSponsorshipHandler},18 runtime_common::{sponsoring::UniqueSponsorshipHandler},20 Runtime,19 Runtime,21};20};21use frame_support::parameter_types;22use sp_core::U256;22use up_common::{types::BlockNumber, constants::*};23use up_common::{constants::*, types::BlockNumber};232424parameter_types! {25parameter_types! {25 pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;26 pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;27 pub const DefaultSponsoringFeeLimit: U256 = U256::MAX;26}28}272928type SponsorshipHandler = (30type SponsorshipHandler = (runtime/common/ethereum/sponsoring.rsdiffbeforeafterboth161617//! Implements EVM sponsoring logic via TransactionValidityHack17//! Implements EVM sponsoring logic via TransactionValidityHack181819use core::{convert::TryInto, marker::PhantomData};19use evm_coder::{Call, abi::AbiReader};20use evm_coder::{Call, abi::AbiReader};20use pallet_common::{CollectionHandle, eth::map_eth_to_id};21use pallet_common::{CollectionHandle, eth::map_eth_to_id};21use sp_core::H160;22use pallet_evm::account::CrossAccountId;23use pallet_evm_transaction_payment::CallContext;22use sp_std::prelude::*;24use pallet_nonfungible::{25 Config as NonfungibleConfig,26 erc::{27 UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721MintableCall, ERC721Call,28 TokenPropertiesCall,29 },30};23use up_sponsorship::SponsorshipHandler;31use pallet_fungible::{32 Config as FungibleConfig,33 erc::{UniqueFungibleCall, ERC20Call},34};24use core::marker::PhantomData;35use pallet_refungible::Config as RefungibleConfig;25use core::convert::TryInto;36use pallet_unique::Config as UniqueConfig;26use pallet_evm::account::CrossAccountId;37use sp_std::prelude::*;27use up_data_structs::{TokenId, CreateItemData, CreateNftData, CollectionMode};38use up_data_structs::{CollectionMode, CreateItemData, CreateNftData, TokenId};28use pallet_unique::Config as UniqueConfig;39use up_sponsorship::SponsorshipHandler;294030use crate::{Runtime, runtime_common::sponsoring::*};41use crate::{Runtime, runtime_common::sponsoring::*};3132use pallet_nonfungible::erc::{33 UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721MintableCall, ERC721Call, TokenPropertiesCall,34};35use pallet_fungible::erc::{UniqueFungibleCall, ERC20Call};36use pallet_fungible::Config as FungibleConfig;37use pallet_nonfungible::Config as NonfungibleConfig;38use pallet_refungible::Config as RefungibleConfig;394240pub type EvmSponsorshipHandler = (43pub type EvmSponsorshipHandler = (41 UniqueEthSponsorshipHandler<Runtime>,44 UniqueEthSponsorshipHandler<Runtime>,444745pub struct UniqueEthSponsorshipHandler<T: UniqueConfig>(PhantomData<*const T>);48pub struct UniqueEthSponsorshipHandler<T: UniqueConfig>(PhantomData<*const T>);46impl<T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig>49impl<T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig>47 SponsorshipHandler<T::CrossAccountId, (H160, Vec<u8>)> for UniqueEthSponsorshipHandler<T>50 SponsorshipHandler<T::CrossAccountId, CallContext> for UniqueEthSponsorshipHandler<T>48{51{49 fn get_sponsor(who: &T::CrossAccountId, call: &(H160, Vec<u8>)) -> Option<T::CrossAccountId> {52 fn get_sponsor(53 who: &T::CrossAccountId,54 call_context: &CallContext,55 ) -> Option<T::CrossAccountId> {50 let collection_id = map_eth_to_id(&call.0)?;56 let collection_id = map_eth_to_id(&call_context.contract_address)?;51 let collection = <CollectionHandle<T>>::new(collection_id)?;57 let collection = <CollectionHandle<T>>::new(collection_id)?;52 let sponsor = collection.sponsorship.sponsor()?.clone();58 let sponsor = collection.sponsorship.sponsor()?.clone();53 let (method_id, mut reader) = AbiReader::new_call(&call.1).ok()?;59 let (method_id, mut reader) = AbiReader::new_call(&call_context.input).ok()?;54 Some(T::CrossAccountId::from_sub(match &collection.mode {60 Some(T::CrossAccountId::from_sub(match &collection.mode {55 CollectionMode::NFT => {61 CollectionMode::NFT => {56 let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;62 let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;runtime/opal/Cargo.tomldiffbeforeafterboth417up-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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 }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "polkadot-v0.9.27" }446446447################################################################################447################################################################################448# Build Dependencies448# Build Dependenciesruntime/quartz/Cargo.tomldiffbeforeafterboth418pallet-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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 }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "polkadot-v0.9.27" }447447448################################################################################448################################################################################449# Build Dependencies449# Build Dependenciesruntime/tests/Cargo.tomldiffbeforeafterboth16sp-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" }181819fp-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", branch = "unique-polkadot-v0.9.27-fee-limit" }202021frame-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" }272728pallet-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }303031pallet-common = { path = '../../pallets/common' }31pallet-common = { path = '../../pallets/common' }32pallet-structure = { path = '../../pallets/structure' }32pallet-structure = { path = '../../pallets/structure' }43scale-info = "*"43scale-info = "*"444445evm-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", branch = "polkadot-v0.9.27" }4747runtime/unique/Cargo.tomldiffbeforeafterboth430pallet-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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "unique-polkadot-v0.9.27-fee-limit" }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", branch = "polkadot-v0.9.27" }441441442################################################################################442################################################################################443# Build Dependencies443# Build Dependenciestests/src/eth/api/ContractHelpers.soldiffbeforeafterboth23}23}242425/// @title Magic contract, which allows users to reconfigure other contracts25/// @title Magic contract, which allows users to reconfigure other contracts26/// @dev the ERC-165 identifier for this interface is 0xd77fab7026/// @dev the ERC-165 identifier for this interface is 0x172cb4fb27interface ContractHelpers is Dummy, ERC165, ContractHelpersEvents {27interface ContractHelpers is Dummy, ERC165, ContractHelpersEvents {28 /// Get user, which deployed specified contract28 /// Get user, which deployed specified contract29 /// @dev May return zero address in case if contract is deployed29 /// @dev May return zero address in case if contract is deployed111 function setSponsoringMode(address contractAddress, uint8 mode) external;111 function setSponsoringMode(address contractAddress, uint8 mode) external;112112113 /// Get current contract sponsoring rate limit113 /// Get current contract sponsoring rate limit114 /// @param contractAddress Contract to get sponsoring mode of114 /// @param contractAddress Contract to get sponsoring rate limit of115 /// @return uint32 Amount of blocks between two sponsored transactions115 /// @return uint32 Amount of blocks between two sponsored transactions116 /// @dev EVM selector for this function is: 0x610cfabd,116 /// @dev EVM selector for this function is: 0x610cfabd,117 /// or in textual repr: getSponsoringRateLimit(address)117 /// or in textual repr: getSponsoringRateLimit(address)131 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)131 function setSponsoringRateLimit(address contractAddress, uint32 rateLimit)132 external;132 external;133134 /// Set contract sponsoring fee limit135 /// @dev Sponsoring fee limit - is maximum fee that could be spent by136 /// single transaction137 /// @param contractAddress Contract to change sponsoring fee limit of138 /// @param feeLimit Fee limit139 /// @dev Only contract owner can change this setting140 /// @dev EVM selector for this function is: 0x03aed665,141 /// or in textual repr: setSponsoringFeeLimit(address,uint256)142 function setSponsoringFeeLimit(address contractAddress, uint256 feeLimit)143 external;144145 /// Get current contract sponsoring fee limit146 /// @param contractAddress Contract to get sponsoring fee limit of147 /// @return uint256 Maximum amount of fee that could be spent by single148 /// transaction149 /// @dev EVM selector for this function is: 0xc3fdc9ee,150 /// or in textual repr: getSponsoringFeeLimit(address)151 function getSponsoringFeeLimit(address contractAddress)152 external153 view154 returns (uint256);133155134 /// Is specified user present in contract allow list156 /// Is specified user present in contract allow list135 /// @dev Contract owner always implicitly included157 /// @dev Contract owner always implicitly includedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// 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/>.161617import * 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';2119import {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';303731describe('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});488489describe('Sponsoring Fee Limit', () => {490491 let testContract: CompiledContract;492 493 function compileTestContract() {494 if (!testContract) {495 const input = {496 language: 'Solidity',497 sources: {498 ['TestContract.sol']: {499 content:500 `501 // SPDX-License-Identifier: MIT502 pragma solidity ^0.8.0;503 504 contract TestContract {505 event Result(bool);506507 function test(uint32 cycles) public {508 uint256 counter = 0;509 while(true) {510 counter ++;511 if (counter > cycles){512 break;513 }514 }515 emit Result(true);516 }517 }518 `,519 },520 },521 settings: {522 outputSelection: {523 '*': {524 '*': ['*'],525 },526 },527 },528 };529 const json = JSON.parse(solc.compile(JSON.stringify(input)));530 const out = json.contracts['TestContract.sol']['TestContract'];531 532 testContract = {533 abi: out.abi,534 object: '0x' + out.evm.bytecode.object,535 };536 }537 return testContract;538 }539 540 async function deployTestContract(web3: Web3, owner: string) {541 const compiled = compileTestContract();542 const testContract = new web3.eth.Contract(compiled.abi, undefined, {543 data: compiled.object,544 from: owner,545 ...GAS_ARGS,546 });547 return await testContract.deploy({data: compiled.object}).send({from: owner});548 }549550 itWeb3('Default fee limit', async ({api, web3, privateKeyWrapper}) => {551 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);552 const flipper = await deployFlipper(web3, owner);553 const helpers = contractHelpers(web3, owner);554 expect(await helpers.methods.getSponsoringFeeLimit(flipper.options.address).call()).to.be.equals('115792089237316195423570985008687907853269984665640564039457584007913129639935');555 });556557 itWeb3('Set 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 await helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send();562 expect(await helpers.methods.getSponsoringFeeLimit(flipper.options.address).call()).to.be.equals('100');563 });564565 itWeb3('Negative test - set fee limit by non-owner', async ({api, web3, privateKeyWrapper}) => {566 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);567 const stranger = await createEthAccountWithBalance(api, web3, privateKeyWrapper);568 const flipper = await deployFlipper(web3, owner);569 const helpers = contractHelpers(web3, owner);570 await expect(helpers.methods.setSponsoringFeeLimit(flipper.options.address, 100).send({from: stranger})).to.be.rejected;571 });572573 itWeb3('Negative test - check that eth transactions exceeding fee limit are not executed', async ({api, web3, privateKeyWrapper}) => {574 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);575 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);576 const user = await createEthAccountWithBalance(api, web3, privateKeyWrapper);577578 const testContract = await deployTestContract(web3, owner);579 const helpers = contractHelpers(web3, owner);580 581 await helpers.methods.setSponsoringMode(testContract.options.address, SponsoringMode.Generous).send({from: owner});582 await helpers.methods.setSponsoringRateLimit(testContract.options.address, 0).send({from: owner});583 584 await helpers.methods.setSponsor(testContract.options.address, sponsor).send();585 await helpers.methods.confirmSponsorship(testContract.options.address).send({from: sponsor});586587 const gasPrice = BigInt(await web3.eth.getGasPrice());588589 await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 2_000_000n * gasPrice).send();590591 const originalUserBalance = await web3.eth.getBalance(user);592 await testContract.methods.test(100).send({from: user, gas: 2_000_000});593 expect(await web3.eth.getBalance(user)).to.be.equal(originalUserBalance);594595 await testContract.methods.test(100).send({from: user, gas: 2_100_000});596 expect(await web3.eth.getBalance(user)).to.not.be.equal(originalUserBalance);597 });598599 itWeb3('Negative test - check that evm.call transactions exceeding fee limit are not executed', async ({api, web3, privateKeyWrapper}) => {600 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);601 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);602603 const testContract = await deployTestContract(web3, owner);604 const helpers = contractHelpers(web3, owner);605 606 await helpers.methods.setSponsoringMode(testContract.options.address, SponsoringMode.Generous).send({from: owner});607 await helpers.methods.setSponsoringRateLimit(testContract.options.address, 0).send({from: owner});608 609 await helpers.methods.setSponsor(testContract.options.address, sponsor).send();610 await helpers.methods.confirmSponsorship(testContract.options.address).send({from: sponsor});611612 const gasPrice = BigInt(await web3.eth.getGasPrice());613614 await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 2_000_000n * gasPrice).send();615616 const alice = privateKeyWrapper('//Alice');617 const originalAliceBalance = (await api.query.system.account(alice.address)).data.free.toBigInt();618 619 await submitTransactionAsync(620 alice,621 api.tx.evm.call(622 subToEth(alice.address),623 testContract.options.address,624 testContract.methods.test(100).encodeABI(),625 Uint8Array.from([]),626 2_000_000n,627 gasPrice,628 null,629 null,630 [],631 ),632 );633 expect((await api.query.system.account(alice.address)).data.free.toBigInt()).to.be.equal(originalAliceBalance);634 635 await submitTransactionAsync(636 alice,637 api.tx.evm.call(638 subToEth(alice.address),639 testContract.options.address,640 testContract.methods.test(100).encodeABI(),641 Uint8Array.from([]),642 2_100_000n,643 gasPrice,644 null,645 null,646 [],647 ),648 );649 expect((await api.query.system.account(alice.address)).data.free.toBigInt()).to.not.be.equal(originalAliceBalance);650 });651});481652tests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth126 "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": "uint256", "name": "", "type": "uint256" }],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": "uint256", "name": "feeLimit", "type": "uint256" }229 ],230 "name": "setSponsoringFeeLimit",231 "outputs": [],232 "stateMutability": "nonpayable",233 "type": "function"234 },208 {235 {209 "inputs": [236 "inputs": [210 {237 {