Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/merge-new-token-…
Browse files Browse the repository at this point in the history
…managers
  • Loading branch information
Foivos committed Mar 25, 2024
2 parents d7b0dd8 + 02708c3 commit 573569e
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 12 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Coverage

on:
pull_request:
push:
branches:
- main
- releases/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coverage:
name: Code Coverage
strategy:
matrix:
node-version:
- 18.x
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build > build.log 2>&1

- name: Check for build warnings
run: |
if grep -q -i "error" build.log || grep -q -i "warning" build.log; then
echo "Build contains following errors or warnings..."
cat build.log
exit 1
else
exit 0;
fi
- name: Generate code coverage
run: npm run coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
4 changes: 4 additions & 0 deletions .github/workflows/conventional-commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Ensure Conventional Commit message
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ensure-CC:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Linting
on:
- pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
strategy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Slither Static Analysis
on:
- pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Testing
on:
- pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
strategy:
Expand Down
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 573569e

Please sign in to comment.