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

fix: readme typos #587

Merged
merged 4 commits into from
Nov 26, 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
6 changes: 3 additions & 3 deletions content/courses/connecting-to-offchain-data/oracles.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ within the `programs/burry-escrow` directory:
├── Xargo.toml
└── src
├── constants.rs
├── errors.rs
├── error.rs
├── instructions
│ ├── deposit.rs
│ ├── mod.rs
Expand Down Expand Up @@ -798,9 +798,9 @@ pub const SOL_USDC_FEED: &str = "GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR";
### 5. Errors

Next, let's define the custom errors we'll use throughout the program. Inside
the `errors.rs` file, paste the following:
the `error.rs` file, paste the following:

```rust filename="errors.rs"
```rust filename="error.rs"
use anchor_lang::prelude::*;

#[error_code]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@ in our `Cargo.toml` file.

```typescript
[dependencies]
anchor-lang = "0.28.0"
anchor-spl = "0.28.0"
anchor-lang = "0.30.1"
anchor-spl = "0.30.1"
switchboard-v2 = "0.4.0"
```

Expand Down Expand Up @@ -535,7 +535,7 @@ mod burry_escrow {
init_vrf_client_handler(ctx)
}

pub fn get_out_of_jail(ctx: Context<RequestRandomness>, params: RequestRandomnessParams) -> Result<()>{
pub fn get_out_of_jail(ctx: Context<RequestRandomness>, params: RequestRandomnessParams) -> Result<()>{
get_out_of_jail_handler(ctx, params)
}

Expand Down Expand Up @@ -592,7 +592,7 @@ about `zero_copy`, take a look at our
pub struct VrfClientState {
pub bump: u8,
pub result_buffer: [u8; 32],
pub dice_type: u8, // 6 sided
pub dice_type: u8, // 6 sided
pub die_result_1: u8,
pub die_result_2: u8,
pub timestamp: i64,
Expand Down Expand Up @@ -638,10 +638,10 @@ pub struct VrfClientState {
}
```

#### 5. Errors.rs
#### 5. Error.rs

Next, let's take a quick pit stop and add one last error
`InvalidVrfAuthorityError` to `errors.rs`. We'll use this when the VRF authority
`InvalidVrfAuthorityError` to `error.rs`. We'll use this when the VRF authority
is incorrect.

```rust
Expand Down Expand Up @@ -758,7 +758,7 @@ pub struct InitVrfClient<'info> {
#[account(
init,
seeds = [
VRF_STATE_SEED,
VRF_STATE_SEED,
user.key.as_ref(),
escrow_account.key().as_ref(),
vrf.key().as_ref(),
Expand Down Expand Up @@ -939,7 +939,7 @@ pub struct RequestRandomnessParams {

Now, we can work on the logic of this instruction. The logic should gather all
of the accounts needed and pass them to
`[VrfRequestRandomness](https://github.com/switchboard-xyz/solana-sdk/blob/fbef37e4a78cbd8b8b6346fcb96af1e20204b861/rust/switchboard-solana/src/oracle_program/instructions/vrf_request_randomness.rs#L8)`,
[VrfRequestRandomness](https://github.com/switchboard-xyz/solana-sdk/blob/fbef37e4a78cbd8b8b6346fcb96af1e20204b861/rust/switchboard-solana/src/oracle_program/instructions/vrf_request_randomness.rs#L8),
which is a really nice struct from Switchboard. Then we'll sign the request and
send it on it's way.

Expand Down Expand Up @@ -971,7 +971,7 @@ pub fn get_out_of_jail_handler(ctx: Context<RequestRandomness>, params: RequestR
let escrow_key = ctx.accounts.escrow_account.key();
let user_key = ctx.accounts.user.key();
let state_seeds: &[&[&[u8]]] = &[&[
&VRF_STATE_SEED,
&VRF_STATE_SEED,
user_key.as_ref(),
escrow_key.as_ref(),
vrf_key.as_ref(),
Expand Down Expand Up @@ -1048,7 +1048,7 @@ the randomness in the account.
```rust
// inside consume_randomness.rs

pub fn consume_randomness_handler(ctx: Context<ConsumeRandomness>) -> Result <()> {
pub fn consume_randomness_handler(ctx: Context<ConsumeRandomness>) -> Result<()> {
msg!("Consuming randomness...");

let vrf = ctx.accounts.vrf.load()?;
Expand All @@ -1070,7 +1070,7 @@ randomness and dice rolls within it. We also want to check that the
randomness is stale.

```rust
pub fn consume_randomness_handler(ctx: Context<ConsumeRandomness>) -> Result <()> {
pub fn consume_randomness_handler(ctx: Context<ConsumeRandomness>) -> Result<()> {
msg!("Successfully consumed randomness.");

let vrf = ctx.accounts.vrf.load()?;
Expand Down
Loading