Skip to content

Commit

Permalink
fix(factory): remove unused using directives (#254)
Browse files Browse the repository at this point in the history
* fix(factory): remove unused using directives

* remove more unused

* add InterchainToken bytecode check

* update test
  • Loading branch information
milapsheth authored Mar 21, 2024
1 parent 7efdc45 commit 02708c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
5 changes: 0 additions & 5 deletions contracts/InterchainTokenFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
pragma solidity ^0.8.0;

import { AddressBytes } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/AddressBytes.sol';
import { SafeTokenTransfer, SafeTokenTransferFrom, SafeTokenCall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeTransfer.sol';
import { Multicall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/Multicall.sol';
import { Upgradable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Upgradable.sol';
import { IAxelarGateway } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol';
Expand All @@ -19,11 +18,7 @@ import { IInterchainToken } from './interfaces/IInterchainToken.sol';
* @notice This contract is responsible for deploying new interchain tokens and managing their token managers.
*/
contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, Multicall, Upgradable {
using AddressBytes for bytes;
using AddressBytes for address;
using SafeTokenTransfer for IInterchainToken;
using SafeTokenTransferFrom for IInterchainToken;
using SafeTokenCall for IInterchainToken;

IInterchainTokenService public immutable interchainTokenService;
bytes32 public immutable chainNameHash;
Expand Down
6 changes: 0 additions & 6 deletions contracts/InterchainTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { IAxelarGateway } from '@axelar-network/axelar-gmp-sdk-solidity/contract
import { ExpressExecutorTracker } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/express/ExpressExecutorTracker.sol';
import { Upgradable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Upgradable.sol';
import { Create3Address } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/deploy/Create3Address.sol';
import { SafeTokenTransferFrom, SafeTokenCall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeTransfer.sol';
import { AddressBytes } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/AddressBytes.sol';
import { StringToBytes32, Bytes32ToString } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/Bytes32String.sol';
import { Multicall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/Multicall.sol';
import { Pausable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/Pausable.sol';
import { InterchainAddressTracker } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/InterchainAddressTracker.sol';
Expand Down Expand Up @@ -44,12 +42,8 @@ contract InterchainTokenService is
InterchainAddressTracker,
IInterchainTokenService
{
using StringToBytes32 for string;
using Bytes32ToString for bytes32;
using AddressBytes for bytes;
using AddressBytes for address;
using SafeTokenTransferFrom for IERC20;
using SafeTokenCall for IERC20;

IAxelarGateway public immutable gateway;
IAxelarGasService public immutable gasService;
Expand Down
17 changes: 16 additions & 1 deletion test/InterchainToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ const { ethers } = require('hardhat');
const {
constants: { AddressZero, HashZero, MaxUint256 },
getContractAt,
utils: { keccak256 },
} = ethers;
const { expect } = require('chai');
const { getRandomBytes32, expectRevert } = require('./utils');
const { getRandomBytes32, expectRevert, getEVMVersion } = require('./utils');
const { deployContract } = require('../scripts/deploy');

describe('InterchainToken', () => {
Expand Down Expand Up @@ -138,4 +139,18 @@ describe('InterchainToken', () => {
expect(finalAllowance).to.eq(initialAllowance);
});
});

describe('Bytecode checks [ @skip-on-coverage ]', () => {
it('Should preserve the same bytecode', async () => {
const contract = await ethers.getContractFactory('InterchainToken', owner);
const contractBytecode = contract.bytecode;
const contractBytecodeHash = keccak256(contractBytecode);

const expected = {
london: '0xa01cf28b0b6ce6dc3b466e995585d69486400d671fce0ea8d06beba583e6f3bb',
}[getEVMVersion()];

expect(contractBytecodeHash).to.be.equal(expected);
});
});
});

0 comments on commit 02708c3

Please sign in to comment.