Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Contract

Test uses : Use env.mock_all_auths() for simple testing (allows all auth)

image

image

Understanding Token Decimals in Soroban

The decimal value (18 in your code) determines the divisibility of your token. It represents the number of decimal places that your token can be divided into.

0 - No decimals (whole numbers only)
6 - Common for stablecoins (like USDC)
7 - Native XLM decimal places
8 - Common for Bitcoin-like tokens
18 - Common for Ethereum-like tokens

Examples with Different Decimals

1 token = 100 base units
Smallest unit: 0.01
1 token = 10,000,000 base units
Smallest unit: 0.0000001
1 token = 1,000,000,000,000,000,000 base units
Smallest unit: 0.000000000000000001

How to Choose

Consider these factors when selecting decimals:

Industry standards
Gas efficiency (smaller decimals = less computation)
User experience requirements

Example Code with Different Decimals

client.initialize(&admin, &0, &symbol, &token);
client.initialize(&admin, &7, &symbol, &token);
client.initialize(&admin, &6, &symbol, &token);

Important Notes: The decimal value cannot be changed after initialization Choose carefully based on your token's intended use More decimals means higher precision but also more complexity Consider gas costs when working with large decimal values

About

Token Contract

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages