You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
content: "contract MyContract { function foo() public {} }",
64
+
'Contract.sol': {
65
+
content: 'contract MyContract { function foo() public {} }',
66
66
},
67
67
},
68
68
settings: {
@@ -71,35 +71,35 @@ const jsonInput = {
71
71
runs: 200,
72
72
},
73
73
outputSelection: {
74
-
"*": [],
74
+
'*': [],
75
75
},
76
76
},
77
77
} asSolidityJsonInput;
78
78
79
79
// Step 3: Create a compilation
80
80
const compilation =newSolidityCompilation(
81
81
solc,
82
-
"0.8.20", // compiler version
82
+
'0.8.20', // compiler version
83
83
jsonInput,
84
84
{
85
-
path: "Contract.sol",
86
-
name: "MyContract", // The name of your contract
87
-
}
85
+
path: 'Contract.sol',
86
+
name: 'MyContract', // The name of your contract
87
+
},
88
88
);
89
89
90
90
// Step 4: Set up a SourcifyChain instance
91
91
const myChain =newSourcifyChain({
92
-
name: "My EVM Chain",
92
+
name: 'My EVM Chain',
93
93
chainId: 1337,
94
-
rpc: ["http://localhost:8545"],
94
+
rpc: ['http://localhost:8545'],
95
95
supported: true,
96
96
});
97
97
98
98
// Step 5: Verify the contract
99
99
const verification =newVerification(
100
100
compilation,
101
101
myChain,
102
-
"0xc0ffee254729296a45a3885639AC7E10F9d54979"
102
+
'0xc0ffee254729296a45a3885639AC7E10F9d54979',
103
103
);
104
104
105
105
awaitverification.verify();
@@ -115,13 +115,16 @@ This example shows the complete verification flow for a Solidity contract using
115
115
For browser usage, we recommend using [web-solc](https://github.com/gnidan/web-solc) instead of `@ethereum-sourcify/compilers`. Here's an example of how to implement the `ISolidityCompiler` interface with `web-solc`:
lib-sourcify v2 consists of several key components:
137
140
138
141
-**Validation**: Based on a Solidity metadata.json file that describes a contract build, checks if all source files are present and valid. Fetches missing sources from IPFS if necessary.
139
-
140
142
-`SolidityMetadataContract`: Represents a Solidity contract with its metadata and source files
141
143
-`processFiles.ts`: Utility functions for creating `SolidityMetadataContract` instances from files
142
144
143
145
-**Compilation**: Handles contract compilation
144
-
145
146
-`AbstractCompilation`: Base class for compilation
0 commit comments