Skip to content

Commit

Permalink
fix: separated error cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Nov 12, 2024
1 parent 345ef36 commit 17d5b19
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions contracts/v0.2/src/SubmissionProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

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

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

0 comments on commit 17d5b19

Please sign in to comment.