-
Notifications
You must be signed in to change notification settings - Fork 302
feat(target_chains/ton): add parse_price_feed_updates #2099
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
|
|
||
| () update_price_feeds(int msg_value, slice data) impure { | ||
| load_data(); | ||
| tuple parse_price_feeds_from_data(slice data) { |
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.
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); |
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.
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.
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.
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); |
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.
0 is price_id, 1 is price_feed_cell
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.
See my inline comment about the order of the output. I'll approve as soon as it's fixed.
| 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 { |
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.
This is probably when having a top level if to return in this case makes the code cleaner.
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.
Thanks!
No description provided.