Skip to content

Commit

Permalink
refactor(messaging): fetch zeta token address from connector (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev authored May 13, 2024
1 parent 424f64b commit 1b8b21c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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}}
Expand All @@ -24,8 +25,8 @@ contract {{contractName}} is ZetaInteractor{{#if arguments.argsListNotEmpty}}, Z
{{/if}}
IERC20 internal immutable _zetaToken;

constructor(address connectorAddress, address zetaTokenAddress{{#if arguments.feesNative}}, address zetaConsumerAddress{{/if}}) ZetaInteractor(connectorAddress) {
_zetaToken = IERC20(zetaTokenAddress);
constructor(address connectorAddress{{#if arguments.feesNative}}, address zetaConsumerAddress{{/if}}) ZetaInteractor(connectorAddress) {
_zetaToken = IERC20(ZetaConnectorBase(connectorAddress).zetaToken());
{{#if arguments.feesNative}}
_zetaConsumer = ZetaTokenConsumer(zetaConsumerAddress);
{{/if}}
Expand Down
3 changes: 1 addition & 2 deletions packages/tasks/templates/messaging/tasks/deploy.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ 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, zetaToken{{#if arguments.feesNative}}, zetaTokenConsumer{{/if}}, { gasLimit });
const contract = await factory.deploy(connector{{#if arguments.feesNative}}, zetaTokenConsumer{{/if}}, { gasLimit });

await contract.deployed();
if (!json) {
Expand Down

0 comments on commit 1b8b21c

Please sign in to comment.