This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -263,21 +263,27 @@ class Console extends EventEmitter {
263
263
"utf8"
264
264
) ;
265
265
const json = JSON . parse ( body ) ;
266
- const metadata = JSON . parse ( json . metadata ) ;
267
- const sources = Object . keys ( metadata . sources ) ;
268
- // filter out Truffle's console.log. We don't want users to interact with in the REPL.
269
- // user contracts named console.log will be imported, and a warning will be issued.
270
- if (
271
- sources . length > 1 ||
272
- ( sources . length === 1 &&
273
- ! sources . some ( source => {
274
- return (
275
- source === "truffle/console.sol" ||
276
- source === "truffle/Console.sol"
277
- ) ;
278
- } ) )
279
- ) {
266
+ // Artifacts may not contain metadata. For example, early Solidity versions as well as
267
+ // Vyper contracts do not include metadata. Just push them to json blobs.
268
+ if ( json . metadata === undefined ) {
280
269
jsonBlobs . push ( json ) ;
270
+ } else {
271
+ // filter out Truffle's console.log. We don't want users to interact with in the REPL.
272
+ // user contracts named console.log will be imported, and a warning will be issued.
273
+ const metadata = JSON . parse ( json . metadata ) ;
274
+ const sources = Object . keys ( metadata . sources ) ;
275
+ if (
276
+ sources . length > 1 ||
277
+ ( sources . length === 1 &&
278
+ ! sources . some ( source => {
279
+ return (
280
+ source === "truffle/console.sol" ||
281
+ source === "truffle/Console.sol"
282
+ ) ;
283
+ } ) )
284
+ ) {
285
+ jsonBlobs . push ( json ) ;
286
+ }
281
287
}
282
288
} catch ( error ) {
283
289
throw new Error ( `Error parsing or reading ${ file } : ${ error . message } ` ) ;
You can’t perform that action at this time.
0 commit comments