1+ #!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
3+ """
4+ Time : 2024/10/12 下午2:10
5+ Author : xuzh
6+ Project : hemera_indexer
7+ """
8+ from common .utils .abi_code_utils import Event , Function
9+
10+ # log event
11+ WETH_DEPOSIT_EVENT = Event (
12+ {
13+ "anonymous" : False ,
14+ "inputs" : [
15+ {"indexed" : True , "name" : "dst" , "type" : "address" },
16+ {"indexed" : False , "name" : "wad" , "type" : "uint256" },
17+ ],
18+ "name" : "Deposit" ,
19+ "type" : "event" ,
20+ }
21+ )
22+
23+ WETH_WITHDRAW_EVENT = Event (
24+ {
25+ "anonymous" : False ,
26+ "inputs" : [
27+ {"indexed" : True , "name" : "src" , "type" : "address" },
28+ {"indexed" : False , "name" : "wad" , "type" : "uint256" },
29+ ],
30+ "name" : "Withdrawal" ,
31+ "type" : "event" ,
32+ }
33+ )
34+
35+ ERC20_TRANSFER_EVENT = Event (
36+ {
37+ "anonymous" : False ,
38+ "inputs" : [
39+ {"indexed" : True , "name" : "from" , "type" : "address" },
40+ {"indexed" : True , "name" : "to" , "type" : "address" },
41+ {"indexed" : False , "name" : "value" , "type" : "uint256" },
42+ ],
43+ "name" : "Transfer" ,
44+ "type" : "event" ,
45+ }
46+ )
47+
48+ ERC721_TRANSFER_EVENT = ERC20_TRANSFER_EVENT
49+
50+ ERC1155_SINGLE_TRANSFER_EVENT = Event (
51+ {
52+ "anonymous" : False ,
53+ "inputs" : [
54+ {"indexed" : True , "name" : "operator" , "type" : "address" },
55+ {"indexed" : True , "name" : "from" , "type" : "address" },
56+ {"indexed" : True , "name" : "to" , "type" : "address" },
57+ {"indexed" : False , "name" : "id" , "type" : "uint256" },
58+ {"indexed" : False , "name" : "value" , "type" : "uint256" },
59+ ],
60+ "name" : "TransferSingle" ,
61+ "type" : "event" ,
62+ }
63+ )
64+
65+ ERC1155_BATCH_TRANSFER_EVENT = Event (
66+ {
67+ "anonymous" : False ,
68+ "inputs" : [
69+ {"indexed" : True , "name" : "operator" , "type" : "address" },
70+ {"indexed" : True , "name" : "from" , "type" : "address" },
71+ {"indexed" : True , "name" : "to" , "type" : "address" },
72+ {"indexed" : False , "name" : "ids" , "type" : "uint256[]" },
73+ {"indexed" : False , "name" : "values" , "type" : "uint256[]" },
74+ ],
75+ "name" : "TransferBatch" ,
76+ "type" : "event" ,
77+ }
78+ )
79+
80+ # ABI function
81+ TOKEN_NAME_FUNCTION = Function (
82+ {
83+ "constant" : True ,
84+ "inputs" : [],
85+ "name" : "name" ,
86+ "outputs" : [{"name" : "" , "type" : "string" }],
87+ "payable" : False ,
88+ "stateMutability" : "view" ,
89+ "type" : "function" ,
90+ }
91+ )
92+
93+ TOKEN_SYMBOL_FUNCTION = Function (
94+ {
95+ "constant" : True ,
96+ "inputs" : [],
97+ "name" : "symbol" ,
98+ "outputs" : [{"name" : "" , "type" : "string" }],
99+ "payable" : False ,
100+ "stateMutability" : "view" ,
101+ "type" : "function" ,
102+ }
103+ )
104+
105+ TOKEN_DECIMALS_FUNCTION = Function (
106+ {
107+ "constant" : True ,
108+ "inputs" : [],
109+ "name" : "decimals" ,
110+ "outputs" : [{"name" : "" , "type" : "uint8" }],
111+ "payable" : False ,
112+ "stateMutability" : "view" ,
113+ "type" : "function" ,
114+ }
115+ )
116+
117+ TOKEN_TOTAL_SUPPLY_FUNCTION = Function (
118+ {
119+ "constant" : True ,
120+ "inputs" : [],
121+ "name" : "totalSupply" ,
122+ "outputs" : [{"name" : "" , "type" : "uint256" }],
123+ "payable" : False ,
124+ "stateMutability" : "view" ,
125+ "type" : "function" ,
126+ }
127+ )
128+
129+ TOKEN_TOTAL_SUPPLY_WITH_ID_FUNCTION = Function (
130+ {
131+ "constant" : True ,
132+ "inputs" : [{"name" : "id" , "type" : "uint256" }],
133+ "name" : "totalSupply" ,
134+ "outputs" : [{"name" : "" , "type" : "uint256" }],
135+ "payable" : False ,
136+ "stateMutability" : "view" ,
137+ "type" : "function" ,
138+ }
139+ )
140+
141+ ERC721_OWNER_OF_FUNCTION = Function (
142+ {
143+ "constant" : True ,
144+ "inputs" : [{"name" : "tokenId" , "type" : "uint256" }],
145+ "name" : "ownerOf" ,
146+ "outputs" : [{"name" : "owner" , "type" : "address" }],
147+ "payable" : False ,
148+ "stateMutability" : "view" ,
149+ "type" : "function" ,
150+ }
151+ )
152+
153+ ERC721_TOKEN_URI_FUNCTION = Function (
154+ {
155+ "constant" : True ,
156+ "inputs" : [{"name" : "tokenId" , "type" : "uint256" }],
157+ "name" : "tokenURI" ,
158+ "outputs" : [{"name" : "uri" , "type" : "address" }],
159+ "payable" : False ,
160+ "stateMutability" : "view" ,
161+ "type" : "function" ,
162+ }
163+ )
164+
165+ ERC1155_MULTIPLE_TOKEN_URI_FUNCTION = Function (
166+ {
167+ "constant" : True ,
168+ "inputs" : [{"name" : "tokenId" , "type" : "uint256" }],
169+ "name" : "uri" ,
170+ "outputs" : [{"name" : "uri" , "type" : "address" }],
171+ "payable" : False ,
172+ "stateMutability" : "view" ,
173+ "type" : "function" ,
174+ }
175+ )
176+
177+ ERC20_BALANCE_OF_FUNCTION = Function (
178+ {
179+ "constant" : True ,
180+ "inputs" : [{"name" : "_owner" , "type" : "address" }],
181+ "name" : "balanceOf" ,
182+ "outputs" : [{"name" : "balance" , "type" : "uint256" }],
183+ "payable" : False ,
184+ "stateMutability" : "view" ,
185+ "type" : "function" ,
186+ }
187+ )
188+
189+ ERC1155_TOKEN_ID_BALANCE_OF_FUNCTION = Function (
190+ {
191+ "constant" : True ,
192+ "inputs" : [
193+ {"name" : "account" , "type" : "address" },
194+ {"name" : "id" , "type" : "uint256" },
195+ ],
196+ "name" : "balanceOf" ,
197+ "outputs" : [{"name" : "balance" , "type" : "uint256" }],
198+ "payable" : False ,
199+ "stateMutability" : "view" ,
200+ "type" : "function" ,
201+ }
202+ )
0 commit comments