Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [create2]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
46 views

Compute CREATE2 pool address in python for a AMM dex contract based on Uniswap v2

I am trying to create a function in python that can generate the pool address from the address of the tokens. The relevant portion of the solidity contracts is below: contract SyncSwapClassicPool is ...
Cristian's user avatar
  • 113
2 votes
2 answers
68 views

Why does addresses generated by create2 differs between blockchains?

Recently, UniswapV2 got deployed on other chains using the same addresses and the same bytecode. But all transactions are getting reverted, and the reason is simple : the uniswap’s factory is using ...
user2284570's user avatar
  • 1,018
0 votes
0 answers
16 views

cannot estimate gas error when deploying with solidity-create2-deployer

I continuously get the cannot estimate gas error when attempting to deploy a contract using the solidity-create2-deployer contract and I'm clueless as to where the error arises. find my code below ...
web3lisa's user avatar
0 votes
2 answers
64 views

Is it possible to use CREATE2 without going through the Smart Contract's function?

EIP-1014 was the standard that added the CTEATE2 Opcode (0xf5). Is there any way to use 0xf5 other than calling the SmartContract's inline-assembly function?
imelon2's user avatar
  • 558
1 vote
1 answer
80 views

Redeploy to same address using CREATE (not CREATE2) | aka does a nonce reset?

Let's say I am using a (Gnosis) Safe as my main deployer account (0xD1) to allow for use of CREATE2 calls. I use my main account, 0xD1, to deploy a "TempCreator" contract (0xC2) using ...
L Co's user avatar
  • 113
0 votes
1 answer
52 views

Is it possible to make my CREATE2 factory so that the calculated address is totally independent of the address my factory is deployed on?

Is it possible to make my CREATE2 factory so that the calculated address is totally independent of the address my factory is deployed on. For example, this is the formula listed on solidity-by-example ...
Priyank Gupta's user avatar
1 vote
1 answer
219 views

Identify if a token contract was deployed using Create2

Is there a way to analyze a token contract and determine if it was created using Create2?
ether_explorer11111's user avatar
1 vote
0 answers
152 views

Create3 deployment with proxy contract ownership?

I have deployed an upgradable proxy contract with create3factory from solmate. In my contract i transfer ownership to an address. But still the owner ship is not on that address. Its a differant ...
Furkan Sezal's user avatar
3 votes
1 answer
155 views

Do dune analytics `creation_traces` data include contracts created by other contracts?

Or do they only check to see for a to address to be blank in a transaction. Does it find all CREATE/CREATE2 opcodes -> meaning an EoA or contract deployment?
Patrick Collins's user avatar
0 votes
0 answers
34 views

How to deploy a smart contract using CREATE2 with truffle?

How can I deploy a new smart contract using CREATE2 upcode (EIP-1014) with truffle?
Ehsan Khodarahmi's user avatar
1 vote
1 answer
339 views

Connecting a manually created Gnosis Safe to the Safe UI

I have a Safe at https://etherscan.io/address/0x000000000034065b3a94c2118cfe5b4c0067b615#readProxyContract, and I was having trouble connecting it to both the Safe Web and Safe Mobile apps. When ...
matt's user avatar
  • 13
0 votes
0 answers
86 views

Create2 - Sending ether to not yet existing smart contract

I'm trying to understand the create2 opcode to deploy a smart contract. As we can predict the address of newly created smart contract, it is possible to send ETH to non yet existing smart contract and ...
REZAZI MOHAMED ABDESSAMED's user avatar
1 vote
0 answers
38 views

How to deploy a contract to the same address in testnet?

My code for deploying a contract import { ethers } from "hardhat"; async function main() { const CF = await ethers.getContractFactory('abc'); const c = await CF.deploy(); await c....
Camila326's user avatar
  • 115
0 votes
0 answers
45 views

How to know if a smart contract is calling a function or if it is an EOA?

Some have suggested detecting the contract bytecode size but this can be spoofed in the constructor where the value will be 0 for an EOA and a contract. Then with create2 and self destruct the problem ...
Nat's user avatar
  • 279
1 vote
1 answer
298 views

Calculate the contract address created using create2 with dynamic byte string as a salt

EIP-1014 describes salt as bytes32. However, the function create2 written in assembly allows passing byte string of arbitrary size as the salt parameter. Example function deploy(bytes memory bytecode, ...
Ivan Zakharov's user avatar
2 votes
2 answers
618 views

Extracting salt from tx's to the CREATE2 deployer contract 0x4e59b44847b379578588920ca78fbf26c0b4956c

I've noticed a pattern in deploying CREATE2 contracts and now I'm trying to find out the salt used. The reason is, for verifying contracts with CREATE2 on Sourcify salt and the deployerAddress are ...
kuzdogan's user avatar
  • 657
2 votes
1 answer
598 views

Deploying smart contract using CREATE2, bytecode, salt - getting different addresses on different chains?

I would like to deploy the same contract to multiple chains under the same address using CREATE2. DeterministicDeployFactory: https://docs.alchemy.com/docs/create2-an-alternative-to-deriving-contract-...
Mars Robertson's user avatar
4 votes
2 answers
1k views

What are the differences between create2 and create3?

Which strategies should we follow when using create2 and create3? I had seen that li.fi deployed the contracts using create3 factory contract. and i know some basics about create that we can find out ...
0xbeny's user avatar
  • 193
6 votes
1 answer
387 views

Why Uniswap V3 factory saves parameters to storage and then deletes them instead of passing parameters to pool constructor directly

In the UniswapV3 contracts we can see that when creating a new pool, instead of passing parameters to the pool contract, we actually deploy the pool contract, and in the pool contract's constructor it ...
Patrick Collins's user avatar
0 votes
2 answers
57 views

Determing value of ERC-20 token

In developing a new ERC-20 token, can you determine the value of the token? Can you make them worth a different fraction of an ethereum?
HoboJeff's user avatar
2 votes
1 answer
215 views

How to tell if code is already deployed by create2 at an address

We have a factory creating clones using create2, using OpenZeppelin's Clones (https://docs.openzeppelin.com/contracts/4.x/api/proxy#Clones-cloneDeterministic-address-bytes32-). Is it possible to know ...
Alexander Kondratskiy's user avatar
2 votes
1 answer
142 views

What happens if by randomness you deploy a contract to the same address then an existing EOA

What happens if by randomness you deploy a contract to the same address then an existing EOA? Would the deployment be rejected? Would it only be rejected if the EOA has no transaction history i.e a ...
FreddyC's user avatar
  • 301
1 vote
0 answers
704 views

getCreate2Address (create2) UNABLE to get correct contract address :(

UPDATE: I think the real question is what to use as Init code? The contract has no constructor. Can someone help on this? Basically i am using openzeppelin Clones.sol contract to determine the ...
smenir443's user avatar
  • 125
0 votes
0 answers
40 views

spend child contract(deployed by mother contract) from mother contract?

I have created a smart contract like this : contract ChildContract { function sendTokenTo(uint _amount, ITRC20 _token, address payable _receiver) external payable onlyOwner { ...
Hamid Naghipour's user avatar
3 votes
1 answer
1k views

How difficult is it to deploy a contract to one specific address that you want?

Let's consider two scenarios: Address X deployed Uniswap code to ETH mainnet with Create2 opcode to address Y Address X deployed Uniswap code to ETH mainnet with Create opcode to address Z I am an ...
Patrick Collins's user avatar
4 votes
2 answers
683 views

Convert EOA to contract account

EIP-2026 mentions several ways of creating a new account. One way is by: (...) converting a non-countract account into a contract account (...) Is this a hypothetical scenario or could this be done ...
Markus Schick's user avatar
1 vote
2 answers
580 views

How to determine if a contract with a create2 address exists?

Say I have a factory contract that creates child contracts using create2 where a child contract may have never existed or may have existed but no longer exists by for example self-destructing, how can ...
MShakeG's user avatar
  • 1,703
0 votes
1 answer
119 views

Create2 gives different addresses on different networks

I'm trying to deploy a contract on two networks with the create2 method. I'm using same arguments in Goerli and Rinkeby, however I'm still getting two different addresses for the same contract. Here ...
yieniggu's user avatar
  • 121
0 votes
1 answer
453 views

how to deploy a contract by sending ether to it's address

I'm trying to build a payment gateway and I generated address of a contract before deploying it with create2. how to deploy the contract by sending ether to new generated address? pragma solidity 0.8....
Meysam's user avatar
  • 81
1 vote
1 answer
287 views

CREATE2 opcode offset and size

This is the UniswapV2Factory contract createPair function. I know that create2 opcode takes 4 arguments (value, offset , size , salt) How add(bytecode,32) can give the offset ? How mload(bytecode) can ...
Mehmet Akifhan Ilgaz's user avatar
0 votes
1 answer
1k views

Deploy contract with Bytecode from smart contract

I have a contract that has a function deployContract(bytes memory runtimeBytecode) I want this function to be able to deploy the bytes sent to it as a new smart contract. I understand that I will have ...
maxime's user avatar
  • 106
2 votes
0 answers
751 views

Can one still bypass EIP-155 and deploy to the same chain-independent address from an EOA

I was trying to deploy a contract to a deterministic address using Nicks method. This works fine on Rinkeby and all the Ethereum-Testnets that I tried. However, it doesn't work on Mumbai and probably ...
Marlo's user avatar
  • 359
1 vote
1 answer
560 views

Gas cost of Create2

I code a very simple program to test create2(). The program has two contracts, an empty firstContract, and a test contract to deploy firstContract via create2. The codes are below. Then I call ...
LeoZ's user avatar
  • 11
0 votes
4 answers
765 views

Why does create2 predicted address not equal actual address?

For some reason the predicted/pre-computed address is not equal to the actual address when the created contract accepts address for it's constructor parameters, however it's fine when the constructor ...
MShakeG's user avatar
  • 1,703
2 votes
2 answers
2k views

how to precalcuate the deployed contract address

// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; import "https://github.com/Uniswap/v2-core/blob/master/contracts/UniswapV2Pair.sol"; contract TestERC20 { address public _pair =...
hobbydev's user avatar
  • 143
0 votes
1 answer
877 views

EXTCODESIZE returning 32 for contract size less than 32

I'm currently completing the Ethernaut challenges, one of them is to deploy a small contract (runtime bytecode is 10 bytes long). I'm running the tests on my local machine, and using Solidity to ...
riordant's user avatar
1 vote
1 answer
536 views

Is there a size limitation on create2 bytecode field?

I have the following method in my Solidity contract. function deploy(bytes memory bytecode, uint _salt) public payable returns (address){ address addr; assembly { addr := create2( ...
Armen's user avatar
  • 13
3 votes
1 answer
512 views

Security Implications of CREATE2 and SELFDESTRUCT

I was reading a discussion on the topic, i have two questions it is commented The SELFDESTRUCT and recreation cannot happen within one transaction, due to how SELFDESTRUCT operates. could someone ...
Stormsson's user avatar
  • 379
3 votes
1 answer
1k views

is it possible to create smart contract with deterministic address (like CREATE2 does) from transaction itself (i.e. without proxy/creator smart c)?

I found that From ethereum yellow whitepaper Transaction contains fields: nonce gasPrice gasLimit to value v, r, s init (contains "smart contract creation code" that should return "...
srghma's user avatar
  • 203
4 votes
3 answers
863 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&...
Paul Razvan Berg's user avatar
1 vote
1 answer
790 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 ...
Paul Razvan Berg's user avatar
14 votes
2 answers
9k 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 ...
YulePale's user avatar
  • 1,853
1 vote
2 answers
2k 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 ...
Franco's user avatar
  • 155
14 votes
3 answers
3k 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 { ...
Mars Robertson's user avatar
5 votes
1 answer
1k 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 ...
vnavascues's user avatar
1 vote
0 answers
29 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 ...
Poma's user avatar
  • 171
1 vote
1 answer
2k 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(...
Joël's user avatar
  • 1,720
2 votes
0 answers
164 views

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

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 ...
Gustavo Toledo's user avatar
1 vote
1 answer
1k 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 ...
navigante's user avatar
12 votes
4 answers
6k views

Is it possible to batch approve + transfer an ERC-20 token?

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 ...
Paul Razvan Berg's user avatar