This skill allows the agent to initiate payments through the SOHO Pay Creditor smart contract using the spendWithAuthorization EIP-712 flow.
The agent signs the payment authorization off-chain using a pre-configured wallet, and then submits the transaction to the network on the user's behalf.
The primary way to use this skill is with a natural language command that maps to:
pay
: The numerical amount to pay (e.g., 10, 0.5).: The recipient EVM address (0x...). Names are not supported and no random addresses are ever generated by this skill.When you issue a pay command, the skill performs the following actions:
registerAgent.PRIVATE_KEY wallet (from environment variables) to sign the authorization message.spendWithAuthorization function on the Creditor contract, providing the signed message.The status helper reads the BorrowerManager profile + USDC wallet balance for the bot:
s_borrowerProfiles(address) public mapping getter to fetch: creditLimit, outstandingDebt, totalSpent, totalRepaid, spendingCount, repaymentCount, lastActivityTime, creditScore, isActive, isAgent, transactionIds.
IERC20(USDC).balanceOf(bot) to fetch the USDC wallet balance for the same address.This is what powers prompts like:
"check my bot status on testnet""check my bot outstanding debt on mainnet"The repay helper uses USDC to pay down outstandingDebt tracked by BorrowerManager and Creditor:
IERC20(USDC).allowance(bot, Creditor) and, if too low, sends an approve(Creditor, amount) tx first.Creditor.repay(amount, USDC) from the borrower wallet.min(amount, outstandingDebt).applyPaymentToPlans.updateOnRepayment (new score + limit).vault.repayVaultDebt.status again to verify:outstandingDebt has decreased (or is 0),totalRepaid increased,creditScore and creditLimit have been updated.This is what backs prompts like:
"repay my bot debt on testnet""repay 5 USDC of my bot debt on mainnet"PRIVATE_KEY environment variable.PRIVATE_KEY is used only locally on the machine running OpenClaw. The raw key is never sent to SOHO Pay, ClawHub, or any external service — only signed messages and transactions leave the machine. Anyone running this bot must understand that the key controls whatever funds are on the selected network.PRIVATE_KEY as a required, sensitive credential. You can use a single key for both Base mainnet and Base Sepolia, but be aware this may control real funds on mainnet.chainId for the selected network and aborts if the RPC does not match.The following values are hardcoded into the script for consistency, and are used on both Base mainnet and Base Sepolia:
0xdb34d612dd9aa548f6c94af118f82a461a835e090xc6ecd37c42ee73714956b6a449b41bc1d46b07b00x43848d5a4efa0b1c72e1fd8ece1abf42e9d5e221 (6 decimals)0This skill is a small Node.js project under skills/sohopay.
PRIVATE_KEY in the environment where OpenClaw runs:```bash
export PRIVATE_KEY=0xYOUR_KEY_HERE
```
This address will be the SOHO Pay "agent" on Base mainnet / Base Sepolia.
```bash
clawhub install sohopay
cd skills/sohopay
npm install
```
This installs the runtime dependencies declared in package.json (currently ethers and dotenv).
```bash
# Base mainnet (default)
node scripts/register.js
# Explicit mainnet
node scripts/register.js mainnet
# Base Sepolia testnet
node scripts/register.js testnet
```
This calls registerAgent(agent) on the BorrowerManager contract using the PRIVATE_KEY address.
scripts/pay.js:```bash
# Base mainnet (default when no network arg is given)
node scripts/pay.js 10 0xMerchantOnMainnet
# Explicit mainnet
node scripts/pay.js mainnet 10 0xMerchantOnMainnet
# Base Sepolia testnet
node scripts/pay.js testnet 10 0xMerchantOnTestnet
```
This uses the SOHO Pay Creditor contract to spend on credit via spendWithAuthorization.
scripts/status.js:```bash
# Base mainnet
node scripts/status.js mainnet
# Base Sepolia testnet
node scripts/status.js testnet
```
This reads the BorrowerManager profile and USDC wallet balance for the agent and prints a human-readable summary (credit limit, outstanding debt, totals, scores, and USDC balance).
scripts/repay.js:```bash
# Base mainnet
node scripts/repay.js mainnet 10
# Base Sepolia testnet
node scripts/repay.js testnet 10
```
This uses USDC from the agent wallet to repay outstandingDebt via the Creditor contract, updating the borrower profile and vault debt, and emitting a repayment event.
PRIVATE_KEY is highly sensitive. Treat it exactly like the key to a normal wallet: anyone with this value can move all funds it controls.PRIVATE_KEY.merchant_address. If the address is wrong, funds on that network may be irrecoverably sent to the wrong account.These are the kinds of prompts you can send to your OpenClaw agent once the skill is installed and PRIVATE_KEY is configured.
"register my bot to use sohopay on Base Sepolia testnet"
"register my bot to use sohopay on Base mainnet"
"pay 10 USDC to 0x1234567890abcdef1234567890abcdef12345678 on testnet using sohopay"
"check my bot status on testnet"
"check my bot outstanding debt on mainnet"
Creditor.repay(amount, stablecoin)) "repay my bot debt on testnet"
"repay 5 USDC of my bot debt on mainnet"
node scripts/register.js [mainnet|testnet] [check] node scripts/register.js testnet – register bot on Base Sepolia node scripts/register.js mainnet check – status only, no txnode scripts/pay.js [mainnet|testnet] node scripts/status.js mainnet node scripts/status.js testnetnode scripts/repay.js [mainnet|testnet] When mapped through OpenClaw, you should prefer natural-language prompts; the scripts above are provided for debugging and manual CLI use.
共 1 个版本