Skip to content

Commit

Permalink
remove IgnoreValue from ping endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
BiancaIalangi committed Dec 5, 2024
1 parent 658b1e8 commit ef18412
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions ping-pong/interactor/src/interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,14 @@ 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()
.from(sender)
.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()
Expand Down
13 changes: 6 additions & 7 deletions ping-pong/src/ping_pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down Expand Up @@ -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);
Expand All @@ -130,7 +129,7 @@ pub trait PingPong {
} else {
Result::Err("unknown user")
}
},
}
UserStatus::Withdrawn => Result::Err("already withdrawn"),
}
}
Expand Down Expand Up @@ -224,7 +223,7 @@ pub trait PingPong {
fn deadline(&self) -> SingleValueMapper<u64>;

/// 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<u64>;
Expand Down
9 changes: 2 additions & 7 deletions ping-pong/src/proxy_ping_pong_egld.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,11 @@ where
Gas: TxGas<Env>,
{
/// 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<IgnoreValue>,
>(
pub fn ping(
self,
_data: Arg0,
) -> TxTypedCall<Env, From, To, (), Gas, ()> {
self.wrapped_tx
.raw_call("ping")
.argument(&_data)
.original_result()
}

Expand Down Expand Up @@ -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<Env, From, To, NotPayable, Gas, u64> {
Expand Down

0 comments on commit ef18412

Please sign in to comment.