|
| 1 | +# Spraay Batch Payment Tools for Google ADK |
| 2 | + |
| 3 | +[Spraay](https://spraay.app) enables AI agents to batch-send ETH or ERC-20 tokens to up to 200 recipients in a single transaction on [Base](https://base.org), with ~80% gas savings compared to individual transfers. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +These tools allow any Google ADK agent to execute batch cryptocurrency payments on Base. Common use cases include: |
| 8 | + |
| 9 | +- **Payroll**: Pay team members in ETH or stablecoins in one transaction |
| 10 | +- **Airdrops**: Distribute tokens to community members efficiently |
| 11 | +- **Bounties**: Send rewards to multiple contributors at once |
| 12 | +- **Revenue sharing**: Split payments across stakeholders |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +```bash |
| 17 | +pip install google-adk-community web3 |
| 18 | +``` |
| 19 | + |
| 20 | +## Quick Start |
| 21 | + |
| 22 | +```python |
| 23 | +from google.adk.agents import Agent |
| 24 | +from google.adk_community.tools.spraay import ( |
| 25 | + spraay_batch_eth, |
| 26 | + spraay_batch_token, |
| 27 | + spraay_batch_eth_variable, |
| 28 | + spraay_batch_token_variable, |
| 29 | +) |
| 30 | + |
| 31 | +agent = Agent( |
| 32 | + name="payment_agent", |
| 33 | + model="gemini-2.5-flash", |
| 34 | + instruction="""You are a payment assistant that helps users send |
| 35 | + batch cryptocurrency payments on Base using Spraay. Always confirm |
| 36 | + recipient addresses and amounts before executing transactions.""", |
| 37 | + tools=[ |
| 38 | + spraay_batch_eth, |
| 39 | + spraay_batch_token, |
| 40 | + spraay_batch_eth_variable, |
| 41 | + spraay_batch_token_variable, |
| 42 | + ], |
| 43 | +) |
| 44 | +``` |
| 45 | + |
| 46 | +## Configuration |
| 47 | + |
| 48 | +Set the following environment variables: |
| 49 | + |
| 50 | +| Variable | Required | Description | |
| 51 | +|---|---|---| |
| 52 | +| `SPRAAY_PRIVATE_KEY` | Yes | Private key of the sending wallet | |
| 53 | +| `SPRAAY_RPC_URL` | No | Base RPC endpoint (default: `https://mainnet.base.org`) | |
| 54 | +| `SPRAAY_CONTRACT_ADDRESS` | No | Override Spraay contract address | |
| 55 | + |
| 56 | +```bash |
| 57 | +export SPRAAY_PRIVATE_KEY="0x..." |
| 58 | +``` |
| 59 | + |
| 60 | +## Tools |
| 61 | + |
| 62 | +### `spraay_batch_eth` |
| 63 | + |
| 64 | +Send equal amounts of ETH to multiple recipients. |
| 65 | + |
| 66 | +```python |
| 67 | +# Example: Send 0.01 ETH to 3 recipients |
| 68 | +result = spraay_batch_eth( |
| 69 | + recipients=["0xAddr1...", "0xAddr2...", "0xAddr3..."], |
| 70 | + amount_per_recipient_eth="0.01", |
| 71 | +) |
| 72 | +``` |
| 73 | + |
| 74 | +### `spraay_batch_token` |
| 75 | + |
| 76 | +Send equal amounts of an ERC-20 token to multiple recipients. Handles token approval automatically. |
| 77 | + |
| 78 | +```python |
| 79 | +# Example: Send 100 USDC to 3 recipients |
| 80 | +USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" |
| 81 | +result = spraay_batch_token( |
| 82 | + token_address=USDC_BASE, |
| 83 | + recipients=["0xAddr1...", "0xAddr2...", "0xAddr3..."], |
| 84 | + amount_per_recipient="100", |
| 85 | + token_decimals=6, # USDC uses 6 decimals |
| 86 | +) |
| 87 | +``` |
| 88 | + |
| 89 | +### `spraay_batch_eth_variable` |
| 90 | + |
| 91 | +Send different ETH amounts to each recipient. |
| 92 | + |
| 93 | +```python |
| 94 | +# Example: Send variable amounts to 3 recipients |
| 95 | +result = spraay_batch_eth_variable( |
| 96 | + recipients=["0xAddr1...", "0xAddr2...", "0xAddr3..."], |
| 97 | + amounts_eth=["0.1", "0.25", "0.05"], |
| 98 | +) |
| 99 | +``` |
| 100 | + |
| 101 | +### `spraay_batch_token_variable` |
| 102 | + |
| 103 | +Send different token amounts to each recipient. |
| 104 | + |
| 105 | +```python |
| 106 | +# Example: Send variable USDC amounts to 3 recipients |
| 107 | +result = spraay_batch_token_variable( |
| 108 | + token_address=USDC_BASE, |
| 109 | + recipients=["0xAddr1...", "0xAddr2...", "0xAddr3..."], |
| 110 | + amounts=["100", "250.5", "75"], |
| 111 | + token_decimals=6, |
| 112 | +) |
| 113 | +``` |
| 114 | + |
| 115 | +## Protocol Details |
| 116 | + |
| 117 | +- **Contract**: `0x1646452F98E36A3c9Cfc3eDD8868221E207B5eEC` on Base Mainnet |
| 118 | +- **Max recipients**: 200 per transaction |
| 119 | +- **Fee**: 0.3% protocol fee |
| 120 | +- **Gas savings**: ~80% compared to individual transfers |
| 121 | +- **Token support**: Any ERC-20 token on Base |
| 122 | +- **Website**: [spraay.app](https://spraay.app) |
| 123 | +- **Source**: [github.com/plagtech](https://github.com/plagtech) |
| 124 | + |
| 125 | +## Running Tests |
| 126 | + |
| 127 | +```bash |
| 128 | +pytest tests/unittests/tools/spraay/ -v |
| 129 | +``` |
| 130 | + |
| 131 | +## License |
| 132 | + |
| 133 | +Apache 2.0 - See [LICENSE](../../LICENSE) for details. |
0 commit comments