BlockPo / BlockPo-to-Tradelayer

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

Vesting Token Volume Function Conversion for Oracles #153

Closed patrickdugan closed 1 year ago

patrickdugan commented 4 years ago

Case: USDC is trading against a BTC/USD oracle, USDC has traded against BTC on the base Dex at a rate of 9000 for 1 BTC. Hence the engine checks the property 0 pair for the collateral currency of an oracle, it finds a BTC price for that, multiplies by contracts traded, notional value of the contracts. Remember with Oracles, usually the collateral will be a USD-pegged asset that is the denominator of the contract and == notional. With some Oracles and Native contracts, the numerator is settled and therefore the 1/entry-1/exit inverse-quoting is applied.

As it stands we could throw in a hardcoded value that is likely to drift from the true LTC/USD or BTC/USD price over time, but is acceptable enough for the vesting. This is a lower priority feature. Ideally we'd apply this to Liquidity Reward and really make it useful beyond a policing function for developer reward, but Oracles are too prone to abuse because anyone can wash traded BTC with their issued coin, then wash trade the contract to try and harvest the Liquidity Reward.

patrickdugan commented 3 years ago

Whew this one is really old, did we manage to include the derivatives volume?

patrickdugan commented 2 years ago

@santos177 This is done right? We're sampling from Oracle volume for Vesting?