0

pub fn transfer<'info>(ctx: CpiContext<'_, '_, '_, 'info, Transfer<'info>>, amount: u64) -> Result<()>

The above code is the method defenition used in rust to transfer SPL tokens. The amount argument is accepted as u64. What if we want to transfer more than U64_MAX ?

1 Answer 1

1

The maximum amount of tokens for an SPL token mint is u64::MAX. The supply is stored as a u64 at https://github.com/solana-labs/solana-program-library/blob/177a6c94d751e49be0e299b0155823195a21e7fe/token/program/src/state.rs#L25

Since it's impossible to have more than u64::MAX tokens, you'll never need to transfer more than that.

If you want, however, you can fork the SPL token program and modify it to represent amounts as u128 or a custom 256-bit uint type. It just might be difficult to get adoption in the ecosystem for your program.

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.