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 spends more Numa tokens than required to mint an amount of nuAsset tokens #239

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

Comments

@sherlock-admin3
Copy link
Contributor

Slow Sky Puma

Medium

User spends more Numa tokens than required to mint an amount of nuAsset tokens

Summary

Higher Price between vault buy price and LP price is Used to Mint nuAsset from Numa, instead of using the lower price.

Root Cause

In NumaPrinter.sol, a wrong calculation is done to get the lowest price between Vault buy price and LP Price, and this results in the higher price used to mint a nuAsset from Numa.

Internal pre-conditions

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

External pre-conditions

No response

Attack Path

  1. User calls mintAssetOutputFromNuma when vault buy price != LP Price
  2. getNbOfNumaNeededAndFeeis called to fetch the min amount of Numa needed to mint _nuAssetAmount
  3. Higher amount between vault buy price numaAmountVault and LP price numaAmountPrice is returned

Impact

The user spends more numa token than required, to mint the commensurate amount 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