Abstract Toolkit
Scanned@Masoncags-tech
npx machina-cli add skill @Masoncags-tech/abstract-toolkit --openclawAbstract Onboard
Everything an agent needs to operate on Abstract.
Quick Start
Create Abstract Global Wallet (AGW)
AGW is a smart contract wallet that earns XP on Abstract. Essential for agents!
export WALLET_PRIVATE_KEY=0x...
node scripts/create-agw.js
Your EOA becomes the signer, AGW is a separate smart contract address.
Check Balances
node scripts/check-balances.js <wallet> all
Bridge ETH to Abstract
export WALLET_PRIVATE_KEY=0x...
node scripts/relay-bridge.js --from base --amount 0.01
Deploy a Contract
export WALLET_PRIVATE_KEY=0x...
node scripts/deploy-abstract.js ./artifacts/MyContract.json "constructor-arg"
Transfer Tokens
export WALLET_PRIVATE_KEY=0x...
node scripts/transfer.js --to 0x... --amount 0.01 # ETH
node scripts/transfer.js --to 0x... --amount 100 --token USDC # Token
Swap Tokens
export WALLET_PRIVATE_KEY=0x...
export DEX_ROUTER=0x... # Set DEX router address
node scripts/swap-tokens.js --from ETH --to USDC --amount 0.01
Call Any Contract
# Read
node scripts/call-contract.js --address 0x... --abi ./abi.json --function balanceOf --args 0x1234
# Write
export WALLET_PRIVATE_KEY=0x...
node scripts/call-contract.js --address 0x... --abi ./abi.json --function transfer --args 0x1234,100 --write
Key Information
| Item | Value |
|---|---|
| Chain ID | 2741 |
| RPC | https://api.mainnet.abs.xyz |
| Explorer | https://abscan.org |
| Bridge | https://relay.link/bridge/abstract |
| USDC | 0x84A71ccD554Cc1b02749b35d22F684CC8ec987e1 |
| WETH | 0x3439153EB7AF838Ad19d56E1571FBD09333C2809 |
Scripts
| Script | Purpose |
|---|---|
create-agw.js | Create Abstract Global Wallet (earns XP!) |
check-balances.js | Check ETH and token balances |
relay-bridge.js | Bridge ETH from other chains |
deploy-abstract.js | Deploy contracts to Abstract |
transfer.js | Send ETH or tokens |
swap-tokens.js | Trade tokens via DEX |
call-contract.js | Call any contract function |
References
| File | Contents |
|---|---|
agw.md | Abstract Global Wallet guide (XP, activation) |
hardhat.config.js | Working Hardhat config for Abstract |
addresses.md | Key contract addresses |
troubleshooting.md | Common errors and fixes |
Common Issues
- Gas estimation fails → Use Hardhat, not foundry-zksync
- Compiler errors → Use Solidity 0.8.x with zksolc
- TX stuck → Check gas price, verify on abscan.org
See references/troubleshooting.md for detailed solutions.
Dependencies
# Core dependencies
npm install ethers zksync-ethers viem
# For contract deployment
npm install @matterlabs/hardhat-zksync
# For AGW (Abstract Global Wallet)
npm install @abstract-foundation/agw-client
Overview
Abstract Toolkit provides a ready-to-run set of scripts and configurations to operate on Abstract (ZK Stack L2). It enables deploying contracts via zksolc and Hardhat, bridging ETH and tokens through Relay, and trading on a DEX, while offering direct interaction with the Abstract mainnet. It centralizes key addresses, scripts, and dependencies for efficient on-chain work.
How This Skill Works
The toolkit exposes a collection of scripts (create-agw.js, check-balances.js, relay-bridge.js, deploy-abstract.js, transfer.js, swap-tokens.js, call-contract.js) that connect to Abstract using ethers and zksync-ethers, guided by a signer derived from WALLET_PRIVATE_KEY. You can deploy contracts, bridge assets, transfer or swap tokens, and call contract functions on Abstract, with Hardhat handling deployment and zksolc for compilation. Key addresses and chain information are documented for reliable interactions.
When to Use It
- You need to deploy a new smart contract to Abstract using zksolc and Hardhat.
- You want to bridge ETH or tokens from a base chain into Abstract via Relay.
- You intend to trade or swap tokens on Abstract using a DEX.
- You need to check balances or transfer ETH/tokens within Abstract.
- You need to call a contract function on Abstract (read or write) and verify results.
Quick Start
- Step 1: export WALLET_PRIVATE_KEY and create the AGW: export WALLET_PRIVATE_KEY=0x...; node scripts/create-agw.js
- Step 2: Run a task with the appropriate script, e.g., node scripts/check-balances.js <wallet> all or node scripts/relay-bridge.js --from base --amount 0.01 or node scripts/deploy-abstract.js ./artifacts/MyContract.json 'constructor-arg'
- Step 3: Verify results on abscan.org and consult addresses.md for key contract addresses and chain details
Best Practices
- Use the Abstract Global Wallet (AGW) as the signer for all actions.
- Securely manage WALLET_PRIVATE_KEY and avoid hardcoding it in scripts.
- Verify network details and addresses from the Key Information table and addresses.md before actions.
- Pin versions of zksolc, Hardhat, and ethers; test with small amounts first.
- Review transaction results on abscan.org after each operation.
Example Use Cases
- Deploy a new contract to Abstract with deploy-abstract.js and a constructor argument.
- Bridge 0.01 ETH from the base chain to Abstract using relay-bridge.js.
- Swap 0.01 ETH for USDC on Abstract via swap-tokens.js with a specified DEX router.
- Transfer 100 USDC to another address using transfer.js.
- Read balanceOf for an address using call-contract.js.