smart-contract-reading-guide
БесплатноБез исполняемых скриптовНе проверенHow to read and understand smart contracts — navigating Etherscan, reading Solidity code, understanding ABIs, decoding transactions, and spotting common…
от nirholas★ 289 звёзд на GitHubОб этом скилле
Smart Contract Reading Guide
You don't need to be a Solidity developer to read smart contracts. This guide teaches you to understand what contracts do by reading their code on block explorers.
Finding Contract Code
Block Explorers
| Chain | Explorer | URL |
|---|---|---|
| Ethereum | Etherscan | etherscan.io |
| Arbitrum | Arbiscan | arbiscan.io |
| Base | BaseScan | basescan.org |
| Optimism | Optimistic Etherscan | optimistic.etherscan.io |
| Polygon | PolygonScan | polygonscan.com |
Steps to Read a Contract
- Go to the explorer → Enter contract address
- Click "Contract" tab
- Look for the green checkmark ("Contract Source Code Verified")
- If not verified → RED FLAG — don't interact with unverified contracts
Understanding Contract Structure
Solidity 101 for Readers
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Interface — defines what functions exist
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
}
// Contract — the actual code
contract MyToken is IERC20 {
// State variables (stored on blockchain)
string public name = "My Token";
mapping(address => uint256) private _balances;
address public owner;
// Events (logs, used for tracking)
event Transfer(address indexed from, address indexed to, uint256 value);
// Modifier (access control)
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
// View function (read-only, free to call)
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
// State-changing function (costs gas)
function transfer(address to, uint256 amount) external returns (bool) {
_balances[msg.sender] -= amount;
_balances[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
// Owner-only function (⚠️ check these carefully)
function mint(address to, uint256 amount) external onlyOwner {
_balances[to] += amount;
}
}
Key Solidity Concepts
| Concept | Meaning | Why It Matters |
|---|---|---|
public |
Anyone can call/read | Normal, expected |
external |
Only callable from outside | Normal for functions |
view / pure |
Read-only (free to call) | Safe — no state changes |
onlyOwner |
Only the owner can call | Check what owner can do |
payable |
Can receive ETH | May collect fees |
mapping |
Key-value storage | Stores balances, approvals |
require |
Validation check | If false, transaction reverts |
emit |
Logs an event | Used for tracking |
Reading on Etherscan
"Read Contract" Tab
Free queries — anyone can call these:
| Function | What It Returns |
|---|---|
name() |
Token name |
symbol() |
Token symbol (e.g., "USDC") |
decimals() |
Decimal places (6 for USDC, 18 for most tokens) |
totalSupply() |
Total tokens in existence |
balanceOf(address) |
How many tokens an address holds |
owner() |
Who controls the contract |
paused() |
Whether the contract is paused |
"Write Contract" Tab
Requires wallet connection and gas:
| Function | What It Does | Risk Level |
|---|---|---|
transfer() |
Send tokens | Normal |
approve() |
Grant spending permission | Medium (check amount) |
stake() |
Lock tokens for rewards | Normal |
mint() |
Create new tokens | Check who can call |
Decoding Transactions
Transaction Overview
On any transaction page:
| Field | What It Shows |
|---|---|
| Status | Success or Failed |
| From | Sender address |
| To | Contract called |
| Value | ETH sent |
| Input Data | Function call + parameters |
| Gas Used | Actual gas consumed |
Reading Input Data
Raw input data looks like:
0xa9059cbb000000000000000000000000abcdef...00000000000000000000000000000000000000000000000000000002540be400
Decoded (Etherscan does this automatically for verified contracts):
Function: transfer(address, uint256)
to: 0xabcdef...
amount: 10000000000 (10,000 USDC with 6 decimals)
Event Logs
Every transaction emits events (in the "Logs" tab):
Transfer(
from: 0x1234...,
to: 0x5678...,
value: 1000000000000000000 (1 ETH in wei)
)
Common DeFi Contract Patterns
ERC-20 Token
| Function | What to Check |
|---|---|
mint() |
Who can call? If unrestricted → inflation risk |
burn() |
Deflationary mechanism |
pause() |
Can transfers be frozen? |
blacklist() |
Can addresses be blocked? |
setFee() |
Can transfer tax be changed? |
Lending Protocol (Aave-style)
| Function | What It Does |
|---|---|
supply() |
Deposit collateral |
borrow() |
Take a loan |
Установить smart-contract-reading-guide в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл smart-contract-reading-guide?
How to read and understand smart contracts — navigating Etherscan, reading Solidity code, understanding ABIs, decoding transactions, and spotting common patterns. Use when helping users verify contracts, understand DeFi protocol mechanics, or decode on-chain activity.
Как установить скилл smart-contract-reading-guide?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл smart-contract-reading-guide запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic