The latest release of Term Finance Protocol, version 0.9.0, brings new features designed to enhance the overall robustness of the Protocol (audit here). Most importantly, it introduces enhanced safeguards around protocol price oracles such as zero-price checks, staleness check, sequencer uptime checks and fallback price feeds from trusted providers like Chainlink, Redstone and Chronicle Labs. Below we go through each in turn and explain why it matters.
DeFi lending protocols rely on secure, accurate and real-time financial market data for collateral management. Under normal conditions, Chainlink price feeds update at the lesser of every 0.5% price deviation or every X hours (for exact details on each of the Chainlink feeds used by Term see here).
Because Chainlink uses a multi-layered decentralized aggregation system, they are able to maintain a high level of uptime. That said, it is still possible in times of extreme network congestion for price feeds to remain stale for an extended period of time. These situations are likely to coincide with times of elevated market risk.
To the extent that the protocol’s collateral management mechanism is relying on stale price feeds this could potentially put the protocol at risk of bad debt if prices decline significantly in between updates. To prevent this, v0.9.0 includes a staleness check to compare the “updatedAt” timestamp returned with each price feed call against the current timestamp to see if the time that has lapsed since the last update exceeds the staleness threshold and falls back to the secondary price feed where this occurs.
While the above safeguard helps to address the timeliness of a price feed response, it doesn’t protect against failures. Although unlikely, there is nothing preventing Chainlink price feeds from returning a zero or even a negative price (as “latestRoundData” returns a signed integer - int256 rather than uint256). This would only happen if something were seriously wrong with the Chainlink network but in such a scenario all of a borrower’s collateral could be (unintentionally) at risk of liquidation. Version 0.9.0 addresses this potentiality by performing a check that reverts to a fallback oracle anytime it receives a response from a price feed that is less than or equal to zero.
As Term looks toward expanding its deployment onto various L2s, the latest v 0.9.0 release contemplates situations where the sequencer of an optimistic rollup goes offline by including an L2 specific oracle implementation that references Chainlink L2 Sequencer Uptime Feeds.
The concern with keeping liquidations open while a sequencer is down is that while the average borrower is unable to manage their collateral on the L2 due to the sequencer being down, liquidations of their collateral may still be executed by technically savvy liquidators who manage to interact with Term Finance’s L2 deployment directly through the L1 optimistic rollup contracts.
By applying a modifier to each oracle read method that reverts if the sequencer is not properly functioning, this implementation helps to prevent unfair liquidations. By further imposing a grace period once the sequencer is back to normal functioning, this additional safeguard serves to provide a more even playing field between liquidators and users of Term Finance.
Chainlink - Term Finance relies on Chainlink oracles as its primary oracle where available. Chainlink is the most established oracle provider in the space and has a strong track record securing tens of billions of total value locked in DeFi across multiple chains. They are the most decentralized of the various oracle networks, offering the highest level of security and redundancy.
Chronicle - Term Finance has selected Chronicle Labs after thorough diligence to serve as a backup price feed, where available. Chronicle was one of the first on-chain oracles on Ethereum and was created to facilitate SAI. It continues to secure over $20B as the exclusive guardian of MakerDAO assets and is fully decentralized and backed by established validators. A list of selected validators can be found here.
Redstone - Despite being a newer entrant in the oracle landscape, Redstone has rapidly distinguished itself, pioneering oracle services for groundbreaking projects like Ether.fi and Ethena, demonstrating their capacity to handle and secure even the largest of protocols.
The enhancements in Term Finance Protocol version 0.9.0 demonstrate our steadfast commitment to the core DeFi principles of transparency, auditability, decentralization, and security. These updates not only bolster the robustness of our price oracle mechanisms but also ensure the protocol remains transparent and verifiable by the community.
Every update is thoroughly documented and audited by Sigma Prime, in addition to undergoing formal verification using Certora's CLI. The Sigma Prime audit of version 0.9.0 is traceable to a specific commit hash in our public repository and implementation contracts deployed are comprehensively detailed on our developers' site, enabling anyone in the community to match the code they see on GitHub with the actual contracts deployed on the blockchain.