Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions api/v1_prizes_claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

const (
yakMintAddress = "ZDaUDL4XFdEct7UgeztrFQAptsvh4ZdhyZDZ1RpxYAK"
yakClaimAmount = 2000000000 // 2 YAK with 9 decimals - amount required to claim a prize (for Solana transaction)
yakClaimAmount = 200000000000 // 200 YAK with 9 decimals - amount required to claim a prize (for Solana transaction)
prizeReceiverAddress = "14FwoYck4DNGKQ1UnPJgrxTPGrdpGaueDVgkvpssQeiB"
)

Expand Down Expand Up @@ -152,8 +152,8 @@ func (app *ApiServer) v1PrizesClaim(c *fiber.Ctx) error {
// We need to find balance changes where:
// 1. The signature matches
// 2. The mint matches YAK
// 3. The user's account has a negative change of exactly -2 YAK (spending)
// 4. The prize receiver's account has a positive change of exactly +2 YAK (receiving)
// 3. The user's account has a negative change of exactly -200 YAK (spending)
// 4. The prize receiver's account has a positive change of exactly +200 YAK (receiving)
var userBalanceChange struct {
Owner string
Change int64
Expand All @@ -177,7 +177,7 @@ func (app *ApiServer) v1PrizesClaim(c *fiber.Ctx) error {

if queryErr != nil {
if errors.Is(queryErr, pgx.ErrNoRows) {
return fiber.NewError(fiber.StatusBadRequest, "Transaction not found or invalid. Must be exactly 2 YAK sent to the prize address.")
return fiber.NewError(fiber.StatusBadRequest, "Transaction not found or invalid. Must be exactly 200 YAK sent to the prize address.")
}
app.logger.Error("Failed to query balance changes", zap.Error(queryErr))
return fiber.NewError(fiber.StatusInternalServerError, "Database error")
Expand Down Expand Up @@ -209,7 +209,7 @@ func (app *ApiServer) v1PrizesClaim(c *fiber.Ctx) error {

if receiverQueryErr != nil {
if errors.Is(receiverQueryErr, pgx.ErrNoRows) {
return fiber.NewError(fiber.StatusBadRequest, "Transaction not found or invalid. Must send exactly 2 YAK to the prize receiver address.")
return fiber.NewError(fiber.StatusBadRequest, "Transaction not found or invalid. Must send exactly 200 YAK to the prize receiver address.")
}
app.logger.Error("Failed to query receiver balance changes", zap.Error(receiverQueryErr))
return fiber.NewError(fiber.StatusInternalServerError, "Database error")
Expand Down
2 changes: 1 addition & 1 deletion api/v1_prizes_claim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestV1PrizesClaim(t *testing.T) {

const (
yakMintAddress = "ZDaUDL4XFdEct7UgeztrFQAptsvh4ZdhyZDZ1RpxYAK"
yakClaimAmount = 2000000000 // 2 YAK with 9 decimals - amount required to claim a prize
yakClaimAmount = 200000000000 // 200 YAK with 9 decimals - amount required to claim a prize
prizeReceiverAddress = "14FwoYck4DNGKQ1UnPJgrxTPGrdpGaueDVgkvpssQeiB"
validWallet = "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
validSignature = "valid_signature_123"
Expand Down