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

link refund tx to initial tx #235

Merged
merged 4 commits into from
Oct 18, 2024
Merged

Conversation

dragos-rebegea
Copy link
Collaborator

No description provided.

@@ -6,6 +6,7 @@ mod events;
use core::ops::Deref;

pub use dfp_big_uint::DFPBigUint;
use esdt_safe_proxy::RefundInfo;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you dont have to import the struct explicitly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty, fixed

Copy link

Coverage Summary

Totals

Count Covered %
Lines 11242 5758 51.22
Regions 1871 961 51.36
Functions 1051 486 46.24
Instantiations 5201 1206 23.19

Files

Expand
File Lines Regions Functions Instantiations
/home/runner/.cargo/git/checkouts/mx-contracts-rs-13011bd47afef959/d91bbff/contracts/crowdfunding-esdt/src/crowdfunding_esdt.rs 51.56% 57.14% 77.78% 64.00%
/home/runner/.cargo/git/checkouts/mx-contracts-rs-13011bd47afef959/d91bbff/contracts/crowdfunding-esdt/src/crowdfunding_esdt_proxy.rs 100.00% 100.00% 100.00% 100.00%
/bridge-proxy/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/bridge-proxy/src/bridge-proxy.rs 50.31% 64.91% 62.50% 19.42%
/bridge-proxy/src/bridge_proxy_contract_proxy.rs 47.93% 44.44% 44.44% 51.35%
/bridge-proxy/src/bridged_tokens_wrapper_proxy.rs 27.04% 27.27% 27.27% 15.79%
/bridge-proxy/src/config.rs 60.71% 53.33% 75.00% 22.92%
/bridge-proxy/src/esdt_safe_proxy.rs 0.00% 0.00% 0.00% 0.00%
/bridge-proxy/tests/bridge_proxy_blackbox_test.rs 97.20% 96.00% 90.00% 90.00%
/bridged-tokens-wrapper/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/bridged-tokens-wrapper/src/dfp_big_uint.rs 100.00% 100.00% 100.00% 43.48%
/bridged-tokens-wrapper/src/esdt_safe_proxy.rs 2.74% 5.71% 4.92% 3.57%
/bridged-tokens-wrapper/src/events.rs 100.00% 33.33% 100.00% 5.88%
/bridged-tokens-wrapper/src/lib.rs 100.00% 100.00% 100.00% 25.07%
/bridged-tokens-wrapper/tests/bridged_tokens_wrapper_whitebox_test.rs 90.47% 91.28% 90.62% 90.62%
/bridged-tokens-wrapper/tests/dfp_big_uint_test.rs 100.00% 100.00% 100.00% 100.00%
/bridged-tokens-wrapper/tests/scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/common/eth-address/src/lib.rs 93.33% 66.67% 88.89% 46.74%
/common/fee-estimator-module/src/lib.rs 100.00% 93.75% 100.00% 19.83%
/common/fee-estimator-module/src/price_aggregator_proxy.rs 6.14% 4.76% 6.67% 5.26%
/common/max-bridged-amount-module/src/lib.rs 100.00% 87.50% 100.00% 17.48%
/common/token-module/src/lib.rs 68.33% 62.20% 76.19% 22.59%
/common/transaction/src/lib.rs 45.28% 45.10% 58.33% 21.56%
/common/transaction/src/transaction_status.rs 83.33% 66.67% 83.33% 29.79%
/common/tx-batch-module/src/batch_status.rs 33.33% 25.00% 33.33% 7.14%
/common/tx-batch-module/src/lib.rs 81.25% 72.60% 87.50% 19.36%
/common/tx-batch-module/src/tx_batch_mapper.rs 92.54% 89.66% 100.00% 33.75%
/esdt-safe/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/esdt-safe/src/lib.rs 54.25% 41.40% 56.76% 16.26%
/esdt-safe/tests/esdt_safe_scenario_rs_test.rs 100.00% 100.00% 100.00% 100.00%
/esdt-safe/tests/scenario_go_test.rs 100.00% 100.00% 100.00% 100.00%
/multi-transfer-esdt/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs 10.06% 11.11% 11.11% 15.38%
/multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs 39.48% 40.91% 40.91% 42.22%
/multi-transfer-esdt/src/esdt_safe_proxy.rs 22.04% 14.29% 16.39% 14.44%
/multi-transfer-esdt/src/lib.rs 61.14% 60.66% 68.75% 25.33%
/multi-transfer-esdt/src/multi_transfer_proxy.rs 37.32% 38.10% 38.10% 40.00%
/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs 100.00% 100.00% 100.00% 100.00%
/multi-transfer-esdt/tests/multi_transfer_esdt_scenario_rs_test.rs 57.14% 30.00% 30.00% 30.00%
/multi-transfer-esdt/tests/scenario_go_test.rs 30.00% 30.00% 30.00% 30.00%
/multisig/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/multisig/src/action.rs 25.00% 22.22% 33.33% 30.77%
/multisig/src/bridge_proxy_contract_proxy.rs 0.00% 0.00% 0.00% 0.00%
/multisig/src/esdt_safe_proxy.rs 23.25% 15.71% 18.03% 10.34%
/multisig/src/events.rs 100.00% 66.67% 100.00% 12.90%
/multisig/src/lib.rs 69.77% 71.05% 70.00% 25.66%
/multisig/src/multi_transfer_esdt_proxy.rs 19.00% 22.73% 22.73% 13.64%
/multisig/src/multisig_general.rs 80.00% 65.38% 75.00% 30.77%
/multisig/src/multisig_proxy.rs 15.38% 12.24% 14.12% 13.86%
/multisig/src/queries.rs 64.52% 61.76% 57.89% 15.79%
/multisig/src/setup.rs 25.97% 32.61% 25.81% 7.00%
/multisig/src/storage.rs 100.00% 66.67% 100.00% 27.41%
/multisig/src/user_role.rs 83.33% 72.73% 75.00% 41.67%
/multisig/src/util.rs 94.44% 84.38% 100.00% 44.12%
/multisig/tests/multisig_blackbox_test.rs 100.00% 100.00% 100.00% 100.00%
/multisig/tests/multisig_scenario_rs_test.rs 82.69% 72.73% 72.73% 72.73%
/multisig/tests/scenario_go_test.rs 70.00% 70.00% 70.00% 70.00%
/test-caller/meta/src/main.rs 0.00% 0.00% 0.00% 0.00%
/test-caller/src/test-caller.rs 0.00% 0.00% 0.00% 0.00%

Copy link

Contract comparison - from 10502db to ef221a3

Path                                                                                             size                  has-allocator                     has-format
test-caller.wasm 3238 ➡️ 3274 🔴 false without message
test-caller-dbg.wasm 7109 ➡️ 7110 🔴 false without message
esdt-safe.wasm 26334 ➡️ 26692 🔴 false without message
esdt-safe-dbg.wasm 63529 ➡️ 64277 🔴 false without message
multi-transfer-esdt.wasm 17213 ➡️ 17273 🔴 false without message
multi-transfer-esdt-dbg.wasm 41043 ➡️ 40924 🟢 false without message
bridge-proxy-dbg.wasm 34788 ➡️ 34759 🟢 false without message
bridge-proxy.wasm 13383 ➡️ 13291 🟢 false without message
bridged-tokens-wrapper.wasm 9027 ➡️ 9195 🔴 false without message
bridged-tokens-wrapper-dbg.wasm 26108 ➡️ 26808 🔴 false without message
multisig-dbg.wasm 72041 ➡️ 72044 🔴 false without message
multisig.wasm 29339 ➡️ 29365 🔴 false without message

Comment on lines +357 to +364
self.create_refund_transaction_event(
batch_id,
tx_nonce,
payment_token,
actual_bridged_amount,
required_fee,
refund_info.initial_batch_id,
refund_info.initial_nonce,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also need to include the refund address and tx.to in the create_refund_transaction_event because if we do not receive the create_transaction_event before, we don't have all the details to index the "refunded" swap in ES

@@ -34,7 +34,7 @@ pub trait BridgeProxyContract:

#[payable("*")]
#[endpoint]
fn deposit(&self, eth_tx: EthTransaction<Self::Api>) {
fn deposit(&self, eth_tx: EthTransaction<Self::Api>, batch_id: u64) {
Copy link
Contributor

@iulianpascalau iulianpascalau Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not put this mandatory argument here, which is useless in the case we want to do a normal swap from Mvx->Eth
Instead, why not create a depositWithLinkedBatchID function? And that should be called from the bridge proxy SC

This is the bridge proxy SC, not the esdt safe

@iulianpascalau iulianpascalau merged commit 202a8b2 into feat/v3 Oct 18, 2024
5 checks passed
@iulianpascalau iulianpascalau deleted the link-refund-tx-to-initial-tx branch October 18, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants