|
|
@ -1,6 +1,6 @@ |
|
|
|
import { Plugin } from '@remixproject/engine' |
|
|
|
import { Plugin } from '@remixproject/engine' |
|
|
|
import { ContractAST, ContractSources, DeployOptions } from '../types/contract' |
|
|
|
import { ContractAST, ContractSources, DeployOptions } from '../types/contract' |
|
|
|
import { EnableProxyURLParam, EnableUpgradeURLParam, GETUUPSProxyVersionAbi, UUPS, UUPSABI, UUPSBytecode, UUPSBytecodeV5, UUPSfunAbi, UUPSupgradeAbi, UUPSupgradeToAndCallAbi } from './constants/uups' |
|
|
|
import { EnableProxyURLParam, EnableUpgradeURLParam, GETUUPSProxyVersionAbi, UUPS, UUPSABI, UUPSBytecode, UUPSBytecodeV5, UUPSfunAbi, UUPSfunAbiV5, UUPSupgradeAbi, UUPSupgradeToAndCallAbi } from './constants/uups' |
|
|
|
import * as remixLib from '@remix-project/remix-lib' |
|
|
|
import * as remixLib from '@remix-project/remix-lib' |
|
|
|
import * as semver from 'semver' |
|
|
|
import * as semver from 'semver' |
|
|
|
const txFormat = remixLib.execution.txFormat |
|
|
|
const txFormat = remixLib.execution.txFormat |
|
|
@ -104,7 +104,7 @@ export class OpenZeppelinProxy extends Plugin { |
|
|
|
contractABI: UUPSABI, |
|
|
|
contractABI: UUPSABI, |
|
|
|
contractByteCode: UUPSBytecodeV5, |
|
|
|
contractByteCode: UUPSBytecodeV5, |
|
|
|
contractName: proxyName, |
|
|
|
contractName: proxyName, |
|
|
|
funAbi: UUPSfunAbi, |
|
|
|
funAbi: UUPSfunAbiV5, |
|
|
|
funArgs: args, |
|
|
|
funArgs: args, |
|
|
|
linkReferences: {}, |
|
|
|
linkReferences: {}, |
|
|
|
dataHex: UUPSBytecodeV5 + constructorData.replace('0x', ''), |
|
|
|
dataHex: UUPSBytecodeV5 + constructorData.replace('0x', ''), |
|
|
@ -115,6 +115,7 @@ export class OpenZeppelinProxy extends Plugin { |
|
|
|
if (!hasUpgradeVersionCall) { |
|
|
|
if (!hasUpgradeVersionCall) { |
|
|
|
data.contractByteCode = UUPSBytecode |
|
|
|
data.contractByteCode = UUPSBytecode |
|
|
|
data.dataHex = UUPSBytecode + constructorData.replace('0x', '') |
|
|
|
data.dataHex = UUPSBytecode + constructorData.replace('0x', '') |
|
|
|
|
|
|
|
data.funAbi = UUPSfunAbi |
|
|
|
this.call('terminal', 'logHtml', `Deploying ERC1967 < 5.0.0 as proxy...`) |
|
|
|
this.call('terminal', 'logHtml', `Deploying ERC1967 < 5.0.0 as proxy...`) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
this.call('terminal', 'logHtml', `Deploying ERC1967 >= 5.0.0 as proxy...`) |
|
|
|
this.call('terminal', 'logHtml', `Deploying ERC1967 >= 5.0.0 as proxy...`) |
|
|
@ -158,7 +159,6 @@ export class OpenZeppelinProxy extends Plugin { |
|
|
|
const response = txFormat.decodeResponse(returnValue, GETUUPSProxyVersionAbi) |
|
|
|
const response = txFormat.decodeResponse(returnValue, GETUUPSProxyVersionAbi) |
|
|
|
version = response[0].split('string: ')[1] |
|
|
|
version = response[0].split('string: ')[1] |
|
|
|
// check if version is >= 5.0.0
|
|
|
|
// check if version is >= 5.0.0
|
|
|
|
console.log('version', response) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (semver.gte(version, '5.0.0')) { |
|
|
|
if (semver.gte(version, '5.0.0')) { |
|
|
|