diff --git a/libs/remix-ui/run-tab/src/lib/actions/evmmap.ts b/libs/remix-ui/run-tab/src/lib/actions/evmmap.ts index a219fc9173..caac70a01e 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/evmmap.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/evmmap.ts @@ -17,7 +17,7 @@ export type HardFork = | 'tangerineWhistle' | 'homestead' -export const evmMap: Map = new Map([ +export const evmMap: Map = new Map([ ['cancun', { chainId: [ { id: 1, name: "Ethereum Mainnet" }, @@ -36,7 +36,8 @@ export const evmMap: Map = new Map([ { id: 421614, name: "Arbitrum Sepolia" }, { id: 534352, name: "Scroll" }, { id: 11155111, name: "Sepolia" } - ] + ], + minCompilerVersion: "0.8.24" }], ['shanghai', { chainId: [ @@ -58,10 +59,8 @@ export const evmMap: Map = new Map([ { id: 1088, name: "Metis Andromeda Mainnet" }, { id: 1284, name: "Moonbeam" }, { id: 2000, name: "Dogechain Mainnet" }, - { id: 42220, name: "Celo Mainnet" }, { id: 42161, name: "Arbitrum One" }, { id: 42170, name: "Arbitrum Nova" }, - { id: 44787, name: "Celo Alfajores Testnet" }, { id: 59144, name: "Linea Mainnet" }, { id: 59141, name: "Linea Testnet" }, { id: 59902, name: "Metis Sepolia Testnet" }, @@ -69,7 +68,8 @@ export const evmMap: Map = new Map([ { id: 11155111, name: "Sepolia" }, { id: 11155420, name: "Optimism Sepolia Testnet" }, { id: 1666600000, name: "Harmony Mainnet Shard 0" } - ] + ], + minCompilerVersion: "0.8.20" }], ['paris', { chainId: [ @@ -102,7 +102,8 @@ export const evmMap: Map = new Map([ { id: 11155111, name: "Sepolia" }, { id: 11155420, name: "Optimism Sepolia Testnet" }, { id: 1666600000, name: "Harmony Mainnet Shard 0" } - ] + ], + minCompilerVersion: "0.8.18" }], ['london', { chainId: [ @@ -121,7 +122,8 @@ export const evmMap: Map = new Map([ { id: 59144, name: "Linea Mainnet" }, { id: 59141, name: "Linea Testnet" }, { id: 11155111, name: "Sepolia" }, - ] + ], + minCompilerVersion: "0.8.7" }], ['berlin', { chainId: [ @@ -140,7 +142,8 @@ export const evmMap: Map = new Map([ { id: 59144, name: "Linea Mainnet" }, { id: 59141, name: "Linea Testnet" }, { id: 11155111, name: "Sepolia" } - ] + ], + minCompilerVersion: "0.8.5" }], ['istanbul', { chainId: [ @@ -159,44 +162,51 @@ export const evmMap: Map = new Map([ { id: 59144, name: "Linea Mainnet" }, { id: 59141, name: "Linea Testnet" }, { id: 11155111, name: "Sepolia" } - ] + ], + minCompilerVersion: "0.5.14" }], ['petersburg', { chainId: [ { id: 1, name: "Ethereum Mainnet" }, { id: 5, name: "Goerli" }, { id: 11155111, name: "Sepolia" } - ] + ], + minCompilerVersion: "0.5.5" }], ['constantinople', { chainId: [ { id: 1, name: "Ethereum Mainnet" }, { id: 5, name: "Goerli" }, { id: 11155111, name: "Sepolia" } - ] + ], + minCompilerVersion: "0.5.5" }], ['byzantium', { chainId: [ { id: 1, name: "Ethereum Mainnet" } - ] + ], + minCompilerVersion: "0.4.21" }], ['spuriousDragon', { chainId: [ { id: 1, name: "Ethereum Mainnet" } - ] + ], + minCompilerVersion: "0.4.9" }], ['tangerineWhistle', { chainId: [ { id: 1, name: "Ethereum Mainnet" } - ] + ], + minCompilerVersion: "0.4.0" }], ['homestead', { chainId: [ { id: 1, name: "Ethereum Mainnet" }, { id: 5, name: "Goerli" }, { id: 11155111, name: "Sepolia" } - ] - }] + ], + minCompilerVersion: "0.1.2" + }], ]) export function getCompatibleChains(fork: HardFork): ChainInfo[] { diff --git a/libs/remix-ui/run-tab/src/lib/run-tab.tsx b/libs/remix-ui/run-tab/src/lib/run-tab.tsx index 5778da720b..b82f5b4028 100644 --- a/libs/remix-ui/run-tab/src/lib/run-tab.tsx +++ b/libs/remix-ui/run-tab/src/lib/run-tab.tsx @@ -110,25 +110,24 @@ export function RunTabUI(props: RunTabProps) { return getCompatibleChain(evmVersion ?? 'cancun', targetChainId) } - const checkEvmChainCompatibilityOkFunction = async (targetChainId: number, fetchDetails: any, currentFile: string) => { - () => { - const compatibleChain = returnCompatibleChain(fetchDetails.evmVersion, targetChainId) - console.log('compatibleChain', compatibleChain) - plugin.call('manager', 'activatePlugin', 'environmentExplorer') - plugin.call('tabs', 'focus', 'environmentExplorer') - plugin.call('environmentExplorer', 'setChain', compatibleChain) - plugin.call('environmentExplorer', 'setEvmVersion', 'paris') - plugin.call('solidity', 'compile', currentFile) + const checkEvmChainCompatibilityOkFunction = async (targetChainId: number, fetchDetails: any) => { + const compilerParams = { + evmVersion: 'paris', + optimize: false, + language: 'Solidity', + runs: 200, + version: '0.8.27+commit.40a35a09' } + await plugin.call('solidity', 'setCompilerConfig', compilerParams) + const compilerState = await plugin.call('solidity', 'getCompilerState') + console.log('compilerState', compilerState) + const currentFile = await plugin.call('fileManager', 'getCurrentFile') + await plugin.call('solidity', 'compile', currentFile) } const checkEvmChainCompatibilityCancelFunction = async (targetChainId: number, fetchDetails: any, currentFile: string) => { () => { - plugin.call('manager', 'activatePlugin', 'environmentExplorer') - plugin.call('tabs', 'focus', 'environmentExplorer') - plugin.call('environmentExplorer', 'setChain', targetChainId) - plugin.call('environmentExplorer', 'setEvmVersion', fetchDetails.evmVersion) - plugin.call('solidity', 'compile', currentFile) + console.log('cancel') } } @@ -149,12 +148,19 @@ export function RunTabUI(props: RunTabProps) { console.log('chain is undefined') //show modal plugin.call('notification', 'modal', { - id: 'evm-incompatible', + id: 'evm-chainId-incompatible', title: 'Incompatible EVM - ChainId Detected', - message: `The selected chain is not compatible with the selected compiler version. Please select a one of the two options below.`, + message:
+

The selected chain is not compatible with the selected EVM version. Please select a one of the options below.

+
    +
  • Have Remix switch to a compatible EVM version for this chain and recompile the contract.
  • +
  • Cancel to keep the current EVM version.
  • +
+

To manually change the EVM version, go to the Advanced Configurations section of the Solidity compiler.

+
, modalType: 'modal', okLabel: 'Switch EVM and Recompile', - cancelLabel: 'Do not Switch EVM', + cancelLabel: 'Cancel', okFn: checkEvmChainCompatibilityOkFunction, cancelFn: checkEvmChainCompatibilityCancelFunction })