Skip to content

Commit

Permalink
Network.ts - script hangs when reassigning w/ ContractFactory::deploy
Browse files Browse the repository at this point in the history
Local bridging script hangs indefinitely while waiting for the `InterchainTokenFactoryContract` deployment. 

This is likely due to the fact that the `ethersJS::Contract::deployed()` method is invoked twice for the same variable, `implementation`.  EthersJS seems to get confused when using 
`let implementation = await deployContract(<InterchainTokenServiceContract>)`
and then reassigning like so:
`implementation = await deployContract(<InterchainTokenFactoryContract>)`
since `deployContract()` calls `await contract.deployed()`

Using a single const variable for each contract returned by `deployContract()` resolved the issue, as made in this PR
  • Loading branch information
robriks authored Aug 6, 2024
1 parent c5e02a6 commit 92c7760
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/axelar-local-dev/src/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class Network {
const tokenHandler = await deployContract(wallet, TokenHandler, []);
const interchainTokenFactoryAddress = await this.create3Deployer.deployedAddress('0x', wallet.address, factorySalt);

let implementation = await deployContract(wallet, InterchainTokenServiceContract, [
const tokenServiceImplementation = await deployContract(wallet, InterchainTokenServiceContract, [
tokenManagerDeployer.address,
interchainTokenDeployer.address,
this.gateway.address,
Expand All @@ -250,16 +250,16 @@ export class Network {
]);
const factory = new ContractFactory(InterchainProxy.abi, InterchainProxy.bytecode);
let bytecode = factory.getDeployTransaction(
implementation.address,
tokenServiceImplementation.address,
wallet.address,
defaultAbiCoder.encode(['address', 'string', 'string[]', 'string[]'], [wallet.address, this.name, [], []])
).data;
await this.create3Deployer.connect(wallet).deploy(bytecode, deploymentSalt);
this.interchainTokenService = InterchainTokenServiceFactory.connect(interchainTokenServiceAddress, wallet);

implementation = await deployContract(wallet, InterchainTokenFactoryContract, [interchainTokenServiceAddress]);
const tokenFactoryImplementation = await deployContract(wallet, InterchainTokenFactoryContract, [interchainTokenServiceAddress]);

bytecode = factory.getDeployTransaction(implementation.address, wallet.address, '0x').data;
bytecode = factory.getDeployTransaction(tokenFactoryImplementation.address, wallet.address, '0x').data;

await this.create3Deployer.connect(wallet).deploy(bytecode, factorySalt);
this.interchainTokenFactory = InterchainTokenFactoryFactory.connect(interchainTokenFactoryAddress, wallet);
Expand Down

0 comments on commit 92c7760

Please sign in to comment.