@@ -2,7 +2,10 @@ package currencycreator
22
33import (
44 "fmt"
5+ "math"
56 "testing"
7+
8+ "github.com/stretchr/testify/require"
69)
710
811func TestEstimateCurrentPrice (t * testing.T ) {
@@ -55,3 +58,35 @@ func TestEstimateSell(t *testing.T) {
5558 })
5659 fmt .Printf ("%d total, %d received, %d fees\n " , received + fees , received , fees )
5760}
61+
62+ func TestEstimates_CsvTable (t * testing.T ) {
63+ startValue := uint64 (10000 ) // $0.01
64+ endValue := uint64 (1000000000000000 ) // $1T
65+
66+ fmt .Println ("value locked,payment value,payment quarks,sell value" )
67+ for valueLocked := startValue ; valueLocked <= endValue ; valueLocked *= 10 {
68+ circulatingSupply , _ := EstimateBuy (& EstimateBuyArgs {
69+ BuyAmountInQuarks : valueLocked ,
70+ CurrentSupplyInQuarks : 0 ,
71+ ValueMintDecimals : 6 ,
72+ })
73+
74+ for paymentValue := startValue ; paymentValue <= valueLocked ; paymentValue *= 10 {
75+ paymenQuarks := EstimateValueExchange (& EstimateValueExchangeArgs {
76+ ValueInQuarks : paymentValue ,
77+ CurrentSupplyInQuarks : circulatingSupply ,
78+ ValueMintDecimals : 6 ,
79+ })
80+
81+ sellValue , _ := EstimateSell (& EstimateSellArgs {
82+ SellAmountInQuarks : paymenQuarks ,
83+ CurrentValueInQuarks : valueLocked ,
84+ ValueMintDecimals : 6 ,
85+ })
86+
87+ require .True (t , math .Abs (float64 (paymentValue )- float64 (sellValue )) <= 1 )
88+
89+ fmt .Printf ("%d,%d,%d,%d\n " , valueLocked , paymentValue , paymenQuarks , sellValue )
90+ }
91+ }
92+ }
0 commit comments