Package: peth
PethA python Ethereum utilities command-line tool.Peth, pronounced likePeace, wishes to become theSwiss Army Knifeguarding the Ethereum space.Peth发音与和平（Peace）相近，是一款以太坊命令行工具。愿景是成为以太坊世界的瑞士军刀。Install 安装From pipInstall with pip. 通过 pip 安装。$ python -m venv test
$ source test/bin/activate

$ pip install peth
# or
$ pip install git+https://github.com/lmy375/pethRun peth。运行 peth。$ peth -hFrom sourceClone the repo. 克隆本仓库。git clone https://github.com/lmy375/peth(Optional) Editconfig.jsonwith new EVM network RPC endpoints and your Etherscan API keys. （可选的）编辑根目录下的config.json文件，添加自定义的 RPC 地址。添加 API Key 可以提高执行速度（否则限频时会自动等待）。{"chains":{"eth":[// RPC endpoint URL."https://rpc.ankr.com/eth",// Etherscan-style API URL.// Get better experience if you have an API key.// https://api.etherscan.io/api?apikey=<Your API Key>&// Do NOT forget the '?' or '&' in the URL."https://api.etherscan.io/api?",// Etherscan address page URL."https://etherscan.io/address/"],...}}Runpython -m peth. 在目录下执行python -m peth。$python-mpeth
Welcometothepethshell.Type`help`tolistcommands.

peth>helpDocumentedcommands(typehelp<topic>):========================================abi4byteconfigerc20ipythonproxysigner
abi_encodecontractestimate_gaslogproxy_allstorage
aesdebanketh_calllooppytimelock
amldebugeth_call_rawnamequittimestamp
balancedecompileexitnoncerpc_calltx
byedethfactorynumberruntx_raw
calldata_decodediffgnosisopensend_txtx_replay
chaindiffasmgraphoraclesendertxs
codedisasmhelpownershurl
codesizedownload_jsonidmpairsha3verify
common_addressesdownload_sourceintpricesigview

peth>Usage 使用说明SDKIn [1]: from peth.core.peth import Peth

In [2]: p = Peth.get_or_create('eth')

In [3]: p.rpc_call('eth_blockNumber')
Out[3]: '0xf66715'

In [4]: p.rpc_call('eth_getBalance', ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', 'latest'])
Out[4]: '0x84c3181015c16f220'

In [5]: p.call_contract('0xdAC17F958D2ee523a2206206994597C13D831ec7', 'balanceOf(address)->(uint256)', ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'])
Out[5]: 72201976Command-line options 命令行参数# Basic RPC call.# 执行基本的 RPC call# 参考 https://eth.wiki/json-rpc/API$peth-reth_blockNumber
0xe0aabb# -c to change network.# 使用 -c 指定使用的区块链网络。支持的网络见 config.json$peth-reth_blockNumber-cbsc
0x10c158f# RPC call with arguments.# 带参数的 RPC 调用$peth-reth_getBalance0x0000000000000000000000000000000000000000latest
0x268fd6968816d5aaeb0# Raw style.# 直接指定参数 JSON 字符串$peth--rpc-call-raweth_getBlockByNumber'["0x0", false]'{'jsonrpc':'2.0','id':0,'result':{'difficulty':'0x400000000','extraData':'0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa','gasLimit':'0x1388','gasUsed':'0x0','hash':'0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3','logsBloom':'0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000','miner':'0x0000000000000000000000000000000000000000','mixHash':'0x0000000000000000000000000000000000000000000000000000000000000000','nonce':'0x0000000000000042','number':'0x0','parentHash':'0x0000000000000000000000000000000000000000000000000000000000000000','receiptsRoot':'0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421','sha3Uncles':'0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347','size':'0x21c','stateRoot':'0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544','timestamp':'0x0','totalDifficulty':'0x400000000','transactions':[],'transactionsRoot':'0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421','uncles':[]}}# Call name() of USDT contract.# 调用 USDT 合约的 name 方法$peth--to0xdac17f958d2ee523a2206206994597c13d831ec7-e"name()->(string)"TetherUSD# Run peth command.# 执行 peth 内置命令。$peth--cmdnumber14723791Peth console 控制台The recommanded way to usepethis the interactive console mode.相比上面的单条命令行方式，更推荐的使用方式是使用交互式的 peth console。$peth
Welcometothepethshell.Type`help`tolistcommands.

peth>Config 配置类命令# Change network to BSC.# 切换网络。peth>chainbsc
Current:
Chain:eth
RPC:https://rpc.ankr.com/eth
API:https://api.etherscan.io/api?
Address:https://etherscan.io/address/
Changed:
Chain:bsc
RPC:https://rpc.ankr.com/bsc
API:https://api.bscscan.com/api?
Address:https://bscscan.com/address/# Change sender in eth_call# 切换合约调用时的使用的 msg.senderpeth>sender0xdac17f958d2ee523a2206206994597c13d831ec7
Old:0x0000000000000000000000000000000000000000
New:0xdac17f958d2ee523a2206206994597c13d831ec7# Exit console.# 退出。peth>exitUtilities 工具类命令# Execute shell commands.# 执行原生 bash 命令。peth>shls
README.md__pycache__config.jsoncoreethmain.pyoutputrequirements.txttestsutil
peth>!ls
README.md__pycache__config.jsoncoreethmain.pyoutputrequirements.txttestsutil# Evaluate python expressions.# 解析 python 表达式（常用于当计算器）peth>pyint(1e18)*100100000000000000000000peth>?int(1e18)*100100000000000000000000# Open URL or file.# 打开链接或者文件。peth>openhttps://www.google.com/
peth>openREADME.md# List some contract address# 打印出一些常见地址peth>common_addresses
NameChainAddress
PancakeMasterChefbsc0x73feaa1eE314F8c655E354234017bE2193C9E24E
PancakePairbsc0x0eD7e52944161450477ee417DE9Cd3a859b14fD0# Calculate SHA3 hash.# 计算 SHA3 哈希peth>sha3balanceOf()722713f7196651d0fe4592d1dc3ef527a8f2d47259e18fa8ec48288f351a83eb# Query the selector in https://www.4byte.directory/# 根据 selector 反查函数签名peth>4byte722713f7
balanceOf()peth>4bytetransferFrom(address,address,uint256)0x030e30dfsuper_transferFrom(address,address,uint256)0x09d6796four_transferFrom(address,address,uint256)0x23b872ddtransferFrom(address,address,uint256)0x3642e004lexDAOtransferFrom(address,address,uint256)0x3c1008bbinternal_transferFrom(address,address,uint256)0x5ec7b353safetransferFrom(address,address,uint256)0xcb712535_transferFrom(address,address,uint256)0xd05391d2admin_transferFrom(address,address,uint256)8item(s)foundin4byte.json.
Fullmatch:0x23b872ddtransferFrom(address,address,uint256)# ABI encode.peth>abi_encodetest(uint256,string,address,string)0x1000"AAAA"0x418e63cab75812661b055e111336dfc32951135d"BBBB"0xeb7f0ebe00000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000418e63cab75812661b055e111336dfc32951135d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000004414141410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044242424200000000000000000000000000000000000000000000000000000000# ABI decode.# With known selector.peth>abi_decode0xa9059cbb000000000000000000000000418e63cab75812661b055e111336dfc32951135d000000000000000000000000000000000000000000000000000000000c28cb001selectorsfound.
Method:0xa9059cbbfunctiontransfer(address,uint256)Arguments:addressarg1=ReversibleDemo(0x418e63cab75812661b055e111336dfc32951135d)uint256arg2=204000000# With unknown selector.peth>abi_decode0xeb7f0ebe00000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000418e63cab75812661b055e111336dfc32951135d00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000004414141410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044242424200000000000000000000000000000000000000000000000000000000
Noselectorfoundfor0xeb7f0ebe.
Guessingtypes...[0]uint2564096(0x1000)[1]stringAAAA[2]address0x418e63cab75812661b055e111336dfc32951135d[3]stringBBBB# Print number.# 打印 int 数（方便 Token 余额转换）peth>int100000000000000000000Value:100000000000000000000Value/1e18:100.0
Value/1e6:100000000000000.0# Convert UNIX timestamp to local datetime, or convert seconds to hours / days.# 时间戳转化（时长大于10年，则认为是时间段，而不是时间戳）peth>timestamp16518452522022-05-0621:54:12
peth>timestamp36003600secs=1.0hours=0.0daysETH basic 以太坊基础命令# print current block number# 打印当前区块数peth>number17569820# print balance# 打印地址当前余额peth>balance0xdAC17F958D2ee523a2206206994597C13D831ec71Wei(0.0000Ether)# print nonce# 打印地址 noncepeth>nonce0xdAC17F958D2ee523a2206206994597C13D831ec71# print specified slot of storage# 获取合约地址中 storage 指定 slot 的值peth>storage0xdAC17F958D2ee523a2206206994597C13D831ec710x000000000000000000000000000000000000000000000000008d7b18430396d4# Get code of contract# 打印合约字节码peth>code0xdAC17F958D2ee523a2206206994597C13D831ec7
0x606060405260043610610196576000357c01000...# Get size of contract# 打印合约字节码长度（可用于判断账户是否是合约）peth>codesize0xdAC17F958D2ee523a2206206994597C13D831ec7
Size11075peth>codesize0x0000000000000000000000000000000000000000
Size0# Call contract view function.# 调用合约的 view 函数。peth>eth_call0xdac17f958d2ee523a2206206994597c13d831ec7name()->(string)TetherUSD# If full ABI is not provided, peth fetch the ABI from Etherscan.# 也可以只提供函数名，peth 会自动通过 Etherscan 获取 ABI 信息。peth>eth_call0xdac17f958d2ee523a2206206994597c13d831ec7name
TetherUSDContract 合约特殊命令# Get property value of the contract.# 获取合约某个属性值（调用无参 View 方法，可指定类型）peth>view0xdac17f958d2ee523a2206206994597c13d831ec7name
0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a5465746865722055534400000000000000000000000000000000000000000000
peth>view0xdac17f958d2ee523a2206206994597c13d831ec7namestring
TetherUSD# Print ERC20 information# 打印 ERC20 信息peth>erc200xdac17f958d2ee523a2206206994597c13d831ec7
totalSupply()->(uint256)=>39815550064061448name()->(string)=>TetherUSD
symbol()->(string)=>USDT
decimals()->(uint8)=>6# Print proxy information# 打印代理信息peth>proxy0xdD4051c3571C143b989C3227E8eB50983974835C
0xdD4051c3571C143b989C3227E8eB50983974835CisanERC-1967Proxy
Implementation:0xeabe9aa60e7da3a962b39942fb3c3568b7c57c1dController
Admin:0x0e1dde6cd48758482528b718ef8d27a7e69eae62ProxyAdmin
Beacon:0x0000000000000000000000000000000000000000EOA# Print owner information of Ownable contract.# 打印合约的 owner 信息peth>owner0x0e1dDE6CD48758482528B718EF8d27a7E69EAE62
Owner:0xf8e5227add01b2b8f36981a2566c160e5e4136e4
EOA# Print Gnosis information.# 打印 Gnosis 多签信息peth>gnosis0xF6Bc2E3b1F939C435D9769D078a6e5048AaBD463
Version:1.3.0
Policy:5/8
Owners:0x01bb2320faea7f514b790a04812461112687bb19EOA0x4cc02225a3d7636af61d3903b2cba838a6f54ac2EOA0x587b28fad1132fd3ac50cb38342e2c6ca7dc670aEOA0xcc16c45be95773e9da59d42a575b169b23d4f58dEOA0xa286844303f5207658bc2a6ef582099295501f5eEOA0x6cee7a18072c5d26e99d186ead6feb9f17d5ac9eEOA0x64dcf80aa31f40d094cfb2d578019bcb2eccf58bEOA0x46ff1b2b030201f572e22fc18c26974ec8fe8819EOA
Impl:0xd9db270c1b5e3bd161e8c8503c55ceabee709552# Print timelock information# 打印时间锁合约信息peth>timelock0x574703381d4cb4eeb474e43eee97e3d9986e48a7
MinDelay:0s=0.00h
MaxDelay:2592000s=720.00h
CurrentDelay:0s=0.00h
Admin:0xa42f6fb68607048dde54fcd53d2195cc8ca5f486GnosisSafe3/5# Print Uniswap pair information.# 打印 Uniswap 类型交易对信息peth>pair0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852
TokenPair:0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852
WETH0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc218USDT0xdac17f958d2ee523a2206206994597c13d831ec76Reseves:24821.6555WETH,66468321.6535USDT
Price:1WETH=2677.8360USDT1USDT=0.0004WETH# Print ChainLink Oracle information.# 打印 ChainLink 预言机信息peth>oracle0xdeb288f737066589598e9214e782fa5a8ed689e8
Aggregator:0x81076d6ff2620ea9dd7ba9c1015f0d09a3a732e6
Description:BTC/ETH
Owner:0x21f73d42eb58ba49ddb685dc29d3bf5c0f0373ca
Decimals:18LatestAnswer:13297486710000000000(13.30)MaxAnswer:10000000000000000000000(10000.00)MinAnswer:100000000000000000(0.10)16Transmitters:0x57cd4848b12469618b689163f507817940acca020xcc29be4ca92d4ecc43c8451fba94c200b83991f60x64c735d72eab90c04da523b6b9895773acb60f5d0xa938d77590af1d98bab7dc4a0bde594fc3f9c4030x2a4a7afa40a9d03b425752fb4cfd5f0ff5b3964c0x9cfab1513ffa293e7023159b3c7a4c984b6a34800xf42336e35d5c1d1d0db3140e174bcfc3945f68220xf16e77a989529aa4c58318acee8a1548df3fccc10x8b1d49a93a84b5da0917a1ed42d8a3e191c285240x7bfb89db2d7217c57c3ad3d4b55826efd17dc2e90xbbf078a8849d74623e36e6dbbdc8e0a35e657c260x43793ee58e0a3d920e3e4a115a9fa07dc4b097150x0312ea121df0a323ff535b753172736cc9d53d130xc4b732fd121f2f3783a9ac2a6c62fd535fd13fda0x5a6fcc02d8c50ea58a22115a7c4608b7230300160xe3e0596ac55ae6044b757bab27426f7dc9e018d4Transaction 交易类命令# Print decoded transaction information with txid.# 打印解码后的合约调用信息。peth>tx0x1f26956899a5d6754b1b765794bf8b5daef994357a817209a6d84498da026922
From:0x17F96db7cf1D3964F3Cd32E98AFE9Eb43A15fe24
To:0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852
Method:functionswap(uint256amount0Out,uint256amount1Out,addressto,bytesdata)returns()Arguments:amount0Out:21829054100743363759amount1Out:0to:0x0302c1e37200005183c900a30000aa005eaf710cdata:11b815efb8f581194ae79006d24e0d814b7697f6c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000010b1f962fa00000000000000000000000000000000000000000000000000630d453738095301
ERC20Transfers:WETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)to->0x0302c1E37200005183c900A30000Aa005eaF710C21829054100743363759USDT(0xdAC17F958D2ee523a2206206994597C13D831ec7)0x11b815efB8f581194ae79006d24E0d814B7697F6->to71705387770WETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)0x0302c1E37200005183c900A30000Aa005eaF710C->0x11b815efB8f581194ae79006d24E0d814B7697F621801173487118685020WETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)0x0302c1E37200005183c900A30000Aa005eaF710C->0x0000E0Ca771e21bD00057F54A68C30D40000000027880613624678739# Print decoded transaction information with address and calldata.# 也可以直接指定合约地址及数据（解析多签或者时间锁交易时常用）peth>tx0x0d4a11d5EEaaC28EC3F61d100daF4d40471f18520x022c0d9f0000000000000000000000000000000000000000000000012ef0610ca1979caf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000302c1e37200005183c900a30000aa005eaf710c0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000006911b815efb8f581194ae79006d24e0d814b7697f6c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000010b1f962fa00000000000000000000000000000000000000000000000000630d4537380953010000000000000000000000000000000000000000000000
Method:functionswap(uint256amount0Out,uint256amount1Out,addressto,bytesdata)returns()Arguments:amount0Out:21829054100743363759amount1Out:0to:0x0302c1e37200005183c900a30000aa005eaf710cdata:11b815efb8f581194ae79006d24e0d814b7697f6c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000010b1f962fa00000000000000000000000000000000000000000000000000630d453738095301# Print transaction history of address.# 打印某个地址多条的交易信息peth>txs0xf8E5227aDD01b2b8f36981a2566c160E5E4136e4
----[1]0x83ad34dde3cf458b904110747b0390d3cbd34cfe7038d1b996b2be7219ac9f0614484519----
0x2ed297968850f81144adca7aed34fac375643e46->0xf8e5227add01b2b8f36981a2566c160e5e4136e4value5044300830232571940----[2]0xbe906287eaacbcbc25a9ab9528faf4fdd23fa8ffb512836bab18720b46a5071614484670----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractSpoolOwner(0x4f03f70a99e5c3b49d733ddd7458f80fa9b5a5b5)----[3]0x022716d5bc20790246d2e08e7f24dd0c42a5840231f537a58fb658cb5c0c853114486465----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractAaveStrategy(0x854db91e371e42818936e646361452c3060ec9dd)----[4]0x129459268bf44c2837fa04af38c386c0266fc1c3b03b4fb0ac56ddb49f2f494114486467----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractAaveStrategy(0x21d24ad1a66bd35447365d5adaa3530ae3695781)----[5]0x44314234de5e43de33a52710c1a6e97ad2a87075ea7f79f1612ac481ba3cbbf014486468----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractAaveStrategy(0x6f4dad966d7ea29f1e2f106da547c66f4df0e8e5)----[6]0xc7a825f8d24365def18a3c7c4395a29adc4cc81c7d8a81e90d595d60aa8a548714486469----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractCurve3poolStrategy(0x55fc10a40f0056c28b953b5da3dc53679e70bf70)----[7]0xae00264f3a2533b4189451b4996b6a24b2f702916a340cdf540fb1db77b5701814486470----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractCurve3poolStrategy(0xa249f52f8ea0048c9d6e55eb0a8de06b67affe67)----[8]0x7d5a44387d06c1b15472c86615f47bf0d7988fcb65cda017d789370fd959428814486472----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractCurve3poolStrategy(0x9ab6f67285151563f7675cf365e42841c243455e)----[9]0xd0658a9e55f90f634a904e14da37dfda8e9218d6c73cd9ebf5a7a9fb74b2af4414486475----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractHarvestStrategy(0xa97a5fea16c9881254be77e4f3adf8e23c3f5bd4)----[10]0x38031a9798683c78136dc23e38cc51dde4001482d0f12701ee84fc32398fb8c714486476----
0xf8e5227add01b2b8f36981a2566c160e5e4136e4createscontractHarvestStrategy(0xb84cd9b5548ee1538ca50b947fa99adf5fd85e78)Bytecode 字节码类工具# Print assembly code of address.# 打印反汇编后的合约字节码peth>disasm0xdD4051c3571C143b989C3227E8eB50983974835C
PUSH10x80
PUSH10x40
MSTORE
PUSH10x4
CALLDATASIZE
LT
PUSH20x5e
JUMPI
PUSH10x0
CALLDATALOAD
PUSH10xe0
...# Extract selector dispatching code and print signatures.# 获取合约可能的 selector （根据 PUSH4 指令提取，会有误报），分析闭源合约常用。peth>abi4byte0xdAC17F958D2ee523a2206206994597C13D831ec7
0x06fdde03name()0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a5465746865722055534400000000000000000000000000000000000000000000
0x0753c30cdeprecate(address)0x095ea7b3approve(address,uint256)0x0ecb93c0addBlackList(address)0x18160dddtotalSupply()0x000000000000000000000000000000000000000000000000009c5715d89b008f
0x23b872ddtransferFrom(address,address,uint256)0x26976e3fupgradedAddress()0x0000000000000000000000000000000000000000000000000000000000000000
0x27e235e3balances(address)0x313ce567decimals()0x0000000000000000000000000000000000000000000000000000000000000006
0x3eaaf86b_totalSupply()0x000000000000000000000000000000000000000000000000009c5715d89b008f
0x3f4ba83aunpause()0x59bf1abegetBlackListStatus(address)0x5c658165allowed(address,address)0x5c975abbpaused()0x0000000000000000000000000000000000000000000000000000000000000000
0x70a08231balanceOf(address)0x8456cb59pause()0x893d20e8getOwner()0x000000000000000000000000c6cde7c39eb2f0f0095f41570af89efc2c1ea828
0x8da5cb5bowner()0x000000000000000000000000c6cde7c39eb2f0f0095f41570af89efc2c1ea828
0x95d89b41symbol()0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000045553445400000000000000000000000000000000000000000000000000000000
0xa9059cbbtransfer(address,uint256)0xc0324c77setParams(uint256,uint256)0xcc872b66issue(uint256)0xdb006a75redeem(uint256)0xdd62ed3eallowance(address,address)0xdd644f72basisPointsRate()0x0000000000000000000000000000000000000000000000000000000000000000
0xe47d6060isBlackListed(address)0xe4997dc5removeBlackList(address)0xe5b5019aMAX_UINT()0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
0xf2fde38btransferOwnership(address)0xf3bdc228destroyBlackFunds(address)0xaee92d33approveByLegacy(address,address,uint256)0x8b477adbtransferFromByLegacy(address,address,address,uint256)0x6e18980atransferByLegacy(address,address,uint256)Source 源码类工具# Print contract information of Etherscan.# 打印合约信息（会自动调用所有无参 View 方法）peth>contract0xdAC17F958D2ee523a2206206994597C13D831ec7SourceCode:pragmasolidity^0.4.17;ABI:...ContractName:TetherTokenCompilerVersion:v0.4.18+commit.9cf6e910OptimizationUsed:0Runs:0ConstructorArguments:000000000000000000000000000000000000000000000000000000174876e8000000000000000000...EVMVersion:DefaultLibrary:LicenseType:Proxy:0Implementation:SwarmSource:bzzr://645ee12d73db47fd78ba77fa1f824c3c8f9184061b3b10386beb4dc9236abb28===VIEWS===0x06fdde03functionname()viewreturns(string)=>TetherUSD0x0e136b19functiondeprecated()viewreturns(bool)=>False0x18160dddfunctiontotalSupply()viewreturns(uint256)=>398155500640614480x26976e3ffunctionupgradedAddress()viewreturns(address)=>0x00000000000000000000000000000000000000000x313ce567functiondecimals()viewreturns(uint256)=>60x35390714functionmaximumFee()viewreturns(uint256)=>00x3eaaf86bfunction_totalSupply()viewreturns(uint256)=>398155500640614480x5c975abbfunctionpaused()viewreturns(bool)=>False0x893d20e8functiongetOwner()viewreturns(address)=>0xC6CDE7C39eB2f0F0095F41570af89eFC2C1Ea8280x8da5cb5bfunctionowner()viewreturns(address)=>0xC6CDE7C39eB2f0F0095F41570af89eFC2C1Ea8280x95d89b41functionsymbol()viewreturns(string)=>USDT0xdd644f72functionbasisPointsRate()viewreturns(uint256)=>00xe5b5019afunctionMAX_UINT()viewreturns(uint256)=>115792089237316195423570985008687907853269984665640564039457584007913129639935===OTHERS===0x0753c30cfunctiondeprecate(address_upgradedAddress)0x095ea7b3functionapprove(address_spender,uint256_value)0x0ecb93c0functionaddBlackList(address_evilUser)0x23b872ddfunctiontransferFrom(address_from,address_to,uint256_value)0x27e235e3functionbalances(address)viewreturns(uint256)0x3f4ba83afunctionunpause()0x59bf1abefunctiongetBlackListStatus(address_maker)viewreturns(bool)0x5c658165functionallowed(address,address)viewreturns(uint256)0x70a08231functionbalanceOf(addresswho)viewreturns(uint256)0x8456cb59functionpause()0xa9059cbbfunctiontransfer(address_to,uint256_value)0xc0324c77functionsetParams(uint256newBasisPoints,uint256newMaxFee)0xcc872b66functionissue(uint256amount)0xdb006a75functionredeem(uint256amount)0xdd62ed3efunctionallowance(address_owner,address_spender)viewreturns(uint256)0xe47d6060functionisBlackListed(address)viewreturns(bool)0xe4997dc5functionremoveBlackList(address_clearedUser)0xf2fde38bfunctiontransferOwnership(addressnewOwner)0xf3bdc228functiondestroyBlackFunds(address_blackListedUser)# Print contract name.# 打印合约名（或 EOA)peth>name0xdAC17F958D2ee523a2206206994597C13D831ec7
0xdAC17F958D2ee523a2206206994597C13D831ec7TetherToken
peth>name0x0000000000000000000000000000000000000000
0x0000000000000000000000000000000000000000EOA# Diff contract source code.# 对比合约源码差异。peth>diffbsc0x73feaa1eE314F8c655E354234017bE2193C9E24Eftm0xa71f52aee8311c22b6329EF7715A5B8aBF1c6588[*]Diffbsc-0x73feaa1eE314F8c655E354234017bE2193C9E24Eftm-0xa71f52aee8311c22b6329EF7715A5B8aBF1c6588
Writtentooutput/diff/SAMENAME_SafeMath_0.85.html
Writtentooutput/diff/SAMENAME_Address_0.72.html
Writtentooutput/diff/SafeBEP20_SafeERC20_0.62.html
Writtentooutput/diff/BEP20_ProtofiERC20_0.85.html
Writtentooutput/diff/CakeToken_ElectronToken_0.59.html
Writtentooutput/diff/SyrupBar_ElectronToken_0.57.html
Non-matchedcontracts:
Context,Ownable,MasterChef
----------
ProtofiMasterChef,ProtonToken
peth>openoutput/diff/SAMENAME_SafeMath_0.85.html# Open blockchain explorer of the address.# 打开区块链浏览器对应地址（会自动唤起浏览器）peth>url0xdAC17F958D2ee523a2206206994597C13D831ec7
https://etherscan.io/address/0xdAC17F958D2ee523a2206206994597C13D831ec7# Download solc standard input json, which can be compile with `solc --standard-json`# 下载 solidity 的标准 JSON 格式源码，可以直接使用 solc --standard-json 进行编译。peth>download_json0xdAC17F958D2ee523a2206206994597C13D831ec7
Downloadedasoutput/json/api.etherscan.io/TetherToken_0.4.18_0xdAC17F958D2ee523a2206206994597C13D831ec7.json# Download source.# 下载源码（多文件时会创建对应的文件目录结构）peth>download_source0xe140bB5F424A53e0687bfC10F6845a5672D7e242
Downloadedoutput/source/api.etherscan.io/0xe140bB5F424A53e0687bfC10F6845a5672D7e242/contracts/Spool.sol
Downloadedoutput/source/api.etherscan.io/0xe140bB5F424A53e0687bfC10F6845a5672D7e242/contracts/external/@openzeppelin/token/ERC20/IERC20.sol
Downloadedoutput/source/api.etherscan.io/0xe140bB5F424A53e0687bfC10F6845a5672D7e242/contracts/external/@openzeppelin/token/ERC20/utils/SafeERC20.sol
Downloadedoutput/source/api.etherscan.io/0xe140bB5F424A53e0687bfC10F6845a5672D7e242/contracts/external/@openzeppelin/utils/Address.sol
Downloadedoutput/source/api.etherscan.io/0xe140bB5F424A53e0687bfC10F6845a5672D7e242/contracts/external/@openzeppelin/utils/SafeCast.sol
Downloadedoutput/source/api.etherscan.io/0xe140bB5F424A53e0687bfC10F6845a5672D7e242/contracts/interfaces/IBaseStrategy.sol
Downloadedoutput/source/api.etherscan.io/0xe140bB5F424A53e0687bfC10F6845a5672D7e242/contracts/interfaces/IController.sol
Downloadedoutput/source/api.etherscan.io/0xe140bB5F424A53e0687bfC10F6845a5672D7e242/contracts/interfaces/ISpoolOwner.sol
...# Run solidity file through eth_call.# 利用 eth_call 执行 solidity 代码。peth>!catethcall_executor.sol
pragmasolidity^0.8.13;interfaceERC20{functionbalanceOf(addressa)externalreturns(uint);}contractExecutor{functionrun()externalreturns(uint){returnERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7).balanceOf(0x5754284f345afc66a98fbB0a0Afe71e0F007B949);}}peth>runethcall_executor.sol972099416751514Others 其他Read the code.参考源码。