diff --git a/docs/CircleBridgeFacet.md b/archive/docs/CircleBridgeFacet.md similarity index 100% rename from docs/CircleBridgeFacet.md rename to archive/docs/CircleBridgeFacet.md diff --git a/script/deploy/facets/DeployCircleBridgeFacet.s.sol b/archive/scripts/Deploy/DeployCircleBridgeFacet.s.sol similarity index 100% rename from script/deploy/facets/DeployCircleBridgeFacet.s.sol rename to archive/scripts/Deploy/DeployCircleBridgeFacet.s.sol diff --git a/archive/scripts/DeployDeBridgeDlnFacet.s.sol b/archive/scripts/Deploy/DeployDeBridgeDlnFacet.s.sol similarity index 100% rename from archive/scripts/DeployDeBridgeDlnFacet.s.sol rename to archive/scripts/Deploy/DeployDeBridgeDlnFacet.s.sol diff --git a/archive/scripts/DeployDeBridgeFacet.s.sol b/archive/scripts/Deploy/DeployDeBridgeFacet.s.sol similarity index 100% rename from archive/scripts/DeployDeBridgeFacet.s.sol rename to archive/scripts/Deploy/DeployDeBridgeFacet.s.sol diff --git a/script/deploy/facets/DeployGasRebateDistributor.s.sol b/archive/scripts/Deploy/DeployGasRebateDistributor.s.sol similarity index 100% rename from script/deploy/facets/DeployGasRebateDistributor.s.sol rename to archive/scripts/Deploy/DeployGasRebateDistributor.s.sol diff --git a/script/deploy/facets/DeployGnosisBridgeL2Facet.s.sol b/archive/scripts/Deploy/DeployGnosisBridgeL2Facet.s.sol similarity index 100% rename from script/deploy/facets/DeployGnosisBridgeL2Facet.s.sol rename to archive/scripts/Deploy/DeployGnosisBridgeL2Facet.s.sol diff --git a/archive/scripts/DeployLiFiDiamondImmutable.s.sol b/archive/scripts/Deploy/DeployLiFiDiamondImmutable.s.sol similarity index 100% rename from archive/scripts/DeployLiFiDiamondImmutable.s.sol rename to archive/scripts/Deploy/DeployLiFiDiamondImmutable.s.sol diff --git a/archive/scripts/DeployMakerTeleportFacet.s.sol b/archive/scripts/Deploy/DeployMakerTeleportFacet.s.sol similarity index 100% rename from archive/scripts/DeployMakerTeleportFacet.s.sol rename to archive/scripts/Deploy/DeployMakerTeleportFacet.s.sol diff --git a/archive/scripts/DeployMultichainFacet.s.sol b/archive/scripts/Deploy/DeployMultichainFacet.s.sol similarity index 100% rename from archive/scripts/DeployMultichainFacet.s.sol rename to archive/scripts/Deploy/DeployMultichainFacet.s.sol diff --git a/script/deploy/facets/DeployNonStandardSelectorsRegistryFacet.s.sol b/archive/scripts/Deploy/DeployNonStandardSelectorsRegistryFacet.s.sol similarity index 100% rename from script/deploy/facets/DeployNonStandardSelectorsRegistryFacet.s.sol rename to archive/scripts/Deploy/DeployNonStandardSelectorsRegistryFacet.s.sol diff --git a/script/deploy/facets/DeployServiceFeeCollector.s.sol b/archive/scripts/Deploy/DeployServiceFeeCollector.s.sol similarity index 100% rename from script/deploy/facets/DeployServiceFeeCollector.s.sol rename to archive/scripts/Deploy/DeployServiceFeeCollector.s.sol diff --git a/archive/scripts/DeploySynapseBridgeFacet.s.sol b/archive/scripts/Deploy/DeploySynapseBridgeFacet.s.sol similarity index 100% rename from archive/scripts/DeploySynapseBridgeFacet.s.sol rename to archive/scripts/Deploy/DeploySynapseBridgeFacet.s.sol diff --git a/script/deploy/facets/UpdateCircleBridgeFacet.s.sol b/archive/scripts/Deploy/UpdateCircleBridgeFacet.s.sol similarity index 100% rename from script/deploy/facets/UpdateCircleBridgeFacet.s.sol rename to archive/scripts/Deploy/UpdateCircleBridgeFacet.s.sol diff --git a/archive/scripts/UpdateDeBridgeDlnFacet.s.sol b/archive/scripts/Deploy/UpdateDeBridgeDlnFacet.s.sol similarity index 100% rename from archive/scripts/UpdateDeBridgeDlnFacet.s.sol rename to archive/scripts/Deploy/UpdateDeBridgeDlnFacet.s.sol diff --git a/archive/scripts/UpdateDeBridgeFacet.s.sol b/archive/scripts/Deploy/UpdateDeBridgeFacet.s.sol similarity index 100% rename from archive/scripts/UpdateDeBridgeFacet.s.sol rename to archive/scripts/Deploy/UpdateDeBridgeFacet.s.sol diff --git a/script/deploy/facets/UpdateGnosisBridgeL2Facet.s.sol b/archive/scripts/Deploy/UpdateGnosisBridgeL2Facet.s.sol similarity index 100% rename from script/deploy/facets/UpdateGnosisBridgeL2Facet.s.sol rename to archive/scripts/Deploy/UpdateGnosisBridgeL2Facet.s.sol diff --git a/archive/scripts/UpdateMakerTeleportFacet.s.sol b/archive/scripts/Deploy/UpdateMakerTeleportFacet.s.sol similarity index 100% rename from archive/scripts/UpdateMakerTeleportFacet.s.sol rename to archive/scripts/Deploy/UpdateMakerTeleportFacet.s.sol diff --git a/archive/scripts/UpdateMultichainFacet.s.sol b/archive/scripts/Deploy/UpdateMultichainFacet.s.sol similarity index 100% rename from archive/scripts/UpdateMultichainFacet.s.sol rename to archive/scripts/Deploy/UpdateMultichainFacet.s.sol diff --git a/script/deploy/facets/UpdateNonStandardSelectorsRegistryFacet.sol b/archive/scripts/Deploy/UpdateNonStandardSelectorsRegistryFacet.sol similarity index 100% rename from script/deploy/facets/UpdateNonStandardSelectorsRegistryFacet.sol rename to archive/scripts/Deploy/UpdateNonStandardSelectorsRegistryFacet.sol diff --git a/archive/scripts/UpdateSynapseBridgeFacet.s.sol b/archive/scripts/Deploy/UpdateSynapseBridgeFacet.s.sol similarity index 100% rename from archive/scripts/UpdateSynapseBridgeFacet.s.sol rename to archive/scripts/Deploy/UpdateSynapseBridgeFacet.s.sol diff --git a/script/deploy/zksync/008_deploy_service_fee_collector.ts b/archive/scripts/Deploy/zkSync/008_deploy_service_fee_collector.ts similarity index 91% rename from script/deploy/zksync/008_deploy_service_fee_collector.ts rename to archive/scripts/Deploy/zkSync/008_deploy_service_fee_collector.ts index a67d938e4..bbec888d9 100644 --- a/script/deploy/zksync/008_deploy_service_fee_collector.ts +++ b/archive/scripts/Deploy/zkSync/008_deploy_service_fee_collector.ts @@ -1,13 +1,13 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' import { DeployFunction } from 'hardhat-deploy/types' import { ethers, network } from 'hardhat' -import { PeripheryRegistryFacet } from '../../../typechain' +import { PeripheryRegistryFacet } from '../../../../typechain' import { diamondContractName, updateDeploymentLogs, verifyContract, -} from './9999_utils' -import globalConfig from '../../../config/global.json' +} from '../../../../script/deploy/zksync/9999_utils' +import globalConfig from '../../../../config/global.json' const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Protect against unwanted redeployments diff --git a/script/tasks/solidity/AcceptOwnershipTransferPeriphery.s.sol b/archive/scripts/Tasks/AcceptOwnershipTransferPeriphery.s.sol similarity index 100% rename from script/tasks/solidity/AcceptOwnershipTransferPeriphery.s.sol rename to archive/scripts/Tasks/AcceptOwnershipTransferPeriphery.s.sol diff --git a/archive/scripts/AddRoutersAndTokenForMultichain.s.sol b/archive/scripts/Tasks/AddRoutersAndTokenForMultichain.s.sol similarity index 100% rename from archive/scripts/AddRoutersAndTokenForMultichain.s.sol rename to archive/scripts/Tasks/AddRoutersAndTokenForMultichain.s.sol diff --git a/script/tasks/solidity/MakeLiFiDiamondImmutable.s.sol b/archive/scripts/Tasks/MakeLiFiDiamondImmutable.s.sol similarity index 100% rename from script/tasks/solidity/MakeLiFiDiamondImmutable.s.sol rename to archive/scripts/Tasks/MakeLiFiDiamondImmutable.s.sol diff --git a/script/tasks/solidity/RemoveUnusableSelectorsFromImmutableDiamond.s.sol b/archive/scripts/Tasks/RemoveUnusableSelectorsFromImmutableDiamond.s.sol similarity index 100% rename from script/tasks/solidity/RemoveUnusableSelectorsFromImmutableDiamond.s.sol rename to archive/scripts/Tasks/RemoveUnusableSelectorsFromImmutableDiamond.s.sol diff --git a/script/tasks/solidity/TransferOwnershipOfPeripheryContractsForImmutable.s.sol b/archive/scripts/Tasks/TransferOwnershipOfPeripheryContractsForImmutable.s.sol similarity index 100% rename from script/tasks/solidity/TransferOwnershipOfPeripheryContractsForImmutable.s.sol rename to archive/scripts/Tasks/TransferOwnershipOfPeripheryContractsForImmutable.s.sol diff --git a/archive/scripts/diamondMakeImmutable.sh b/archive/scripts/Tasks/diamondMakeImmutable.sh similarity index 100% rename from archive/scripts/diamondMakeImmutable.sh rename to archive/scripts/Tasks/diamondMakeImmutable.sh diff --git a/archive/src/DeBridgeDlnFacet.sol b/archive/src/DeBridgeDlnFacet.sol deleted file mode 100644 index 3545d5cdc..000000000 --- a/archive/src/DeBridgeDlnFacet.sol +++ /dev/null @@ -1,172 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.17; - -import { ILiFi } from "../Interfaces/ILiFi.sol"; -import { LibDiamond } from "../Libraries/LibDiamond.sol"; -import { LibAsset, IERC20 } from "../Libraries/LibAsset.sol"; -import { LibSwap } from "../Libraries/LibSwap.sol"; -import { ReentrancyGuard } from "../Helpers/ReentrancyGuard.sol"; -import { SwapperV2 } from "../Helpers/SwapperV2.sol"; -import { Validatable } from "../Helpers/Validatable.sol"; -import { IDlnSource } from "../Interfaces/IDlnSource.sol"; - -/// @title DeBridgeDLN Facet -/// @author LI.FI (https://li.fi) -/// @notice Provides functionality for bridging through DeBridge DLN -/// @custom:version 1.0.0 -contract DeBridgeDlnFacet is ILiFi, ReentrancyGuard, SwapperV2, Validatable { - /// Storage /// - - address internal constant NON_EVM_ADDRESS = - 0x11f111f111f111F111f111f111F111f111f111F1; - IDlnSource public immutable dlnSource; - - /// Types /// - - /// @param receivingAssetId The address of the asset to receive - /// @param receiver The address of the receiver - /// @param minAmountOut The minimum amount to receive on the destination chain - struct DeBridgeDlnData { - bytes receivingAssetId; - bytes receiver; - uint256 minAmountOut; - } - - /// Events /// - - event DlnOrderCreated(bytes32 indexed orderId); - - event BridgeToNonEVMChain( - bytes32 indexed transactionId, - uint256 indexed destinationChainId, - bytes receiver - ); - - /// Constructor /// - - /// @notice Constructor for the contract. - /// @param _dlnSource The address of the DLN order creation contract - constructor(IDlnSource _dlnSource) { - dlnSource = _dlnSource; - } - - /// External Methods /// - - /// @notice Bridges tokens via DeBridgeDLN - /// @param _bridgeData The core information needed for bridging - /// @param _deBridgeDlnData Data specific to DeBridgeDLN - function startBridgeTokensViaDeBridgeDln( - ILiFi.BridgeData memory _bridgeData, - DeBridgeDlnData calldata _deBridgeDlnData - ) - external - payable - nonReentrant - refundExcessNative(payable(msg.sender)) - validateBridgeData(_bridgeData) - doesNotContainSourceSwaps(_bridgeData) - doesNotContainDestinationCalls(_bridgeData) - { - LibAsset.depositAsset( - _bridgeData.sendingAssetId, - _bridgeData.minAmount - ); - _startBridge( - _bridgeData, - _deBridgeDlnData, - dlnSource.globalFixedNativeFee() - ); - } - - /// @notice Performs a swap before bridging via DeBridgeDLN - /// @param _bridgeData The core information needed for bridging - /// @param _swapData An array of swap related data for performing swaps before bridging - /// @param _deBridgeDlnData Data specific to DeBridgeDLN - function swapAndStartBridgeTokensViaDeBridgeDln( - ILiFi.BridgeData memory _bridgeData, - LibSwap.SwapData[] calldata _swapData, - DeBridgeDlnData calldata _deBridgeDlnData - ) - external - payable - nonReentrant - refundExcessNative(payable(msg.sender)) - containsSourceSwaps(_bridgeData) - doesNotContainDestinationCalls(_bridgeData) - validateBridgeData(_bridgeData) - { - uint256 fee = dlnSource.globalFixedNativeFee(); - address assetId = _bridgeData.sendingAssetId; - _bridgeData.minAmount = _depositAndSwap( - _bridgeData.transactionId, - _bridgeData.minAmount, - _swapData, - payable(msg.sender), - LibAsset.isNativeAsset(assetId) ? 0 : fee - ); - _startBridge(_bridgeData, _deBridgeDlnData, fee); - } - - /// Internal Methods /// - - /// @dev Contains the business logic for the bridge via DeBridgeDLN - /// @param _bridgeData The core information needed for bridging - /// @param _deBridgeDlnData Data specific to DeBridgeDLN - function _startBridge( - ILiFi.BridgeData memory _bridgeData, - DeBridgeDlnData calldata _deBridgeDlnData, - uint256 _fee - ) internal { - IDlnSource.OrderCreation memory orderCreation = IDlnSource - .OrderCreation({ - giveTokenAddress: _bridgeData.sendingAssetId, - giveAmount: _bridgeData.minAmount, - takeTokenAddress: _deBridgeDlnData.receivingAssetId, - takeAmount: _deBridgeDlnData.minAmountOut, - takeChainId: _bridgeData.destinationChainId, - receiverDst: _deBridgeDlnData.receiver, - givePatchAuthoritySrc: _bridgeData.receiver, - orderAuthorityAddressDst: _deBridgeDlnData.receiver, - allowedTakerDst: "", - externalCall: "", - allowedCancelBeneficiarySrc: "" - }); - - bytes32 orderId; - if (!LibAsset.isNativeAsset(_bridgeData.sendingAssetId)) { - // Give the DLN Source approval to bridge tokens - LibAsset.maxApproveERC20( - IERC20(_bridgeData.sendingAssetId), - address(dlnSource), - _bridgeData.minAmount - ); - - orderId = dlnSource.createOrder{ value: _fee }( - orderCreation, - "", - 0, - "" - ); - } else { - orderCreation.giveAmount = orderCreation.giveAmount - _fee; - orderId = dlnSource.createOrder{ value: _bridgeData.minAmount }( - orderCreation, - "", - 0, - "" - ); - } - - emit DlnOrderCreated(orderId); - - if (_bridgeData.receiver == NON_EVM_ADDRESS) { - emit BridgeToNonEVMChain( - _bridgeData.transactionId, - _bridgeData.destinationChainId, - _deBridgeDlnData.receiver - ); - } - - emit LiFiTransferStarted(_bridgeData); - } -} diff --git a/archive/src/AxelarFacet.sol b/archive/src/Facets/AxelarFacet.sol similarity index 100% rename from archive/src/AxelarFacet.sol rename to archive/src/Facets/AxelarFacet.sol diff --git a/src/Facets/CelerIMFacetImmutable.sol b/archive/src/Facets/CelerIMFacetImmutable.sol similarity index 100% rename from src/Facets/CelerIMFacetImmutable.sol rename to archive/src/Facets/CelerIMFacetImmutable.sol diff --git a/src/Facets/CircleBridgeFacet.sol b/archive/src/Facets/CircleBridgeFacet.sol similarity index 100% rename from src/Facets/CircleBridgeFacet.sol rename to archive/src/Facets/CircleBridgeFacet.sol diff --git a/archive/src/DeBridgeFacet.sol b/archive/src/Facets/DeBridgeFacet.sol similarity index 100% rename from archive/src/DeBridgeFacet.sol rename to archive/src/Facets/DeBridgeFacet.sol diff --git a/src/Facets/GnosisBridgeL2Facet.sol b/archive/src/Facets/GnosisBridgeL2Facet.sol similarity index 100% rename from src/Facets/GnosisBridgeL2Facet.sol rename to archive/src/Facets/GnosisBridgeL2Facet.sol diff --git a/archive/src/MakerTeleportFacet.sol b/archive/src/Facets/MakerTeleportFacet.sol similarity index 100% rename from archive/src/MakerTeleportFacet.sol rename to archive/src/Facets/MakerTeleportFacet.sol diff --git a/archive/src/MultichainFacet.sol b/archive/src/Facets/MultichainFacet.sol similarity index 100% rename from archive/src/MultichainFacet.sol rename to archive/src/Facets/MultichainFacet.sol diff --git a/archive/src/NXTPFacet.sol b/archive/src/Facets/NXTPFacet.sol similarity index 100% rename from archive/src/NXTPFacet.sol rename to archive/src/Facets/NXTPFacet.sol diff --git a/src/Facets/NonStandardSelectorsRegistryFacet.sol b/archive/src/Facets/NonStandardSelectorsRegistryFacet.sol similarity index 100% rename from src/Facets/NonStandardSelectorsRegistryFacet.sol rename to archive/src/Facets/NonStandardSelectorsRegistryFacet.sol diff --git a/archive/src/SynapseBridgeFacet.sol b/archive/src/Facets/SynapseBridgeFacet.sol similarity index 100% rename from archive/src/SynapseBridgeFacet.sol rename to archive/src/Facets/SynapseBridgeFacet.sol diff --git a/archive/src/WormholeFacet.sol b/archive/src/Facets/WormholeFacet.sol similarity index 100% rename from archive/src/WormholeFacet.sol rename to archive/src/Facets/WormholeFacet.sol diff --git a/archive/src/AxelarExecutor.sol b/archive/src/Periphery/AxelarExecutor.sol similarity index 100% rename from archive/src/AxelarExecutor.sol rename to archive/src/Periphery/AxelarExecutor.sol diff --git a/archive/src/FusePoolZap.sol b/archive/src/Periphery/FusePoolZap.sol similarity index 100% rename from archive/src/FusePoolZap.sol rename to archive/src/Periphery/FusePoolZap.sol diff --git a/src/Periphery/GasRebateDistributor.sol b/archive/src/Periphery/GasRebateDistributor.sol similarity index 100% rename from src/Periphery/GasRebateDistributor.sol rename to archive/src/Periphery/GasRebateDistributor.sol diff --git a/src/Periphery/ServiceFeeCollector.sol b/archive/src/Periphery/ServiceFeeCollector.sol similarity index 100% rename from src/Periphery/ServiceFeeCollector.sol rename to archive/src/Periphery/ServiceFeeCollector.sol diff --git a/test/solidity/Facets/CircleBridgeFacet.t.sol b/archive/test/CircleBridgeFacet.t.sol similarity index 100% rename from test/solidity/Facets/CircleBridgeFacet.t.sol rename to archive/test/CircleBridgeFacet.t.sol diff --git a/test/solidity/Periphery/GasRebateDistributor.t.sol b/archive/test/GasRebateDistributor.t.sol similarity index 100% rename from test/solidity/Periphery/GasRebateDistributor.t.sol rename to archive/test/GasRebateDistributor.t.sol diff --git a/test/solidity/Facets/GnosisBridgeL2Facet.t.sol b/archive/test/GnosisBridgeL2Facet.t.sol similarity index 100% rename from test/solidity/Facets/GnosisBridgeL2Facet.t.sol rename to archive/test/GnosisBridgeL2Facet.t.sol diff --git a/test/solidity/Facets/NonStandardSelectorsRegistryFacet.t.sol b/archive/test/NonStandardSelectorsRegistryFacet.t.sol similarity index 100% rename from test/solidity/Facets/NonStandardSelectorsRegistryFacet.t.sol rename to archive/test/NonStandardSelectorsRegistryFacet.t.sol diff --git a/test/solidity/Periphery/ServiceFeeCollector.t.sol b/archive/test/ServiceFeeCollector.t.sol similarity index 100% rename from test/solidity/Periphery/ServiceFeeCollector.t.sol rename to archive/test/ServiceFeeCollector.t.sol diff --git a/config/dexs.json b/config/dexs.json index 884b12116..5bcfea839 100644 --- a/config/dexs.json +++ b/config/dexs.json @@ -393,7 +393,8 @@ "0x79540403cdE176Ca5f1fb95bE84A7ec91fFDEF76", "0x7fA60f4A59Dd8285C5Fcd8fd2A92A2Ca45ef8a0C", "0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc", - "0x134f525AC05E4724e55C363A9C4FA35ceB13F88d" + "0x134f525AC05E4724e55C363A9C4FA35ceB13F88d", + "0x6352a56caadc4f1e25cd6c75970fa768a3304e64" ], "immutablezkevm": [ "0xAcD913Ad6936Bb662395ac9a66D75bFc77c165fF", diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index e50c24f58..54b3f1434 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit e50c24f5839db17f46991478384bfda14acfb830 +Subproject commit 54b3f14346da01ba0d159114b399197fea8b7cda diff --git a/script/deploy/facets/DeployCelerIMFacet.s.sol b/script/deploy/facets/DeployCelerIMFacet.s.sol index fa327f282..0bce174e7 100644 --- a/script/deploy/facets/DeployCelerIMFacet.s.sol +++ b/script/deploy/facets/DeployCelerIMFacet.s.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.17; import { DeployScriptBase } from "./utils/DeployScriptBase.sol"; import { stdJson } from "forge-std/Script.sol"; import { CelerIMFacetMutable } from "lifi/Facets/CelerIMFacetMutable.sol"; -import { CelerIMFacetImmutable } from "lifi/Facets/CelerIMFacetImmutable.sol"; import { CelerIMFacetBase } from "lifi/Helpers/CelerIMFacetBase.sol"; contract DeployScript is DeployScriptBase { @@ -12,6 +11,8 @@ contract DeployScript is DeployScriptBase { constructor() DeployScriptBase("CelerIMFacet") {} + error CelerImFacetImmutableIsArchived(); + function run() public returns (CelerIMFacetBase deployed, bytes memory constructorArgs) @@ -30,9 +31,7 @@ contract DeployScript is DeployScriptBase { deploy(type(CelerIMFacetMutable).creationCode) ); } else { - deployed = CelerIMFacetImmutable( - deploy(type(CelerIMFacetImmutable).creationCode) - ); + revert CelerImFacetImmutableIsArchived(); } } diff --git a/script/deploy/healthCheck.mts b/script/deploy/healthCheck.mts index 8d24c6c03..95c56ffc2 100644 --- a/script/deploy/healthCheck.mts +++ b/script/deploy/healthCheck.mts @@ -28,6 +28,19 @@ for (const [k, v] of Object.entries(chains)) { chainMap[k] = v } +// TODO: remove this and import from ./utils/viemScriptHelpers.ts instead (did not work when I tried it) +export const getViemChainForNetworkName = (networkName: string): Chain => { + const chainName = chainNameMappings[networkName] || networkName + const chain: Chain = chainMap[chainName] + + if (!chain) + throw new Error( + `Chain ${networkName} (aka '${chainName}', if a mapping exists) not supported by viem or requires name mapping. Check if you can find your chain here: https://github.com/wevm/viem/tree/main/src/chains/definitions` + ) + + return chain +} + const SAFE_THRESHOLD = 3 const louperCmd = 'louper-cli' @@ -80,12 +93,12 @@ const main = defineCommand({ 'Louper CLI is required but not installed. Would you like to install it now?', { type: 'confirm', - }, + } ) if (answer) { await spinner( 'Installing...', - () => $`npm install -g @mark3labs/louper-cli`, + () => $`npm install -g @mark3labs/louper-cli` ) } else { consola.error('Louper CLI is required to run this script') @@ -101,7 +114,7 @@ const main = defineCommand({ `../../script/deploy/_targetState.json` ) const nonCoreFacets = Object.keys( - targetStateJson[network.toLowerCase()].production.LiFiDiamond, + targetStateJson[network.toLowerCase()].production.LiFiDiamond ).filter((k) => { return ( !coreFacets.includes(k) && @@ -133,7 +146,7 @@ const main = defineCommand({ const diamondDeployed = await checkIsDeployed( 'LiFiDiamond', deployedContracts, - publicClient, + publicClient ) if (!diamondDeployed) { logError(`LiFiDiamond not deployed`) @@ -152,7 +165,7 @@ const main = defineCommand({ const isDeployed = await checkIsDeployed( facet, deployedContracts, - publicClient, + publicClient ) if (!isDeployed) { logError(`Facet ${facet} not deployed`) @@ -170,7 +183,7 @@ const main = defineCommand({ const isDeployed = await checkIsDeployed( facet, deployedContracts, - publicClient, + publicClient ) if (!isDeployed) { logError(`Facet ${facet} not deployed`) @@ -189,13 +202,13 @@ const main = defineCommand({ await $`${louperCmd} inspect diamond -a ${diamondAddress} -n ${chainNameMappings[network]} --json` const registeredFacets = JSON.parse(facetsResult.stdout).facets.map( - (f: { name: string }) => f.name, + (f: { name: string }) => f.name ) for (const facet of [...coreFacets, ...nonCoreFacets]) { if (!registeredFacets.includes(facet)) { logError( - `Facet ${facet} not registered in Diamond or possibly unverified`, + `Facet ${facet} not registered in Diamond or possibly unverified` ) } else { consola.success(`Facet ${facet} registered in Diamond`) @@ -210,7 +223,7 @@ const main = defineCommand({ const isDeployed = await checkIsDeployed( contract, deployedContracts, - publicClient, + publicClient ) if (!isDeployed) { logError(`Periphery contract ${contract} not deployed`) @@ -231,9 +244,7 @@ const main = defineCommand({ client: publicClient, }) const addresses = await Promise.all( - corePeriphery.map((c) => - peripheryRegistry.read.getPeripheryContract([c]), - ), + corePeriphery.map((c) => peripheryRegistry.read.getPeripheryContract([c])) ) for (const periphery of corePeriphery) { @@ -258,10 +269,10 @@ const main = defineCommand({ }) const approvedDexs = await dexManager.read.approvedDexs() - // Loop through dexs excluding the address for FeeCollector, LiFuelFeeCollector and ServiceFeeCollector and TokenWrapper + // Loop through dexs excluding the address for FeeCollector, LiFuelFeeCollector and TokenWrapper let numMissing = 0 for (const dex of dexs.filter( - (d) => !corePeriphery.includes(getAddress(d)), + (d) => !corePeriphery.includes(getAddress(d)) )) { if (!approvedDexs.includes(getAddress(dex))) { logError(`Dex ${dex} not approved in Diamond`) @@ -269,12 +280,12 @@ const main = defineCommand({ } } - // Check that FeeCollector, LiFuelFeeCollector and ServiceFeeCollector and TokenWrapper are included in approvedDexs + // Check that FeeCollector, LiFuelFeeCollector and TokenWrapper are included in approvedDexs const feeCollectors = corePeriphery.filter( (p) => p === 'FeeCollector' || p === 'LiFuelFeeCollector' || - p === 'TokenWrapper', + p === 'TokenWrapper' ) for (const f of feeCollectors) { if (!approvedDexs.includes(getAddress(deployedContracts[f]))) { @@ -286,7 +297,7 @@ const main = defineCommand({ } consola.info( - `Found ${numMissing} missing dex${numMissing === 1 ? '' : 's'}`, + `Found ${numMissing} missing dex${numMissing === 1 ? '' : 's'}` ) // ╭─────────────────────────────────────────────────────────╮ @@ -305,7 +316,7 @@ const main = defineCommand({ 'LiFiDiamond', safeAddress, deployedContracts, - publicClient, + publicClient ) } @@ -314,7 +325,7 @@ const main = defineCommand({ 'FeeCollector', withdrawWallet, deployedContracts, - publicClient, + publicClient ) // LiFuelFeeCollector @@ -322,7 +333,7 @@ const main = defineCommand({ 'LiFuelFeeCollector', rebalanceWallet, deployedContracts, - publicClient, + publicClient ) // Receiver @@ -330,7 +341,7 @@ const main = defineCommand({ 'Receiver', refundWallet, deployedContracts, - publicClient, + publicClient ) // ╭─────────────────────────────────────────────────────────╮ @@ -360,11 +371,11 @@ const main = defineCommand({ ])) ) { logError( - `Deployer wallet ${deployerWallet} cannot execute ${sig.name} (${sig.sig})`, + `Deployer wallet ${deployerWallet} cannot execute ${sig.name} (${sig.sig})` ) } else { consola.success( - `Deployer wallet ${deployerWallet} can execute ${sig.name} (${sig.sig})`, + `Deployer wallet ${deployerWallet} can execute ${sig.name} (${sig.sig})` ) } } @@ -383,11 +394,11 @@ const main = defineCommand({ ])) ) { logError( - `Refund wallet ${refundWallet} cannot execute ${sig.name} (${sig.sig})`, + `Refund wallet ${refundWallet} cannot execute ${sig.name} (${sig.sig})` ) } else { consola.success( - `Refund wallet ${refundWallet} can execute ${sig.name} (${sig.sig})`, + `Refund wallet ${refundWallet} can execute ${sig.name} (${sig.sig})` ) } } @@ -453,19 +464,19 @@ const checkOwnership = async ( name: string, expectedOwner: Address, deployedContracts: Record, - publicClient: PublicClient, + publicClient: PublicClient ) => { if (deployedContracts[name]) { const contractAddress = deployedContracts[name] const owner = await getOwnableContract( contractAddress, - publicClient, + publicClient ).read.owner() if (getAddress(owner) !== getAddress(expectedOwner)) { logError( `${name} owner is ${getAddress(owner)}, expected ${getAddress( - expectedOwner, - )}`, + expectedOwner + )}` ) } else { consola.success(`${name} owner is correct`) @@ -476,7 +487,7 @@ const checkOwnership = async ( const checkIsDeployed = async ( contract: string, deployedContracts: Record, - publicClient: PublicClient, + publicClient: PublicClient ): Promise => { if (!deployedContracts[contract]) { return false diff --git a/script/tasks/diamondEMERGENCYPause.sh b/script/tasks/diamondEMERGENCYPause.sh index 6bb2776e7..a75997535 100755 --- a/script/tasks/diamondEMERGENCYPause.sh +++ b/script/tasks/diamondEMERGENCYPause.sh @@ -170,19 +170,6 @@ function handleNetwork() { fi fi - - if [[ "$ACTION" != "unpause the diamond" && ( "$RESPONSE" == *"$DIAMOND_IS_PAUSED_SELECTOR"* || "$RESPONSE" == *"DiamondIsPaused"* ) ]]; then - if [[ "$ACTION" == "remove a single facet" ]]; then - error "[network: $NETWORK] Cannot remove a facet while diamond is paused." - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end network $NETWORK <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" - exit 1 - else - success "[network: $NETWORK] The diamond is already paused. No further action required." - echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end network $NETWORK <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" - exit 0 - fi - fi - # execute the requested action local ATTEMPTS=1 while [ $ATTEMPTS -le "$MAX_ATTEMPTS_PER_SCRIPT_EXECUTION" ]; do