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

Assorted fixes #666

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Solana, but the pattern is familiar:
- You can also consider PDAs as records in a database, with the address being
the primary key used to look up the values inside.

PDAs combine a program addresss and some developer-chosen seeds to create
PDAs combine a program address and some developer-chosen seeds to create
addresses that store individual pieces of data. Since PDAs are addresses that
lie _off_ the Ed25519 Elliptic curve, PDAs don't have secret keys. Instead, PDAs
can be signed for by the program address used to create them.
Expand Down
16 changes: 8 additions & 8 deletions content/courses/onchain-development/intro-to-onchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ synchronized system:
- **devnet**: For application development
- **localnet**: For local testing

The program that run on Solana - the ones that create tokens, swap tokens, art
The programs that run on Solana - the ones that create tokens, swap tokens, art
marketplaces, escrows, market makers, DePIN apps, auctions, retail payments
platforms, etc - are called **Solana apps**.

Expand Down Expand Up @@ -131,17 +131,17 @@ to store any form of data as required by the program.
is a `PublicKey`, PDA addresses are not public keys and do not have a
matching private key.
- A program's PDAs are unique so, they won't conflict with other programs.
- PDAs can also act as signer in an instruction. We'll learn more about this
- PDAs can also act as signers in an instruction. We'll learn more about this
in further lessons.

#### Examples of PDA Usage

| Purpose | Seeds | Resulting PDA |
| ----------------- | -------------------------- | ---------------------------- |
| Exchange Rate | `"USD"`, `"AUD"` | Stores USD to AUD rate |
| User Relationship | User1 wallet, User2 wallet | Stores relationship data |
| Product Review | User wallet, Product ID | Stores user's review |
| Global Config | `"config"` | Stores program-wide settings |
| Use Case | Seeds | PDA (Key) | Value (Data Stored) |
| ----------------- | ------------------------------ | --------------- | ------------------------------------------ |
| Exchange Rate | `["USD", "AUD"]` | Derived address | Current USD to AUD exchange rate |
| User Relationship | `[user1_wallet, user2_wallet]` | Derived address | Relationship data (e.g., friends, blocked) |
| Movie Review | `[reviewer_wallet, "titanic"]` | Derived address | Review text, rating, timestamp |
| Global Config | `["config"]` | Derived address | Program-wide settings |

#### Benefits

Expand Down
6 changes: 4 additions & 2 deletions content/courses/program-security/account-data-matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,13 @@ The `insecure_withdraw` instruction handler transfers all the tokens in the

<Callout>

Notice that this instruction handler \***\*does\*\*** have a signer check for
Notice that this instruction handler **does** have a signer check for
`authority` and an owner check for `vault`. However, nowhere in the account
validation or instruction handler logic is there code that checks that the
`authority` account passed into the instruction handler matches the `authority`
account on the `vault`. </Callout>
account on the `vault`.

</Callout>

```rust
use anchor_lang::prelude::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ pub struct User {
[Anchor's `init_if_needed` constraint](https://www.anchor-lang.com/docs/account-constraints),
guarded by a feature flag, should be used with caution.It initializes an account
only if it hasn't been initialized yet. If the account is already initialized,
the instruction handler will still execute, so
it's \***\*\*\*\***extremely\***\*\*\*\*** important to include checks in your
instruction handler to prevent resetting the account to its initial state.
the instruction handler will still execute, so it's **extremely** important to
include checks in your instruction handler to prevent resetting the account to
its initial state.

</Callout>

For example, if the `authority` field is set in the instruction handler, ensure
Expand Down
11 changes: 5 additions & 6 deletions content/courses/tokens-and-nfts/nfts-with-metaplex.md
Original file line number Diff line number Diff line change
Expand Up @@ -899,13 +899,12 @@ endless!

The steps covered above for creating an NFT would be incredibly tedious to
execute for thousands of NFTs in one go. Many providers, including Metaplex,
Magic Eden, and Tensor have so-called 'fair launch' tools that take care of
MagicEden, and Tensor have so-called 'fair launch' tools that take care of
minting large quantities of NFTs and ensuring they are sold within the
parameters set by their creators. Dive into fair launch platforms on the
[Digital Collectables](https://solana.com/ecosystem/explore?categories=digital%20collectibles)
page. This hands-on experience will not only reinforce your understanding of the
tools but also boost your confidence in your ability to use them effectively in
the future.
parameters set by their creators. Dive into one of these fair launch platforms
and create an NFT. This hands-on experience will not only reinforce your
understanding of the tools but also boost your confidence in your ability to use
them effectively in the future.

<Callout type="success" title="Completed the lab?">
Push your code to GitHub and
Expand Down
Loading