Skip to content

About

ERC-20 security, bytecode & fork screener for Robinhood Chain & EVM

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

token-screen

test

Screen an ERC-20 before it is used as a staking token. One address per line goes in, one verdict per line comes out: what can be upgraded, what can be paused, what a transfer really costs, and whether a transfer to the burn address goes through.

Author: lavFACTORY protocol author

Current release: v1.0.0

The code in main is the code the archive was built from: the fifteen files inside the archive are the same bytes as the ones in this repository, so cloning the repository and unpacking the archive come to the same thing. Release notes live in docs/releases/v1.0.0.md, and what was verified before the release is in docs/token-screen-v1.0.0-CHECK.md.

Contents

path what it is
check-token.sh reads the chain: proxy, admin surface, diamond facets, transfer hooks, pause switch, the burn transfer
screen-all.sh batch mode: screens a list, runs the fork test per token, prints the table and one RESULT line per row
networks.sh the network table and the only readers of the RESULT line, result_fields and status_of
test/TokenScreen.t.sol the fork test: measures the transfer fee and the burn, funds its own probe when no holder is given
selftest/ offline checks, and the beacon branch end to end against a local anvil
RESULT-contract.md the spec: every key of the RESULT line, the verdict ladder, the failure modes
foundry.toml forge config: solc 0.8.24, evm_version = "cancun", five rpc endpoints as literal URLs
tokens.txt the list screen-all.sh reads by default: three lines, one per network, with the format in comments
LICENSE MIT, and each script carries SPDX-License-Identifier: MIT
docs/ release notes, the check notes, and the artifact index with checksums
patches/ r3 through r6, the patch series this release was assembled from
logs/ the live runs quoted in the release notes

Requirements

forge, cast and jq, plus curl and anvil for the beacon fixture. The library version is pinned:

forge install foundry-rs/forge-std@v1.9.5

Quick start

From a clone, which brings the code, the docs and the patch history in one step:

git clone https://github.com/lavFACTORY/token-screen.git
cd token-screen
forge install foundry-rs/forge-std@v1.9.5

./selftest/selftest.sh              # eleven checks, no chain, no forge
./selftest/beacon-e2e.sh            # six checks against a local anvil
./check-token.sh <token> [holder]   # one token: the human report plus one RESULT line
./screen-all.sh <list>              # a list: one table row and one RESULT line per token

From the release archive, when a pinned 1.0.0 is what you want:

unzip token-screen-v1.0.0.zip
cd token-screen-v1.0.0
forge install foundry-rs/forge-std@v1.9.5

The list

One token per line, text after # is ignored:

token [holder] [network]

holder is any address that holds the token. It is optional: without it, and when the address it names holds less than one probe, the fork test derives a fresh address and funds it through deal, and the fee column carries a * to say the balance was not found on chain. network is robinhood (the default), base, arbitrum, bsc or mainnet. The default list path is ./tokens.txt, which ships here with three example lines, one of them a negative control: the zero address, which has no code and therefore reads FAIL(nocode).

The table

column meaning
TOKEN the address, shortened
NET the network named in the list
PROXY none, clone, erc1967, zeppelinos, beacon, custom, joined with + when several apply, with +diamond when facet selectors are in the dispatcher
ADMIN none, owner, roles, owner+roles, with +pause when a pause switch exists
FEE% the transfer fee measured on a fork, two decimals; - when nothing was measured; a * when the balance it was measured from was created by the test
BURN ok a transfer to 0x...dEaD goes through, blocked it does not, na untested
STATUS CLEAN, WARN or FAIL, with the reason in brackets on a FAIL

CLEAN means nothing in the report needs attention. WARN means an owner, roles, a proxy, a diamond, a transfer hook, or a measurement that did not arrive. FAIL means a transfer fee, a blocked burn, or a run that did not finish. The verdict is computed in exactly one place, status_of in networks.sh, because the fee is only known after the fork test has run.

The RESULT line

Every run prints one machine readable line on the same stream as the human report, so no caller has to parse prose:

RESULT token=0x912ce59144191c1204e64559fe8253a0e49e6548 symbol=_ARB_ net=arbitrum proxy=erc1967 admin=owner diamond=0 hooks=1 pausable=0 burn=ok fee_bps=0 err=- test=Success block=529733894 fee_addr=0x278d858f05b94576c1e6f73285886876ff6ef8d2 status=WARN

block is written by forge 1.10 and later, which records the fork block in the JSON it serializes; on 1.7.x it stays -. Every key, its values, and which half of the pipeline writes it are in RESULT-contract.md. A caller that reads more than one line for the same token keeps the last value of every key, which is how the fee measured by the fork test joins the facts read from the chain.

Endpoints

networks.sh holds the defaults and expands ${NETWORK_RPC_URL:-default} itself, so ARBITRUM_RPC_URL and its four siblings override a whole row, both halves of it. The [rpc_endpoints] aliases in foundry.toml are literal URLs for manual runs, such as forge test --match-contract TokenScreen --rpc-url arbitrum. The foundry parser does not understand the bash ${VAR:-default} form, which is why those aliases carry no placeholders.

Checks that need no chain

./selftest/selftest.sh                 the event reader, the verdict ladder, the column order:
                                       eleven checks, no chain, no forge, no network
./selftest/beacon-e2e.sh               the beacon branch against a local anvil: six checks, needs
                                       anvil, cast, curl and jq, prints SKIP when one is missing
./selftest/selftest.sh <result.json>   diagnose one real result, for example the JSON a live run
                                       wrote, and print the row the reader produces from it

The first runs on every push and pull request through .github/workflows/test.yml, which also checks the syntax of every shell script and that the five scripts are still executable. The beacon fixture runs on demand from the Actions tab, because it installs foundry on the runner to get anvil.

Every live number this tool prints comes from a fork test, so these cover the reader, the ladder and the row, not the schema that forge writes; the third command is what settles that, on a real file.

Test matrix & CI status

suite scope tests status runner
selftest.sh event reader, verdict ladder, column contract 11 11/11 passing Ubuntu CI (push, pull_request)
beacon-e2e.sh beacon branch end-to-end against anvil 6 6/6 passing Ubuntu CI (workflow_dispatch, foundry)
TokenScreen.t.sol fork fee measurement and burn probe live run manual RPC fork, see logs/r5-live-arb.log

About

ERC-20 security, bytecode & fork screener for Robinhood Chain & EVM

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages