Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new endpoint in test caller #264

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions common/mock-contracts/mock-esdt-safe/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: 1
// Endpoints: 3
// Async Callback (empty): 1
// Total number of exported functions: 4
// Total number of exported functions: 6

#![no_std]

Expand All @@ -21,6 +21,8 @@ multiversx_sc_wasm_adapter::endpoints! {
init => init
upgrade => upgrade
createTransaction => create_transaction
withdrawTransactionFees => withdraw_transaction_fees
withdrawRefundFeesForEthereum => withdraw_refund_fees_for_ethereum
)
}

Expand Down
3 changes: 3 additions & 0 deletions multisig/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
Loading