IdleCDO.virtualPrice() and _updatePrices() yield different prices in a number of cases
The function `IdleCDO.virtualPrice()` is used to determine the current price of a tranche. Similarly, `IdleCDO._updatePrices()` is used to store the latest price of a tranche, as well as update other parts of the system accounting. There are a number of cases where the prices yielded by these two functions differ. While these are primarily corner cases that are not obviously exploitable in practice, potential violations of key accounting invariants should always be considered serious.\\nAdditionally, the use of two separate implementations of the same calculation suggest the potential for more undiscovered discrepancies, possibly of higher consequence.\\nAs an example, in `_updatePrices()` the precision loss from splitting the strategy returns favors BB tranche holders. In `virtualPrice()` both branches of the price calculation incur precision loss, favoring the `IdleCDO` contract itself.\\n`_updatePrices()`\\n```\\nif (BBTotSupply == 0) {\\n  // if there are no BB holders, all gain to AA\\n  AAGain = gain;\\n} else if (AATotSupply == 0) {\\n  // if there are no AA holders, all gain to BB\\n  BBGain = gain;\\n} else {\\n  // split the gain between AA and BB holders according to trancheAPRSplitRatio\\n  AAGain = gain \\* trancheAPRSplitRatio / FULL\\_ALLOC;\\n  BBGain = gain - AAGain;\\n}\\n```\\n\\n`virtualPrice()`\\n```\\nif (\\_tranche == AATranche) {\\n  // calculate gain for AA tranche\\n  // trancheGain (AAGain) = gain \\* trancheAPRSplitRatio / FULL\\_ALLOC;\\n  trancheNAV = lastNAVAA + (gain \\* \\_trancheAPRSplitRatio / FULL\\_ALLOC);\\n} else {\\n  // calculate gain for BB tranche\\n  // trancheGain (BBGain) = gain \\* (FULL\\_ALLOC - trancheAPRSplitRatio) / FULL\\_ALLOC;\\n  trancheNAV = lastNAVBB + (gain \\* (FULL\\_ALLOC - \\_trancheAPRSplitRatio) / FULL\\_ALLOC);\\n}\\n```\\n
Implement a single method that determines the current price for a tranche, and use this same implementation anywhere the price is needed.
```\\nif (BBTotSupply == 0) {\\n  // if there are no BB holders, all gain to AA\\n  AAGain = gain;\\n} else if (AATotSupply == 0) {\\n  // if there are no AA holders, all gain to BB\\n  BBGain = gain;\\n} else {\\n  // split the gain between AA and BB holders according to trancheAPRSplitRatio\\n  AAGain = gain \\* trancheAPRSplitRatio / FULL\\_ALLOC;\\n  BBGain = gain - AAGain;\\n}\\n```\\n