Skip to content

Commit

Permalink
rename: upgrade_async_call_and_exit
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-marinica committed Mar 27, 2024
1 parent cd55795 commit a0beddf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub trait ForwarderRawDeployUpgrade {
.code(new_code)
.code_metadata(code_metadata)
.arguments_raw(args.to_arg_buffer())
.upgrade_async_call();
.upgrade_async_call_and_exit();
}

#[endpoint]
Expand All @@ -70,6 +70,6 @@ pub trait ForwarderRawDeployUpgrade {
.code_metadata(code_metadata)
.arguments_raw(args.to_arg_buffer())
.with_gas_limit(self.blockchain().get_gas_left())
.upgrade_async_call();
.upgrade_async_call_and_exit();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ pub trait UpgradeContractModule {
new_code: ManagedBuffer,
opt_arg: OptionalValue<ManagedBuffer>,
) {
let _ = self
.tx()
self.tx()
.to(child_sc_address)
.typed(vault_proxy::VaultProxy)
.upgrade(opt_arg)
.code(new_code)
.code_metadata(CodeMetadata::UPGRADEABLE)
.upgrade_async_call();
.upgrade_async_call_and_exit();
}

#[endpoint]
Expand All @@ -28,13 +27,12 @@ pub trait UpgradeContractModule {
source_address: ManagedAddress,
opt_arg: OptionalValue<ManagedBuffer>,
) {
let _ = self
.tx()
self.tx()
.to(child_sc_address)
.typed(vault_proxy::VaultProxy)
.upgrade(opt_arg)
.code_metadata(CodeMetadata::UPGRADEABLE)
.from_source(source_address)
.upgrade_async_call();
.upgrade_async_call_and_exit();
}
}
10 changes: 8 additions & 2 deletions framework/base/src/types/interaction/tx_call_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ where
CodeValue: TxCodeValue<TxScEnv<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
{
pub fn upgrade_async_call(self) {
/// Launches the upgrade async call.
///
/// TODO: change return type to `!`.
pub fn upgrade_async_call_and_exit(self) {
let gas = self.gas.explicit_or_gas_left(&self.env);
self.payment.with_egld_value(|egld_value| {
SendRawWrapper::<Api>::new().upgrade_contract(
Expand Down Expand Up @@ -60,7 +63,10 @@ where
FromSourceValue: TxFromSourceValue<TxScEnv<Api>>,
RH: TxEmptyResultHandler<TxScEnv<Api>>,
{
pub fn upgrade_async_call(self) {
/// Launches the upgrade from source async call.
///
/// TODO: change return type to `!`.
pub fn upgrade_async_call_and_exit(self) {
let gas = self.gas.explicit_or_gas_left(&self.env);
self.payment.with_egld_value(|egld_value| {
SendRawWrapper::<Api>::new().upgrade_from_source_contract(
Expand Down

0 comments on commit a0beddf

Please sign in to comment.