Skip to content

Commit 6315bbb

Browse files
viraj124DefiCake
andauthored
feat: add TS linting check in CI (#350)
- fixes existing ts linting errors - closes #346 --------- Co-authored-by: Mad <46090742+DefiCake@users.noreply.github.com>
1 parent 9399453 commit 6315bbb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+203
-173
lines changed

.changeset/small-singers-attend.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@fuel-bridge/solidity-contracts': patch
3+
'@fuel-bridge/test-utils': patch
4+
---
5+
6+
ts linting for test packages

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
**/typechain/
55
docker/l1-chain/hardhat
66
dist
7+
**/exports/

packages/integration-tests/tests/bridge_erc20.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ describe('Bridging ERC20 tokens', async function () {
642642

643643
it('Rate limit parameters are updated when current withdrawn amount is more than the new limit & set a new higher limit', async () => {
644644
const deployer = await env.eth.deployer;
645-
let newRateLimit = '5';
645+
const newRateLimit = '5';
646646

647647
let withdrawnAmountBeforeReset =
648648
await env.eth.fuelERC20Gateway.currentPeriodAmount(

packages/integration-tests/tests/bridge_mainnet_tokens.ts

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import type { BridgeFungibleToken } from '@fuel-bridge/fungible-token';
22
import {
33
RATE_LIMIT_AMOUNT,
44
RATE_LIMIT_DURATION,
5+
USDT_ADDRESS,
6+
USDC_ADDRESS,
7+
WBTC_ADDRESS,
8+
WETH_ADDRESS,
59
} from '@fuel-bridge/solidity-contracts/protocol/constants';
6-
import {
10+
import type {
711
CustomToken,
812
CustomTokenWETH,
13+
} from '@fuel-bridge/solidity-contracts/typechain';
14+
import {
915
CustomToken__factory,
1016
CustomTokenWETH__factory,
1117
} from '@fuel-bridge/solidity-contracts/typechain';
12-
import {
13-
USDT_ADDRESS,
14-
USDC_ADDRESS,
15-
WBTC_ADDRESS,
16-
WETH_ADDRESS,
17-
} from '@fuel-bridge/solidity-contracts/protocol/constants';
1818
import type { TestEnvironment } from '@fuel-bridge/test-utils';
1919
import {
2020
setupEnvironment,
@@ -89,8 +89,7 @@ describe('Bridge mainnet tokens', function () {
8989
fuel_AssetId
9090
);
9191

92-
let transactionRequest;
93-
transactionRequest = await fuel_bridge.functions
92+
const transactionRequest = await fuel_bridge.functions
9493
.withdraw(paddedAddress)
9594
.addContracts([fuel_bridge, fuel_bridgeImpl])
9695
.txParams({
@@ -232,7 +231,6 @@ describe('Bridge mainnet tokens', function () {
232231
const NUM_TOKENS = 100000000000000000000n;
233232
let ethereumTokenSender: Signer;
234233
let ethereumTokenSenderAddress: string;
235-
let ethereumTokenSenderBalance: bigint;
236234
let fuelTokenReceiver: FuelWallet;
237235
let fuelTokenReceiverAddress: string;
238236
let fuelTokenReceiverBalance: BN;
@@ -247,20 +245,12 @@ describe('Bridge mainnet tokens', function () {
247245
await weth_testToken
248246
.connect(ethereumTokenSender)
249247
.deposit({ value: NUM_TOKENS });
250-
251-
ethereumTokenSenderBalance = await weth_testToken.balanceOf(
252-
ethereumTokenSenderAddress
253-
);
254248
} else {
255249
const mintAmount =
256250
BigInt(NUM_TOKENS) / 10n ** (18n - decimals[index]);
257251
await customToken
258252
.mint(ethereumTokenSender, mintAmount)
259253
.then((tx) => tx.wait());
260-
261-
ethereumTokenSenderBalance = await customToken.balanceOf(
262-
ethereumTokenSenderAddress
263-
);
264254
}
265255

266256
fuelTokenReceiver = env.fuel.signers[0];
@@ -302,10 +292,10 @@ describe('Bridge mainnet tokens', function () {
302292

303293
fuelTokenMessageNonce = new BN(event.args.nonce.toString());
304294

305-
let newSenderBalance;
306-
307295
// check that the sender balance has decreased by the expected amount
308-
newSenderBalance = await token.balanceOf(ethereumTokenSenderAddress);
296+
const newSenderBalance = await token.balanceOf(
297+
ethereumTokenSenderAddress
298+
);
309299

310300
expect(newSenderBalance === 0n).to.be.true;
311301
});
@@ -315,15 +305,15 @@ describe('Bridge mainnet tokens', function () {
315305
this.timeout(FUEL_MESSAGE_TIMEOUT_MS);
316306

317307
// relay the message ourselves
318-
let message = await waitForMessage(
308+
const message = await waitForMessage(
319309
env.fuel.provider,
320310
fuelTokenMessageReceiver,
321311
fuelTokenMessageNonce,
322312
FUEL_MESSAGE_TIMEOUT_MS
323313
);
324314
expect(message).to.not.be.null;
325315

326-
let tx = await relayCommonMessage(env.fuel.deployer, message, {
316+
const tx = await relayCommonMessage(env.fuel.deployer, message, {
327317
gasLimit: 30000000,
328318
maturity: undefined,
329319
contractIds: [fuel_bridgeImpl.id.toHexString()],

packages/integration-tests/tests/bridge_proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import type { Proxy } from '@fuel-bridge/fungible-token';
12
import type { TestEnvironment } from '@fuel-bridge/test-utils';
23
import { setupEnvironment, getOrDeployL2Bridge } from '@fuel-bridge/test-utils';
34
import chai from 'chai';
45
import type { Contract, FuelError } from 'fuels';
5-
import { Proxy } from '@fuel-bridge/fungible-token';
66

77
const { expect } = chai;
88

packages/integration-tests/tests/transfer_eth.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import type { TestEnvironment } from '@fuel-bridge/test-utils';
12
import {
2-
TestEnvironment,
33
setupEnvironment,
44
fuels_parseEther,
55
createRelayMessageParams,
@@ -14,9 +14,8 @@ import {
1414
hardhatSkipTime,
1515
} from '@fuel-bridge/test-utils';
1616
import chai from 'chai';
17-
import type { Signer } from 'ethers';
1817
import { parseEther } from 'ethers';
19-
import type { JsonRpcProvider } from 'ethers';
18+
import type { Signer, JsonRpcProvider } from 'ethers';
2019
import { Address, BN, padFirst12BytesOfEvmAddress } from 'fuels';
2120
import type {
2221
AbstractAddress,
@@ -264,6 +263,8 @@ describe('Transferring ETH', async function () {
264263
// withdraw ETH back to the base chain
265264
const blocksPerCommitInterval =
266265
await env.eth.fuelChainState.BLOCKS_PER_COMMIT_INTERVAL();
266+
267+
// eslint-disable-next-line no-constant-condition
267268
while (true) {
268269
const currentBlock = await env.fuel.provider.getBlockNumber();
269270
debug(`Current block ${currentBlock.toString()}`);
@@ -349,7 +350,7 @@ describe('Transferring ETH', async function () {
349350
});
350351

351352
describe('ETH Withdrawls based on rate limit updates', async () => {
352-
let NUM_ETH = '9';
353+
const NUM_ETH = '9';
353354
const largeRateLimit = `30`;
354355
let fuelETHSender: FuelWallet;
355356
let ethereumETHReceiver: Signer;

packages/solidity-contracts/deploy/hardhat/008.set_canonical_token_bytecode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
22
import type { DeployFunction } from 'hardhat-deploy/dist/types';
3+
34
import {
45
USDT_ADDRESS,
56
USDC_ADDRESS,

packages/solidity-contracts/deploy/mainnet/002.fuel_message_portal_v3.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { MaxUint256 } from 'ethers';
22
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
33
import type { DeployFunction } from 'hardhat-deploy/dist/types';
44

5-
import { FuelMessagePortalV3__factory as FuelMessagePortal } from '../../typechain';
6-
75
import {
86
RATE_LIMIT_AMOUNT,
97
RATE_LIMIT_DURATION,
108
} from '../../protocol/constants';
9+
import { FuelMessagePortalV3__factory as FuelMessagePortal } from '../../typechain';
1110

1211
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1312
const {

packages/solidity-contracts/deploy/mainnet/009.gateway_add_usdc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { parseUnits } from 'ethers';
12
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
23
import type { DeployFunction } from 'hardhat-deploy/dist/types';
3-
import { parseUnits } from 'ethers';
44

55
const USDC_ADDRESS = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
66

packages/solidity-contracts/deploy/mainnet/010.gateway_rate_limit_usdc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { parseUnits } from 'ethers';
12
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
23
import type { DeployFunction } from 'hardhat-deploy/dist/types';
3-
import { parseUnits } from 'ethers';
44

55
const USDC_ADDRESS = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
66
const ONE_WEEK_IN_SECONDS = 3600 * 24 * 7;

0 commit comments

Comments
 (0)