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

Slow Sky Puma - User gets fewer Numa tokens when burning nuAsset tokens #248

Open
sherlock-admin3 opened this issue Dec 31, 2024 · 0 comments

Comments

@sherlock-admin3
Copy link
Contributor

Slow Sky Puma

Medium

User gets fewer Numa tokens when burning nuAsset tokens

Summary

Incorrect calculation in NumaPrinter.sol results in user getting fewer Numa tokens when burning nuAsset tokens to mint Numa tokens

Root Cause

In NumaPrinter.sol, a wrong calculation is done to get the highest amount between the amount of Numa generated from the Vault buy price and the amount of Numa generated LP Price, and this results a lower amount of Numa returned to burnAssetInputToNuma.

Internal pre-conditions

  1. User needs to call burnAssetInputToNuma when vault buy price != LP Price

External pre-conditions

No response

Attack Path

  1. User calls burnAssetInputToNuma when vault buy price != LP Price
  2. getNbOfNumaFromAssetWithFeeis called to fetch the max amount of Numa minted from burning _nuAssetAmount
  3. Higher amount of Numa between vault buy price amountnumaAmountVault and LP price amount numaAmountPrice is returned

Impact

The user receives less Numa tokens than should be sent, when burning nuAssetAmount of nuAsset tokens.

PoC

No response

Mitigation

The line

if (numaAmountVault < numaAmountPool) costWithoutFee = numaAmountVault;

should be changed to

if (numaAmountVault > numaAmountPool) costWithoutFee = numaAmountVault;
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

No branches or pull requests

1 participant