Skip to content

Commit

Permalink
Add priceTestToken example with comment
Browse files Browse the repository at this point in the history
  • Loading branch information
VjeraTurk committed Oct 28, 2024
1 parent edea753 commit 2bc56a9
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions examples/booking/mintnbuy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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:
Expand Down

0 comments on commit 2bc56a9

Please sign in to comment.