Skip to content

Commit

Permalink
Merge pull request #1516 from multiversx/encode-error-basic-features
Browse files Browse the repository at this point in the history
encode error from basic features migration to new proxy and unified syntax
  • Loading branch information
mihaicalinluca authored Mar 28, 2024
2 parents a8394b9 + a320dca commit d02b4a4
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions contracts/feature-tests/basic-features/src/codec_err_test.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
multiversx_sc::imports!();
use crate::types::CodecErrorTestType;

mod encode_err_proxy {
multiversx_sc::imports!();
use crate::types::CodecErrorTestType;

#[multiversx_sc::proxy]
pub trait EncodeErrorProxy {
#[init]
fn init(&self, error_arg: CodecErrorTestType);

#[endpoint]
fn encode_error_method(&self, error_arg: CodecErrorTestType);
}
}

/// Test various serialization errors.
#[multiversx_sc::module]
pub trait CodecErrorTest {
Expand Down Expand Up @@ -62,24 +48,17 @@ pub trait CodecErrorTest {
fn codec_err_event_data(&self) {
self.event_err_data(CodecErrorTestType);
}

#[proxy]
fn encode_err_proxy(&self) -> encode_err_proxy::Proxy<Self::Api>;

/// Never actually calls any deploy/upgrade, so it is appropriate in this contract.
/// It just covers contract init serialization errors.
#[endpoint]
fn codec_err_contract_init(&self) {
let _ = self.encode_err_proxy().init(CodecErrorTestType);
let _ = self.tx().raw_deploy().argument(&CodecErrorTestType);
}

/// Never actually calls any async/sync call, so it is appropriate in this contract.
/// It just covers contract call serialization errors.
#[endpoint]
fn codec_err_contract_call(&self) {
let _ = self
.encode_err_proxy()
.contract(ManagedAddress::zero())
.encode_error_method(CodecErrorTestType);
let _ = self.tx().raw_call().argument(&CodecErrorTestType);
}
}

0 comments on commit d02b4a4

Please sign in to comment.