Skip to content

Safe Math wrapper for the native primitive numeric types used in an Solana programs

License

Notifications You must be signed in to change notification settings

Apocentre/solana-safe-math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana Safe Math

 use solana_safe_math::{SafeMath};
 
 fn process_init_escrow(
   accounts: &[AccountInfo],
   amount: u64,
   program_id: &Pubkey
 ) -> ProgramResult {
   let val = 10_u64;
  
   val.safe_add(amount)?;
   val.safe_sub(amount)?;
   val.safe_mul(amount)?;
   val.safe_div(amount)?;
   val.safe_pow(8_u32)?;
 }

Works with u128, u64, u32, u16 and u8

About

Safe Math wrapper for the native primitive numeric types used in an Solana programs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages