diff --git a/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts b/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts index fc4b3d5ac0..684b4334d2 100644 --- a/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts +++ b/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts @@ -130,8 +130,7 @@ export class OpenZeppelinProxy extends Plugin { if (initializeInput) { inputs[name] = { inputs: initializeInput, - initializeInputs: this.blockchain.getInputs(initializeInput), - options: [{ title: 'Deploy with Proxy', active: false }, { title: 'Upgrade Proxy', active: false }] + initializeInputs: this.blockchain.getInputs(initializeInput) } } }) diff --git a/libs/remix-ui/run-tab/src/lib/actions/events.ts b/libs/remix-ui/run-tab/src/lib/actions/events.ts index ffa81a8a59..26f7d33b74 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/events.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/events.ts @@ -2,7 +2,7 @@ import { envChangeNotification } from "@remix-ui/helper" import { RunTab } from "../types/run-tab" import { setExecutionContext, setFinalContext, updateAccountBalances } from "./account" import { addExternalProvider, addInstance, removeExternalProvider, setNetworkNameFromProvider } from "./actions" -import { clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetUdapp, setCurrentFile, setDeployOptions, setLoadType, setRecorderCount, setSendValue } from "./payload" +import { clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetUdapp, setCurrentContract, setCurrentFile, setDeployOptions, setLoadType, setRecorderCount, setSendValue } from "./payload" import { CompilerAbstract } from '@remix-project/remix-solidity' import * as ethJSUtil from 'ethereumjs-util' import Web3 from 'web3' @@ -100,16 +100,20 @@ const broadcastCompilationResult = async (plugin: RunTab, dispatch: React.Dispat const contracts = getCompiledContracts(compiler).map((contract) => { return { name: languageVersion, alias: contract.name, file: contract.file, compiler } }) + const index = contracts.findIndex(contract => contract.alias === plugin.REACT_API.contracts.currentContract) + + if (index < 0) dispatch(setCurrentContract(contracts[0].alias)) const isUpgradeable = await plugin.call('openzeppelin-proxy', 'isConcerned', data.sources[file].ast) if (isUpgradeable) { const options = await plugin.call('openzeppelin-proxy', 'getDeployOptions', data.contracts[file]) - dispatch(setDeployOptions(options)) + dispatch(setDeployOptions({ options: [{ title: 'Deploy with Proxy', active: false }, { title: 'Upgrade Proxy', active: false }], initializeOptions: options })) } - else dispatch(setDeployOptions({})) + else dispatch(setDeployOptions({} as any)) dispatch(fetchContractListSuccess({ [file]: contracts })) dispatch(setCurrentFile(file)) + // TODO: set current contract } const getCompiledContracts = (compiler) => { diff --git a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx index 179eb80b92..eaee7eda69 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx @@ -226,7 +226,18 @@ export function ContractDropdownUI (props: ContractDropdownProps) {