Skip to content

Commit a4074c9

Browse files
author
Jeff Yanta
committed
Update currency creator program interface to 10 decimal default
1 parent 2626826 commit a4074c9

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/solana/currencycreator/accounts_currency_config.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import (
99
)
1010

1111
const (
12-
DefaultMintMaxSupply = 21_000_000_000_000 // 21mm tokens with 6 decimals
13-
DefaultMintDecimals = 6
12+
DefaultMintMaxTokenSupply = 21_000_000 // 21mm tokens
13+
DefaultMintQuarksPerUnit = 10_000_000_000
14+
DefaultMintMaxQuarkSupply = DefaultMintMaxTokenSupply * DefaultMintQuarksPerUnit // 21mm tokens with 10 decimals
15+
DefaultMintDecimals = 10
1416
)
1517

1618
const (

pkg/solana/currencycreator/estimate_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ func TestEstimateCurrentPrice(t *testing.T) {
99
t.Skip()
1010

1111
fmt.Println(EstimateCurrentPrice(0).Text('f', DefaultCurveDecimals))
12-
fmt.Println(EstimateCurrentPrice(DefaultMintMaxSupply).Text('f', DefaultCurveDecimals))
12+
fmt.Println(EstimateCurrentPrice(DefaultMintMaxQuarkSupply).Text('f', DefaultCurveDecimals))
1313
}
1414

1515
func TestEstimateBuyInUsdc(t *testing.T) {
@@ -30,18 +30,18 @@ func TestEstimateBuyInUsdc(t *testing.T) {
3030
fmt.Printf("%d total, %d received, %d fees\n", received+fees, received, fees)
3131
}
3232

33-
func TestEstimateSelInUsdc(t *testing.T) {
33+
func TestEstimateSellInUsdc(t *testing.T) {
3434
t.Skip()
3535

3636
received, fees := EstimateSellInUsdc(&EstimateSellInUsdcArgs{
37-
SellAmountInQuarks: 1_234_567_890,
37+
SellAmountInQuarks: 12_345_678_900_000,
3838
CurrentValueInQuarks: 50_000_000,
3939
SellFeeBps: 0,
4040
})
4141
fmt.Printf("%d total, %d received, %d fees\n", received+fees, received, fees)
4242

4343
received, fees = EstimateSellInUsdc(&EstimateSellInUsdcArgs{
44-
SellAmountInQuarks: 1_234_567_890,
44+
SellAmountInQuarks: 12_345_678_900_000,
4545
CurrentValueInQuarks: 50_000_000,
4646
SellFeeBps: 100,
4747
})

0 commit comments

Comments
 (0)