pull/4143/head
filip mertens 1 year ago
parent 304baa1cba
commit 0ba850d8cd
  1. 52
      libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts

@ -46,36 +46,28 @@ export class OpenZeppelinProxy extends Plugin {
async getUUPSContractOptions(contracts, ast, file) { async getUUPSContractOptions(contracts, ast, file) {
const options = {} const options = {}
await Promise.all( await Promise.all(Object.keys(contracts).map(async (name) => {
Object.keys(contracts).map(async (name) => { if (ast) {
if (ast) { const UUPSSymbol = ast.exportedSymbols[UUPS] ? ast.exportedSymbols[UUPS][0] : null
const UUPSSymbol = ast.exportedSymbols[UUPS] ? ast.exportedSymbols[UUPS][0] : null
await Promise.all(ast.absolutePath === file && ast.nodes.map(async (node) => {
await Promise.all( if (node.name === name && node.linearizedBaseContracts.includes(UUPSSymbol)) {
ast.absolutePath === file && const abi = contracts[name].abi
ast.nodes.map(async (node) => { const initializeInput = abi.find(node => node.name === 'initialize')
if (node.name === name && node.linearizedBaseContracts.includes(UUPSSymbol)) { const isDeployWithProxyEnabled: boolean = await this.call('config', 'getAppParameter', EnableProxyURLParam) || false
const abi = contracts[name].abi const isDeployWithUpgradeEnabled: boolean = await this.call('config', 'getAppParameter', EnableUpgradeURLParam) || false
const initializeInput = abi.find((node) => node.name === 'initialize')
const isDeployWithProxyEnabled: boolean = (await this.call('config', 'getAppParameter', EnableProxyURLParam)) || false options[name] = {
const isDeployWithUpgradeEnabled: boolean = (await this.call('config', 'getAppParameter', EnableUpgradeURLParam)) || false options: [{ title: 'Deploy with Proxy', active: isDeployWithProxyEnabled }, { title: 'Upgrade with Proxy', active: isDeployWithUpgradeEnabled }],
initializeOptions: {
options[name] = { inputs: initializeInput,
options: [ initializeInputs: initializeInput ? this.blockchain.getInputs(initializeInput) : null
{ title: 'Deploy with Proxy', active: isDeployWithProxyEnabled }, }
{ title: 'Upgrade with Proxy', active: isDeployWithUpgradeEnabled }, }
], }
initializeOptions: { }))
inputs: initializeInput, }
initializeInputs: initializeInput ? this.blockchain.getInputs(initializeInput) : null, }))
},
}
}
})
)
}
})
)
return options return options
} }

Loading…
Cancel
Save