Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: core networks for osnap #2

Merged
merged 7 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ export default {
...sharedNetworkConfig,
url: `https://linea-goerli.infura.io/v3/${INFURA_KEY}`,
},
core: {
...sharedNetworkConfig,
url: "https://rpc.coredao.org",
},
coreTestnet: {
...sharedNetworkConfig,
url: "https://rpc.test.btcs.network",
},
},
namedAccounts: {
deployer: 0,
Expand All @@ -119,5 +127,23 @@ export default {
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
customChains: [
{
network: "coreTestnet",
chainId: 1115,
urls: {
apiURL: "https://api.test.btcs.network/api",
browserURL: "https://scan.test.btcs.network/",
},
},
{
network: "core",
chainId: 1116,
urls: {
apiURL: "https://openapi.coredao.org/api",
browserURL: "https://scan.coredao.org/",
},
},
],
},
};
14 changes: 14 additions & 0 deletions sdk/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export enum SupportedNetworks {
HardhatNetwork = 31337,
LineaGoerli = 59140,
Sepolia = 11155111,
CoreTestnet = 1115,
Core = 1116,
}

// const canonicalMasterCopyAddress = (contract: KnownContracts) => {
Expand Down Expand Up @@ -215,6 +217,18 @@ export const ContractVersions: Record<
},
[SupportedNetworks.LineaGoerli]: CanonicalAddresses,
[SupportedNetworks.Sepolia]: CanonicalAddresses,
[SupportedNetworks.CoreTestnet]: {
...CanonicalAddresses,
[KnownContracts.OPTIMISTIC_GOVERNOR]: {
"1.2.0": "0xD43463Fadd73373bE260b67F5825274F4403dAF0",
},
},
[SupportedNetworks.Core]: {
...CanonicalAddresses,
[KnownContracts.OPTIMISTIC_GOVERNOR]: {
"1.2.0": "0x596Fd6A5A185c67aBD1c845b39f593fBA9C233aa",
},
},
};

/** Addresses of the head versions of all contracts */
Expand Down
2 changes: 1 addition & 1 deletion sdk/factory/mastercopyDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const deployMastercopyWithInitData = async (
const initCodeHash = keccak256(initCode);

const computedTargetAddress = getCreate2Address(
await singletonFactory.address(),
await singletonFactory.getAddress(),
salt,
initCodeHash
);
Expand Down
10 changes: 6 additions & 4 deletions sdk/factory/singletonFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ export const getSingletonFactory = async (
"Singleton factory is not deployed on this chain. Deploying singleton factory..."
);
// fund the singleton factory deployer account
await signer.sendTransaction({
to: singletonDeployer,
value: parseEther("0.0247"),
});
await (
await signer.sendTransaction({
to: singletonDeployer,
value: parseEther("0.0247"),
})
).wait();

// deploy the singleton factory
await (
Expand Down
2 changes: 1 addition & 1 deletion tasks/deploy-replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const deploy = async (_: unknown, hre: HardhatRuntimeEnvironment) => {
console.log(`\n\x1B[4m\x1B[1m${hre.network.name}\x1B[0m`);

const [deployer] = await hre.ethers.getSigners();
const signer = hre.ethers.provider.getSigner(deployer.address);
const signer = await hre.ethers.provider.getSigner(deployer.address);
for (let index = 0; index < contracts.length; index++) {
const initData: InitData | undefined = MasterCopyInitData[contracts[index]];

Expand Down
2 changes: 1 addition & 1 deletion tasks/singleton-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const deploy = async (_: unknown, hre: HardhatRuntimeEnvironment) => {
}

const [deployer] = await hre.ethers.getSigners();
await deployModuleFactory(hre.ethers.provider.getSigner(deployer.address));
await deployModuleFactory(await hre.ethers.provider.getSigner(deployer.address));
};

task(
Expand Down
Loading