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

oracles-and-oracle-networks #362

Closed
wants to merge 6 commits into from
Closed

Conversation

Phenzic
Copy link

@Phenzic Phenzic commented Aug 27, 2024

Problem

  • There are Grammar and Spelling errors in the piece
  • Found broken links in the article
  • The code snippet for the aggregator contract was updated in the source code
  • Typescript unit test needed optimization, to reduce redundancy, handle error properly,
    • it had inconsistent means of logging data
  • The typescript contract call script (client-side) didn't have anchor imported

Summary of Changes

I Made Grammar and code modifications to the article.

Fixes #

  • I modified the aggregator contract based on the source code reference on github

  • Resolved grammatic errors,

  • Made changes to foster concise reading

  • Corrected Spell Checks

  • Updated & replaced broken Links

  • Modified typescript unit test to do the following:

    • Added utility functions (getSwitchboardAggregator and deriveEscrowStateAccount) to reduce code duplication and improve readability.
    • I used assert.strictEqual and assert.isTrue for more precise assertions.
    • I Improved error handling with more specific assertions and clearer error messages.
    • I added consistent usage of console.error for logging errors and console.log for regular output.
    • I Improved overall the code readability by reducing redundant code and using clearer function and variable names.
    • I also strengthened the assertions to ensure that the expected outcomes are met in each test.
    • I also updated the headers to follow the SEO requirements (arranged in steps)
  • For the Typescript contract call script:

    • I used the anchor.web3.Keypair.generate() method since its more conventional and readable when generating a new keypair in Solana.
    • I created a reusable function to use across your application. This will reduce overhead and potential issues with multiple network connections.
    • I added a console.log statement to display the fetched SOL price.
    • I added a try-catch error handler for the fetchPrice function

Note: apologies for the 2 extra edited file; a little setback from using Prettify

@Phenzic Phenzic requested a review from nickfrosty as a code owner August 27, 2024 08:50
}

// Call the function to fetch the SOL price
fetchSolPrice();
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need for wrapper functions. See CONTRIBUTING.md.

AggregatorAccount,
SwitchboardProgram,
} from "@switchboard-xyz/solana.js";
import * as anchor from "@project-serum/anchor";
Copy link
Collaborator

Choose a reason for hiding this comment

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

@project-serum/anchor does not exist anymore.

though, it’s helpful to break it up across different files. Our program will
have the following files within the `programs/src` directory:
code to a single `lib.rs` file and call it a day. To keep it more organized,
though, it’s helpful to break it up across different files.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use the multiple files template. This is mentioned in CONTRIBUTING.md.

assert(failUnlockPrice == newAccount.unlockPrice);
assert(escrowBalance > 0);
assert.strictEqual(failUnlockPrice, newAccount.unlockPrice);
assert.isAbove(escrowBalance, 0);
} catch (e) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use full names. This is mentioned in CONTRIBUTING.md

],
"exclude": ["node_modules"]
"exclude": ["node_modules"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove these from the PR.

Copy link
Collaborator

@mikemaccana mikemaccana left a comment

Choose a reason for hiding this comment

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

This PR seems mainly to be minor grammar fixes, updates from Switchboard's GitHub gists, and doesn't meet the CONTRIBUTING.md requirements.

@Phenzic Phenzic closed this Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants