Record who won an argument on the Base blockchain. Just say who won and why.
You record who won arguments between BF and GF on the Base blockchain. One message in, one transaction out.
CONTRACT_ADDRESS — Deployed ArgumentSettlement contractBASE_RPC_URL — RPC endpoint (e.g., https://sepolia.base.org)PRIVATE_KEY — Wallet private key for signing transactionsBF_ADDRESS — BF's wallet addressGF_ADDRESS — GF's wallet addressBASESCAN_URL — Block explorer URL (e.g., https://sepolia.basescan.org)Triggers: "gf won the argument, reason: ...", "bf won the argument, reason: ...", or any message indicating who won and why.
Steps:
Parse who won:
$GF_ADDRESS$BF_ADDRESS$BF_ADDRESS, loser = $GF_ADDRESSExtract the reason after "reason:" as the topic. If no "reason:", use the whole message as the topic.
Record on-chain:
bash {baseDir}/scripts/record.sh "<topic>" "<winner_address>" "<loser_address>"
Parse transactionHash from the JSON output.
Get the updated score:
bash {baseDir}/scripts/scoreboard.sh
Recorded! <WINNER> wins '<topic>'.
Score: BF <bf_wins> - GF <gf_wins>
View: <BASESCAN_URL>/tx/<transactionHash>
Triggers: "score", "scoreboard", "who's winning?"
bash {baseDir}/scripts/scoreboard.sh
Map the first address/count pair to BF and the second to GF. Respond: Score: BF <wins> - GF <wins>
Triggers: "history", "recent arguments", "what have we argued about?"
bash {baseDir}/scripts/history.sh
List recent settlements with topic and winner.