-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: As a user, I want to differentiate the Attestations from each n…
…etwork
- Loading branch information
Showing
8 changed files
with
206 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ethers } from "hardhat"; | ||
import dotenv from "dotenv"; | ||
import { getChainPrefix } from "./utils"; | ||
|
||
dotenv.config({ path: "../.env" }); | ||
|
||
async function main() { | ||
console.log("Updating AttestationRegistry with the chain prefix..."); | ||
|
||
const attestationProxyAddress = process.env.ATTESTATION_REGISTRY_ADDRESS; | ||
if (!attestationProxyAddress) { | ||
throw new Error("Attestation proxy address not found"); | ||
} | ||
|
||
const attestationRegistry = await ethers.getContractAt("AttestationRegistry", attestationProxyAddress); | ||
|
||
const network = await ethers.provider.getNetwork(); | ||
const chainPrefix = getChainPrefix(network.chainId); | ||
console.log(`Chain prefix for chain ID ${network.chainId} is ${chainPrefix}`); | ||
|
||
await attestationRegistry.updateChainPrefix(chainPrefix); | ||
|
||
console.log("AttestationRegistry updated!"); | ||
} | ||
|
||
// We recommend this pattern to be able to use async/await everywhere | ||
// and properly handle errors. | ||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const getChainPrefix = (chainId: bigint): bigint => { | ||
switch (chainId) { | ||
case 59140n: // Linea testnet | ||
return 0n; | ||
case 59144n: // Linea mainnet | ||
return 0n; | ||
case 421613n: // Arbitrum testnet | ||
return 1000000000000000000000000000000000000000000000000000000000000n; | ||
case 42161n: // Arbitrum mainnet | ||
return 1000000000000000000000000000000000000000000000000000000000000n; | ||
default: | ||
throw new Error("Unknown network"); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.