-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Contracts #1
base: master
Are you sure you want to change the base?
Conversation
Looks good 👍 Will leave it to @ahnaguib to give final approval. |
contracts/TellorProvider.sol
Outdated
function pushTellor() external { | ||
(bool retrieved, uint256 value, uint256 _time) = getTellorData(); | ||
|
||
require(_time > now - medianOracle.reportExpirationTimeSec() && retrieved, "Tellor value too old"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for not relying on pushData() failing instead of checking here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that getData()
relies on the time that the payload was added to the market-oracle contract, while here we check the time the data was added to the Tellor system. We could theoretically take an old Tellor value and push a report, which will be accepted on getData.
It's another layer of protection to ensure the data is fresh.
|
||
function verifyTellorReports() external { | ||
//most recent tellor report is in dispute, so let's purge it | ||
if(tellor.retrieveData(TellorID, tellorReport.time0) == 0 || tellor.retrieveData(TellorID,tellorReport.time1) == 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about if one of them is valid, it pushes it after purging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will add that to the job. After we purge a report, we'll check if we have a valid value and push it again
contracts/IMedianOracle.sol
Outdated
function reportExpirationTimeSec() external returns(uint256); | ||
function pushReport(uint256 payload) external; | ||
function purgeReports() external; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add new lines to all the files to keep the linters happy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
||
function pushTellor() external { | ||
(bool retrieved, uint256 value, uint256 _time) = getTellorData(); | ||
//Saving _time in a storage value to quickly verify disputes later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey am I missing something or should the report only get pushed if retrieved
is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retrieved
is true if the value count is greater than 0. TellorID
10 has months of data with a value count of over 4500, so retrieved
will always be true when using the current Tellor contracts.
Hello!
I just set the truffle project and created the basic contracts for the conector.