Skip to content
Merged
Changes from all commits
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
17 changes: 13 additions & 4 deletions integration-tests/e2e-call-runtime/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,25 @@ pub mod e2e_call_runtime {
.expect("instantiate failed")
.account_id;

let transfer_amount = 100_000_000_000u128;

// when
let call_data = vec![
// A value representing a `MultiAddress<AccountId32, _>`. We want the
// "Id" variant, and that will ultimately contain the
// bytes for our destination address
Value::unnamed_variant("Id", [Value::from_bytes(&contract_acc_id)]),
// A value representing the amount we'd like to transfer.
Value::u128(100_000_000_000u128),
Value::u128(transfer_amount),
];

let get_balance = build_message::<ContractRef>(contract_acc_id.clone())
.call(|contract| contract.get_contract_balance());
let pre_balance = client
.call_dry_run(&ink_e2e::alice(), &get_balance, 0, None)
.await
.return_value();

// Send funds from Alice to the contract using Balances::transfer
client
.runtime_call(&ink_e2e::alice(), "Balances", "transfer", call_data)
Expand All @@ -61,10 +70,10 @@ pub mod e2e_call_runtime {
.call_dry_run(&ink_e2e::alice(), &get_balance, 0, None)
.await;

assert!(matches!(
assert_eq!(
get_balance_res.return_value(),
100_000_000_000u128
));
pre_balance + transfer_amount
);

Ok(())
}
Expand Down