Skip to content

Commit 7baf913

Browse files
yann300Aniket-Engg
authored andcommitted
msg when pinned contract not existing
1 parent a040e63 commit 7baf913

File tree

1 file changed

+8
-0
lines changed
  • libs/remix-ui/run-tab/src/lib/actions

1 file changed

+8
-0
lines changed

libs/remix-ui/run-tab/src/lib/actions/events.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ const loadPinnedContracts = async (plugin, dispatch, dirName) => {
186186
for (const file of filePaths) {
187187
const pinnedContract = await plugin.call('fileManager', 'readFile', file)
188188
const pinnedContractObj = JSON.parse(pinnedContract)
189+
const code = await plugin.call('blockchain', 'getCode', pinnedContractObj.address)
190+
if (code === '0x') {
191+
const msg = `Cannot load contract at ${pinnedContractObj.address} .
192+
Contract not found at that address. If you are using a forked environment, please make sure that this contract was originally deployed in this fork.
193+
`
194+
await plugin.call('terminal', 'terminal', { type: 'error', value: msg })
195+
return
196+
}
189197
pinnedContractObj.isPinned = true
190198
if (pinnedContractObj) addInstance(dispatch, pinnedContractObj)
191199
}

0 commit comments

Comments
 (0)