BlockPo / BlockPo-to-Tradelayer

Incubation Repo for the TradeLayer protocol, 0.2.0
http://www.tradelayer.org
Other
8 stars 8 forks source link

Native Contracts - Index and Outlier Exclusion #474

Closed patrickdugan closed 2 years ago

patrickdugan commented 2 years ago

Modify the parameter logic to allow the source of a native contract to be an array of arrays, the array may contain arrays of two SP id numbers or single contract id numbers, these contract ids must be of oracle contracts. We want to limit the recombination explosion in possible /USD contracts by not allowing any recursion here, you know? "Maybe limiting recursion is a good thing here" - the computer 'scientist' said.

The index price is an equal weighting of the VWAP of the two SP ids spot trading over 3 blocks, the TWAP of an oracle over 3 blocks, and excludes the outlier if there are 3 or more members. If there are 3, then the 1 that is furthest from the average of the 3 is excluded. If there are 4, then the 2 that are furthest are excluded. At 5, we keep it to just 2 that are furthest being excluded. At 6, exclude 3 outliers. At N/2 Rounded Down, we exclude outliers from an index with N members.

That oughta solve the Oracle Problem!

patrickdugan commented 2 years ago

This is an inferior design to the anti-WT tickets we're going to do instead.