#anchor #saber #solana

add-decimals

Wraps another token to give it more decimals

8 stable releases

1.1.2 Apr 17, 2022
1.1.1 Mar 15, 2022
1.0.11 Feb 1, 2022
1.0.7 Dec 31, 2021

#9 in #saber

AGPL-3.0

52KB
1K SLoC

add-decimals

Creates a wrapper token which increases the number of decimals of a token. This allows our Stable Swap algorithm to work with tokens that do not have the same number of decimals.

About

The wrapper is a PDA account with the seeds:

  • "anchor" (from legacy Anchor PDA derivation)
  • underlying_mint - (mint of the underlying asset)
  • decimals - (the number of decimals, must be greater than the decimals of the underlying's mint)

Anyone may initialize a new wrapper. To do so:

  1. Compute the address of the new wrapper
  2. Initialize an account for the wrapper to hold the underlying tokens.
  3. Initialize a mint for the wrapper. It is recommended to use a vanity address via solana-keygen grind.
  4. Run the initialize_wrapper instruction.

License

The Saber Periphery contracts are licensed under the Affero GPL License, Version 3.0.


lib.rs:

Wraps another token to give it more decimals.

The resulting token is an SPL Token that has more decimals than its underlying token.

Dependencies

~20–31MB
~503K SLoC