Bootstrapping of gold oracle pool and Dexy

Most of actions in the bank contracts, and also LP redemption are relying on liquidity pool’s price to oracle price ratio. To avoid relying in such actions on two data inputs (which would probably mean a lot of failed txs as the inputs are constantly being updated), and also to extract common functionality from multiple contracts, we use tracking contracts here.

A tracker is like a monitor that triggers an alarm when an event occurs. The alarm continues to “ring” until the tracker resets the alarm, which can only happen after the event has ended. Thus, if the alarm is in a “triggered” state, we can be sure that the event is ongoing (i.e., not yet ended). In our case, the event we are monitoring is the ratio of LP rate and Oracle rate going below (or above) some value. The registers define the ratio to monitor (R4, R5) and whether we are monitoring above or below (R6), along with the height at which the trigger occurred (R7). The value in R7 will be “infinity” if the event has ended.

This box is be spent whenever tracker state must change i.e., move from trigger to reset or vice versa. This box can only be be spent if the tracker state changes.

Tracking contract source code: dexy-stable/contracts/tracking.es at master · kushti/dexy-stable · GitHub

And tracking contracts are just deployed on the mainnet!

3 Likes