deployProxy error: Cannot read property 'evm' of undefined

hi @abcoathup

It throws Cannot read property 'evm' of undefined when using deployProxy. Here is initialize func in my contract.

function initialize() public initializer {
    .....
}

And here is my test code

this.contract = await deployProxy(MyContract);

Do I need to pass args and opts in deployProxy? Thanks in advance.

[EDIT] Moved from: OpenZeppelin Truffle Upgrades: Step by Step Tutorial

1 Like

Hi @trongdth,

I am sorry that you have this issue.

Are you able to share your contract and test (or a cut down version) so that I can try to reproduce the error? I tried a couple of different combinations and wasn’t able to get the error.

We can specify parameters for our initialize function when testing using deployProxy but your code snippet shows an initializer with no parameters.

Hi @trongdth,

I just wanted to follow up. Were you able to resolve?

Sorry @abcoathup, I was busy in the last couple of days. For your information, I can able to upgrade a smart contract and keep the original state like your example. But my idea is to want to keep the balance of user when deploying an ERC-20 token.

Thanks @abcoathup

1 Like

@abcoathup @trongdth currently battling with this error. Can you pls share how you came about a solution?
current deployment looks like below
.then(()=> deployProxy ( contractInstance, [ __address, _address, accounts[0], _address, _address, _address, accounts[13] ], {deployer, initializer:'initialize',unsafeAllowCustomTypes:true} ) )

1 Like

Hi @Godtide,

We can discuss in: deployProxy Error: Truffle

1 Like