skill-02-smart-contract-interaction
Skill2 starsChanged 6 months agoMITView on GitHub
Interacts with smart contracts via ABI encode/decode, read/write calls, deployment, proxy patterns, and multicall batching. Use when calling contract functions, deploying contracts, or working with upgradeable proxies.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/00-web3-agent-core.mdcCursor rule
- .cursor/rules/10-guardrails-first.mdcCursor rule
- .cursor/rules/20-chain-preset-selector.mdcCursor rule
- .cursor/rules/30-simulate-before-send.mdcCursor rule
- skill-01-wallet-managementSkill
- skill-03-defi-operationsSkill
- skill-04-nft-managementSkill
- skill-05-dao-governanceSkill
- skill-06-cross-chain-bridgeSkill
- skill-07-token-analyticsSkill
- skill-08-security-auditSkill
- skill-09-compliance-amlSkill
- skill-10-identity-didSkill
- skill-11-oracle-data-feedsSkill
- skill-12-gas-optimizationSkill
- skill-13-rwa-tokenizationSkill
- skill-14-social-reputationSkill
- skill-15-mev-protectionSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Before any write interaction:
- Distinctive: line 33
Check contract is verified on block explorer (Etherscan API)
- Distinctive: line 35
Run rug-pull pattern checks (see skill-08)
- Very specific: line 48
Use Multicall3 (0xcA11bde05977b3631167028862bE2a173976CA11) to batch reads.
- Very specific: line 55
Check token approvals — warn if type(uint256).max
- Very specific: line 70
Read implementation: storage slot 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc
- Distinctive: line 71
Always interact with proxy address, not implementation
- Distinctive: line 72
Verify implementation is not self-destructable without timelock
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Smart Contract Interaction
When to Use
- Reading contract state (view/pure functions)
- Writing transactions (state-changing calls)
- Encoding/decoding ABI data
- Deploying contracts (direct or via factory)
- Working with proxy patterns (EIP-1967, UUPS, Transparent)
- Batching reads with Multicall3
Prerequisites
- MCP:
blockchain-rpc-server - MCP:
defi-protocol-serverfor known protocol ABIs - MCP:
security-auditscreening for unknown contracts - Guardrails: verify contract before interaction
Workflow
1. Contract Verification
Before any write interaction:
- Check contract is verified on block explorer (Etherscan API)
- Compare bytecode hash if unverified — block if mismatch with known good
- Run rug-pull pattern checks (see skill-08)
- Confirm address is not on sanctions list
2. Read Calls
// Prefer eth_call with explicit block tag
const result = await provider.call({
to: contractAddress,
data: iface.encodeFunctionData('balanceOf', [userAddress])
}, 'latest');Use Multicall3 (0xcA11bde05977b3631167028862bE2a173976CA11) to batch reads.
3. Write Calls
- Encode function call with ABI
- Estimate gas:
eth_estimateGas+ 20% buffer - Simulate via
eth_callwithfromset to signer - Check token approvals — warn if
type(uint256).max - Submit transaction with appropriate gas params (see skill-12)
4. Deployment
| Pattern | When to Use |
| Direct deploy | Simple, immutable contracts |
| CREATE2 | Deterministic addresses across chains |
| EIP-1967 Proxy | Upgradeable logic contracts |
| UUPS | Gas-efficient upgrades (logic owns upgrade) |
| Minimal Proxy (EIP-1167) | Clone factory patterns |
5. Proxy Interaction
- Read implementation:
storageslot0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc - Always interact with proxy address, not implementation
- Verify implementation is not self-destructable without timelock
ABI Resources
knowledge-base/standards/— ERC interface ABIsdefi-protocol-server— Pre-indexed protocol ABIs- Etherscan verified source for unknown contracts
References
references/multicall-patterns.mdreferences/proxy-patterns.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

