Skip to content

Commit

Permalink
Merge branch 'feat/v3.1' into v3.5-audit-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CostinCarabas authored Dec 19, 2024
2 parents 38538b9 + 7eb68ea commit ddb2146
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
21 changes: 21 additions & 0 deletions test-caller/src/test-caller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct CalledData<M: ManagedTypeApi> {
pub size: u64,
pub address: ManagedAddress<M>,
pub token_identifier: TokenIdentifier<M>,
pub buff: ManagedBuffer<M>,
}

#[multiversx_sc::contract]
Expand Down Expand Up @@ -41,6 +42,26 @@ pub trait TestCallerContract {
size,
address,
token_identifier,
buff: ManagedBuffer::new(),
};

_ = self.called_data_params().push(&data);
}

#[payable("*")]
#[view(callPayableWithBuff)]
fn call_payable_with_buff(
&self,
buff: ManagedBuffer,
) {
let payment = self.call_value().single_esdt();
let token_identifier = payment.token_identifier;

let data = CalledData{
size: 0,
address: ManagedAddress::zero(),
token_identifier,
buff,
};

_ = self.called_data_params().push(&data);
Expand Down
5 changes: 3 additions & 2 deletions test-caller/wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

// Init: 1
// Upgrade: 1
// Endpoints: 4
// Endpoints: 5
// Async Callback (empty): 1
// Total number of exported functions: 7
// Total number of exported functions: 8

#![no_std]

Expand All @@ -23,6 +23,7 @@ multiversx_sc_wasm_adapter::endpoints! {
callPayable => call_payable
callNonPayable => call_non_payable
callPayableWithParams => call_payable_with_params
callPayableWithBuff => call_payable_with_buff
getCalledDataParams => get_called_data_params
)
}
Expand Down

0 comments on commit ddb2146

Please sign in to comment.