Deployed: https://rinkeby.etherscan.io/address/0x121e370ae349425d0d744f6db43c2f43e777f972#code

pragma solidity 0.8.3;

contract Test {
    uint256 public a;
    constructor (uint256 _a) public {
        a = _a;

contract DeployTest {
    function deploy(bytes32 _salt, uint256 param) public {
        new Test{salt: _salt}(param);

Transaction 1

Transaction 2

I was expecting that the new deployment will override the old one?

I was looking at this article: https://hackernoon.com/using-ethereums-create2-nw2137q7

In Solidity assembly, create2() takes 4 parameters: 1: The amount of wei to send to the new contract as msg.value. This is 0 for this example. 2–3: The location of the bytecode in memory 4: The salt — that we will calculate in step 3. We leave this as a parameter so it can we provided after we have calculated it.

I'm not using assembly. I'm using Solidity code and constructor parameters.

I will do some more experiments but maybe you'll know - can I override the existing contract if I use the same salt but different constructor parameters?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.