Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/txfusion/sending-messages' into …
Browse files Browse the repository at this point in the history
…txfusion/sending-messages
  • Loading branch information
mortezashojaei committed Oct 15, 2024
2 parents cff1960 + 8383e95 commit 075f699
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
11 changes: 5 additions & 6 deletions typescript/sdk/src/deploy/verify/ContractVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ export class ContractVerifier {

const compilerversion = `v${buildArtifact.solcLongVersion}`;

// TODO: make it compatible with ZKSync compiler
// double check compiler version matches expected format
// const versionRegex = /v(\d.\d.\d+)\+commit.\w+/;
// const matches = versionRegex.exec(compilerversion);
// if (!matches) {
// throw new Error(`Invalid compiler version ${compilerversion}`);
// }
const versionRegex = /v(\d.\d.\d+)\+commit.\w+/;
const matches = versionRegex.exec(compilerversion);
if (!matches) {
throw new Error(`Invalid compiler version ${compilerversion}`);
}

// set compiler options
// only license type is configurable, empty if not provided
Expand Down
24 changes: 16 additions & 8 deletions typescript/sdk/src/utils/zksync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,33 @@ import {
loadAllZkArtifacts,
} from '@hyperlane-xyz/core/artifacts';

/**
* @dev Retrieves a ZkSync artifact by its contract name or qualified name.
* @param name The name of the contract or qualified name in the format "sourceName:contractName".
* @return The corresponding ZkSyncArtifact if found, or undefined if not found.
*/
export const getZKArtifactByContractName = async (
name: string,
): Promise<ZkSyncArtifact | undefined> => {
// Load all ZkSync artifacts
const allArtifacts = await loadAllZkArtifacts();

const artifact = (Object.values(allArtifacts) as ZkSyncArtifact[]).find(
// Find the artifact that matches the contract name or qualified name
const artifact = Object.values(allArtifacts).find(
({ contractName, sourceName }) => {
if (contractName.toLowerCase() === name.toLowerCase()) {
return true;
}
const lowerCaseContractName = contractName.toLowerCase();
const lowerCaseName = name.toLowerCase();

const qualifiedName = `${sourceName}:${contractName}`;
if (name === qualifiedName) {
// Check if the contract name matches
if (lowerCaseContractName === lowerCaseName) {
return true;
}

return false;
// Check if the qualified name matches
const qualifiedName = `${sourceName}:${contractName}`;
return qualifiedName === name; // Return true if qualified name matches
},
);

return artifact as any;
return artifact;
};
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7371,7 +7371,7 @@ __metadata:

"@hyperlane-xyz/core@file:../../solidity::locator=%40hyperlane-xyz%2Fsdk%40workspace%3Atypescript%2Fsdk":
version: 5.1.0
resolution: "@hyperlane-xyz/core@file:../../solidity#../../solidity::hash=06cbd9&locator=%40hyperlane-xyz%2Fsdk%40workspace%3Atypescript%2Fsdk"
resolution: "@hyperlane-xyz/core@file:../../solidity#../../solidity::hash=ec11db&locator=%40hyperlane-xyz%2Fsdk%40workspace%3Atypescript%2Fsdk"
dependencies:
"@arbitrum/nitro-contracts": "npm:^1.2.1"
"@eth-optimism/contracts": "npm:^0.6.0"
Expand All @@ -7385,7 +7385,7 @@ __metadata:
"@ethersproject/abi": "*"
"@ethersproject/providers": "*"
"@types/sinon-chai": "*"
checksum: 35d74457493971b0d55745c2d7ad4da2b707295385127d44463f78f3cca9600e586bc898797fb56136b29a6d96826b2e91c50e4660500ebd4796c1fee1c50ae9
checksum: 3a73365a7269417ff9e21de55c57fb5705354c6be31a12f256d365ef58387503a8896e7b2d68dff8577cf525a9d7ea0b2cc128a5bf2b4ec2e4b966b0e2dc98dc
languageName: node
linkType: hard

Expand Down

0 comments on commit 075f699

Please sign in to comment.