Skip to content

Commit

Permalink
use final 6551 registry address
Browse files Browse the repository at this point in the history
  • Loading branch information
jfschwarz committed Nov 16, 2023
1 parent 41f381b commit 6217577
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
26 changes: 15 additions & 11 deletions deploy/00_deploy_ERC6551Registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { deployMastercopy } from "../sdk"
import {
DEFAULT_SALT,
ERC2470_SINGLETON_FACTORY_ADDRESS,
ERC6551_REGISTRY_ADDRESS,
} from "../sdk/src/constants"

const deployERC6551Registry: DeployFunction = async (hre) => {
Expand All @@ -31,25 +32,28 @@ const deployERC6551Registry: DeployFunction = async (hre) => {
}),
chain,
})
const ERC6551Registry = await hre.ethers.getContractFactory("ERC6551Registry")
const bytecode = ERC6551Registry.bytecode as `0x${string}`

// TODO: use Nick's factory 0x4e59b44847b379578588920ca78fbf26c0b4956c and 6551 salt rather than ERC2470
const expectedAddress = getCreate2Address({
bytecode,
from: ERC2470_SINGLETON_FACTORY_ADDRESS,
salt: DEFAULT_SALT,
})
const expectedAddress = ERC6551_REGISTRY_ADDRESS

const NICKS_FACTORY_ADDRESS = "0x4e59b44847b379578588920ca78fbf26c0b4956c"

if (
await deployerClient
.extend(publicActions)
.getBytecode({ address: expectedAddress })
) {
console.log(` ✔ Contract is already deployed at ${expectedAddress}`)
console.log(
` ✔ ERC6551 registry contract is already deployed at ${expectedAddress}`
)
} else {
await deployMastercopy(deployerClient, bytecode)
console.log(` ✔ Contract deployed at ${expectedAddress}`)
const hash = await deployerClient.sendTransaction({
to: NICKS_FACTORY_ADDRESS,
value: BigInt(0),
data: "0x0000000000000000000000000000000000000000fd8eb4e1dca713016c518e31608060405234801561001057600080fd5b5061023b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063246a00211461003b5780638a54c52f1461006a575b600080fd5b61004e6100493660046101b7565b61007d565b6040516001600160a01b03909116815260200160405180910390f35b61004e6100783660046101b7565b6100e1565b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b60015284601552605560002060601b60601c60005260206000f35b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b600152846015526055600020803b61018b578560b760556000f580610157576320188a596000526004601cfd5b80606c52508284887f79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf887226060606ca46020606cf35b8060601b60601c60005260206000f35b80356001600160a01b03811681146101b257600080fd5b919050565b600080600080600060a086880312156101cf57600080fd5b6101d88661019b565b945060208601359350604086013592506101f46060870161019b565b94979396509194608001359291505056fea2646970667358221220ea2fe53af507453c64dd7c1db05549fa47a298dfb825d6d11e1689856135f16764736f6c63430008110033",
})
console.log(
` ✔ ERC6551 registry contract deployed at ${expectedAddress} (tx hash: ${hash})`
)
}

try {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const MECH_FACTORY_ADDRESS =
"0x000000000000000000000000000000000000eeee" as const // TODO get MechFactory deployed to a nice vanity address

export const ERC6551_REGISTRY_ADDRESS =
"0x51aD9b7E1C9c3b208c72cB3cF44B9aA24Ecf9477" as const
"0x000000006551c19487814612e58FE06813775758" as const

export const ERC2470_SINGLETON_FACTORY_ADDRESS =
"0xce0042b868300000d44a59004da54a005ffdcf9f" as const
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19994,11 +19994,11 @@ __metadata:

"typescript@patch:typescript@^5.2.2#~builtin<compat/typescript>":
version: 5.2.2
resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin<compat/typescript>::version=5.2.2&hash=14eedb"
resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin<compat/typescript>::version=5.2.2&hash=f3b441"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 07106822b4305de3f22835cbba949a2b35451cad50888759b6818421290ff95d522b38ef7919e70fb381c5fe9c1c643d7dea22c8b31652a717ddbd57b7f4d554
checksum: 0f4da2f15e6f1245e49db15801dbee52f2bbfb267e1c39225afdab5afee1a72839cd86000e65ee9d7e4dfaff12239d28beaf5ee431357fcced15fb08583d72ca
languageName: node
linkType: hard

Expand Down

0 comments on commit 6217577

Please sign in to comment.