Skip to content

LeoYeAI/agent-master-skills / skills/aawp

AAWP (AI Agent Wallet Protocol) — the only crypto wallet protocol built exclusively for AI Agents on EVM-compatible blockchains. Not for humans. The signer is the AI Agent itself, cryptographically bound at wallet creation. Supports wallet lifecycle management, token transfers, DEX swaps, cross-chain bridging, arbitrary contract interactions, DCA automation, and price alerts.

FileKindSize
README.mdmarkdown10.9 KB
SKILL.mdskill md20.1 KB
WALLET_SETUP.mdmarkdown4.6 KB
_meta.jsonconfig436 B
bin/install.jsscript7.0 KB
config/chains.jsonconfig4.2 KB
core/index.d.tsscript2.8 KB
core/loader.jsscript1.0 KB
daemon/client.jsscript1.1 KB
daemon/daemon.jsscript606 B
lib/address-book.jsscript1.6 KB
lib/gas-estimator.jsscript1.7 KB
lib/multicall.jsscript2.6 KB
lib/nonce-manager.jsscript1.9 KB
lib/tx-history.jsscript1.3 KB
scripts/bootstrap.shscript1.7 KB
scripts/dca.jsscript9.4 KB
scripts/deploy-clanker.jsscript13.6 KB
scripts/doctor.shscript1.6 KB
scripts/ensure-daemon.shscript2.2 KB
scripts/limit-order.jsscript28.3 KB
scripts/nft.jsscript25.2 KB
scripts/portfolio.jsscript18.0 KB
scripts/price-alert.jsscript12.1 KB
scripts/provision.shscript9.4 KB
scripts/restart-daemon.shscript1.5 KB
scripts/restore-impl.jsscript3.9 KB
scripts/sign-worker.jsscript2.9 KB
scripts/start-daemon.jsscript3.9 KB
scripts/swap.jsscript31.8 KB
scripts/wallet-manager.jsscript70.6 KB
scripts/yield.jsscript34.1 KB

lib/multicall.js

View on GitHub
'use strict';

const { ethers } = require('ethers');
const fs = require('fs');
const path = require('path');

// Multicall3 is deployed at the same address on all EVM chains
const MULTICALL3_ADDR = '0xcA11bde05977b3631167028862bE2a173976CA11';

const MULTICALL3_ABI = [
  'function aggregate3((address target, bool allowFailure, bytes callData)[] calls) payable returns ((bool success, bytes returnData)[])',
];

/**
 * Batch multiple calls into a single wallet execute() via Multicall3.aggregate3.
 * @param {Array} calls - [{ to, value, data, description }]
 * @param {string} walletAddr - AAWP wallet address
 * @param {object} chain - chain config from CHAINS
 * @param {Function} socketQuery - the socketQuery function for signing
 * @param {Function} getNonce - async function returning next nonce
 * @returns {string} txHash
 */
async function batchExecute(calls, walletAddr, chain, socketQuery, getNonce) {
  if (!calls || calls.length === 0) throw new Error('No calls to batch');

  // If only one call has value > 0, we need to sum total value
  const totalValue = calls.reduce((sum, c) => sum + BigInt(c.value || '0'), 0n);

  // Encode Multicall3.aggregate3
  const iface = new ethers.Interface(MULTICALL3_ABI);
  const multicallArgs = calls.map(c => ({
    target: c.to,
    allowFailure: false,
    callData: c.data || '0x',
  }));
  const data = iface.encodeFunctionData('aggregate3', [multicallArgs]);

  const nonce = await getNonce();
  const deadline = Math.floor(Date.now() / 1000) + 3600;

  console.log(`\n📦 Batch executing ${calls.length} calls via Multicall3`);
  for (let i = 0; i < calls.length; i++) {
    console.log(`  ${i + 1}. ${calls[i].description || calls[i].to} (value: ${calls[i].value || '0'})`);
  }

  // Inject guardian private key as gas_key (same logic as sign-worker.js)
  let gasKey;
  try {
    const gPath = path.join(process.env.AAWP_SKILL || '/root/clawd/skills/aawp', 'config/guardian.json');
    const g = JSON.parse(fs.readFileSync(gPath, 'utf8'));
    if (g.privateKey) gasKey = g.privateKey.replace(/^0x/, '');
  } catch (_) {}
  gasKey = process.env.AAWP_GUARDIAN_KEY || process.env.AAWP_GAS_KEY || gasKey;

  const result = await socketQuery({
    cmd: 'sign',
    wallet: walletAddr,
    to: MULTICALL3_ADDR,
    value: '0x' + totalValue.toString(16),
    nonce: Number(nonce),
    deadline,
    chain_id: chain.chainId,
    rpc: chain.rpcOverride || chain.rpc,
    data,
    gas_key: gasKey,
  });

  if (result.error) throw new Error(`Batch sign failed: ${result.error}`);
  return result.result;
}

module.exports = { batchExecute, MULTICALL3_ADDR };
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall