Questions tagged [create2]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
28 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
  • 455
1 vote
1 answer
25 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
12 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
120 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
62 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
86 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
25 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
150 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
65 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
32 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
0 votes
0 answers
32 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
0 votes
0 answers
167 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
0 votes
0 answers
245 views

Different address using Create2 due to difference in byteCode(type(ERC1967Proxy).creationCode and ethers.getContractFactory("ERC1967Proxy").bytecode

I am currently facing an issue while trying to calculate the address of a SimpleAccount contract using getCreate2Address() from ethers.utils in JavaScript. I noticed that the address I receive is ...
kannu's user avatar
  • 11
2 votes
2 answers
347 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
447 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
766 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
305 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
36 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
170 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
1 vote
1 answer
124 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
  • 181
1 vote
0 answers
525 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
39 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
938 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
514 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
463 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,443
0 votes
1 answer
99 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
360 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
272 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
  • 96
2 votes
0 answers
636 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
  • 297
1 vote
1 answer
471 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
622 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,443
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
804 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
480 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
472 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
983 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
  • 191
4 votes
3 answers
713 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
621 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
8k 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,823
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
13 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
877 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,710
2 votes
0 answers
163 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
5k 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
4 votes
1 answer
668 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 ...
Nick Furfaro's user avatar
8 votes
2 answers
3k 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?
Shane Fontaine's user avatar