Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evelinemolnar committed Oct 2, 2024
1 parent 48e46a2 commit c1321a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
4 changes: 2 additions & 2 deletions bridged-tokens-wrapper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ pub trait BridgedTokensWrapper:
opt_refunding_address: OptionalValue<ManagedAddress>,
) {
let (payment_token, payment_amount) = self.call_value().single_fungible_esdt();
let chain_specific_token_id = self
let universal_token_id = self
.chain_specific_to_universal_mapping(&requested_token)
.get();

let converted_amount = if chain_specific_token_id == payment_token {
let converted_amount = if universal_token_id == payment_token {
self.unwrap_token_common(&requested_token)
} else {
payment_amount
Expand Down
27 changes: 8 additions & 19 deletions multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ fn test_unwrap_token_create_transaction_paused() {
}

#[test]
fn insufficient_liquidity_test() {
fn test_unwrap_token_create_transaction_insufficient_liquidity() {
let mut state = MultiTransferTestState::new();
state.deploy_contracts();
state.config_multi_transfer();
Expand Down Expand Up @@ -818,41 +818,30 @@ fn test_unwrap_token_create_transaction_should_work() {
.run();
}

#[test] //small issue, the test passes and it should not because BRIDGE_TOKEN_ID is not mapped to WRAPPED_TOKEN_ID
fn mismatched_token_id_test() {
#[test]
fn test_unwrap_token_create_transaction_amount_zero() {
let mut state = MultiTransferTestState::new();

state.deploy_contracts();

state.config_multi_transfer();
state.config_bridged_tokens_wrapper();

let result = state
.world
.query()
.to(BRIDGED_TOKENS_WRAPPER_ADDRESS)
.typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy)
.chain_specific_to_universal_mapping(WRAPPED_TOKEN_ID)
.returns(ReturnsResult)
.run();

println!("{:?}", result);

state
.world
.tx()
.from(BRIDGE_PROXY_ADDRESS)
.to(BRIDGED_TOKENS_WRAPPER_ADDRESS)
.typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy)
.unwrap_token_create_transaction(
WRAPPED_TOKEN_ID,
TokenIdentifier::from(WRAPPED_TOKEN_ID),
EthAddress::zero(),
OptionalValue::Some(ManagedAddress::zero()),
)
.egld_or_single_esdt(
&EgldOrEsdtTokenIdentifier::esdt(BRIDGE_TOKEN_ID),
&EgldOrEsdtTokenIdentifier::esdt(UNIVERSAL_TOKEN_IDENTIFIER),
0u64,
&BigUint::from(100u64),
&BigUint::from(0u64),
)
.returns(ExpectError(ERROR, "Esdt token unavailable"))
.returns(ExpectError(ERROR, "Must pay more than 0 tokens!"))
.run();
}

0 comments on commit c1321a9

Please sign in to comment.