From 97c71aea0326f8831ee117a4e69a331ba221fb86 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 1 Feb 2023 12:21:19 +0000 Subject: [PATCH 01/12] Make cross-contract callee non-optional --- crates/env/src/call/call_builder.rs | 72 +++++++------------ crates/env/src/engine/on_chain/impls.rs | 6 +- .../generator/as_dependency/call_builder.rs | 2 +- .../src/generator/trait_def/call_builder.rs | 2 +- examples/erc1155/lib.rs | 3 +- .../call-builder/lib.rs | 4 +- examples/multisig/lib.rs | 18 ++--- .../forward-calls/lib.rs | 9 +-- 8 files changed, 42 insertions(+), 74 deletions(-) diff --git a/crates/env/src/call/call_builder.rs b/crates/env/src/call/call_builder.rs index 95c851c6f76..160b7891b72 100644 --- a/crates/env/src/call/call_builder.rs +++ b/crates/env/src/call/call_builder.rs @@ -71,10 +71,8 @@ where E: Environment, { /// Returns the account ID of the called contract instance. - /// - /// Returns `None` if no account ID has been set for the call. #[inline] - pub fn callee(&self) -> &Option { + pub fn callee(&self) -> &E::AccountId { &self.call_type.callee } @@ -205,11 +203,9 @@ where /// # type AccountId = ::AccountId; /// # type Balance = ::Balance; /// build_call::() -/// .call_type( -/// Call::new() -/// .callee(AccountId::from([0x42; 32])) -/// .gas_limit(5000) -/// .transferred_value(10)) +/// .callee(AccountId::from([0x42; 32])) +/// .gas_limit(5000) +/// .transferred_value(10) /// .exec_input( /// ExecutionInput::new(Selector::new([0xDE, 0xAD, 0xBE, 0xEF])) /// .push_arg(42u8) @@ -241,9 +237,8 @@ where /// # }; /// # type AccountId = ::AccountId; /// let my_return_value: i32 = build_call::() -/// .call_type(Call::new() -/// .callee(AccountId::from([0x42; 32])) -/// .gas_limit(5000)) +/// .callee(AccountId::from([0x42; 32])) +/// .gas_limit(5000) /// .transferred_value(10) /// .exec_input( /// ExecutionInput::new(Selector::new([0xDE, 0xAD, 0xBE, 0xEF])) @@ -306,12 +301,9 @@ where /// # type AccountId = ::AccountId; /// # type Balance = ::Balance; /// let call_result = build_call::() -/// .call_type( -/// Call::new() -/// .callee(AccountId::from([0x42; 32])) -/// .gas_limit(5000) -/// .transferred_value(10), -/// ) +/// .callee(AccountId::from([0x42; 32])) +/// .gas_limit(5000) +/// .transferred_value(10) /// .try_invoke() /// .expect("Got an error from the Contract's pallet."); /// @@ -343,41 +335,26 @@ where /// The default call type for cross-contract calls. Performs a cross-contract call to `callee` /// with gas limit `gas_limit`, transferring `transferred_value` of currency. pub struct Call { - callee: Option, + callee: E::AccountId, gas_limit: Gas, transferred_value: E::Balance, } -impl Default for Call { - fn default() -> Self { - Call { - callee: Default::default(), +impl Call { + /// Returns a clean builder for [`Call`]. + pub fn new(callee: E::AccountId) -> Self { + Self { + callee, gas_limit: Default::default(), transferred_value: E::Balance::zero(), } } } -impl Call { - /// Returns a clean builder for [`Call`]. - pub fn new() -> Self { - Default::default() - } -} - impl Call where E: Environment, { - /// Sets the `callee` for the current cross-contract call. - pub fn callee(self, callee: E::AccountId) -> Self { - Call { - callee: Some(callee), - gas_limit: self.gas_limit, - transferred_value: self.transferred_value, - } - } - /// Sets the `gas_limit` for the current cross-contract call. pub fn gas_limit(self, gas_limit: Gas) -> Self { Call { @@ -521,26 +498,29 @@ where } } -impl CallBuilder>, Args, RetType> +impl CallBuilder, Args, RetType> where E: Environment, { /// Sets the `callee` for the current cross-contract call. - pub fn callee(self, callee: E::AccountId) -> Self { - let call_type = self.call_type.value(); + pub fn callee( + self, + callee: E::AccountId, + ) -> CallBuilder>, Args, RetType> { CallBuilder { - call_type: Set(Call { - callee: Some(callee), - gas_limit: call_type.gas_limit, - transferred_value: call_type.transferred_value, - }), + call_type: Set(Call::new(callee)), call_flags: self.call_flags, exec_input: self.exec_input, return_type: self.return_type, _phantom: Default::default(), } } +} +impl CallBuilder>, Args, RetType> +where + E: Environment, +{ /// Sets the `gas_limit` for the current cross-contract call. pub fn gas_limit(self, gas_limit: Gas) -> Self { let call_type = self.call_type.value(); diff --git a/crates/env/src/engine/on_chain/impls.rs b/crates/env/src/engine/on_chain/impls.rs index e3a7d4a4e6c..ae9fa3fdb1b 100644 --- a/crates/env/src/engine/on_chain/impls.rs +++ b/crates/env/src/engine/on_chain/impls.rs @@ -412,11 +412,7 @@ impl TypedEnvBackend for EnvInstance { { let mut scope = self.scoped_buffer(); let gas_limit = params.gas_limit(); - let callee = params - .callee() - .as_ref() - .expect("An account ID must be set in order to call a contract."); - let enc_callee = scope.take_encoded(callee); + let enc_callee = scope.take_encoded(params.callee()); let enc_transferred_value = scope.take_encoded(params.transferred_value()); let call_flags = params.call_flags(); let enc_input = if !call_flags.forward_input() && !call_flags.clone_input() { diff --git a/crates/ink/codegen/src/generator/as_dependency/call_builder.rs b/crates/ink/codegen/src/generator/as_dependency/call_builder.rs index 06ce61e4425..8bd858b87de 100644 --- a/crates/ink/codegen/src/generator/as_dependency/call_builder.rs +++ b/crates/ink/codegen/src/generator/as_dependency/call_builder.rs @@ -391,7 +391,7 @@ impl CallBuilder<'_> { #( , #input_bindings : #input_types )* ) -> #output_type { ::ink::env::call::build_call::() - .call_type(::ink::env::call::Call::new().callee(::ink::ToAccountId::to_account_id(self))) + .callee(::ink::ToAccountId::to_account_id(self)) .exec_input( ::ink::env::call::ExecutionInput::new( ::ink::env::call::Selector::new([ #( #selector_bytes ),* ]) diff --git a/crates/ink/codegen/src/generator/trait_def/call_builder.rs b/crates/ink/codegen/src/generator/trait_def/call_builder.rs index 34221367b36..15bf820f181 100644 --- a/crates/ink/codegen/src/generator/trait_def/call_builder.rs +++ b/crates/ink/codegen/src/generator/trait_def/call_builder.rs @@ -319,7 +319,7 @@ impl CallBuilder<'_> { #( , #input_bindings : #input_types )* ) -> Self::#output_ident { ::ink::env::call::build_call::() - .call_type(::ink::env::call::Call::new().callee(::ink::ToAccountId::to_account_id(self))) + .callee(::ink::ToAccountId::to_account_id(self)) .exec_input( ::ink::env::call::ExecutionInput::new( ::ink::env::call::Selector::new([ #( #selector_bytes ),* ]) diff --git a/examples/erc1155/lib.rs b/examples/erc1155/lib.rs index 4f703b2a922..5b5980dba34 100644 --- a/examples/erc1155/lib.rs +++ b/examples/erc1155/lib.rs @@ -366,7 +366,8 @@ mod erc1155 { // If our recipient is a smart contract we need to see if they accept or // reject this transfer. If they reject it we need to revert the call. let result = build_call::() - .call_type(Call::new().callee(to).gas_limit(5000)) + .callee(to) + .gas_limit(5000) .exec_input( ExecutionInput::new(Selector::new(ON_ERC_1155_RECEIVED_SELECTOR)) .push_arg(caller) diff --git a/examples/lang-err-integration-tests/call-builder/lib.rs b/examples/lang-err-integration-tests/call-builder/lib.rs index 1d143fadece..e84ca132c39 100755 --- a/examples/lang-err-integration-tests/call-builder/lib.rs +++ b/examples/lang-err-integration-tests/call-builder/lib.rs @@ -52,7 +52,7 @@ mod call_builder { selector: [u8; 4], ) -> Option { let result = build_call::() - .call_type(Call::new().callee(address)) + .callee(address) .exec_input(ExecutionInput::new(Selector::new(selector))) .returns::<()>() .try_invoke() @@ -79,7 +79,7 @@ mod call_builder { use ink::env::call::build_call; build_call::() - .call_type(Call::new().callee(address)) + .callee(address) .exec_input(ExecutionInput::new(Selector::new(selector))) .returns::<()>() .invoke() diff --git a/examples/multisig/lib.rs b/examples/multisig/lib.rs index 250db845d3c..a6c1c15b540 100755 --- a/examples/multisig/lib.rs +++ b/examples/multisig/lib.rs @@ -536,12 +536,9 @@ mod multisig { let t = self.take_transaction(trans_id).expect(WRONG_TRANSACTION_ID); assert!(self.env().transferred_value() == t.transferred_value); let result = build_call::<::Env>() - .call_type( - Call::new() - .callee(t.callee) - .gas_limit(t.gas_limit) - .transferred_value(t.transferred_value), - ) + .callee(t.callee) + .gas_limit(t.gas_limit) + .transferred_value(t.transferred_value) .call_flags(CallFlags::default().set_allow_reentry(t.allow_reentry)) .exec_input( ExecutionInput::new(t.selector.into()).push_arg(CallInput(&t.input)), @@ -574,12 +571,9 @@ mod multisig { self.ensure_confirmed(trans_id); let t = self.take_transaction(trans_id).expect(WRONG_TRANSACTION_ID); let result = build_call::<::Env>() - .call_type( - Call::new() - .callee(t.callee) - .gas_limit(t.gas_limit) - .transferred_value(t.transferred_value), - ) + .callee(t.callee) + .gas_limit(t.gas_limit) + .transferred_value(t.transferred_value) .call_flags(CallFlags::default().set_allow_reentry(t.allow_reentry)) .exec_input( ExecutionInput::new(t.selector.into()).push_arg(CallInput(&t.input)), diff --git a/examples/upgradeable-contracts/forward-calls/lib.rs b/examples/upgradeable-contracts/forward-calls/lib.rs index 51c4144cc06..419523ab355 100644 --- a/examples/upgradeable-contracts/forward-calls/lib.rs +++ b/examples/upgradeable-contracts/forward-calls/lib.rs @@ -70,12 +70,9 @@ pub mod proxy { #[ink(message, payable, selector = _)] pub fn forward(&self) -> u32 { ink::env::call::build_call::() - .call_type( - Call::new() - .callee(self.forward_to) - .transferred_value(self.env().transferred_value()) - .gas_limit(0), - ) + .callee(self.forward_to) + .transferred_value(self.env().transferred_value()) + .gas_limit(0) .call_flags( ink::env::CallFlags::default() .set_forward_input(true) From 6eee75d41d9205c07b06583e8277d4244a497893 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 1 Feb 2023 12:34:41 +0000 Subject: [PATCH 02/12] clippy --- examples/erc1155/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/erc1155/lib.rs b/examples/erc1155/lib.rs index 5b5980dba34..9ec11483473 100644 --- a/examples/erc1155/lib.rs +++ b/examples/erc1155/lib.rs @@ -358,7 +358,6 @@ mod erc1155 { { use ink::env::call::{ build_call, - Call, ExecutionInput, Selector, }; @@ -374,7 +373,7 @@ mod erc1155 { .push_arg(from) .push_arg(token_id) .push_arg(value) - .push_arg(data), + .push_arg(data),Call::new() ) .returns::>() .params() From 183044ab3c8bfe473c76881f10b3131d17b56e8f Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 1 Feb 2023 12:36:31 +0000 Subject: [PATCH 03/12] Fmt --- examples/erc1155/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/erc1155/lib.rs b/examples/erc1155/lib.rs index 9ec11483473..253a740716a 100644 --- a/examples/erc1155/lib.rs +++ b/examples/erc1155/lib.rs @@ -373,7 +373,8 @@ mod erc1155 { .push_arg(from) .push_arg(token_id) .push_arg(value) - .push_arg(data),Call::new() + .push_arg(data), + Call::new(), ) .returns::>() .params() From ff656c84c02508785b9be827ac1bf3963837c9f4 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 1 Feb 2023 12:40:54 +0000 Subject: [PATCH 04/12] Fix --- examples/erc1155/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/erc1155/lib.rs b/examples/erc1155/lib.rs index 253a740716a..5b750c65729 100644 --- a/examples/erc1155/lib.rs +++ b/examples/erc1155/lib.rs @@ -374,7 +374,6 @@ mod erc1155 { .push_arg(token_id) .push_arg(value) .push_arg(data), - Call::new(), ) .returns::>() .params() From a1733101faebd021d842a01fde6f16bb3107738f Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 1 Feb 2023 12:44:20 +0000 Subject: [PATCH 05/12] clippy --- examples/multisig/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/multisig/lib.rs b/examples/multisig/lib.rs index a6c1c15b540..25e5d25fbfb 100755 --- a/examples/multisig/lib.rs +++ b/examples/multisig/lib.rs @@ -67,7 +67,6 @@ mod multisig { env::{ call::{ build_call, - Call, ExecutionInput, }, CallFlags, From f189bc45570bcf5d64f3e0f738c3e52c169b533d Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 1 Feb 2023 12:48:05 +0000 Subject: [PATCH 06/12] clippy --- examples/upgradeable-contracts/forward-calls/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/upgradeable-contracts/forward-calls/lib.rs b/examples/upgradeable-contracts/forward-calls/lib.rs index 419523ab355..21953acb23e 100644 --- a/examples/upgradeable-contracts/forward-calls/lib.rs +++ b/examples/upgradeable-contracts/forward-calls/lib.rs @@ -17,7 +17,6 @@ #[ink::contract] pub mod proxy { - use ink::env::call::Call; /// A simple proxy contract. #[ink(storage)] From 7d5cf083ea1c90da4f6b9a953fa6e6a4bb29c962 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 1 Feb 2023 12:56:23 +0000 Subject: [PATCH 07/12] clippy --- examples/lang-err-integration-tests/call-builder/lib.rs | 1 - examples/multisig/lib.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/lang-err-integration-tests/call-builder/lib.rs b/examples/lang-err-integration-tests/call-builder/lib.rs index e84ca132c39..26324563754 100755 --- a/examples/lang-err-integration-tests/call-builder/lib.rs +++ b/examples/lang-err-integration-tests/call-builder/lib.rs @@ -21,7 +21,6 @@ mod call_builder { use ink::env::{ call::{ build_call, - Call, ExecutionInput, Selector, }, diff --git a/examples/multisig/lib.rs b/examples/multisig/lib.rs index 25e5d25fbfb..358b7ca39ab 100755 --- a/examples/multisig/lib.rs +++ b/examples/multisig/lib.rs @@ -309,7 +309,6 @@ mod multisig { /// use ink::env::{ /// call::{ /// utils::ArgumentList, - /// Call, /// CallParams, /// ExecutionInput, /// Selector, From 6222491d42876d74d66f23d3686575361feab642 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 1 Feb 2023 07:57:06 -0800 Subject: [PATCH 08/12] Add a similar method for `code_hash` --- crates/env/src/call/call_builder.rs | 30 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/crates/env/src/call/call_builder.rs b/crates/env/src/call/call_builder.rs index 160b7891b72..66f185e38a8 100644 --- a/crates/env/src/call/call_builder.rs +++ b/crates/env/src/call/call_builder.rs @@ -28,7 +28,6 @@ use crate::{ Error, }; use core::marker::PhantomData; -use ink_primitives::Clear; use num_traits::Zero; /// The final parameters to the cross-contract call. @@ -265,8 +264,7 @@ where /// # use ink_primitives::Clear; /// # type AccountId = ::AccountId; /// let my_return_value: i32 = build_call::() -/// .call_type(DelegateCall::new() -/// .code_hash(::Hash::CLEAR_HASH)) +/// .code_hash(::Hash::CLEAR_HASH) /// .exec_input( /// ExecutionInput::new(Selector::new([0xDE, 0xAD, 0xBE, 0xEF])) /// .push_arg(42u8) @@ -381,16 +379,8 @@ pub struct DelegateCall { impl DelegateCall { /// Returns a clean builder for [`DelegateCall`] - pub const fn new() -> Self { - DelegateCall { - code_hash: E::Hash::CLEAR_HASH, - } - } -} - -impl Default for DelegateCall { - fn default() -> Self { - Self::new() + pub const fn new(code_hash: E::Hash) -> Self { + DelegateCall { code_hash } } } @@ -515,6 +505,20 @@ where _phantom: Default::default(), } } + + /// Sets the `code_hash` for the current cross-contract delegate call. + pub fn code_hash( + self, + code_hash: E::Hash, + ) -> CallBuilder>, Args, RetType> { + CallBuilder { + call_type: Set(DelegateCall::new(code_hash)), + call_flags: self.call_flags, + exec_input: self.exec_input, + return_type: self.return_type, + _phantom: Default::default(), + } + } } impl CallBuilder>, Args, RetType> From 7484d95e7eb4e02fc923e0d11ffeb6c4239af720 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 1 Feb 2023 08:03:50 -0800 Subject: [PATCH 09/12] Fix doc tests --- crates/ink/src/env_access.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/ink/src/env_access.rs b/crates/ink/src/env_access.rs index 89cbcf82556..78980d9976c 100644 --- a/crates/ink/src/env_access.rs +++ b/crates/ink/src/env_access.rs @@ -266,7 +266,7 @@ where /// # Example /// /// ``` - /// + /// /// #[ink::contract] /// pub mod only_owner { /// #[ink(storage)] @@ -344,7 +344,7 @@ where /// # Example /// /// ``` - /// + /// /// #[ink::contract] /// pub mod my_contract { /// #[ink(storage)] @@ -524,8 +524,7 @@ where /// pub fn invoke_contract(&self) -> i32 { /// let call_params = build_call::() /// .call_type( - /// Call::new() - /// .callee(AccountId::from([0x42; 32])) + /// Call::new(AccountId::from([0x42; 32])) /// .gas_limit(5000) /// .transferred_value(10)) /// .exec_input( @@ -588,8 +587,7 @@ where /// pub fn invoke_contract_delegate(&self) -> i32 { /// let call_params = build_call::() /// .call_type( - /// DelegateCall::new() - /// .code_hash(::Hash::CLEAR_HASH)) + /// DelegateCall::new(::Hash::CLEAR_HASH)) /// .exec_input( /// ExecutionInput::new(Selector::new([0xCA, 0xFE, 0xBA, 0xBE])) /// .push_arg(42u8) From 324246da1ff41ec44c483909ed549c9ea061545f Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 1 Feb 2023 08:04:44 -0800 Subject: [PATCH 10/12] RustFmt --- crates/ink/src/env_access.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ink/src/env_access.rs b/crates/ink/src/env_access.rs index 78980d9976c..f54660cd42a 100644 --- a/crates/ink/src/env_access.rs +++ b/crates/ink/src/env_access.rs @@ -266,7 +266,7 @@ where /// # Example /// /// ``` - /// + /// /// #[ink::contract] /// pub mod only_owner { /// #[ink(storage)] @@ -344,7 +344,7 @@ where /// # Example /// /// ``` - /// + /// /// #[ink::contract] /// pub mod my_contract { /// #[ink(storage)] From e820cc03cc7d002510bea43ae1b388ff1e0450d9 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 1 Feb 2023 08:24:43 -0800 Subject: [PATCH 11/12] Rename top level methods to `call` and `delegate` --- crates/env/src/call/call_builder.rs | 16 ++++++++-------- .../src/generator/as_dependency/call_builder.rs | 2 +- .../src/generator/trait_def/call_builder.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/env/src/call/call_builder.rs b/crates/env/src/call/call_builder.rs index 66f185e38a8..3ea6c065c97 100644 --- a/crates/env/src/call/call_builder.rs +++ b/crates/env/src/call/call_builder.rs @@ -202,7 +202,7 @@ where /// # type AccountId = ::AccountId; /// # type Balance = ::Balance; /// build_call::() -/// .callee(AccountId::from([0x42; 32])) +/// .call(AccountId::from([0x42; 32])) /// .gas_limit(5000) /// .transferred_value(10) /// .exec_input( @@ -236,7 +236,7 @@ where /// # }; /// # type AccountId = ::AccountId; /// let my_return_value: i32 = build_call::() -/// .callee(AccountId::from([0x42; 32])) +/// .call_type(Call::new(AccountId::from([0x42; 32]))) /// .gas_limit(5000) /// .transferred_value(10) /// .exec_input( @@ -264,7 +264,7 @@ where /// # use ink_primitives::Clear; /// # type AccountId = ::AccountId; /// let my_return_value: i32 = build_call::() -/// .code_hash(::Hash::CLEAR_HASH) +/// .delegate(::Hash::CLEAR_HASH) /// .exec_input( /// ExecutionInput::new(Selector::new([0xDE, 0xAD, 0xBE, 0xEF])) /// .push_arg(42u8) @@ -299,7 +299,7 @@ where /// # type AccountId = ::AccountId; /// # type Balance = ::Balance; /// let call_result = build_call::() -/// .callee(AccountId::from([0x42; 32])) +/// .call(AccountId::from([0x42; 32])) /// .gas_limit(5000) /// .transferred_value(10) /// .try_invoke() @@ -492,8 +492,8 @@ impl CallBuilder, Args, RetType> where E: Environment, { - /// Sets the `callee` for the current cross-contract call. - pub fn callee( + /// Prepares the `CallBuilder` for a cross-contract [`Call`]. + pub fn call( self, callee: E::AccountId, ) -> CallBuilder>, Args, RetType> { @@ -506,8 +506,8 @@ where } } - /// Sets the `code_hash` for the current cross-contract delegate call. - pub fn code_hash( + /// Prepares the `CallBuilder` for a cross-contract [`DelegateCall`]. + pub fn delegate( self, code_hash: E::Hash, ) -> CallBuilder>, Args, RetType> { diff --git a/crates/ink/codegen/src/generator/as_dependency/call_builder.rs b/crates/ink/codegen/src/generator/as_dependency/call_builder.rs index 8bd858b87de..fe5f09feafe 100644 --- a/crates/ink/codegen/src/generator/as_dependency/call_builder.rs +++ b/crates/ink/codegen/src/generator/as_dependency/call_builder.rs @@ -391,7 +391,7 @@ impl CallBuilder<'_> { #( , #input_bindings : #input_types )* ) -> #output_type { ::ink::env::call::build_call::() - .callee(::ink::ToAccountId::to_account_id(self)) + .call(::ink::ToAccountId::to_account_id(self)) .exec_input( ::ink::env::call::ExecutionInput::new( ::ink::env::call::Selector::new([ #( #selector_bytes ),* ]) diff --git a/crates/ink/codegen/src/generator/trait_def/call_builder.rs b/crates/ink/codegen/src/generator/trait_def/call_builder.rs index 15bf820f181..69db77bb431 100644 --- a/crates/ink/codegen/src/generator/trait_def/call_builder.rs +++ b/crates/ink/codegen/src/generator/trait_def/call_builder.rs @@ -319,7 +319,7 @@ impl CallBuilder<'_> { #( , #input_bindings : #input_types )* ) -> Self::#output_ident { ::ink::env::call::build_call::() - .callee(::ink::ToAccountId::to_account_id(self)) + .call(::ink::ToAccountId::to_account_id(self)) .exec_input( ::ink::env::call::ExecutionInput::new( ::ink::env::call::Selector::new([ #( #selector_bytes ),* ]) From 06008c09d3705771a8323a901e22889073c358f6 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 1 Feb 2023 08:32:03 -0800 Subject: [PATCH 12/12] Fix some renames --- examples/erc1155/lib.rs | 2 +- examples/lang-err-integration-tests/call-builder/lib.rs | 4 ++-- examples/multisig/lib.rs | 4 ++-- examples/upgradeable-contracts/forward-calls/lib.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/erc1155/lib.rs b/examples/erc1155/lib.rs index 5b750c65729..ed49e73bcc6 100644 --- a/examples/erc1155/lib.rs +++ b/examples/erc1155/lib.rs @@ -365,7 +365,7 @@ mod erc1155 { // If our recipient is a smart contract we need to see if they accept or // reject this transfer. If they reject it we need to revert the call. let result = build_call::() - .callee(to) + .call(to) .gas_limit(5000) .exec_input( ExecutionInput::new(Selector::new(ON_ERC_1155_RECEIVED_SELECTOR)) diff --git a/examples/lang-err-integration-tests/call-builder/lib.rs b/examples/lang-err-integration-tests/call-builder/lib.rs index 26324563754..092ad1d0358 100755 --- a/examples/lang-err-integration-tests/call-builder/lib.rs +++ b/examples/lang-err-integration-tests/call-builder/lib.rs @@ -51,7 +51,7 @@ mod call_builder { selector: [u8; 4], ) -> Option { let result = build_call::() - .callee(address) + .call(address) .exec_input(ExecutionInput::new(Selector::new(selector))) .returns::<()>() .try_invoke() @@ -78,7 +78,7 @@ mod call_builder { use ink::env::call::build_call; build_call::() - .callee(address) + .call(address) .exec_input(ExecutionInput::new(Selector::new(selector))) .returns::<()>() .invoke() diff --git a/examples/multisig/lib.rs b/examples/multisig/lib.rs index 358b7ca39ab..b5452c7b1c6 100755 --- a/examples/multisig/lib.rs +++ b/examples/multisig/lib.rs @@ -534,7 +534,7 @@ mod multisig { let t = self.take_transaction(trans_id).expect(WRONG_TRANSACTION_ID); assert!(self.env().transferred_value() == t.transferred_value); let result = build_call::<::Env>() - .callee(t.callee) + .call(t.callee) .gas_limit(t.gas_limit) .transferred_value(t.transferred_value) .call_flags(CallFlags::default().set_allow_reentry(t.allow_reentry)) @@ -569,7 +569,7 @@ mod multisig { self.ensure_confirmed(trans_id); let t = self.take_transaction(trans_id).expect(WRONG_TRANSACTION_ID); let result = build_call::<::Env>() - .callee(t.callee) + .call(t.callee) .gas_limit(t.gas_limit) .transferred_value(t.transferred_value) .call_flags(CallFlags::default().set_allow_reentry(t.allow_reentry)) diff --git a/examples/upgradeable-contracts/forward-calls/lib.rs b/examples/upgradeable-contracts/forward-calls/lib.rs index 21953acb23e..d65c5111680 100644 --- a/examples/upgradeable-contracts/forward-calls/lib.rs +++ b/examples/upgradeable-contracts/forward-calls/lib.rs @@ -69,7 +69,7 @@ pub mod proxy { #[ink(message, payable, selector = _)] pub fn forward(&self) -> u32 { ink::env::call::build_call::() - .callee(self.forward_to) + .call(self.forward_to) .transferred_value(self.env().transferred_value()) .gas_limit(0) .call_flags(