From ec6476ece506ef59f4593ba99f3f47447e613747 Mon Sep 17 00:00:00 2001 From: meb <4982406+barrasso@users.noreply.github.com> Date: Thu, 25 May 2023 20:05:14 -0400 Subject: [PATCH] fix lint --- .../contracts/interfaces/ICrossChainPoolModule.sol | 6 +++++- .../synthetix/contracts/interfaces/IUtilsModule.sol | 4 +++- .../contracts/modules/core/CrossChainPoolModule.sol | 5 +---- .../synthetix/contracts/modules/core/UtilsModule.sol | 11 ++++++++--- protocol/synthetix/contracts/storage/Pool.sol | 10 ++++++---- .../modules/core/CcipReceiverModule.test.ts | 2 +- .../modules/core/CrossChainPoolModule.test.ts | 7 ++----- .../integration/modules/core/USDTokenModule.test.ts | 2 +- .../test/integration/modules/core/VaultModule.test.ts | 1 - 9 files changed, 27 insertions(+), 21 deletions(-) diff --git a/protocol/synthetix/contracts/interfaces/ICrossChainPoolModule.sol b/protocol/synthetix/contracts/interfaces/ICrossChainPoolModule.sol index 96bb67faaf..2c2341d919 100644 --- a/protocol/synthetix/contracts/interfaces/ICrossChainPoolModule.sol +++ b/protocol/synthetix/contracts/interfaces/ICrossChainPoolModule.sol @@ -13,7 +13,11 @@ import "../storage/PoolCrossChainInfo.sol"; interface ICrossChainPoolModule is FunctionsClientInterface, AutomationCompatibleInterface { event PoolHeartbeat(uint128 poolId, PoolCrossChainSync.Data syncData); - event CrossChainSecondaryPoolCreated(uint64 srcChainId, uint128 srcPoolId, uint128 thisChainPoolId); + event CrossChainSecondaryPoolCreated( + uint64 srcChainId, + uint128 srcPoolId, + uint128 thisChainPoolId + ); function createCrossChainPool( uint128 sourcePoolId, diff --git a/protocol/synthetix/contracts/interfaces/IUtilsModule.sol b/protocol/synthetix/contracts/interfaces/IUtilsModule.sol index 44f3b3ce16..c5a90ecd14 100644 --- a/protocol/synthetix/contracts/interfaces/IUtilsModule.sol +++ b/protocol/synthetix/contracts/interfaces/IUtilsModule.sol @@ -28,7 +28,9 @@ interface IUtilsModule { * @param supportedNetworks array of all networks that are supported by the protocol * @return numRegistered the number of networks that were actually registered */ - function setSupportedCrossChainNetworks(uint64[] memory supportedNetworks) external returns (uint256 numRegistered); + function setSupportedCrossChainNetworks( + uint64[] memory supportedNetworks + ) external returns (uint256 numRegistered); /** * @notice Configure the system's single oracle manager address. diff --git a/protocol/synthetix/contracts/modules/core/CrossChainPoolModule.sol b/protocol/synthetix/contracts/modules/core/CrossChainPoolModule.sol index 8559c835f2..caddf96865 100644 --- a/protocol/synthetix/contracts/modules/core/CrossChainPoolModule.sol +++ b/protocol/synthetix/contracts/modules/core/CrossChainPoolModule.sol @@ -90,10 +90,7 @@ contract CrossChainPoolModule is ICrossChainPoolModule { // create a pool with no owner. It can only be controlled by cross chain calls from its parent pool uint128 newPoolId = Pool.getCrossChainPoolId(srcChainId, srcPoolId); - Pool.Data storage pool = Pool.create( - newPoolId, - address(0) - ); + Pool.Data storage pool = Pool.create(newPoolId, address(0)); pool.crossChain[0].pairedChains.push(srcChainId); pool.crossChain[0].pairedChains.push(uint64(block.chainid)); diff --git a/protocol/synthetix/contracts/modules/core/UtilsModule.sol b/protocol/synthetix/contracts/modules/core/UtilsModule.sol index 1315b24d40..518fcad4a6 100644 --- a/protocol/synthetix/contracts/modules/core/UtilsModule.sol +++ b/protocol/synthetix/contracts/modules/core/UtilsModule.sol @@ -51,14 +51,19 @@ contract UtilsModule is IUtilsModule { /** * @inheritdoc IUtilsModule */ - function setSupportedCrossChainNetworks(uint64[] memory supportedNetworks) external returns (uint256 numRegistered) { + function setSupportedCrossChainNetworks( + uint64[] memory supportedNetworks + ) external returns (uint256 numRegistered) { OwnableStorage.onlyOwner(); uint64 myChainId = uint64(block.chainid); CrossChain.Data storage cc = CrossChain.load(); - for (uint i = 0;i < supportedNetworks.length;i++) { - if (supportedNetworks[i] != myChainId && !cc.supportedNetworks.contains(supportedNetworks[i])) { + for (uint i = 0; i < supportedNetworks.length; i++) { + if ( + supportedNetworks[i] != myChainId && + !cc.supportedNetworks.contains(supportedNetworks[i]) + ) { numRegistered++; cc.supportedNetworks.add(supportedNetworks[i]); emit NewSupportedCrossChainNetwork(supportedNetworks[i]); diff --git a/protocol/synthetix/contracts/storage/Pool.sol b/protocol/synthetix/contracts/storage/Pool.sol index 7949bff1ea..cb0a8e7e36 100644 --- a/protocol/synthetix/contracts/storage/Pool.sol +++ b/protocol/synthetix/contracts/storage/Pool.sol @@ -521,10 +521,12 @@ library Pool { self.crossChain[0].pairedChains.push(chainId); } - function getCrossChainPoolId(uint64 srcChainId, uint128 srcPoolId) internal returns (uint128 ccPoolId) { - return uint128( - uint256(keccak256(abi.encode("SNXV3CC", srcChainId, srcPoolId))) | (1 << 127) - ); + function getCrossChainPoolId( + uint64 srcChainId, + uint128 srcPoolId + ) internal returns (uint128 ccPoolId) { + return + uint128(uint256(keccak256(abi.encode("SNXV3CC", srcChainId, srcPoolId))) | (1 << 127)); } function setCrossChainSyncData( diff --git a/protocol/synthetix/test/integration/modules/core/CcipReceiverModule.test.ts b/protocol/synthetix/test/integration/modules/core/CcipReceiverModule.test.ts index 0533c1e9b4..e09b0fd2c0 100644 --- a/protocol/synthetix/test/integration/modules/core/CcipReceiverModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/CcipReceiverModule.test.ts @@ -7,7 +7,7 @@ import { bootstrap } from '../../bootstrap'; describe('CcipReceiverModule', function () { const { signers, systems } = bootstrap(); - let owner: ethers.Signer, user1: ethers.Signer, user2: ethers.Signer, FakeCcip: ethers.Signer; + let owner: ethers.Signer, FakeCcip: ethers.Signer; before('identify signers', async () => { [owner, user1, user2, FakeCcip] = signers(); diff --git a/protocol/synthetix/test/integration/modules/core/CrossChainPoolModule.test.ts b/protocol/synthetix/test/integration/modules/core/CrossChainPoolModule.test.ts index a67a717378..6fa2270498 100644 --- a/protocol/synthetix/test/integration/modules/core/CrossChainPoolModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/CrossChainPoolModule.test.ts @@ -1,6 +1,3 @@ -import assert from 'assert/strict'; -import assertEvent from '@synthetixio/core-utils/utils/assertions/assert-event'; -import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; import { ethers } from 'ethers'; import { bootstrapWithMockMarketAndPool } from '../../bootstrap'; @@ -9,10 +6,10 @@ import { verifyUsesFeatureFlag } from '../../verifications'; describe('CrossChainPoolModule', function () { const { signers, systems } = bootstrapWithMockMarketAndPool(); - let owner: ethers.Signer, user1: ethers.Signer, user2: ethers.Signer; + let user1: ethers.Signer; before('identify signers', async () => { - [owner, user1, user2] = signers(); + [, user1] = signers(); }); describe('createCrossChainPool()', () => { diff --git a/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts b/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts index 535ba8774a..bffc84bd3a 100644 --- a/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts @@ -6,7 +6,7 @@ import { verifyUsesFeatureFlag } from '../../verifications'; import { bn, bootstrapWithStakedPool } from '../../bootstrap'; describe('USDTokenModule', function () { - const { owner, systems, staker, accountId, poolId, collateralAddress, depositAmount } = + const { owner, systems, staker, accountId, poolId, collateralAddress } = bootstrapWithStakedPool(); const usdAmount = bn(100); diff --git a/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts b/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts index ca91edb082..e25fd39995 100644 --- a/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts @@ -795,7 +795,6 @@ describe('VaultModule', function () { before(restoreDebtCheck); before('cause debt', async () => { // for cross chain we have to set the debt on cross chain sync data beause the market is not read directly - const now = await getTime(provider()); await systems().Core.Pool_distributeDebtToVaults(poolId, depositAmount.div(10)); });