Skip to content

Commit

Permalink
Dont return customPayload if airdrop not started or already ended
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksej-paschenko committed Sep 22, 2024
1 parent fc11391 commit c2b7b82
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package api
import (
"context"
"fmt"
"github.com/tonkeeper/tongo/tvm"
"strconv"
"strings"
"time"

"github.com/tonkeeper/tongo/tvm"

"github.com/avast/retry-go"
"github.com/tonkeeper/tongo"
"github.com/tonkeeper/tongo/abi"
Expand Down Expand Up @@ -94,9 +95,15 @@ func (h *Handler) Run(ctx context.Context) {
}

func (h *Handler) convertToWalletInfo(ctx context.Context, airdrop prover.WalletAirdrop) (*oas.WalletInfo, error) {
customPayload, err := createCustomPayload(airdrop.Proof)
if err != nil {
return nil, err
var err error
var customPayload string

now := time.Now().UTC().Unix()
if int64(airdrop.Data.StartFrom) <= now && now <= int64(airdrop.Data.ExpireAt) {
customPayload, err = createCustomPayload(airdrop.Proof)
if err != nil {
return nil, err
}
}
stateInit, err := h.getStateInit(ctx, airdrop.AccountID)
if err != nil {
Expand Down

0 comments on commit c2b7b82

Please sign in to comment.