Skip to content

Commit

Permalink
fix: readme typos (#587)
Browse files Browse the repository at this point in the history
* fix: typo filename

"anchor init --template=multiple" generates "error.rs", not "errors.rs"

* feat: update dependencies

* fix: typo link

* fix: code indent
  • Loading branch information
ChiefWoods authored Nov 26, 2024
1 parent d4aa648 commit 56f457a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
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 @@ -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

0 comments on commit 56f457a

Please sign in to comment.