1

In tokens extensions while using the rust library https://docs.rs/spl-token-2022 when should I use

  1. PodMint instead of Mint
  2. PodAccount instead of Account

I am a bit confused because for example, the length of the PodMint and Mint is the same while initializing a mint and paying for rent

let extensions = [ExtensionType::InterestBearingConfig];
let mint_len = ExtensionType::try_calculate_account_len::<Mint>(&extensions).unwrap();
let pod_mint_len = ExtensionType::try_calculate_account_len::<PodMint>(&extensions).unwrap();
println!("MINT LENGTH = {}", mint_len);
println!("POD MINT LENGTH = {}", pod_mint_len);
// This is printed in the console
// MINT LENGTH = 222
// POD MINT LENGTH = 222

This shows that the same amount of memory is allocated when creating the mint, so where would I use the Pod types (PodMint, PodAccount)

1 Answer 1

0

The concept of PodMint vs Mint is to allow for in-place / zero-copy deserialization, which uses much fewer compute units on-chain. If you want to do things in-place, then you can use the Pod variants. If you want to copy the data out of the account, then you can use the non-pod variants.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.