$npx -y skills add This-Is-Captain-Code/monagotchi --skill monagotchi-traderManage $MONA tokens on nad.fun (Monad blockchain) for Monagotchi pet interactions. Use when you need to burn tokens for pet actions, check token balance, or get token info. Every pet action (feed, play, clean, heal) requires burning $MONA tokens through this skill. Works with mon
| 1 | # Nad.fun Monagotchi Trader |
| 2 | |
| 3 | Manage $MONA tokens on the Monad blockchain for Monagotchi pet interactions. This skill handles burning tokens when the owner wants to feed, play with, clean, or heal their pet. |
| 4 | |
| 5 | ## Overview |
| 6 | |
| 7 | $MONA is the fuel for your Monagotchi. Every pet action burns tokens — they're sent to the dead address and permanently removed from supply. The more you care for your pet, the scarcer $MONA becomes. |
| 8 | |
| 9 | ## Setup |
| 10 | |
| 11 | Install dependencies first: |
| 12 | |
| 13 | ```bash |
| 14 | cd {baseDir}/scripts && npm install |
| 15 | ``` |
| 16 | |
| 17 | ## Configuration |
| 18 | |
| 19 | Required environment variables (set in `~/.openclaw/openclaw.json` under `skills.entries.monagotchi-trader.env`): |
| 20 | |
| 21 | ``` |
| 22 | MONAGOTCHI_TOKEN_ADDRESS=0x... # $MONA token contract on Monad |
| 23 | MONAD_PRIVATE_KEY=0x... # Owner wallet private key (for signing burn txs) |
| 24 | MONAD_RPC_URL=https://... # Monad RPC endpoint |
| 25 | ``` |
| 26 | |
| 27 | ## Action Costs |
| 28 | |
| 29 | | Action | $MONA Burned | |
| 30 | |--------|-------------| |
| 31 | | Feed | 1,000 | |
| 32 | | Play | 2,500 | |
| 33 | | Clean | 1,500 | |
| 34 | | Heal | 5,000 | |
| 35 | | Sleep/Wake | 0 (free) | |
| 36 | | Status | 0 (free) | |
| 37 | |
| 38 | These costs are defined in the `{baseDir}/scripts/monagotchi-trader.mjs` config and can be adjusted. |
| 39 | |
| 40 | ## How Burning Works |
| 41 | |
| 42 | Burning = transferring tokens to the dead address: |
| 43 | ``` |
| 44 | 0x000000000000000000000000000000000000dEaD |
| 45 | ``` |
| 46 | |
| 47 | This is a standard ERC-20 `transfer()` call. Tokens sent to the dead address are permanently out of circulation. |
| 48 | |
| 49 | ## Operations |
| 50 | |
| 51 | ### Check Balance |
| 52 | |
| 53 | ```bash |
| 54 | node {baseDir}/scripts/monagotchi-trader.mjs balance |
| 55 | ``` |
| 56 | |
| 57 | Returns JSON with the owner's $MONA balance and what they can afford. |
| 58 | |
| 59 | ### Burn Tokens (for a pet action) |
| 60 | |
| 61 | ```bash |
| 62 | node {baseDir}/scripts/monagotchi-trader.mjs burn feed |
| 63 | node {baseDir}/scripts/monagotchi-trader.mjs burn play |
| 64 | node {baseDir}/scripts/monagotchi-trader.mjs burn clean |
| 65 | node {baseDir}/scripts/monagotchi-trader.mjs burn heal |
| 66 | ``` |
| 67 | |
| 68 | Each command: |
| 69 | 1. Checks the owner's $MONA balance |
| 70 | 2. Verifies sufficient tokens for the action |
| 71 | 3. Sends the required amount to 0x...dEaD |
| 72 | 4. Waits for tx confirmation |
| 73 | 5. Outputs JSON with the tx hash on success or an error message on failure |
| 74 | |
| 75 | ### Get Token Info |
| 76 | |
| 77 | ```bash |
| 78 | node {baseDir}/scripts/monagotchi-trader.mjs info |
| 79 | ``` |
| 80 | |
| 81 | Returns token name, symbol, total supply, owner balance, and bonding curve progress. |
| 82 | |
| 83 | ## Output Format |
| 84 | |
| 85 | All commands output JSON to stdout. Status/debug messages go to stderr. Parse stdout for structured results: |
| 86 | |
| 87 | ```json |
| 88 | {"success": true, "action": "feed", "burned": 1000, "txHash": "0x...", "remainingBalance": "45000.0"} |
| 89 | ``` |
| 90 | |
| 91 | On failure: |
| 92 | ```json |
| 93 | {"success": false, "error": "Insufficient $MONA. Need 1000, have 500.0"} |
| 94 | ``` |
| 95 | |
| 96 | ## Contract Details |
| 97 | |
| 98 | ### Monad Mainnet Addresses |
| 99 | |
| 100 | See `{baseDir}/references/nadfun-contracts.md` for full list. Key addresses: |
| 101 | |
| 102 | ``` |
| 103 | BONDING_CURVE: 0xA7283d07812a02AFB7C09B60f8896bCEA3F90aCE |
| 104 | LENS: 0x7e78A8DE94f21804F7a17F4E8BF9EC2c872187ea |
| 105 | BURN_ADDRESS: 0x000000000000000000000000000000000000dEaD |
| 106 | ``` |
| 107 | |
| 108 | ## Security |
| 109 | |
| 110 | ⚠️ **The private key is stored as an environment variable.** This is the owner's wallet key used to sign burn transactions. Keep it safe: |
| 111 | |
| 112 | - Never commit it to git |
| 113 | - Set it in `~/.openclaw/openclaw.json` under `skills.entries.monagotchi-trader.env` |
| 114 | - Consider using a dedicated wallet with only $MONA and a small amount of MON for gas |
| 115 | |
| 116 | ## Integration with monagotchi-controller |
| 117 | |
| 118 | The typical flow when the owner requests a pet action: |
| 119 | |
| 120 | 1. **monagotchi-controller** checks pet status via `curl -s http://${MONAGOTCHI_ESP32_IP}/pet` |
| 121 | 2. **monagotchi-controller** determines which action to take and its cost |
| 122 | 3. **monagotchi-trader** checks $MONA balance — `node {baseDir}/scripts/monagotchi-trader.mjs balance` |
| 123 | 4. **monagotchi-trader** burns the required $MONA — `node {baseDir}/scripts/monagotchi-trader.mjs burn <action>` |
| 124 | 5. If burn tx confirms → **monagotchi-controller** calls the ESP32 endpoint |
| 125 | 6. If burn fails → report the error, don't execute the action |
| 126 | 7. **monagotchi-environment** updates room lights/temp based on pet state |
| 127 | |
| 128 | ## Examples |
| 129 | |
| 130 | - "Feed my pet" → `node {baseDir}/scripts/monagotchi-trader.mjs burn feed` → on success, controller calls POST /feed |
| 131 | - "What's my $MONA balance?" → `node {baseDir}/scripts/monagotchi-trader.mjs balance`, report back |
| 132 | - "Heal and clean my pet" → burn 5,000 for heal → call /heal → burn 1,500 for clean → call /clean |
| 133 | - "Can I afford to play?" → check balance → compare against 2,500 → respond yes/no |