From ef18412a106a3cf78a48492720ccdab6c61ae6a6 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Thu, 5 Dec 2024 13:00:39 +0200 Subject: [PATCH] remove IgnoreValue from ping endpoint --- .github/workflows/actions.yml | 2 +- ping-pong/interactor/src/interact.rs | 4 +--- ping-pong/src/ping_pong.rs | 13 ++++++------- ping-pong/src/proxy_ping_pong_egld.rs | 9 ++------- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 1f01ab9..dff89da 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -13,7 +13,7 @@ permissions: jobs: contracts: name: Contracts - uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v3.3.1 + uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v4.1.0 with: rust-toolchain: stable enable-contracts-size-report: false diff --git a/ping-pong/interactor/src/interact.rs b/ping-pong/interactor/src/interact.rs index 90edc8e..018a7e0 100644 --- a/ping-pong/interactor/src/interact.rs +++ b/ping-pong/interactor/src/interact.rs @@ -208,8 +208,6 @@ impl PingPongEgldInteract { } pub async fn ping(&mut self, egld_amount: u64, message: Option<&str>, sender: &Bech32Address) { - let _data: IgnoreValue = IgnoreValue; - let response = self .interactor .tx() @@ -217,7 +215,7 @@ impl PingPongEgldInteract { .to(self.state.current_ping_pong_egld_address()) .gas(30_000_000u64) .typed(proxy_ping_pong_egld::PingPongProxy) - .ping(_data) + .ping() .egld(egld_amount) .returns(ReturnsHandledOrError::new()) .run() diff --git a/ping-pong/src/ping_pong.rs b/ping-pong/src/ping_pong.rs index abecb0d..09f9b35 100644 --- a/ping-pong/src/ping_pong.rs +++ b/ping-pong/src/ping_pong.rs @@ -65,10 +65,9 @@ pub trait PingPong { } /// User sends some EGLD to be locked in the contract for a period of time. - /// Optional `_data` argument is ignored. #[payable("EGLD")] #[endpoint] - fn ping(&self, _data: IgnoreValue) { + fn ping(&self) { let payment = self.call_value().egld_value(); require!( @@ -104,13 +103,13 @@ pub trait PingPong { match user_status { UserStatus::New => { self.user_status(user_id).set(UserStatus::Registered); - }, + } UserStatus::Registered => { sc_panic!("can only ping once") - }, + } UserStatus::Withdrawn => { sc_panic!("already withdrawn") - }, + } } self.ping_event(&caller, &payment); @@ -130,7 +129,7 @@ pub trait PingPong { } else { Result::Err("unknown user") } - }, + } UserStatus::Withdrawn => Result::Err("already withdrawn"), } } @@ -224,7 +223,7 @@ pub trait PingPong { fn deadline(&self) -> SingleValueMapper; /// Block timestamp of the block where the contract got activated. - /// If not specified in the constructor it is the the deploy block timestamp. + /// If not specified in the constructor it is the deploy block timestamp. #[view(getActivationTimestamp)] #[storage_mapper("activationTimestamp")] fn activation_timestamp(&self) -> SingleValueMapper; diff --git a/ping-pong/src/proxy_ping_pong_egld.rs b/ping-pong/src/proxy_ping_pong_egld.rs index ad89444..803954e 100644 --- a/ping-pong/src/proxy_ping_pong_egld.rs +++ b/ping-pong/src/proxy_ping_pong_egld.rs @@ -113,16 +113,11 @@ where Gas: TxGas, { /// User sends some EGLD to be locked in the contract for a period of time. - /// Optional `_data` argument is ignored. - pub fn ping< - Arg0: ProxyArg, - >( + pub fn ping( self, - _data: Arg0, ) -> TxTypedCall { self.wrapped_tx .raw_call("ping") - .argument(&_data) .original_result() } @@ -192,7 +187,7 @@ where } /// Block timestamp of the block where the contract got activated. - /// If not specified in the constructor it is the the deploy block timestamp. + /// If not specified in the constructor it is the deploy block timestamp. pub fn activation_timestamp( self, ) -> TxTypedCall {