Submitted by cmichel
The TWAPOracle.consult function is unclear to the auditor.
It seems to iterate through all registered pairs that share the token parameter (USDV or VADER) and then sums up the foreign token pair per token price.
And divides this sum (sumNative) by the summed-up USD price of these foreign token pairs (sumUSD).
I think the idea is to create some kind of average price but doing it like this does not seem to be effective because large prices are weighted a lot stronger than low prices.
Assume there are 3 USDV pairs registered: (ETH, DAI, USDC).
Oracle Price: USDV/ETH 4500, USDV/DAI 1, USDV/USDC 1
Pool price: USDV/ETH 4500, USDV/DAI 10, USDV/USDC 10
Even though the DAI and USDC pool prices are off by 10x, the final result is 4502/4520 = 0.996017699 very close to a price of 1.0 which seems strange.
Document how the algorithm works and make sure its correct.
Resolve the TODO.
SamSteinGG (Vader) confirmed
