https://github.com/interest-protocol/bps
Basis Point library
https://github.com/interest-protocol/bps
Last synced: 3 months ago
JSON representation
Basis Point library
- Host: GitHub
- URL: https://github.com/interest-protocol/bps
- Owner: interest-protocol
- Created: 2024-11-29T03:31:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-06T18:52:42.000Z (over 1 year ago)
- Last Synced: 2025-02-06T19:43:31.261Z (over 1 year ago)
- Language: Move
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://suiscan.xyz/mainnet/tx/EAaXc6j9ET2cbDt5JERBQV1A4dNzW17TENgeqtisEAwc)
## Mainnet Code
[Explorer](https://suiscan.xyz/mainnet/object/0xdd7e07fc30acb942fc757ff732d1b4db104e0aba9717133b4eac82260dcd9f18/contracts)