-
-
Notifications
You must be signed in to change notification settings - Fork 273
feat: Add waves-claim skill for SURF Waves Cards #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add waves-claim skill for SURF Waves Cards #107
Conversation
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
|
@howlonghasitBen is attempting to deploy a commit to the Amantus Machina Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this 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
| CAN_CLAIM=$(cast call "$CLAIM_VAULT" "canClaim(address)(bool)" "$WALLET" --rpc-url "$RPC_URL" 2>/dev/null) | ||
|
|
There was a problem hiding this comment.
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..." | ||
|
|
There was a problem hiding this comment.
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.| # Get time remaining | ||
| TIME_LEFT=$(cast call "$CLAIM_VAULT" "timeUntilClaim(address)(uint256)" "$WALLET" --rpc-url "$RPC_URL" 2>/dev/null) |
There was a problem hiding this comment.
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.
skills/waves-claim/scripts/claim.sh
Outdated
| echo " TX: https://basescan.org/tx/$TX_HASH" | ||
| echo "" | ||
| echo "🎴 Check your new card on OpenSea:" |
There was a problem hiding this comment.
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
Summary
Adds the
waves-claimskill for claiming free SURF Waves Card NFTs on Base.What's included
SKILL.md- Skill documentation with contract info and usageinstall.sh- One-click installerscripts/check-claim.sh- Check claim eligibilityscripts/claim.sh- Claim a cardContract Details
0xAF1906B749339adaE38A1cba9740fffA168897c20xcc2d6ba8564541e6e51fe5522e26d4f4bbdd458bUsage
Links
Greptile Overview
Greptile Summary
This PR adds a new
waves-claimskill underskills/waves-claim/with documentation (SKILL.md), an installer (install.sh), and two helper scripts to check eligibility and submit a claim transaction via Foundrycast.Main things to double-check are the shell scripts’ handling of
cast callreturn values and exit codes; currently several values are treated as decimals even thoughcastreturns hex by default, and the claim script’s success/failure detection can misbehave due to checking$?after command substitution.Confidence Score: 3/5
castoutputs (hex vs decimal) and may proceed when the vault is empty or mis-report cooldown, which undermines the feature’s correctness.(4/5) You can add custom instructions or style guidelines for the agent here!
Context used:
dashboard- AGENTS.md (source)