From 2bc56a983be2eb389bf7f98b299787185ae9bb6f Mon Sep 17 00:00:00 2001 From: Vjera Turk Date: Mon, 28 Oct 2024 12:08:13 +0100 Subject: [PATCH] Add priceTestToken example with comment --- examples/booking/mintnbuy.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/booking/mintnbuy.go b/examples/booking/mintnbuy.go index da99f5a6..519b2b96 100644 --- a/examples/booking/mintnbuy.go +++ b/examples/booking/mintnbuy.go @@ -90,8 +90,8 @@ func main() { nativeTokenAddress := common.HexToAddress("0x0000000000000000000000000000000000000000") // https://columbus.caminoscan.com/token/0x5b1c852dad36854B0dFFF61d2C13F108D8E01975 - eurshToken := common.HexToAddress("0x5b1c852dad36854B0dFFF61d2C13F108D8E01975") - // testToken := common.HexToAddress("0x53A0b6A344C8068B211d47f177F0245F5A99eb2d") + eurshToken := common.HexToAddress("0x5b1c852dad36854B0dFFF61d2C13F108D8E01975") // You can't use EURSH if you are not registered in their system + testToken := common.HexToAddress("0x53A0b6A344C8068B211d47f177F0245F5A99eb2d") // Requires having Test Token in your CM- account var paymentToken common.Address = nativeTokenAddress var priceBigInt *big.Int @@ -121,6 +121,19 @@ func main() { }, } + // Example prices for Test Token Currency + priceTestToken := &typesv2.Price{ + Value: "100", + Decimals: 2, + Currency: &typesv2.Currency{ + Currency: &typesv2.Currency_TokenCurrency{ + TokenCurrency: &typesv2.TokenCurrency{ + ContractAddress: testToken.Hex(), + }, + }, + }, + } + // Example prices for Native Token priceCAM := &typesv2.Price{ Value: "1", @@ -132,13 +145,17 @@ func main() { }, } - sugar.Infof("%v %v %v %v", priceEUR, priceEURSH, priceCAM) + sugar.Infof("%v %v %v %v", priceEUR, priceEURSH, priceTestToken, priceCAM) sugar.Infof("%v", price) paymentToken = nativeTokenAddress priceBigInt = big.NewInt(0) + + // price = priceEUR + // price = priceEURSH // You can't use EURSH if you are not registered in their system + // price = priceTestToken // Requires having Test Token in your CM- account + price = priceCAM - // price = priceEURSH // You can't use EURSH if you are not registered in their system switch currency := price.Currency.Currency.(type) { case *typesv2.Currency_NativeToken: