Onchain Contract / Token Analysis
Use this skill when the task is to assess a token, protocol, launch module, vault, staking system, router, or related onchain project from a security, permissions, tokenomics, or behavior perspective.
Core objective
Produce a practical analysis that answers:
- - What the system does
- Who controls it
- How value and fees move
- What privileged actions exist
- What users can lose money from
- Whether there are obvious red flags or design risks
Workflow
1. Identify the scope
First determine which of these the request actually targets:
- - token contract
- factory / launcher
- vault / staking / locker
- router / hook / proxy / module
- admin / governance / registry
- full protocol system
If the scope is unclear, infer it from the files, addresses, ABI names, deployment scripts, or docs.
2. Map the architecture
Before judging risk, build a compact model of the system:
- - main contracts
- ownership / admin roles
- external dependencies
- upgradeability pattern
- event flow
- token creation flow
- fee routing flow
Prefer a short system map over long prose.
3. Check control and permissions
Always verify:
- -
owner, admin, governor, operator, manager, INLINECODE5 - role-based access control
- pausable / blacklist / whitelist powers
- mint / burn / seize / rescue / withdraw permissions
- parameter setters
- upgrade authority
- emergency functions
Call out who can do what, and whether those powers are bounded or dangerous.
4. Check token mechanics
For ERC-20 and tokenized systems, verify:
- - total supply model
- mintability
- burnability
- transfer restrictions
- fee on transfer / tax
- max wallet / max tx rules
- trading enable switch
- blacklist / antibot logic
- rebasing / reflection / hidden balance logic
- allowance edge cases
If the token claims to be standard, confirm whether behavior actually matches that claim.
5. Check fee and value flow
Trace where user funds or protocol fees go:
- - LP fee recipients
- treasury recipients
- locker / vault recipients
- protocol fee splits
- conversion / swap path
- withdrawal path
- claim path
Do not just name recipients. Explain whether they are:
- - immutable
- admin-changeable
- delayed
- claim-based
- dependent on offchain identity or signatures
6. Check upgradeability and mutability
If proxies or modules exist, verify:
- - proxy type
- implementation admin
- initialization safety
- reinitialization protection
- storage layout assumptions
- upgrade trust model
If not upgradeable, still check whether behavior can change through configurable modules.
7. Check attack surface
Look for:
- - arbitrary external calls
- reentrancy opportunities
- unchecked token callbacks
- unsafe approvals
- signature replay
- missing nonce / deadline checks
- address(0) edge cases
- misconfigured recipient logic
- accounting mismatch
- stale state after recipient updates
- rounding leakage
- griefing / denial-of-service vectors
When risk depends on business assumptions, state that explicitly.
8. Check market-facing risk
When the target is a token or launch flow, explicitly assess:
- - honeypot-like behavior
- sell restrictions
- hidden tax changes
- admin ability to freeze exits
- liquidity custody
- locker guarantees
- whether front-end labels could misclassify the asset
Do not overclaim. Distinguish:
- - confirmed malicious logic
- dangerous centralization
- poor design
- heuristic / market-behavior false positives
Output format
Default to this structure:
Summary
One short paragraph stating what the system is and the top conclusion.
Findings
List issues in severity order:
- - severity
- title
- affected contract / function
- why it matters
- exploit or failure mode
- whether it is confirmed or conditional
Trust model
State:
- - who controls upgrades
- who controls fees
- who controls pauses or restrictions
- what users must trust offchain
Token / fee flow
Explain:
- - how tokens are created
- where fees accrue
- who can claim them
- what can change later
Open questions
List anything blocked by missing source, missing ABI, missing deployment info, or offchain dependencies.
Special guidance
When reviewing a suspicious token
Be precise:
- - "can blacklist holders" is stronger than "looks risky"
- "owner can change tax" is stronger than "may be a scam"
- "no onchain sell restriction found" is stronger than "not a honeypot"
When reviewing a launch module
Always distinguish:
- - launcher logic
- underlying token implementation
- LP locker behavior
- fee locker behavior
- who receives economic rights
When chain data is required
If the task depends on live state, verify with current chain or explorer data instead of assuming from source alone.
Do not
- - Do not call something malicious without code-based support
- Do not confuse admin centralization with exploitability
- Do not ignore offchain identity dependencies when they control payouts
- Do not stop at contract syntax; trace actual economic outcomes
链上合约/代币分析
当任务需要从安全性、权限、代币经济学或行为角度评估代币、协议、启动模块、金库、质押系统、路由器或相关链上项目时,使用此技能。
核心目标
生成一份实用的分析报告,回答以下问题:
- - 系统功能是什么
- 谁控制该系统
- 价值和费用如何流动
- 存在哪些特权操作
- 用户可能因何亏损
- 是否存在明显的危险信号或设计风险
工作流程
1. 确定分析范围
首先确定请求实际针对的是以下哪一类:
- - 代币合约
- 工厂/启动器
- 金库/质押/锁定合约
- 路由器/钩子/代理/模块
- 管理员/治理/注册表
- 完整协议系统
若范围不明确,则根据文件、地址、ABI名称、部署脚本或文档进行推断。
2. 映射架构
在判断风险之前,先构建系统的精简模型:
- - 主要合约
- 所有权/管理员角色
- 外部依赖项
- 可升级模式
- 事件流
- 代币创建流程
- 费用路由流程
优先使用简短的系统映射图,而非冗长的文字描述。
3. 检查控制与权限
始终验证以下内容:
- - owner、admin、governor、operator、manager、signer
- 基于角色的访问控制
- 暂停/黑名单/白名单权限
- 铸造/销毁/没收/救援/提取权限
- 参数设置器
- 升级权限
- 紧急功能
明确指出谁可以执行什么操作,以及这些权限是否受限或存在风险。
4. 检查代币机制
对于ERC-20及代币化系统,验证以下内容:
- - 总供应量模型
- 可铸造性
- 可销毁性
- 转账限制
- 转账费用/税收
- 最大持仓/最大交易规则
- 交易开关
- 黑名单/反机器人逻辑
- 基数调整/反射/隐藏余额逻辑
- 授权边界情况
若代币声称符合标准,需确认其行为是否确实与声明一致。
5. 检查费用与价值流动
追踪用户资金或协议费用的去向:
- - 流动性池费用接收方
- 国库接收方
- 锁定合约/金库接收方
- 协议费用分配
- 兑换/交换路径
- 提现路径
- 领取路径
不仅要列出接收方,还需说明其性质:
- - 不可变
- 管理员可更改
- 延迟执行
- 基于领取
- 依赖链下身份或签名
6. 检查可升级性与可变性
若存在代理或模块,需验证:
- - 代理类型
- 实现合约管理员
- 初始化安全性
- 重新初始化保护
- 存储布局假设
- 升级信任模型
若不可升级,仍需检查是否可通过可配置模块改变行为。
7. 检查攻击面
寻找以下问题:
- - 任意外部调用
- 重入攻击机会
- 未检查的代币回调
- 不安全的授权
- 签名重放
- 缺少nonce/截止时间检查
- address(0)边界情况
- 配置错误的接收方逻辑
- 账目不匹配
- 接收方更新后的陈旧状态
- 舍入误差
- 恶意干扰/拒绝服务攻击向量
若风险取决于业务假设,需明确说明。
8. 检查市场风险
当目标为代币或启动流程时,需明确评估:
- - 蜜罐行为
- 卖出限制
- 隐藏的税收变更
- 管理员冻结退出的能力
- 流动性托管
- 锁定合约保障
- 前端标签是否可能错误分类资产
避免过度断言。区分以下情况:
- - 确认的恶意逻辑
- 危险的集中化
- 设计缺陷
- 基于启发式/市场行为的误报
输出格式
默认采用以下结构:
摘要
用一段简短文字说明系统功能及主要结论。
发现
按严重程度列出问题:
- - 严重程度
- 标题
- 受影响的合约/函数
- 重要性说明
- 利用或失败模式
- 是否已确认或存在条件限制
信任模型
说明:
- - 谁控制升级
- 谁控制费用
- 谁控制暂停或限制
- 用户必须信任哪些链下因素
代币/费用流动
解释:
- - 代币如何创建
- 费用在哪里累积
- 谁可以领取费用
- 哪些内容后续可能变更
待解决问题
列出因缺少源代码、ABI、部署信息或链下依赖而无法确定的问题。
特别指导
审查可疑代币时
务必精确:
- - 可以将持有者列入黑名单比看起来有风险更明确
- 所有者可以更改税收比可能是骗局更具体
- 未发现链上卖出限制比不是蜜罐更准确
审查启动模块时
始终区分:
- - 启动器逻辑
- 底层代币实现
- 流动性池锁定行为
- 费用锁定行为
- 经济权利的接收方
需要链上数据时
若任务依赖实时状态,需使用当前链或浏览器数据进行验证,而非仅凭源代码假设。
禁止事项
- - 不得在没有代码依据的情况下断言某物为恶意
- 不得将管理员集中化与可利用性混淆
- 不得忽略控制支付的链下身份依赖
- 不得仅停留在合约语法层面;需追踪实际的经济结果