diff --git a/contracts/src/traits/timelock_controller/mod.rs b/contracts/src/traits/timelock_controller/mod.rs index 958c0ec17..6ca457d81 100644 --- a/contracts/src/traits/timelock_controller/mod.rs +++ b/contracts/src/traits/timelock_controller/mod.rs @@ -54,10 +54,7 @@ impl Default for Transaction { fn default() -> Self { Self { callee: ZERO_ADDRESS.into(), - selector: Default::default(), - input: Default::default(), - transferred_value: Default::default(), - gas_limit: Default::default(), + ..Default::default() } } } diff --git a/contracts/src/upgradeability/diamond/diamond.rs b/contracts/src/upgradeability/diamond/diamond.rs index 3c2d7a1b1..2992d8a4a 100644 --- a/contracts/src/upgradeability/diamond/diamond.rs +++ b/contracts/src/upgradeability/diamond/diamond.rs @@ -180,7 +180,7 @@ where } ink::env::call::build_call::() - .call_type(DelegateCall::new(delegate_code.unwrap())) + .delegate(delegate_code.unwrap()) .call_flags( ink::env::CallFlags::default() // We don't plan to use the input data after the delegated call, so the @@ -197,7 +197,7 @@ where default fn _init_call(&self, call: InitCall) -> ! { ink::env::call::build_call::() - .call_type(DelegateCall::new(call.hash)) + .delegate(call.hash) .exec_input(ExecutionInput::new(InkSelector::new(call.selector)).push_arg(call.input)) .call_flags(ink::env::CallFlags::default() // We don't plan to return back to that contract after execution, so we diff --git a/contracts/src/upgradeability/proxy/mod.rs b/contracts/src/upgradeability/proxy/mod.rs index 442892b98..4012a9884 100644 --- a/contracts/src/upgradeability/proxy/mod.rs +++ b/contracts/src/upgradeability/proxy/mod.rs @@ -39,6 +39,7 @@ use openbrush::{ traits::{ Hash, Storage, + StorageAsRef, }, }; @@ -82,7 +83,7 @@ impl> Internal for T { default fn _fallback(&self) -> ! { ink::env::call::build_call::() - .call_type(DelegateCall::new(self.data().forward_to.clone())) + .delegate(self.data().forward_to.clone()) .call_flags( ink::env::CallFlags::default() // We don't plan to use the input data after the delegated call, so the diff --git a/example_project_structure/impls/lending/data.rs b/example_project_structure/impls/lending/data.rs index afd4e9636..4c666f51e 100644 --- a/example_project_structure/impls/lending/data.rs +++ b/example_project_structure/impls/lending/data.rs @@ -52,13 +52,8 @@ pub struct Data { impl Default for Data { fn default() -> Self { Self { - assets_lended: Default::default(), - asset_shares: Default::default(), - shares_asset: Default::default(), - collateral_accepted: Default::default(), - asset_price: Default::default(), - shares_contract_code_hash: Hash::default(), loan_account: [0u8; 32].into(), + ..Default::default() } } } diff --git a/example_project_structure/traits/loan.rs b/example_project_structure/traits/loan.rs index a882fe3e2..51ee13b63 100644 --- a/example_project_structure/traits/loan.rs +++ b/example_project_structure/traits/loan.rs @@ -34,12 +34,8 @@ impl Default for LoanInfo { Self { borrower: [0u8; 32].into(), collateral_token: [0u8; 32].into(), - collateral_amount: Balance::default(), borrow_token: [0u8; 32].into(), - borrow_amount: Balance::default(), - liquidation_price: Balance::default(), - timestamp: Timestamp::default(), - liquidated: false, + ..Defalt::default() } } } diff --git a/examples/psp22/lib.rs b/examples/psp22/lib.rs index 3afa94dee..a9f63b7ec 100644 --- a/examples/psp22/lib.rs +++ b/examples/psp22/lib.rs @@ -20,15 +20,6 @@ pub mod my_psp22 { hated_account: AccountId, } - impl Default for Contract { - fn default() -> Self { - Self { - psp22: Default::default(), - hated_account: [0u8; 32].into(), - } - } - } - impl Transfer for Contract { // Let's override method to reject transactions to bad account fn _before_token_transfer( @@ -49,7 +40,10 @@ pub mod my_psp22 { impl Contract { #[ink(constructor)] pub fn new(total_supply: Balance) -> Self { - let mut instance = Self::default(); + let mut instance = Self { + psp22: Default::default(), + hated_account: [0u8; 32].into(), + }; instance ._mint_to(Self::env().caller(), total_supply) diff --git a/lang/codegen/src/trait_definition.rs b/lang/codegen/src/trait_definition.rs index e6f4bbfc0..b8885e6b0 100644 --- a/lang/codegen/src/trait_definition.rs +++ b/lang/codegen/src/trait_definition.rs @@ -244,7 +244,6 @@ fn generate_wrapper(ink_trait: ItemTrait) -> proc_macro2::TokenStream { #[inline] fn #message_builder_ident( & self - #( , #input_bindings : #input_types )* ) -> ::ink::env::call::CallBuilder< ::ink::env::DefaultEnvironment,