Giter Site home page Giter Site logo

pcaversaccio / create2deployer Goto Github PK

View Code? Open in Web Editor NEW
259.0 259.0 42.0 10.91 MB

Helper smart contract to make easier and safer usage of the `CREATE2` EVM opcode.

License: MIT License

JavaScript 0.89% Solidity 49.71% TypeScript 49.40%
create2 deployment ethereum smart-contracts solidity

create2deployer's Introduction

Hi there πŸ‘‹ I'm Pascal

Linktree

About me πŸ’―

  • πŸ”­ I'm currently working on what's next.
  • πŸ”§ My day (and sometimes night) job is to help safeguard the Ethereum ecosystem.
  • βž• Previously, I founded DAITA Technologies, a Swiss-based startup specialising in transforming raw data into AI-ready data sets at scale, and Alethena, a company pioneering Ethereum-based tokenised shares and their trading via an automated market maker in Switzerland.
  • πŸŽ“ I hold a Master's degree in Quantitative Finance from the Swiss Federal Institute of Technology Zurich (ETH Zurich).
  • ❀️ Generally, I'm truly passionate about Machine/Deep Learning, Computer Vision, Ethereum Smart Contracts, Bitcoin, and OSS Engineering.
  • πŸ“« How to reach me: [email protected].
  • 🌱 I'm currently learning not to go insane – broadly speaking.
  • πŸ’¬ Ask me about anything – maybe I can help you; most likely not.
  • ⚑ Fun fact: It took less code to send a man to the moon than to run a smartphone.

πŸ’» OSes

Debian Ubuntu Windows

🎯 Skills

⌨️ Programming languages

JavaScript Python Solidity TypeScript

πŸŽ› Frameworks and runtime environments

Angular Node.js PyTorch TensorFlow

πŸ—ƒ Package, dependency, and environment management

Conda npm pnpm Yarn

πŸ›  Toolings, platforms, infrastructure providers, and libraries

AWS Cloudflare Git Postman

NumPy OpenCV SciPy

πŸ“¦ npm packages

  • xdeployer – A Hardhat plugin to deploy your smart contracts across multiple Ethereum Virtual Machine (EVM) chains with the same deterministic address.

πŸ“š Smart contract libraries

  • 🐍 snekmate – State-of-the-art, highly opinionated, hyper-optimised, and secure 🐍Vyper smart contract building blocks.

😎 Miscellaneous

πŸ’° Funding

Bitcoin Ethereum Stripe

πŸ”Ž Some stats

Pascal's GitHub Stats

Top Langs

Visitors

create2deployer's People

Contributors

dependabot[bot] avatar pcaversaccio avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

create2deployer's Issues

Solidity Version `0.8.20`

Add a remark in the hardhat.config.ts file that we do not upgrade to Solidity version 0.8.20 due to potential EVM equivalence issues triggered by the recently introduced PUSH0 opcode.

Migration Optimism testnet (from Kovan to Goerli)

Optimism is migrating from Kovan to Goerli testnet (see here). Once the major RPC providers and Etherscan are ready, I will redeploy the Create2Deployer on Goerli Optimism and mark the Kovan Optimism as deprecated. I will also add a note in my Hardhat plugin xdeployer on that change.

πŸ₯Ή Base Mainnet Deployment

UPDATE: The predeploy of Create2Deployer is live on Base: 0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2.

cast code 0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2 --rpc-url https://mainnet.base.org

Returned bytecode:

0x6080604052600436106100435760003560e01c8063076c37b21461004f578063481286e61461007157806356299481146100ba57806366cfa057146100da57600080fd5b3661004a57005b600080fd5b34801561005b57600080fd5b5061006f61006a366004610327565b6100fa565b005b34801561007d57600080fd5b5061009161008c366004610327565b61014a565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100c657600080fd5b506100916100d5366004610349565b61015d565b3480156100e657600080fd5b5061006f6100f53660046103ca565b610172565b61014582826040518060200161010f9061031a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f90910116604052610183565b505050565b600061015683836102e7565b9392505050565b600061016a8484846102f0565b949350505050565b61017d838383610183565b50505050565b6000834710156101f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e636500000060448201526064015b60405180910390fd5b815160000361025f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f60448201526064016101eb565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610156576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f790000000000000060448201526064016101eb565b60006101568383305b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b61014e806104ad83390190565b6000806040838503121561033a57600080fd5b50508035926020909101359150565b60008060006060848603121561035e57600080fd5b8335925060208401359150604084013573ffffffffffffffffffffffffffffffffffffffff8116811461039057600080fd5b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156103df57600080fd5b8335925060208401359150604084013567ffffffffffffffff8082111561040557600080fd5b818601915086601f83011261041957600080fd5b81358181111561042b5761042b61039b565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156104715761047161039b565b8160405282815289602084870101111561048a57600080fd5b826020860160208301376000602084830101528095505050505050925092509256fe608060405234801561001057600080fd5b5061012e806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063249cb3fa14602d575b600080fd5b603c603836600460b1565b604e565b60405190815260200160405180910390f35b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16608857600060aa565b7fa2ef4600d742022d532d4747cb3547474667d6f13804902513b2ec01c848f4b45b9392505050565b6000806040838503121560c357600080fd5b82359150602083013573ffffffffffffffffffffffffffffffffffffffff8116811460ed57600080fd5b80915050925092905056fea26469706673582212205ffd4e6cede7d06a5daf93d48d0541fc68189eeb16608c1999a82063b666eb1164736f6c63430008130033a2646970667358221220fdc4a0fe96e3b21c108ca155438d37c9143fb01278a3c1d274948bad89c564ba64736f6c63430008130033

The above bytecode that is predeployed got verified here: https://etherscan.io/address/0xF49600926c7109BD66Ab97a2c036bf696e58Dbc2#code. You can compare the compiled runtime bytecode and it will match.


TL;DR: Unfortunately, it is not possible to deploy the Create2Deployer contract on the Base production network.

Background

When bridging the funds to the Base mainnet, Base applied a recently introduced (but unfortunately unexpected) behaviour in the Bedrock upgrade that essentially sends a self transfer on L2. I.e. the nonce of the deployer account 0x554282cf65b42fc8fddc6041eb24ce5e8a0632ad was increased by 1 before deploying the Create2Deployer contract. Unfortunately, this means that I can no longer deploy the contract to 0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2. If the demand for this chain is high enough, I might consider redeploying the Create2Deployer contract to a new address including the Base mainnet.

image

create2 factory with initial call

I suggest a new factory contract that can pass initial call bytes, like

    function deployWithInitCall(
        uint256 value,
        bytes32 salt,
        bytes memory code,
        bytes memory initCall
    ) public whenNotPaused {
        Create2.deploy(value, salt, code);

        if (_initCall.length > 0) {
            (bool success, bytes memory reason) = addr.call(_initCall);
            require(success, string(reason));
        }
    }

more can be seen here. wighawag/hardhat-deploy#383

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): update dependency follow-redirects to 1.14.8 [security]
  • chore(deps): update dependency normalize-url to 4.5.1 [security]
  • chore(deps): update dependency path-parse to 1.0.7 [security]
  • chore(deps): update dependency tar to 4.4.18 [security]

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.


  • Check this box to trigger a request for Renovate to run again on this repository

Enforcing front-running prevention

Create2 opens the door to front running, hence, enforcing the salt to contain the msg.sender or having to pass a signature could be ways to resolve this issue.

It could be a problem to have a malicious address front-running the contract creation for reputation purpose only.
Other than that, if I am not mistaken, it seems not to be a problem as you would get the exact same result contract wise.
I might be missing a case ?

What are your thoughts on this ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.