Skip to content

Conversation

@howlonghasitBen
Copy link

@howlonghasitBen howlonghasitBen commented Feb 2, 2026

Summary

Adds the waves-claim skill for claiming free SURF Waves Card NFTs on Base.

What's included

  • SKILL.md - Skill documentation with contract info and usage
  • install.sh - One-click installer
  • scripts/check-claim.sh - Check claim eligibility
  • scripts/claim.sh - Claim a card

Contract Details

Property Value
ClaimVault 0xAF1906B749339adaE38A1cba9740fffA168897c2
NFT Contract 0xcc2d6ba8564541e6e51fe5522e26d4f4bbdd458b
Network Base (Chain ID: 8453)
Cooldown 2 hours
Available 259 cards

Usage

clawhub install waves-claim
./scripts/claim.sh

Links

Greptile Overview

Greptile Summary

This PR adds a new waves-claim skill under skills/waves-claim/ with documentation (SKILL.md), an installer (install.sh), and two helper scripts to check eligibility and submit a claim transaction via Foundry cast.

Main things to double-check are the shell scripts’ handling of cast call return values and exit codes; currently several values are treated as decimals even though cast returns hex by default, and the claim script’s success/failure detection can misbehave due to checking $? after command substitution.

Confidence Score: 3/5

  • Reasonably safe to merge, but the claim/check scripts have a few logic bugs that can cause incorrect eligibility/availability reporting and unreliable error handling.
  • The changes are isolated to a new skill and don’t affect existing runtime code paths, but the scripts as written may mis-handle cast outputs (hex vs decimal) and may proceed when the vault is empty or mis-report cooldown, which undermines the feature’s correctness.
  • skills/waves-claim/scripts/claim.sh; skills/waves-claim/scripts/check-claim.sh

(4/5) You can add custom instructions or style guidelines for the agent here!

Context used:

  • Context from dashboard - AGENTS.md (source)

Claim free SURF Waves Card NFTs on Base blockchain.
- ClaimVault: 0xAF1906B749339adaE38A1cba9740fffA168897c2
- 2 hour cooldown per wallet
- Random card distribution from 259 available cards
- Requires Foundry cast CLI

Usage:
  clawhub install waves-claim
  ./scripts/check-claim.sh  # Check eligibility
  ./scripts/claim.sh        # Claim a card
@vercel
Copy link
Contributor

vercel bot commented Feb 2, 2026

@howlonghasitBen is attempting to deploy a commit to the Amantus Machina Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 35 to 36
CAN_CLAIM=$(cast call "$CLAIM_VAULT" "canClaim(address)(bool)" "$WALLET" --rpc-url "$RPC_URL" 2>/dev/null)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cast call ... availableCount()(uint256) returns a 32-byte hex value by default (e.g. 0x...), but the script compares it as a decimal string later ([ "$AVAILABLE" = "0" ] in claim.sh) and prints it as if it’s a human-readable count. This will show confusing output and can mislead users into thinking there are NFTs available when there aren’t (or vice versa).

Consider piping through cast to-dec (and similarly for timeUntilClaim) so the values are consistent and numeric.

Also appears in: skills/waves-claim/scripts/claim.sh:35-41

Prompt To Fix With AI
This is a comment left during a code review.
Path: skills/waves-claim/scripts/check-claim.sh
Line: 35:36

Comment:
`cast call ... availableCount()(uint256)` returns a 32-byte hex value by default (e.g. `0x...`), but the script compares it as a decimal string later (`[ "$AVAILABLE" = "0" ]` in `claim.sh`) and prints it as if it’s a human-readable count. This will show confusing output and can mislead users into thinking there are NFTs available when there aren’t (or vice versa).

Consider piping through `cast to-dec` (and similarly for `timeUntilClaim`) so the values are consistent and numeric.

Also appears in: `skills/waves-claim/scripts/claim.sh:35-41`

How can I resolve this? If you propose a fix, please make it concise.


echo "📦 Available: $AVAILABLE NFTs"
echo "🔨 Sending claim transaction..."

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AVAILABLE is the raw cast call output (32-byte hex), so [ "$AVAILABLE" = "0" ] will never be true when the vault is empty (it’ll be 0x00..00). This causes the script to proceed to claim() even when no NFTs are available.

Convert AVAILABLE to decimal (or explicitly compare to the full zero hex) before checking.

Also appears in: skills/waves-claim/scripts/check-claim.sh:35-36

Prompt To Fix With AI
This is a comment left during a code review.
Path: skills/waves-claim/scripts/claim.sh
Line: 45:45

Comment:
`AVAILABLE` is the raw `cast call` output (32-byte hex), so `[ "$AVAILABLE" = "0" ]` will never be true when the vault is empty (it’ll be `0x00..00`). This causes the script to proceed to `claim()` even when no NFTs are available.

Convert `AVAILABLE` to decimal (or explicitly compare to the full zero hex) before checking.

Also appears in: `skills/waves-claim/scripts/check-claim.sh:35-36`

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 42 to 43
# Get time remaining
TIME_LEFT=$(cast call "$CLAIM_VAULT" "timeUntilClaim(address)(uint256)" "$WALLET" --rpc-url "$RPC_URL" 2>/dev/null)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIME_LEFT is a hex string from cast call (e.g. 0x...), but it’s used in arithmetic expansion ($((TIME_LEFT / 60))). Bash arithmetic doesn’t accept 0x... unless it’s in 0xNN form without quotes/extra characters; in practice this will error or produce 0 depending on shell.

Pipe through cast to-dec (or printf "%d") before doing math.

Also appears in: skills/waves-claim/scripts/claim.sh:29-31

Prompt To Fix With AI
This is a comment left during a code review.
Path: skills/waves-claim/scripts/check-claim.sh
Line: 42:43

Comment:
`TIME_LEFT` is a hex string from `cast call` (e.g. `0x...`), but it’s used in arithmetic expansion (`$((TIME_LEFT / 60))`). Bash arithmetic doesn’t accept `0x...` unless it’s in `0xNN` form without quotes/extra characters; in practice this will error or produce 0 depending on shell.

Pipe through `cast to-dec` (or `printf "%d"`) before doing math.

Also appears in: `skills/waves-claim/scripts/claim.sh:29-31`

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 56 to 58
echo " TX: https://basescan.org/tx/$TX_HASH"
echo ""
echo "🎴 Check your new card on OpenSea:"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TX=$(cast send ... --json 2>/dev/null) is a command substitution, so if cast fails, the shell will still set TX (likely empty) and $? will be the status of the assignment, not reliably the cast exit code. This makes the success/failure branch unreliable.

Run cast send directly in the if condition (or capture the exit code immediately) so failures are handled correctly.

Prompt To Fix With AI
This is a comment left during a code review.
Path: skills/waves-claim/scripts/claim.sh
Line: 56:58

Comment:
`TX=$(cast send ... --json 2>/dev/null)` is a command substitution, so if `cast` fails, the shell will still set `TX` (likely empty) and `$?` will be the status of the assignment, not reliably the `cast` exit code. This makes the success/failure branch unreliable.

Run `cast send` directly in the `if` condition (or capture the exit code immediately) so failures are handled correctly.

How can I resolve this? If you propose a fix, please make it concise.

- Convert cast hex output to decimal with 'cast to-dec'
- Add proper error handling instead of silent 2>/dev/null
- Add jq to required dependencies
- Validate empty variables before use
- Better curl error checking in install.sh
- Capture cast exit codes properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant