Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 984 Bytes

README.md

File metadata and controls

28 lines (19 loc) · 984 Bytes

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