Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
barrasso committed May 26, 2023
1 parent c6f9196 commit ec6476e
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion protocol/synthetix/contracts/interfaces/IUtilsModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
11 changes: 8 additions & 3 deletions protocol/synthetix/contracts/modules/core/UtilsModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
10 changes: 6 additions & 4 deletions protocol/synthetix/contracts/storage/Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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()', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});

Expand Down

0 comments on commit ec6476e

Please sign in to comment.