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

Added fetchPrice example, reorganized HC docs #247

Merged
merged 8 commits into from
Aug 30, 2024

Conversation

katieclay
Copy link

📋 Add associated issues, tickets, docs URL here.

Overview

Added a brief explanation of the fetchPrice contract

Changes

Describe your changes and implementation choices. More details make PRs easier to review.

  • Added new file for fetchPrice
  • Reorganized HC docs to accommodate for both examples, including TOC tree

Testing

n/a

@katieclay
Copy link
Author

Need to ask about server.register_function(offchain_addsub2, selector("offchain_addsub2(uint32,uint32)")); other example selector()s' parameter functions don't have "offchain_" in them.

@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.10%. Comparing base (7d1a7c2) to head (91b7a5a).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #247   +/-   ##
========================================
  Coverage    78.10%   78.10%           
========================================
  Files           28       28           
  Lines         2137     2137           
========================================
  Hits          1669     1669           
  Misses         407      407           
  Partials        61       61           
Flag Coverage Δ
cannon-go-tests 78.10% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@katieclay katieclay marked this pull request as ready for review August 29, 2024 21:04
bytes32 userKey = bytes32(abi.encode(msg.sender));
(uint32 error, bytes memory ret) = HA.CallOffchain(userKey, req);

if (error != 0) {

Choose a reason for hiding this comment

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

This is correct from a documentation perspective (matches the code) but I'm not sure if the code itself makes sense. Kevin, can you check this? I'm not sure why there's an "emit" followed by a "revert", or why it's splitting the error code and 'ret' string across two different events.

Choose a reason for hiding this comment

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

It's not a change in this PR but I noticed a typo in this file. In the "why is that" section you show the JSON-RPC request sent to the server, including a method field:

"method":"ASD97e0d7ba",

That should be:
"method":"97e0d7ba",

Copy link

@mmontour1306 mmontour1306 left a comment

Choose a reason for hiding this comment

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

Made a couple of comments but it looks OK to me overall.

@katieclay katieclay merged commit abfd7e0 into develop Aug 30, 2024
57 checks passed
@katieclay katieclay deleted the katie/hc-docs-add-example branch August 30, 2024 22:45
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.

4 participants