From cd9af4bdb41b11b33f0f33e86de89323c1419f24 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 19 Apr 2024 14:00:30 +0100 Subject: [PATCH] address bad pragma line in vyper contract on snekmate --- apps/remix-ide-e2e/src/tests/vyper_api.test.ts | 1 - apps/vyper/src/app/utils/compiler.tsx | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/vyper_api.test.ts b/apps/remix-ide-e2e/src/tests/vyper_api.test.ts index 8731bf9e3d..356752a56a 100644 --- a/apps/remix-ide-e2e/src/tests/vyper_api.test.ts +++ b/apps/remix-ide-e2e/src/tests/vyper_api.test.ts @@ -159,7 +159,6 @@ module.exports = { .openFile('src/snekmate') .openFile('src/snekmate/auth') .openFile('src/snekmate/auth/Ownable.vy') - // .click('*[data-id="treeViewLitreeViewItemsrc/snekmate/auth/Ownable.vy"]') .rightClick('*[data-id="treeViewLitreeViewItemsrc/snekmate/auth/Ownable.vy"]') .waitForElementVisible('*[data-id="contextMenuItemvyper"]') .click('*[data-id="contextMenuItemvyper"]') diff --git a/apps/vyper/src/app/utils/compiler.tsx b/apps/vyper/src/app/utils/compiler.tsx index 902c4f1691..3a7f4fbd0b 100644 --- a/apps/vyper/src/app/utils/compiler.tsx +++ b/apps/vyper/src/app/utils/compiler.tsx @@ -144,6 +144,7 @@ const compileReturnType = (output, contract) => { const fixContractContent = (content: string) => { if (content.length === 0) return const pragmaFound = content.includes('#pragma version ^0.3.10') + const wrongpragmaFound = content.includes('# pragma version ^0.3.10') const evmVerFound = content.includes('#pragma evm-version shanghai') const pragma = '#pragma version ^0.3.10' const evmVer = '#pragma evm-version shanghai' @@ -151,7 +152,10 @@ const fixContractContent = (content: string) => { if (evmVerFound === false) { content = `${evmVer}\n${content}` } - if (pragmaFound === false) { + if (wrongpragmaFound === true) { + content = content.replace('# pragma version ^0.3.10', '') + } + if (pragmaFound === false ) { content = `${pragma}\n${content}` } return content