address bad pragma line in vyper contract on snekmate

pull/4747/head
Joseph Izang 7 months ago
parent 3809f1b429
commit cd9af4bdb4
  1. 1
      apps/remix-ide-e2e/src/tests/vyper_api.test.ts
  2. 6
      apps/vyper/src/app/utils/compiler.tsx

@ -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"]')

@ -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

Loading…
Cancel
Save