From 7a466b995f7d2bb380e0eb8dbbc700691783a522 Mon Sep 17 00:00:00 2001 From: SKYBITDev3 <141273631+SKYBITDev3@users.noreply.github.com> Date: Thu, 31 Aug 2023 03:31:48 +0700 Subject: [PATCH] Updated README.md --- README.md | 21 +++++-- .../SKYBITCREATE3Factory.json | 59 +++++++++++++++++++ yarn.lock | 4 ++ 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 artifacts-saved/contracts/SKYBITCREATE3Factory.sol/SKYBITCREATE3Factory.json diff --git a/README.md b/README.md index 64fa2e4..9758668 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # SKYBIT Keyless Deployment of Smart Contracts ## Introduction This tool is for anyone who wants to **deploy smart contracts to the same address** on multiple Ethereum-Virtual-Machine (EVM)-based blockchains. There are many ways to achieve this, but there can be pitfalls depending on which path you take (see the section [Problems that this tool solves](#problems-that-this-tool-solves) for details). It's important to consider your options before you start any deployments to a live blockchain, as it'd be **difficult to switch later** after realizing that you had made a bad decision, especially if many users are already using the contracts that you had deployed. @@ -54,8 +55,7 @@ It also makes it possible to: This repository offers signed raw deployment transactions of unmodified CREATE3 factories from: - Axelar - ZeframLou & transmissions11/solmate - -More choices may be offered in future. +- SKYBIT & Vectorized/solady Gas price in the deployment transaction has been set to 100 Gwei = 10-7 native currency of the blockchain. This is a high value for most blockchains but it's to ensure that the contract will be deployable. @@ -82,11 +82,11 @@ Axelar's factory contract will be deployed to this address (if the transaction d #### ZeframLou & transmissions11/solmate ZeframLou's factory was included because it's well-known, as is the solmate CREATE3 library that it imports. -The original solidity files were obtained by firstly adding the specific github repository commits: +The original solidity files were obtained by firstly adding the specific github repository commits to `package.json`: - https://github.com/ZeframLou/create3-factory#18cfad8d118b25a5092cdfed6bea9c932ca5b6eb - https://github.com/transmissions11/solmate#f2833c7cc951c50e0b5fd7e505571fddc10c8f77 -`@ZeframLou/create3-factory/src/CREATE3Factory.sol` is imported in `contracts/Imports.sol`. The `solmate/utils` directory is copied from `node_modules` to the repository root so that compilation would run without needing to change the line `import {CREATE3} from "solmate/utils/CREATE3.sol";` in the original factory contract. Hardhat then compiles it and places the artifacts in `artifacts` directory. `CREATE3Factory.json` was then copied to `artifacts-saved/@ZeframLou/create3-factory/src/CREATE3Factory.sol/CREATE3Factory.json/` directory for preservation. +`@ZeframLou/create3-factory/src/CREATE3Factory.sol` is imported in `contracts/Imports.sol`. The `solmate/utils` directory is copied from `node_modules` to the repository root so that compilation would run without needing to change the line `import {CREATE3} from "solmate/utils/CREATE3.sol";` in the original factory contract. Hardhat then compiles it and places the artifacts in `artifacts` directory. `CREATE3Factory.json` was then copied to `artifacts-saved/@ZeframLou/create3-factory/src/CREATE3Factory.sol/` directory for preservation. Gas used for the deployment is 394,439 (or a little more for some blockchains), so gas limit in this deployment transaction has been set to 500,000, giving some room in case some opcode costs increase in future, hence there should be at least 0.05 of native currency at the signer's address before factory deployment. @@ -95,6 +95,19 @@ ZeframLou's factory contract will be deployed to this address (if the transactio 0xb3cBfCf8ad9eeccE068D8704C9316f38F6cC54b3 ``` +#### SKYBIT & Vectorized/solady +The Vectorized/solady CREATE3 library has been included because it is gas-efficient. A factory contract is needed to use the library so a new one was created based on ZeframLou's factory. + +The original Vectorized/solady CREATE3 solidity file was obtained by firstly adding the specific github repository commit to `package.json`: +https://github.com/Vectorized/solady#03f3fd05fb1da76edc4df83ae6bf32a842c15f12 +`contracts\SKYBITCREATE3Factory.sol` imports `{CREATE3} from "@Vectorized/solady/src/utils/CREATE3.sol";`. Hardhat then compiles it and places the artifacts in `artifacts` directory. `SKYBITCREATE3Factory.json` was then copied to `artifacts-saved/contracts/SKYBITCREATE3Factory.sol/` directory for preservation. + +Gas used for the deployment is 253,282 (or a little more for some blockchains), so gas limit in this deployment transaction has been set to 400,000, giving some room in case some opcode costs increase in future, hence there should be at least 0.05 of native currency at the signer's address before factory deployment. + +The SKYBIT factory contract will be deployed to this address (if the transaction data is unchanged): +``` +0x03b2761e6f97b72349686728cb5fF7C565BF7db4 +``` ### Usage Other people may have already deployed the factory contract onto some of your desired blockchains to the expected address (if they didn't change the deployment transaction data), in which case you won't need to deploy it on those blockchains - you can then just use those already-deployed factory contracts to deploy whatever other contracts you want to deploy. So first check the expected address on a blockchain explorer to see if a factory contract already exists there. diff --git a/artifacts-saved/contracts/SKYBITCREATE3Factory.sol/SKYBITCREATE3Factory.json b/artifacts-saved/contracts/SKYBITCREATE3Factory.sol/SKYBITCREATE3Factory.json new file mode 100644 index 0000000..16c3fc6 --- /dev/null +++ b/artifacts-saved/contracts/SKYBITCREATE3Factory.sol/SKYBITCREATE3Factory.json @@ -0,0 +1,59 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "SKYBITCREATE3Factory", + "sourceName": "contracts/SKYBITCREATE3Factory.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "creationCode", + "type": "bytes" + } + ], + "name": "deploy", + "outputs": [ + { + "internalType": "address", + "name": "deployed", + "type": "address" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "deployer", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "getDeployed", + "outputs": [ + { + "internalType": "address", + "name": "deployed", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b506103a1806100206000396000f3fe6080604052600436106100295760003560e01c806350f1c4641461002e578063cdcb760a14610077575b600080fd5b34801561003a57600080fd5b5061004e61004936600461021e565b61008a565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61004e610085366004610292565b6100ee565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084901b166020820152603481018290526000906054016040516020818303038152906040528051906020012091506100e78261014c565b9392505050565b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b166020820152603481018390526000906054016040516020818303038152906040528051906020012092506100e78383346101a4565b60006040513060005260ff600b53826020527f21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f6040526055600b20601452806040525061d694600052600160345350506017601e2090565b60006f67363d3d37363d34f03d5260086018f3600052836010806000f5806101d45763301164256000526004601cfd5b8060145261d69460005260016034536017601e20915060008085516020870186855af1610209576319b991a86000526004601cfd5b50803b6100e7576319b991a86000526004601cfd5b6000806040838503121561023157600080fd5b823573ffffffffffffffffffffffffffffffffffffffff8116811461025557600080fd5b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156102a557600080fd5b82359150602083013567ffffffffffffffff808211156102c457600080fd5b818501915085601f8301126102d857600080fd5b8135818111156102ea576102ea610263565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561033057610330610263565b8160405282815288602084870101111561034957600080fd5b826020860160208301376000602084830101528095505050505050925092905056fea2646970667358221220adb8d45e268d3aa3c6c1296cda4c74d7d549bf1d967411a667c87fd2488d9aad64736f6c63430008150033", + "deployedBytecode": "0x6080604052600436106100295760003560e01c806350f1c4641461002e578063cdcb760a14610077575b600080fd5b34801561003a57600080fd5b5061004e61004936600461021e565b61008a565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61004e610085366004610292565b6100ee565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084901b166020820152603481018290526000906054016040516020818303038152906040528051906020012091506100e78261014c565b9392505050565b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b166020820152603481018390526000906054016040516020818303038152906040528051906020012092506100e78383346101a4565b60006040513060005260ff600b53826020527f21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f6040526055600b20601452806040525061d694600052600160345350506017601e2090565b60006f67363d3d37363d34f03d5260086018f3600052836010806000f5806101d45763301164256000526004601cfd5b8060145261d69460005260016034536017601e20915060008085516020870186855af1610209576319b991a86000526004601cfd5b50803b6100e7576319b991a86000526004601cfd5b6000806040838503121561023157600080fd5b823573ffffffffffffffffffffffffffffffffffffffff8116811461025557600080fd5b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156102a557600080fd5b82359150602083013567ffffffffffffffff808211156102c457600080fd5b818501915085601f8301126102d857600080fd5b8135818111156102ea576102ea610263565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561033057610330610263565b8160405282815288602084870101111561034957600080fd5b826020860160208301376000602084830101528095505050505050925092905056fea2646970667358221220adb8d45e268d3aa3c6c1296cda4c74d7d549bf1d967411a667c87fd2488d9aad64736f6c63430008150033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/yarn.lock b/yarn.lock index 7597272..5270249 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,10 @@ # yarn lockfile v1 +"@Vectorized/solady@https://github.com/Vectorized/solady#03f3fd05fb1da76edc4df83ae6bf32a842c15f12": + version "0.0.105" + resolved "https://github.com/Vectorized/solady#03f3fd05fb1da76edc4df83ae6bf32a842c15f12" + "@ZeframLou/create3-factory@https://github.com/ZeframLou/create3-factory#18cfad8d118b25a5092cdfed6bea9c932ca5b6eb": version "0.0.0" resolved "https://github.com/ZeframLou/create3-factory#18cfad8d118b25a5092cdfed6bea9c932ca5b6eb"