Skip to content

Instantly share code, notes, and snippets.

Using network: hardhat (31337), account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 having 10000.0 of native currency, RPC url: undefined
Address of factory deployed keylessly: 0xaf45f86eb0bbf0536fa770b699b806f22496d875
expected address using await walletToUse.call(txData): 0xe32dcd55a5daee6e5a34b046f759721c76e78291
expected address using ethers.getCreate2Address: 0xE32dcD55a5daEE6E5A34b046F759721C76E78291
Now deploying TESTERC20 using factory...
TESTERC20 was deployed by 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Testing deployed contract by getting contract at address 0xe32dcd55a5daee6e5a34b046f759721c76e78291:
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 calling contract.point(): 10,5
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 calling contract.privilegedFunction(): 1
Using network: hardhat (31337), account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 having 10000.0 of native currency, RPC url: undefined
Address of Arachnid's factory deployed keylessly: 0x4e59b44847b379578588920ca78fbf26c0b4956c
expected address using await walletToUse.call(txData): 0xd8d463e3a19f1ea97e8a62670054515f3f38b740
expected address using ethers.getCreate2Address: 0xd8D463e3a19F1eA97E8A62670054515f3f38B740
Now deploying TESTERC20 using Arachnid's factory...
TESTERC20 was deployed by 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Testing deployed contract by getting contract at address 0xd8D463e3a19F1eA97E8A62670054515f3f38B740:
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 calling contract.point(): 10,5
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 calling contract.privilegedFunction(): 1
@SKYBITDev3
SKYBITDev3 / Zoltu's factory vs Arachnid's factory.js
Last active September 5, 2023 05:23
Zoltu's factory vs Arachnid's factory vs Arachnid's factory deployed via Zoltu's factory
async function main() {
const { ethers, network } = require(`hardhat`)
const [wallet1, wallet2] = await ethers.getSigners()
const walletToUse = wallet1 // switch between wallet1 & wallet2 to see the difference in addresses
console.log(`Using network: ${network.name} (${network.config.chainId}), account: ${walletToUse.address} having ${await ethers.formatUnits(await ethers.provider.getBalance(walletToUse.address), `ether`)} of native currency, RPC url: ${network.config.url}`)
let txReceipt
// Deploy Zoltu's factory
const addressOfZoltusFactory = `0x7A0D94F55792C434d74a40883C6ed8545E406D12` // See https://github.com/Zoltu/deterministic-deployment-proxy