pull/4143/head
filip mertens 1 year ago
parent 4c6baecb25
commit fac1dddd8d
  1. 7
      apps/remix-ide-e2e/src/tests/proxy-previous.test.ts
  2. 4
      apps/remix-ide-e2e/src/tests/proxy.test.ts
  3. 9
      libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts

@ -16,6 +16,9 @@ module.exports = {
return sources
},
'Should set the compiler version to 8.19': function(browser: NightwatchBrowser) {
browser.setSolidityCompilerVersion('soljson-v0.8.19+commit.7dd6d404.js')
},
'Should show deploy proxy option for UUPS upgradeable contract #group1': function (browser: NightwatchBrowser) {
browser
@ -90,6 +93,7 @@ module.exports = {
.click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander0"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander1"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Deploying ERC1967 < 5.0.0 as proxy...', 60000)
},
'Should interact with deployed contract via ERC1967 (proxy) #group1': function (browser: NightwatchBrowser) {
@ -140,6 +144,7 @@ module.exports = {
.click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander0"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander1"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Deploying ERC1967 < 5.0.0 as proxy...', 60000)
},
'Should interact with initialized contract to verify parameters #group1': function (browser: NightwatchBrowser) {
@ -193,6 +198,7 @@ module.exports = {
})
.waitForElementPresent('[data-id="universalDappUiTitleExpander0"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander1"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Using ERC1967 < 5.0.0 for the proxy upgrade..', 60000)
},
'Should interact with upgraded function in contract MyTokenV2 #group1': function (browser: NightwatchBrowser) {
@ -230,6 +236,7 @@ module.exports = {
.click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander0"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander1"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Using ERC1967 < 5.0.0 for the proxy upgrade..', 60000)
},
'Should interact with upgraded contract through provided proxy address #group1': function (browser: NightwatchBrowser) {

@ -91,6 +91,7 @@ module.exports = {
.click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander0"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander1"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Deploying ERC1967 >= 5.0.0 as proxy...')
},
'Should interact with deployed contract via ERC1967 (proxy) #group1': function (browser: NightwatchBrowser) {
@ -142,6 +143,7 @@ module.exports = {
.click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander0"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander1"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Deploying ERC1967 >= 5.0.0 as proxy...')
},
'Should interact with initialized contract to verify parameters #group1': function (browser: NightwatchBrowser) {
@ -196,6 +198,7 @@ module.exports = {
})
.waitForElementPresent('[data-id="universalDappUiTitleExpander0"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander1"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Using ERC1967 >= 5.0.0 for the proxy upgrade...')
},
'Should interact with upgraded function in contract MyTokenV2 #group1': function (browser: NightwatchBrowser) {
@ -233,6 +236,7 @@ module.exports = {
.click('[data-id="confirmProxyDeployment-modal-footer-ok-react"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander0"]')
.waitForElementPresent('[data-id="universalDappUiTitleExpander1"]')
.waitForElementContainsText('*[data-id="terminalJournal"]', 'Using ERC1967 >= 5.0.0 for the proxy upgrade...')
},
'Should interact with upgraded contract through provided proxy address #group1': function (browser: NightwatchBrowser) {

@ -115,9 +115,9 @@ export class OpenZeppelinProxy extends Plugin {
if (!hasUpgradeVersionCall) {
data.contractByteCode = UUPSBytecode
data.dataHex = UUPSBytecode + constructorData.replace('0x', '')
this.call('terminal', 'logHtml', `Using ERC1967 < 5.0.0 for proxy deployment...`)
this.call('terminal', 'logHtml', `Deploying ERC1967 < 5.0.0 as proxy...`)
}else{
this.call('terminal', 'logHtml', `Using ERC1967 >= 5.0.0 for proxy deployment...`)
this.call('terminal', 'logHtml', `Deploying ERC1967 >= 5.0.0 as proxy...`)
}
// re-use implementation contract's ABI for UI display in udapp and change name to proxy name.
implementationContractObject.contractName = implementationContractObject.name
@ -154,7 +154,6 @@ export class OpenZeppelinProxy extends Plugin {
let version = '4.8.3'
if (error) {
console.log(`error: ${error.message ? error.message : error}`)
console.log(`Will use version 4.8.3 of the proxy...`)
} else {
const response = txFormat.decodeResponse(returnValue, GETUUPSProxyVersionAbi)
version = response[0].split('string: ')[1]
@ -173,7 +172,7 @@ export class OpenZeppelinProxy extends Plugin {
linkReferences: {},
dataHex: fnData.replace('0x', ''),
}
this.call('terminal', 'logHtml', `Using ERC1967 >= 5.0.0 for proxy upgrade...`)
this.call('terminal', 'logHtml', `Using ERC1967 >= 5.0.0 for the proxy upgrade...`)
this.blockchain.upgradeProxy(proxyAddress, newImplAddress, data, newImplementationContractObject)
} else {
const fnData = await this.blockchain.getEncodedFunctionHex([newImplAddress], UUPSupgradeAbi)
@ -186,7 +185,7 @@ export class OpenZeppelinProxy extends Plugin {
linkReferences: {},
dataHex: fnData.replace('0x', ''),
}
this.call('terminal', 'logHtml', `Using ERC1967 < 5.0.0 for proxy upgrade...`)
this.call('terminal', 'logHtml', `Using ERC1967 < 5.0.0 for the proxy upgrade...`)
this.blockchain.upgradeProxy(proxyAddress, newImplAddress, data, newImplementationContractObject)
}
}

Loading…
Cancel
Save