Skip to content

Commit

Permalink
[Payments] - Add Disputes and Request Payment functionalities (with P…
Browse files Browse the repository at this point in the history
…olkadot-SDK Virto fork) (#320)

* Node compiling

* wip

* request_refund compiling

* request_refund compiling

* wip not compiling

* Compiling

* WIP

* Functionality

* WIP

* WIP

* WIP

* Need more testing

* remove unnecesary shceduler cancel

* splitting mandatory / optional fees

* Better version, working ... need to perform

* more optimized

* working

* Working and free warnings version

* Adding request_payment and accept_and_pay

* To review

* Clippy comments

* compiling

* WIP

* compiling

* WIP

* Migrated and working

* Working version with Polkadot-Sd Virto Fork

* Refactor to reduce nesting, avoid clones, some naming updates and compact logic

---------

Co-authored-by: Daniel Olano <[email protected]>
  • Loading branch information
darkforest0202 and olanod authored Nov 8, 2023
1 parent ba42aa3 commit 7b8f771
Show file tree
Hide file tree
Showing 13 changed files with 1,623 additions and 1,081 deletions.
1,328 changes: 567 additions & 761 deletions Cargo.lock

Large diffs are not rendered by default.

225 changes: 113 additions & 112 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pallets/asset-registry/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ impl pallet_assets::Config for Test {
type WeightInfo = ();
type Extra = ();
type RemoveItemsLimit = ConstU32<5>;
type RuntimeHoldReason = RuntimeHoldReason;
type MaxHolds = ConstU32<50>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
type CallbackHandle = ();
Expand Down
5 changes: 3 additions & 2 deletions pallets/lockdown-mode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ repository = "https://github.com/paritytech/trappist"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
parity-scale-codec = { workspace = true, features = [ "derive" ] }
scale-info = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
frame-benchmarking = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
Expand All @@ -24,8 +27,6 @@ log = { workspace = true }
xcm = { workspace = true }

[dev-dependencies]
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
pallet-remark = { workspace = true }
sp-keystore = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions pallets/lockdown-mode/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn call_filtered_in_lockdown_mode() {
fn call_not_filtered_in_lockdown_mode() {
new_test_ext(DEACTIVATED).execute_with(|| {
assert_ok!(LockdownMode::activate_lockdown_mode(RuntimeOrigin::root()));
let balance_call = RuntimeCall::Balances(BalancesCall::transfer { dest: 1, value: 2 });
let balance_call = RuntimeCall::Balances(BalancesCall::transfer_keep_alive { dest: 1, value: 2 });
let allowed: bool = LockdownMode::contains(&balance_call);
assert!(allowed);
});
Expand All @@ -75,7 +75,7 @@ fn call_not_filtered_in_normal_mode() {
new_test_ext(DEACTIVATED).execute_with(|| {
let lockdown_mode = LockdownModeStatus::<Test>::get();
assert_eq!(lockdown_mode, DEACTIVATED);
let balance_call = RuntimeCall::Balances(BalancesCall::transfer { dest: 1, value: 2 });
let balance_call = RuntimeCall::Balances(BalancesCall::transfer_keep_alive { dest: 1, value: 2 });
let result: bool = LockdownMode::contains(&balance_call);
assert!(result);
});
Expand Down
44 changes: 21 additions & 23 deletions pallets/payments/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,30 @@ edition = "2021"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false }
scale-info = { version = "2.2.0", default-features = false, features = ["derive"] }
log = "0.4.0"

# Substrate
frame-benchmarking = { git = "https://github.com/virto-network/substrate", default-features = false, optional = true, branch = "nicof-adding-hold-traits-asset-pallet" }
frame-support = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
frame-system = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
sp-runtime = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
sp-std = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }

parity-scale-codec = { workspace = true, features = [ "derive" ] }
scale-info = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
frame-benchmarking = { workspace = true, optional = true }

[dev-dependencies]
serde = { version = "1.0.132" }
pallet-balances = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
pallet-sudo = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
pallet-assets = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
sp-keystore = { git = "https://github.com/virto-network/substrate", branch = "nicof-adding-hold-traits-asset-pallet" }

# Substrate
sp-core = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
sp-io = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
sp-runtime = { git = "https://github.com/virto-network/substrate", default-features = false, branch = "nicof-adding-hold-traits-asset-pallet" }
serde = { workspace = true }
pallet-balances = { workspace = true }
pallet-sudo = { workspace = true }
pallet-assets = { workspace = true }
sp-keystore = { workspace = true }
pallet-preimage = { workspace = true }
pallet-scheduler= { workspace = true }

[features]
default = ["std"]
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]
std = [
"codec/std",
"parity-scale-codec/std",
"scale-info/std",
"frame-benchmarking/std",
"frame-support/std",
Expand All @@ -48,6 +43,9 @@ std = [
"pallet-balances/std",
"pallet-sudo/std",
"pallet-assets/std",
"sp-std/std"
"pallet-preimage/std",
"pallet-scheduler/std",
"sp-std/std",
"sp-io/std",
]
try-runtime = [ "frame-support/try-runtime" ]
Loading

0 comments on commit 7b8f771

Please sign in to comment.