venusprotocol / oracle Goto Github PK
View Code? Open in Web Editor NEWVenus oracle repo
License: BSD 3-Clause "New" or "Revised" License
Venus oracle repo
License: BSD 3-Clause "New" or "Revised" License
I have reviewed the code carefully, and I'm really impressed by the code quality and consistency. @RoseRompkxm thank you for doing the great job here! Here are a couple of nitpicks I have, let's discuss them and address the issues. After that I'd say we're good to go with the audits.
Oracles may sometimes revert, e.g. when Chainlink drops the feeds support, they remove the implementation entirely and the call to functions like decimals()
revert. Ideally, we should, ofc, monitor these events, but since we're working with external parties, sometimes things out of our control happen. I propose we handle such cases with try-catch blocks (i.e. try getting the underlying price and return INVALID_PRICE if the call reverts).
https://github.com/VenusProtocol/oracle/blob/develop/contracts/ResilientOracle.sol#L203
https://github.com/VenusProtocol/oracle/blob/develop/contracts/ResilientOracle.sol#L176
These lines in PancakeLibrary suggest that the overflow is desired. However, 0.8 would throw an error in case of overflow:
oracle/contracts/libraries/PancakeLibrary.sol
Lines 49 to 55 in 5fb8988
If the overflow is desired, let's use an unchecked { ... }
block here.
We're using solidity >= 0.8 here, so I propose we remove the dependency on SafeMath and use arithmetic operators directly.
// @TODO: This is some history code, keep it here in case of messing up
} else if (_compareStrings(symbol, "XVS")) {
return prices[address(vToken)];
}
I don't know why we have it. Do we even have a vToken with "XVS" as a symbol? getUnderlyingPrice(XVS.address)
returns zero now, assetPrices(XVS.address)
returns zero as well ๐คท
oracle/contracts/oracles/TwapOracle.sol
Line 157 in 5fb8988
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.