Skip to content

Conversation

@cctdaniel
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Nov 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 1:57pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 1:57pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 1:57pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Ignored (Inspect) Visit Preview Nov 11, 2024 1:57pm
insights ⬜️ Ignored (Inspect) Visit Preview Nov 11, 2024 1:57pm


() update_price_feeds(int msg_value, slice data) impure {
load_data();
tuple parse_price_feeds_from_data(slice data) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tuple is how we deal with arrays in func

load_data();

;; Load price_ids tuple
int price_ids_len = price_ids_slice~load_uint(8);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should price_ids_len == 0 be supported? This will then be treated like a call from update_price_feeds within parse_price_feeds_from_data and everything will be included, meaning min_publish_time and max_publish_time are ignored.

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I'll approve once all comments are addressed.

int i = price_feeds.tlen() - 1;
while (i >= 0) {
tuple price_feed = price_feeds.at(i);
int price_id = price_feed.at(0);
Copy link
Contributor Author

@cctdaniel cctdaniel Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 is price_id, 1 is price_feed_cell

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my inline comment about the order of the output. I'll approve as soon as it's fixed.

Comment on lines +243 to +249
if (price_ids_len == 0) {
ordered_feeds~udict_set(8, index, begin_cell()
.store_uint(price_id, 256)
.store_ref(price_feed_cell)
.end_cell().begin_parse());
index += 1;
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably when having a top level if to return in this case makes the code cleaner.

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cctdaniel cctdaniel merged commit d3d0f9f into main Nov 12, 2024
8 checks passed
@cctdaniel cctdaniel deleted the ton-parse-price-feed-updates branch November 12, 2024 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants