soliditylabs / ZTM-Solidity-Code-Repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible mistake in calculating the amount to be minted for the depositor coin

dmtrbch opened this issue · comments

uint256 mintDepositorCoinAmount = ((msg.value.mulWad(dpcInUsdPrice)) /

It's me again :) Following the tutorial I might have detected yet another mistake.

Instead of using:

uint256 mintDepositorCoinAmount = ((msg.value.mulWad(dpcInUsdPrice)) /
oracle.getPrice());

I think we should use:

uint256 mintDepositorCoinAmount = ((msg.value.mulWad(oracle.getPrice())) /
dpcInUsdPrice);

in order to calculate the amount of Depositor Coins to be minted

I guess this is directly related to my previous comment here #1 (comment), but thanks for the feedback!