From 9462da3276aaa0cb593291238a8731b1c624589a Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Sat, 15 Jun 2024 08:56:28 +0900 Subject: [PATCH] fix: set ZETA token address from constructor argument (#151) --- .../templates/messaging/contracts/{{contractName}}.sol.hbs | 5 ++--- packages/tasks/templates/messaging/tasks/deploy.ts.hbs | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/tasks/templates/messaging/contracts/{{contractName}}.sol.hbs b/packages/tasks/templates/messaging/contracts/{{contractName}}.sol.hbs index 795806f9..abe84687 100644 --- a/packages/tasks/templates/messaging/contracts/{{contractName}}.sol.hbs +++ b/packages/tasks/templates/messaging/contracts/{{contractName}}.sol.hbs @@ -5,7 +5,6 @@ import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@zetachain/protocol-contracts/contracts/evm/tools/ZetaInteractor.sol"; import "@zetachain/protocol-contracts/contracts/evm/interfaces/ZetaInterfaces.sol"; -import "@zetachain/protocol-contracts/contracts/evm/ZetaConnector.base.sol"; {{#unless arguments.feesNative}} import "@zetachain/protocol-contracts/contracts/evm/Zeta.eth.sol"; {{/unless}} @@ -25,8 +24,8 @@ contract {{contractName}} is ZetaInteractor{{#if arguments.argsListNotEmpty}}, Z {{/if}} IERC20 internal immutable _zetaToken; - constructor(address connectorAddress{{#if arguments.feesNative}}, address zetaConsumerAddress{{/if}}) ZetaInteractor(connectorAddress) { - _zetaToken = IERC20(ZetaConnectorBase(connectorAddress).zetaToken()); + constructor(address connectorAddress, address zetaTokenAddress{{#if arguments.feesNative}}, address zetaConsumerAddress{{/if}}) ZetaInteractor(connectorAddress) { + _zetaToken = IERC20(zetaTokenAddress); {{#if arguments.feesNative}} _zetaConsumer = ZetaTokenConsumer(zetaConsumerAddress); {{/if}} diff --git a/packages/tasks/templates/messaging/tasks/deploy.ts.hbs b/packages/tasks/templates/messaging/tasks/deploy.ts.hbs index 2ddcddc3..0621a5f0 100644 --- a/packages/tasks/templates/messaging/tasks/deploy.ts.hbs +++ b/packages/tasks/templates/messaging/tasks/deploy.ts.hbs @@ -55,13 +55,14 @@ const deployContract = async ( const wallet = initWallet(hre, networkName); const connector = getAddress("connector", networkName); + const zetaToken = getAddress("zetaToken", networkName); {{#if arguments.feesNative}} const zetaTokenConsumer = getAddress("zetaTokenConsumerUniV3", networkName); {{/if}} const { abi, bytecode } = await hre.artifacts.readArtifact(contractName); const factory = new ethers.ContractFactory(abi, bytecode, wallet); - const contract = await factory.deploy(connector{{#if arguments.feesNative}}, zetaTokenConsumer{{/if}}, { gasLimit }); + const contract = await factory.deploy(connector, zetaToken{{#if arguments.feesNative}}, zetaTokenConsumer{{/if}}, { gasLimit }); await contract.deployed(); if (!json) {