Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Pallet: Atomic Swap #6349

Merged
merged 21 commits into from
Jun 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Basic weight support
  • Loading branch information
sorpaas committed Jun 14, 2020
commit 3088ff198267b02a35ae7ab036f32917d6b775f3
10 changes: 7 additions & 3 deletions frame/atomic-swap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use sp_io::hashing::blake2_256;
use frame_support::{
decl_module, decl_storage, decl_event, decl_error, ensure,
traits::{Get, Currency, ReservableCurrency, BalanceStatus},
weights::Weight,
};
use frame_system::{self as system, ensure_signed};
use codec::{Encode, Decode};
Expand Down Expand Up @@ -114,7 +115,7 @@ decl_module! {

fn deposit_event() = default;

#[weight = 0]
#[weight = T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000)]
fn create_swap(
origin,
target: AccountIdFor<T>,
Expand Down Expand Up @@ -142,7 +143,10 @@ decl_module! {
);
}

#[weight = 0]
#[weight = T::DbWeight::get().reads_writes(1, 1)
sorpaas marked this conversation as resolved.
Show resolved Hide resolved
.saturating_add(40_000_000)
.saturating_add((proof.len() as Weight).saturating_mul(100))
]
fn claim_swap(
origin,
proof: Vec<u8>,
Expand Down Expand Up @@ -170,7 +174,7 @@ decl_module! {
);
}

#[weight = 0]
#[weight = T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000)]
fn cancel_swap(
origin,
target: AccountIdFor<T>,
Expand Down