@hyperlane-xyz/sdk
Version:
The official SDK for the Hyperlane Network
44 lines • 2.08 kB
JavaScript
import { rootLogger } from '@hyperlane-xyz/utils';
import { attachContracts } from '../contracts/contracts.js';
import { isStaticDeploymentSupported } from '../ism/utils.js';
import { HyperlaneDeployer } from './HyperlaneDeployer.js';
import { proxyFactoryFactories, proxyFactoryImplementations, } from './contracts.js';
import { createDefaultProxyFactoryFactories } from './proxyFactoryUtils.js';
export class HyperlaneProxyFactoryDeployer extends HyperlaneDeployer {
constructor(multiProvider, contractVerifier, concurrentDeploy = false) {
super(multiProvider, proxyFactoryFactories, {
logger: rootLogger.child({ module: 'IsmFactoryDeployer' }),
contractVerifier,
concurrentDeploy,
});
}
async deployContracts(chain) {
const contracts = {};
const technicalStack = this.multiProvider.getChainMetadata(chain).technicalStack;
// Check if we should skip static address set deployment
if (!isStaticDeploymentSupported(technicalStack)) {
const addresses = createDefaultProxyFactoryFactories();
return attachContracts(addresses, this.factories);
}
for (const factoryName of Object.keys(this.factories)) {
const factory = await this.deployContract(chain, factoryName, []);
try {
const artifact = {
name: proxyFactoryImplementations[factoryName],
address: await factory.implementation(),
constructorArguments: '',
isProxy: true,
};
await this.verifyContract(chain, artifact);
this.addVerificationArtifacts(chain, [artifact]);
}
catch (error) {
this.logger.warn(`Failed to verify ${factoryName} on ${chain}:`, error);
// Continue deployment even if verification fails
}
contracts[factoryName] = factory;
}
return contracts;
}
}
//# sourceMappingURL=HyperlaneProxyFactoryDeployer.js.map