Proud Rusty Mantis
High
Upon swapping between nuAssets
, we use the following function for the conversion:
function getNbOfNuAssetFromNuAsset(uint256 _nuAssetAmountIn, address _nuAssetIn, address _nuAssetOut) external view returns (uint256) {
uint256 nuAssetOutPerETHmulAmountIn = nuAManager.ethToNuAsset(_nuAssetOut, _nuAssetAmountIn);
uint256 tokensForAmount = nuAManager.nuAssetToEth(_nuAssetIn, nuAssetOutPerETHmulAmountIn);
return tokensForAmount;
}
The function is incorrect as we are converting like this: ETH -> nuAssetA -> ETH
when it should be nuAssetA-> ETH -> nuAssetB
.
- User swaps between tokens
- The conversion is completely incorrect
Incorrect conversion which can cause a protocol drain or users receiving much less than supposed to
Convert like nuAssetA -> ETH -> nuAssetB