Skip to content
Merged
Show file tree
Hide file tree
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
moved the macro to the test mod
  • Loading branch information
agryaznov committed Sep 6, 2022
commit 40e827f12c119853922b1a8ae9cc46c821432d6c
9 changes: 9 additions & 0 deletions crates/env/src/engine/off_chain/test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,12 @@ pub fn assert_contract_termination<T, F>(
assert_eq!(value_transferred, expected_value_transferred_to_beneficiary);
assert_eq!(beneficiary, expected_beneficiary);
}

#[macro_export]
/// Prepend contract message call with value transfer. Used for tests in off-chain environment.
macro_rules! pay_with_call {
($contract:ident . $message:ident ( $($params:ty)? ) , $amount:expr) => {{
::ink_env::test::transfer_in::<Environment>($amount);
$contract.$message($($params:ty)?)
}}
}
14 changes: 0 additions & 14 deletions crates/env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,3 @@ cfg_if::cfg_if! {
}
}
}

cfg_if::cfg_if! {
if #[cfg(feature = "std")] {
#[macro_export]
/// Prepend contract message call with value transfer. Used for tests in off-chain environment.
macro_rules! pay_with_call {
($con:ident . $msg:ident ( $($params:ty)? ) , $amt:expr) => {{
use ink_env::test::transfer_in;
transfer_in::<Environment>($amt);
$con.$msg($($params:ty)?)
}}
}
}
}