Skip to content

Commit

Permalink
Updated address of SKYBIT CREATE3 factory
Browse files Browse the repository at this point in the history
  • Loading branch information
SKYBITDev3 committed Aug 31, 2023
1 parent 02c47dc commit 49c60d1
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Gas used for the deployment is 253,282 (or a little more for some blockchains),

The SKYBIT factory contract will be deployed to this address (if the transaction data is unchanged):
```
0x03b2761e6f97b72349686728cb5fF7C565BF7db4
0x919AF4Dcb057Eb9eC95C84252647bfc01c5B4Cf5
```

### Usage
Expand Down
100 changes: 50 additions & 50 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
require("@nomicfoundation/hardhat-toolbox")
require("@openzeppelin/hardhat-upgrades")
require("dotenv").config()
require(`@nomicfoundation/hardhat-toolbox`)
require(`@openzeppelin/hardhat-upgrades`)
require(`dotenv`).config()

BigInt.prototype["toJSON"] = () => this.toString() // To prevent TypeError: Do not know how to serialize a BigInt
BigInt.prototype[`toJSON`] = () => this.toString() // To prevent TypeError: Do not know how to serialize a BigInt

// SET YOUR ACCOUNT HERE
const accounts = { mnemonic: process.env.MNEMONIC || "test test test test test test test test test test test junk" }
const accounts = { mnemonic: process.env.MNEMONIC || `test test test test test test test test test test test junk` }
// const accounts = [process.env.PRIVATE_KEY0]
// const accounts = [process.env.PRIVATE_KEY1, process.env.PRIVATE_KEY2]

// You can add more blockchains to this list if they don't already exist in @wagmi/chains
const additionalNetworks = { // See https://github.com/wagmi-dev/references/blob/main/packages/chains/src/index.ts
bttc: {
chainId: 199,
url: "https://rpc.bittorrentchain.io",
url: `https://rpc.bittorrentchain.io`,
accounts,

network: "bttc",
network: `bttc`,
urls: {
apiURL: "https://api.bttcscan.com/api",
browserURL: "https://bttcscan.com"
apiURL: `https://api.bttcscan.com/api`,
browserURL: `https://bttcscan.com`
}
},
bttcTestnet: {
chainId: 1028,
url: "https://testrpc.bittorrentchain.io",
url: `https://testrpc.bittorrentchain.io`,
accounts,

network: "bttcTestnet",
network: `bttcTestnet`,
urls: {
apiURL: "https://api-testnet.bttcscan.com/api",
browserURL: "https://testnet.bttcscan.com"
apiURL: `https://api-testnet.bttcscan.com/api`,
browserURL: `https://testnet.bttcscan.com`
}
},

heco: {
chainId: 128,
url: "https://http-mainnet.hecochain.com",
url: `https://http-mainnet.hecochain.com`,
accounts,
// use built-in hardhat-verify details
},
hecoTestnet: {
chainId: 256,
url: "https://http-testnet.hecochain.com",
url: `https://http-testnet.hecochain.com`,
accounts,
// use built-in hardhat-verify details
},

harmonyTest: {
chainId: 1666700000,
url: "https://api.s0.b.hmny.io",
url: `https://api.s0.b.hmny.io`,
accounts,
// use built-in hardhat-verify details
},

bobaTestnet: {
chainId: 2888,
url: "https://goerli.boba.network",
url: `https://goerli.boba.network`,
accounts,

network: "bobaTestnet",
network: `bobaTestnet`,
urls: {
apiURL: "https://api-testnet.bobascan.com/api",
browserURL: "https://testnet.bobascan.com"
apiURL: `https://api-testnet.bobascan.com/api`,
browserURL: `https://testnet.bobascan.com`
}
},
}

const hardhatVerifyBuiltinChains = ["mainnet", "goerli", "optimisticEthereum", "bsc", "sokol", "bscTestnet", "xdai", "gnosis", "heco", "polygon", "opera", "hecoTestnet", "optimisticGoerli", "moonbeam", "moonriver", "moonbaseAlpha", "ftmTestnet", "base", "chiado", "arbitrumOne", "avalancheFujiTestnet", "avalanche", "polygonMumbai", "baseGoerli", "arbitrumTestnet", "arbitrumGoerli", "sepolia", "aurora", "auroraTestnet", "harmony", "harmonyTest"] // https://github.com/NomicFoundation/hardhat/blob/main/packages/hardhat-verify/src/internal/chain-config.ts
const hardhatVerifyBuiltinChains = [`mainnet`, `goerli`, `optimisticEthereum`, `bsc`, `sokol`, `bscTestnet`, `xdai`, `gnosis`, `heco`, `polygon`, `opera`, `hecoTestnet`, `optimisticGoerli`, `moonbeam`, `moonriver`, `moonbaseAlpha`, `ftmTestnet`, `base`, `chiado`, `arbitrumOne`, `avalancheFujiTestnet`, `avalanche`, `polygonMumbai`, `baseGoerli`, `arbitrumTestnet`, `arbitrumGoerli`, `sepolia`, `aurora`, `auroraTestnet`, `harmony`, `harmonyTest`] // https://github.com/NomicFoundation/hardhat/blob/main/packages/hardhat-verify/src/internal/chain-config.ts
const wagmiToHardhatVerifyTranslation = { // because some names don't match. So we'll use the name in hardhat-verify.
arbitrum: "arbitrumOne",
avalancheFuji: "avalancheFujiTestnet",
fantom: "opera",
fantomTestnet: "ftmTestnet",
gnosisChiado: "chiado",
harmonyOne: "harmony",
optimism: "optimisticEthereum",
optimismGoerli: "optimisticGoerli",
arbitrum: `arbitrumOne`,
avalancheFuji: `avalancheFujiTestnet`,
fantom: `opera`,
fantomTestnet: `ftmTestnet`,
gnosisChiado: `chiado`,
harmonyOne: `harmony`,
optimism: `optimisticEthereum`,
optimismGoerli: `optimisticGoerli`,
}

let networks = {}
const chains = require("@wagmi/chains")
const chains = require(`@wagmi/chains`)
for (let [chainName, chainData] of Object.entries(chains)) {
if (!["hardhat", "localhost"].includes(chainName)) { // "HardhatConfig.networks.hardhat can't have an url"
if (![`hardhat`, `localhost`].includes(chainName)) { // "HardhatConfig.networks.hardhat can't have an url"
chainName = wagmiToHardhatVerifyTranslation[chainName] === undefined ? chainName : wagmiToHardhatVerifyTranslation[chainName] // change to what hardhat-verify uses

networks[chainName] = {
Expand All @@ -92,15 +92,15 @@ for (let [chainName, chainData] of Object.entries(chains)) {
}

// add keys for hardhat-verify if blockchain isn't built in hardhat-verify and has explorer
if (!hardhatVerifyBuiltinChains.includes(chainName) && Object.hasOwn(chainData, "blockExplorers")) {
const browserURL = chainData.blockExplorers[Object.hasOwn(chainData.blockExplorers, "etherscan") ? "etherscan" : "default"].url
if (!hardhatVerifyBuiltinChains.includes(chainName) && Object.hasOwn(chainData, `blockExplorers`)) {
const browserURL = chainData.blockExplorers[Object.hasOwn(chainData.blockExplorers, `etherscan`) ? `etherscan` : `default`].url

networks[chainName] = {
...networks[chainName],
...{
network: chainName,
urls: {
apiURL: `${browserURL.slice(0, 8)}api${browserURL.split(".").length === 2 ? "." : "-"}${browserURL.slice(8)}/api`,
apiURL: `${browserURL.slice(0, 8)}api${browserURL.split(`.`).length === 2 ? `.` : `-`}${browserURL.slice(8)}/api`,
browserURL
}
}
Expand All @@ -118,28 +118,28 @@ networks = { ...networks, ...additionalNetworks }
// RPC URL overrides in case the one in @wagmi/chains doesn't work:
// networks.mainnet.url = `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`

networks.polygonMumbai.url = "https://polygon-mumbai.blockpi.network/v1/rpc/public"
networks.polygonMumbai.url = `https://polygon-mumbai.blockpi.network/v1/rpc/public`

networks.bscTestnet.url = "https://data-seed-prebsc-2-s2.bnbchain.org:8545"
networks.bscTestnet.url = `https://data-seed-prebsc-2-s2.bnbchain.org:8545`

networks.sepolia.url = "https://eth-sepolia.g.alchemy.com/v2/demo"
networks.sepolia.url = `https://eth-sepolia.g.alchemy.com/v2/demo`


const customChains = Object.values(networks).filter(network => Object.hasOwn(network, "urls"))
const customChains = Object.values(networks).filter(network => Object.hasOwn(network, `urls`))


/** @type import("hardhat/config").HardhatUserConfig */
/** @type import(`hardhat/config`).HardhatUserConfig */
module.exports = {
solidity: {
compilers: [
{
version: "0.8.21",
version: `0.8.21`,
settings: {
optimizer: {
enabled: true,
runs: 1000000
},
evmVersion: "paris", // shanghai is current default but many blockchains don't support push0 opcode yet (causing "ProviderError: invalid opcode: opcode 0x5f not defined" and "ProviderError: execution reverted"). paris is prior version.
evmVersion: `paris`, // shanghai is current default but many blockchains don't support push0 opcode yet (causing "ProviderError: invalid opcode: opcode 0x5f not defined" and "ProviderError: execution reverted"). paris is prior version.
}
},
],
Expand All @@ -165,24 +165,24 @@ module.exports = {
}

// override hardhat compilation subtask
subtask("compile:solidity:get-dependency-graph")
subtask(`compile:solidity:get-dependency-graph`)
.setAction(
async (args, hre, runSuper) => {
let filePath = "node_modules/@ZeframLou/create3-factory/package.json" // to create package.json required to import solidity file for compilation
const fileContent = "{ \"name\": \"create3-factory\", \"version\": \"18cfad8d118b25a5092cdfed6bea9c932ca5b6eb\" }"
let filePath = `node_modules/@ZeframLou/create3-factory/package.json` // to create package.json required to import solidity file for compilation
const fileContent = `{ "name": "create3-factory", "version": "18cfad8d118b25a5092cdfed6bea9c932ca5b6eb" }`

const fs = require("fs")
const path = require("path")
const fs = require(`fs`)
const path = require(`path`)
fs.writeFileSync(path.join(__dirname, filePath), fileContent)
// console.log(`Created ${filePath}`)

filePath = "node_modules/@transmissions11/solmate/src/utils/Bytes32AddressLib.sol" // to handle "import {CREATE3} from "solmate/utils/CREATE3.sol";"
fileDest = "solmate/utils/Bytes32AddressLib.sol"
filePath = `node_modules/@transmissions11/solmate/src/utils/Bytes32AddressLib.sol` // to handle "import {CREATE3} from "solmate/utils/CREATE3.sol";"
fileDest = `solmate/utils/Bytes32AddressLib.sol`
fs.cpSync(filePath, fileDest, { recursive: true })
// console.log(`Copied ${filePath} to ${fileDest}`)

filePath = "node_modules/@transmissions11/solmate/src/utils/CREATE3.sol"
fileDest = "solmate/utils/CREATE3.sol"
filePath = `node_modules/@transmissions11/solmate/src/utils/CREATE3.sol`
fileDest = `solmate/utils/CREATE3.sol`
fs.cpSync(filePath, fileDest, { recursive: true })
// console.log(`Copied ${filePath} to ${fileDest}`)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SKYBIT-Keyless-Deployment",
"version": "2.3.0",
"version": "2.4.0",
"packageManager": "[email protected]",
"devDependencies": {
"@Vectorized/solady": "https://github.com/Vectorized/solady#03f3fd05fb1da76edc4df83ae6bf32a842c15f12",
Expand Down
4 changes: 2 additions & 2 deletions scripts/deployKeylessly-Create3Factory.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { ethers, network } = require(`hardhat`)

// CHOOSE WHICH FACTORY YOU WANT TO USE: "axelarnetwork", "ZeframLou" or "SKYBIT"
// const factoryToDeploy = "axelarnetwork"
// const factoryToDeploy = "ZeframLou"
// const factoryToDeploy = `axelarnetwork`
// const factoryToDeploy = `ZeframLou`
const factoryToDeploy = `SKYBIT`

const isDeployEnabled = true // toggle in case you do deployment and verification separately.
Expand Down
2 changes: 1 addition & 1 deletion scripts/deployViaCREATE3-TESTERC20.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { ethers, network } = require(`hardhat`)
// const addressOfFactory = `0xb3cBfCf8ad9eeccE068D8704C9316f38F6cC54b3` // commit a47e3749283038fa294f5176e2009af69ac17c59. gas cost: 2169509

const factoryToUse = `SKYBIT`
const addressOfFactory = `0x03b2761e6f97b72349686728cb5fF7C565BF7db4` // commit a47e3749283038fa294f5176e2009af69ac17c59. gas cost: 2140281
const addressOfFactory = `0x919AF4Dcb057Eb9eC95C84252647bfc01c5B4Cf5` // commit a47e3749283038fa294f5176e2009af69ac17c59. gas cost: 2140281


// PASS YOUR OWN STRING HERE TO GENERATE A UNIQUE SALT. After doing your first production deployment, don't change it in order to have same address on other blockchains.
Expand Down
2 changes: 1 addition & 1 deletion scripts/deployViaCREATE3-TESTERC20UG.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { ethers, network, upgrades } = require(`hardhat`)
// const addressOfFactory = `0xb3cBfCf8ad9eeccE068D8704C9316f38F6cC54b3`

const factoryToUse = `SKYBIT`
const addressOfFactory = `0x03b2761e6f97b72349686728cb5fF7C565BF7db4`
const addressOfFactory = `0x919AF4Dcb057Eb9eC95C84252647bfc01c5B4Cf5`

const isDeployEnabled = true // toggle in case you do deployment and verification separately.

Expand Down

0 comments on commit 49c60d1

Please sign in to comment.