Skip to content

interest-protocol/bps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interest BPS

It provides Basis Point arithmetic operations.

It supports the following operations:

  • new: Create a new BPS struct.
  • add: Add two BPS structs.
  • sub: Subtract two BPS structs.
  • mul: Multiply a BPS struct by a scalar.
  • div: Divide a BPS struct by a scalar.
  • calc: Calculate the value of a BPS percentage from a total.
  • max_bps: It returns the maximum BPS value.
  • value: It returns the raw value of the BPS.

Error codes

  • EOverflow: It is raised when the BPS value is greater than the maximum BPS value (10,000).
  • EUnderflow: It is raised when you try to subtract a BPS value from a smaller BPS value.
  • EDivideByZero: It is raised when you try to divide by zero.

Immutable

The package is immutable

Mainnet Code

Explorer

Releases

No releases published

Packages

No packages published

Languages