This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
blockscout.txt
134 lines (118 loc) · 4.01 KB
/
blockscout.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Blockscout's GraphQL api seems to be missing # of runs??
And EVM version??
meanwhile it's non-GraphQL api is similar to etherscan's but a bit different and
is described below
https://[stuff]/api?module=contract&action=getsourcecode&address=[address]
NOTE: JSON case allows Yul! But does not seem to allow SolidityAST, thankfully
blockscout error case: (seems to sometimes happen for no reason?)
(a good reason not to turn this on by default :P )
{
message: "Something went wrong.",
result: null,
status: "0"
}
blockscout not verified case:
{
message: "OK",
status: "1",
result: [{
ABI: "Contract source code not verified",
...
}]
}
oh wait it changed looks liked?? looks like now it's just
{
message: "OK",
status: "1",
result: [{
Address: string;
}]
}
wait!! it's inconsistent! both behaviors exist, dear god >_>
[let's assume it's the latter]
blockscout single source case:
{
message: "OK",
status: "1",
result: [{
ABI: string; //(JSON) [is JSON-ified null for Yul case!]
CompilerVersion: string;
ConstructorArguments?: string; //no leading 0x, excluded if empty
ContractName: string;
EVMVersion: string | null; //uses "default", lowercase, but can be null...?
ExternalLibraries?: { //not stringly-typed, thank god!
address_hash: string; //address, checksummed
name: string;
}[]; //not included if there are none
FileName: "";
ImplementationAddress?: string; //only included if IsProxy is true
IsProxy: string; //"true" or "false" (!)
OptimizationRuns?: number | null; //I assume null means default? (excluded
//altogether if optimization not used)
OptimizationUsed: string; //"true" or "false" (!)
SourceCode: string; //note: there's no header unlike w/Etherscan
Address: string; //not checksummed...
}]
}
blockscout vyper case:
{
message: "OK",
status: "1",
result: [{
ABI: string; //(JSON)
CompilerVersion: string; //does *not* explicitly indicate Vyper!!
//just a short version string
ConstructorArguments?: string;
ContractName: "Vyper_contract"; //what you enter is ignored
EVMVersion: null; //no option to set this
FileName: "";
ImplementationAddress?: string; //only included if IsProxy is true
IsProxy: string; //"true" or "false" (!)
OptimizationUsed: "false"; //again, no option to set this
SourceCode: string;
Address: string;
}]
}
blockscout JSON case: I couldn't get this to work! TODO
(why do I suspect it's coerced into the format below, which is no good...?)
(I couldn't get this to work even for normal compiler settings, note)
blockscout metadata-and-sources case:
[but in this case, it also gets verified on Sourcify, so...]
{
message: "OK",
status: "1",
result: [{
ABI: string; //(JSON)
AdditionalSources?: { //sources beyond the main file! excluded if none
Filename: string; //uses name compiler sees
SourceCode: string;
}[];
CompilerVersion: string;
ConstructorArguments?: string;
ContractName: string;
EVMVersion: string | null;
ExternalLibraries?: {
address_hash: string; //address
name: string;
}[];
FileName: string; //for the main file! uses name compiler sees
ImplementationAddress?: string;
IsProxy: string;
OptimizationRuns?: number | null;
OptimizationUsed: string;
SourceCode: string; //for the main file!
Address: string;
}]
}
UH-OH, METADATA IS MISSING
I did this with debug revert strings on and that's not reflected here!!
NOTE: they have fixed this now, but it looks like it's only fixed for *new*
contracts... oh well
need to retest! only can't do so on sokol :(
fortunately they support goerli now, whew
OK! There's now (sometimes) a CompilerSettings field. it is JSON thankfully
and not stringly typed! WORTH NOTING: it includes everything! in particular,
it includes "libraries" and "outputSelection" fields. no idea if it includes
modelCheckerSettings. :P
Note that CompilerSettings is *not* always present!
OMG -- Blockscout now supports *Yul*?? O_o will have to test that out