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

Audit/oracle/non zero check for ids #68

Merged
merged 3 commits into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/oracle/oracle.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ mod Oracle {
}

let key_currency = *key_currencies.get(idx).unwrap().unbox();
assert(key_currency.id != 0, 'Cannot set null id');
self.oracle_currencies_storage.write(key_currency.id, key_currency);
idx = idx + 1;
};
Expand All @@ -383,6 +384,7 @@ mod Oracle {
break ();
}
let key_pair = *key_pairs.get(idx).unwrap().unbox();
assert(key_pair.id != 0, 'Cannot set null id');
let base_currency = self.oracle_currencies_storage.read(key_pair.base_currency_id);
assert(base_currency.id != 0, 'No base currency registered');
let quote_currency = self
Expand Down Expand Up @@ -1574,6 +1576,7 @@ mod Oracle {
self.assert_only_admin();
let check_pair = self.oracle_pairs_storage.read(new_pair.id);
assert(check_pair.id == 0, 'Pair with this key registered');
assert(new_pair.id != 0, 'Cannot set id null');
let base_currency = self.oracle_currencies_storage.read(new_pair.base_currency_id);
assert(base_currency.id != 0, 'No base currency registered');
let quote_currency = self.oracle_currencies_storage.read(new_pair.quote_currency_id);
Expand Down
Loading