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

fix: swaps of insufficient asset via evm #805

Merged
merged 5 commits into from
Apr 17, 2024

Conversation

dmoka
Copy link
Contributor

@dmoka dmoka commented Apr 17, 2024

The operation fails already when MM does a dry-run estimateGas(...) on the transaction. When insufficient asset is bought, on_funds is triggered where we try to retrieve the price of the fee payment asset from the multi-pallet:

let ed_in_fee_asset = MultiTransactionPayment::price(fee_payment_asset)

But at the point of dry-run, the storage is empty, so it doesn't contain the accepted currency prices, as they are populated only in on_initialize of multi pallet.

The solution is to calculate the oracle onchain price directly instead of getting the prices from an empty prices storage of MultiPaymentPallet

Copy link

github-actions bot commented Apr 17, 2024

Crate versions that have been updated:

  • runtime-integration-tests: v1.20.1 -> v1.20.2
  • pallet-transaction-multi-payment: v9.5.0 -> v9.6.0
  • hydradx-runtime: v227.0.0 -> v228.0.0

Runtime version has been increased.

@dmoka dmoka marked this pull request as ready for review April 17, 2024 11:23
@dmoka dmoka self-assigned this Apr 17, 2024
@mrq1911 mrq1911 changed the title fix: bug of buying insufficient asset via evm fix: buying insufficient asset via evm Apr 17, 2024
@mrq1911 mrq1911 changed the title fix: buying insufficient asset via evm fix: swaps of insufficient asset via evm Apr 17, 2024
@mrq1911 mrq1911 merged commit 6cf5bb5 into master Apr 17, 2024
6 checks passed
@dmoka dmoka deleted the fix/evm-trade-insufficient-asset branch April 17, 2024 14:05
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.

None yet

2 participants