Skip to content

Commit

Permalink
Polkadot: Update rust cross contract call example to ink! v5.0 (#1635)
Browse files Browse the repository at this point in the history
  • Loading branch information
xermicus committed Apr 8, 2024
1 parent d409c1e commit c01ffa2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 1 addition & 6 deletions integration/polkadot/ink/caller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ authors = ["Cyrill Leutwiler <cyrill@parity.io>"]
edition = "2021"

[dependencies]
ink = { version = "4.3.0", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2.10", default-features = false, features = ["derive"], optional = true }
ink = { version = "5.0.0", default-features = false }

[lib]
path = "lib.rs"
Expand All @@ -17,8 +14,6 @@ path = "lib.rs"
default = ["std"]
std = [
"ink/std",
"scale/std",
"scale-info/std",
]

[workspace]
5 changes: 3 additions & 2 deletions integration/polkadot/ink/caller/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#[ink::contract]
mod caller {
use ink::env::{
call::{build_call, Call, ExecutionInput, Selector},
call::{build_call, ExecutionInput, Selector},
DefaultEnvironment,
};

Expand All @@ -31,7 +31,8 @@ mod caller {
transfer_value: Option<u128>,
) -> u32 {
build_call::<DefaultEnvironment>()
.call_type(Call::new(callee).gas_limit(max_gas.unwrap_or_default()))
.call_v1(callee)
.gas_limit(max_gas.unwrap_or(u64::MAX))
.transferred_value(transfer_value.unwrap_or_default())
.exec_input(ExecutionInput::new(Selector::new(selector)).push_arg(arg))
.returns::<u32>() // FIXME: This should be Result<u32, u8> to respect LanguageError
Expand Down

0 comments on commit c01ffa2

Please sign in to comment.