Skip to content
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

Update contract #2314

Merged
merged 11 commits into from
Nov 12, 2024
15 changes: 10 additions & 5 deletions contracts/v0.2/src/SubmissionProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ contract SubmissionProxy is Ownable {

mapping(address => OracleInfo) public whitelist;
mapping(bytes32 feedHash => IFeed feed) public feeds;
mapping(bytes32 feedHash => uint8 threshold) thresholds;
mapping(bytes32 feedHash => uint256 lastSubmissionTime) lastSubmissionTimes;
mapping(bytes32 feedHash => uint8 threshold) public thresholds;
mapping(bytes32 feedHash => uint256 lastSubmissionTime) public lastSubmissionTimes;

event OracleAdded(address oracle, uint256 expirationTime);
event OracleRemoved(address oracle);
Expand All @@ -61,7 +61,8 @@ contract SubmissionProxy is Ownable {
error InvalidSignatureLength();
error InvalidFeed();
error ZeroAddressGiven();
error AnswerTooOld();
error AnswerOutdated();
error AnswerSuperseded();
error InvalidProofFormat();
error InvalidProof();
error FeedHashNotFound();
Expand Down Expand Up @@ -416,8 +417,12 @@ contract SubmissionProxy is Ownable {
}

function submitSingle(bytes32 _feedHash, int256 _answer, uint256 _timestamp, bytes calldata _proof) public {
if (_timestamp <= (block.timestamp - dataFreshness) * 1000 || lastSubmissionTimes[_feedHash] >= _timestamp) {
revert AnswerTooOld();
if (_timestamp <= (block.timestamp - dataFreshness) * 1000 ) {
revert AnswerOutdated();
}
nick-bisonai marked this conversation as resolved.
Show resolved Hide resolved

if (lastSubmissionTimes[_feedHash] >= _timestamp) {
revert AnswerSuperseded();
}

(bytes[] memory proofs_, bool success_) = splitProofs(_proof);
Expand Down
Loading