Time Weighted Average Prices, Pillars of The Umbrella Network

Priyeshu Garg
Umbrella Network
Published in
5 min readJan 16, 2021

Oracles are and always will be a hard problem to solve. Some even believe it’s the hardest problem DeFi faces.

In ancient Greece, there were places where people could ask gods about their wills and get answers — they were called Oracles. The definition was then extended to mathematics and oracles soon became known as the “black box” that could answer questions by abstracting the process it went through while calculating the answer to the question.

Oracles have claimed their importance many times throughout history.

According to Greek legend, King Croesus of Lydia went to an Oracle to ask if he should attack his neighboring kingdom of Persia, whereupon he was told that if he attacks the kingdom, a great kingdom will be lost. Believing it was Persia that would be lost, he waged a war that ultimately led to the fall of his own kingdom.

In the world of DeFi, oracles are one of the fundamental building blocks of the entire ecosystem. They are the bridges that connect decentralized finance to the outside world. Furthermore, they serve as important intersection points between different DeFi protocols. For example, liquidations at a borrowing/lending Dapp require the prices from a trusted source to liquidate under-collateralized loans.

There is a thriving underground industry of DeFi liquidators who are incentivized to sell off positions that are under-collateralized. These sophisticated bots use state of the art technology to search and identify such assets. The bots receive a commission when liquidations occur, making them constantly incentivized to monitor and act on such situations.

In theory, the process is well thought out and should work flawlessly in the DeFi infrastructure.

However, malicious actors cause trouble in this model by actively seeking out and exploiting these situations to trigger liquidations in order to receive bonuses. There are many attack vectors possible for those who want to attack the system, with the targeting and manipulation of on-chain asset prices being a particularly effective method to trigger a liquidation event. Essentially, anyone can manipulate DeFi prices, thanks to the existence of flash-loans which allow DeFi users to take out extremely short term loans of very large amounts of capital without depositing any collateral (provided they return the funds back into the same transaction and agree to bear a reasonable interest rate).

The Oracle problem doesn’t just need an ordinary solution, it needs a multi-faceted one.

The Umbrella Network has sought out to solve this problem by propping it up on multiple pillars of technical infrastructure. In this post, we will introduce our first pillar of defense — Time Weighted Averages.

As mentioned in the examples above, the flash loan attack vector has a limitation — it must be executed within seconds and within the same block in order to have an impact. This, however, isn’t possible when prices are averaged over an extended period of time to establish the correct oracle price for a digital asset.

Example

Time-wise ETH price

The time-weighted average price would be :

=$904.37 for the above data in the table.

The time delta can be defined by the querying counterparty — the UMB network will support TWAPs (Time Weighted Average Prices) for various time-averages like 6H,12H, 24H, etc. The resistance level of the UMB network’s time-weighted average prices would be high, disincentivizing manipulation by making its cost exceed the attack earnings.

For example, a malicious actor would have to absorb the arbitrage losses of 5% for hours in order to manipulate the price of a 6H TWAP. In an instantaneous flash loan price manipulation attack where the oracle uses only the latest available price, the same actor would not have to absorb any losses. Thus, using a 6H TWAP would make flashloan based attacks virtually impossible.

The TWAPs structure can also be re-aligned to weight the recent timestamps higher or lower than the older ones. For example, 50% pricing-weight can be allocated to the last 15 minutes of pricing activity, and the other 50% can be allocated to the remaining 5 hours 45 minutes in the 6H TWAP.

There are asset classes that are even more prone to manipulation than popular pairs like ETH/DAI. The assets forming the mid and tail of the market — medium and small market-cap assets — are easier to manipulate due to illiquid markets. UMB Network oracles focus on solving the oracle problem for these assets first, as barely any oracles exist for them. This means they are often neglected from the burgeoning lending/borrowing industry. UMB Network will unlock liquidity for billions of dollars worth of tokens by providing the necessary infrastructure to less liquid tokens.

TWAPs can also be extended to include VWAPs in their definition, resulting in hybrids called TVWAPs. They are, essentially, Time & Volume Weighted Average Prices that factor in the price of tokens with respect to volumes to come up with the right product prices. UMB Network is currently exploring building various combinations, focusing mostly on finding a setup that would benefit the most developers.

It’s time developers and Oracles start cooperating with each other to ensure ambiguity fades and attack vectors cease to exist. The first step needed to achieve this is to ensure that Oracles aren’t owned by large corporations, but rather by the community that uses them.

This is exactly why the UMB network is owned by the community. The network’s tokenomics dictate that the majority of the governance tokens of the protocol are owned by its community of contributors.

--

--