Skip to content

Commit

Permalink
fix: pow operation in both rust and ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yanCode committed Oct 18, 2024
1 parent 5dc01dd commit 83393b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/courses/onchain-development/anchor-cpi.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ Next, let's update the `add_movie_review` instruction to do the following:
the `DescriptionTooLong` error.
- Make a CPI to the token program's `mint_to` instruction using the mint
authority PDA as a signer. Note that we'll mint 10 tokens to the user but need
to adjust for the mint decimals by making it `10*10^6`.
to adjust for the mint decimals by making it `10 * 10u64.pow(6)`.

Fortunately, we can use the `anchor_spl` crate to access helper functions and
types like `mint_to` and `MintTo` for constructing our CPI to the Token Program.
Expand Down Expand Up @@ -561,7 +561,7 @@ pub fn add_movie_review(
&[ctx.bumps.mint]
]]
),
10*10^6
10 * 10u64.pow(6)
)?;

msg!("Minted tokens");
Expand Down Expand Up @@ -691,7 +691,7 @@ it("Movie review is added`", async () => {
);

const userAta = await getAccount(provider.connection, tokenAccount);
expect(Number(userAta.amount)).to.equal((10 * 10) ^ 6);
expect(Number(userAta.amount)).to.equal(10 * 10 ** 6);
});
```
Expand Down

0 comments on commit 83393b2

Please sign in to comment.