Questions tagged [create2]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
21 views

How to prevent front-running the salt when using CREATE2?

I was looking at Optionality's clone-factory, which is based off EIP-1167, and wondering whether it can be ported to use CREATE2. One concern is that a third-party could, in theory, "front-run&...
1
vote
0answers
12 views

Using the contract owner as the salt for CREATE2

I have a factory contract, which creates child contracts. The child contract inherits from OpenZeppelin's Ownable, so it has an owner and a transferOwnership method. The factory contract uses CREATE2 ...
1
vote
1answer
89 views

What is the benefit of using create2() to create a smart contract?

Why would someone use create2() inline assembly code to create a child contract in factory pattern as opposed to using newContract() to create an instance of "newContract"? What are the ...
1
vote
1answer
128 views

Calculate deterministic address with Create2 when cloning contract with Factory pattern

There is an existing unanswered question from another author with the same problem, I am creating a more detailed one with the hopes both can be closed. I have a solidity contract based on the ideas ...
3
votes
1answer
166 views

Can CREATE2 with the same salt override existing contract?

Deployed: https://rinkeby.etherscan.io/address/0x121e370ae349425d0d744f6db43c2f43e777f972#code pragma solidity 0.8.3; contract Test { uint256 public a; constructor (uint256 _a) public { ...
2
votes
1answer
165 views

How to implement the CREATE2 in Python

I'd like to know either how to implement the skinny CREATE2 in Python or a package that provides it. This is the function I'm trying to port from TypeScript to Python. It calls generateAddress2 with ...
1
vote
0answers
15 views

Is there a way to deploy contracts with circular reference in 2 steps using create2?

Circular reference meaning contracts know each other addresses. So instead of deploy foo deploy bar(foo.address) foo.init(bar.address) Use some clever tricks to have only 2 deploy steps without an ...
1
vote
1answer
378 views

Why does the creationCode of this contract change if a change is made in the importing contract?

For the following: pragma solidity >=0.5.0; contract Include { uint z = 1; } contract CreationCode { uint k = 1; function get() external returns (bytes32) { return keccak256(...
2
votes
0answers
133 views

How i can calculate deterministic address from contract clone (create2)

Is there any way to calculate the deterministic address of a contract cloned by a Factory through create2? I have this contract Factory contract ForwarderFactory { function cloneForwarder(address ...
1
vote
1answer
289 views

How to calculate CREATE2 address in golang?

I have a factory pattern smart contract that creates other smart-contracts by cloning the master smart contract via Minimal Proxy Contract and CREATE2 opcode. What is the proper way to calculate ...
8
votes
4answers
2k views

Is it possible to batch approve + transfer with CREATE2?

In our dapp, we currently have the following user flow: Approve the Sablier contract to spend up to x ERC20 tokens Transfer the x ERC20 tokens to the Sablier contract This is not super bad UX, but ...
3
votes
1answer
262 views

Can I use create2 to deploy minimal proxies in solidity, without using assembly?

Solidity 0.6.2 allows the creation of contracts with the create2 opcode via the new keyword and passing a salt in addition to any args. This is adequate for creating standard contracts, but what if I ...
6
votes
2answers
1k views

Is it possible to deploy a contract using create2 in Solidity?

Can I deploy a contract in Solidity (not in-line assembly) using create2?
1
vote
1answer
71 views

Does create2 increase the nonce of the computed contract’s deployment address?

Simple question about create2 failure. Does create2 increase the nonce of the computed contract’s deployment address ? Or does the first nonce increment operation happens after the first call to the ...
5
votes
1answer
120 views

How does eip1014 (create2) make collisions possible?

In the Clarifications section of EIP 1014 (create2) it says that "This EIP makes collisions possible." It doesn't explain how collisions are now possible, but it links to EIP 684 (Prevent ...
99
votes
6answers
42k views

How is the address of an Ethereum contract computed?

How is the address of an Ethereum contract computed? What use cases are there for knowing a contract's address in advance?