Skip to content

Commit

Permalink
Enable loading previous proxy deployments.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioedeveloper committed Feb 13, 2025
1 parent 6bf1cdc commit b4acbae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions apps/remix-ide/src/blockchain/blockchain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,10 @@ export class Blockchain extends Plugin {
(_) => this.executionContext.currentblockGasLimit()
)
this.txRunner = new TxRunner(web3Runner, {})

this.networkcallid = 0
this.networkStatus = { network: { name: ' - ', id: ' - ' } }
this.registeredPluginEvents = []
this.defaultPinnedProviders = ['vm-cancun', 'vm-mainnet-fork', 'walletconnect', 'injected-MetaMask', 'basic-http-provider', 'hardhat-provider', 'foundry-provider']
this.networkStatus = { network: { name: this.defaultPinnedProviders[0], id: ' - ' } }
this.pinnedProviders = []
this.setupEvents()
this.setupProviders()
Expand Down
4 changes: 2 additions & 2 deletions libs/remix-ui/run-tab/src/lib/actions/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,15 @@ export const isValidContractAddress = async (plugin: RunTab, address: string) =>

export const getNetworkProxyAddresses = async (plugin: RunTab, dispatch: React.Dispatch<any>) => {
const network = plugin.blockchain.networkStatus.network
const identifier = network.name === 'custom' ? network.name + '-' + network.id : network.name
const identifier = network.name.startsWith('vm') ? 'VM' : network.name === 'custom' ? network.name + '-' + network.id : network.name
const networkDeploymentsExists = await plugin.call('fileManager', 'exists', `.deploys/upgradeable-contracts/${identifier}/UUPS.json`)

if (networkDeploymentsExists) {
const networkFile: string = await plugin.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${identifier}/UUPS.json`)
const parsedNetworkFile: NetworkDeploymentFile = JSON.parse(networkFile)
const deployments = []

for (const proxyAddress in Object.keys(parsedNetworkFile.deployments)) {
for (const proxyAddress of Object.keys(parsedNetworkFile.deployments)) {
if (parsedNetworkFile.deployments[proxyAddress] && parsedNetworkFile.deployments[proxyAddress].implementationAddress) {
const solcBuildExists = await plugin.call('fileManager', 'exists', `.deploys/upgradeable-contracts/${identifier}/solc-${parsedNetworkFile.deployments[proxyAddress].implementationAddress}.json`)

Expand Down
2 changes: 1 addition & 1 deletion libs/remix-ui/run-tab/src/lib/actions/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const setupEvents = (plugin: RunTab) => {

plugin.blockchain.event.register('contextChanged', async (context) => {
dispatch(resetProxyDeployments())
if (!context.startsWith('vm')) getNetworkProxyAddresses(plugin, dispatch)
getNetworkProxyAddresses(plugin, dispatch)
if (context !== 'walletconnect') {
(await plugin.call('manager', 'isActive', 'walletconnect')) && plugin.call('manager', 'deactivatePlugin', 'walletconnect')
}
Expand Down

0 comments on commit b4acbae

Please sign in to comment.