Skip to content

Commit

Permalink
Merge branch 'main' of github.com:lifinance/contracts into fixAction
Browse files Browse the repository at this point in the history
  • Loading branch information
0xDEnYO committed Oct 8, 2024
2 parents ab58ad6 + 0dbd29f commit 5963871
Show file tree
Hide file tree
Showing 67 changed files with 2,202 additions and 2,256 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ensureSCCoreDevApproval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
}
// Filter to only include reviews that have "APPROVED" status
console.log(JSON.stringify(reviews,null,2));
const approvedReviews = reviews.filter(review => review.state === 'APPROVED');
if(!approvedReviews.length) {
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/triggerableAction.yml

This file was deleted.

2 changes: 1 addition & 1 deletion archive/test/DeBridgeDlnFacet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ contract DeBridgeDlnFacetTest is TestBaseFacet {
// prepare swap data
address[] memory path = new address[](2);

path[0] = ADDRESS_WETH;
path[0] = ADDRESS_WRAPPED_NATIVE;
path[1] = ADDRESS_USDC;

uint256 amountOut = defaultUSDCAmount;
Expand Down
2 changes: 1 addition & 1 deletion archive/test/MakerTeleportFacet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract MakerTeleportFacetTest is TestBaseFacet {
ADDRESS_UNISWAP = 0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506;
ADDRESS_USDC = 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;
ADDRESS_DAI = 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1;
ADDRESS_WETH = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1;
ADDRESS_WRAPPED_NATIVE = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1;

initTestBase();

Expand Down
6 changes: 3 additions & 3 deletions archive/test/MultiChainFacet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ contract MultichainFacetTest is TestBaseFacet {

function testFailWhenUsingNotWhitelistedRouter() public {
// re-deploy multichain facet with adjusted router whitelist
diamond = createDiamond();
diamond = createDiamond(USER_DIAMOND_OWNER, USER_PAUSER);
routers = [
0x55aF5865807b196bD0197e0902746F31FBcCFa58, // TestMultichainToken
0x7782046601e7b9B05cA55A3899780CE6EE6B8B2B // AnyswapV6Router
Expand Down Expand Up @@ -279,7 +279,7 @@ contract MultichainFacetTest is TestBaseFacet {

function testFail_revert_UsingNonWhitelistedRouter() public {
// re-deploy multichain facet with adjusted router whitelist
diamond = createDiamond();
diamond = createDiamond(USER_DIAMOND_OWNER, USER_PAUSER);
routers = [
0x55aF5865807b196bD0197e0902746F31FBcCFa58, // TestMultichainToken
0x7782046601e7b9B05cA55A3899780CE6EE6B8B2B // AnyswapV6Router
Expand Down Expand Up @@ -334,8 +334,8 @@ contract MultichainFacetTest is TestBaseFacet {
}

function test_OwnerCanInitializeFacet() public {
LiFiDiamond diamond2 = createDiamond(USER_DIAMOND_OWNER, USER_PAUSER);
vm.startPrank(USER_DIAMOND_OWNER);
LiFiDiamond diamond2 = createDiamond();

TestMultichainFacet multichainFacet2 = new TestMultichainFacet();
bytes4[] memory functionSelectors = new bytes4[](7);
Expand Down
16 changes: 16 additions & 0 deletions audit/auditLog.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@
"auditorGitHandle": "sujithsomraaj",
"auditReportPath": "./audit/reports/2024.08.14_StargateFacetV2_ReAudit.pdf",
"auditCommitHash": "d622002440317580b5d0fb90ef22b839d84957e2"
},
"audit20240913": {
"auditCompletedOn": "13.09.2024",
"auditedBy": "Sujith Somraaj (individual security researcher)",
"auditorGitHandle": "sujithsomraaj",
"auditReportPath": "./audit/reports/2024.09.13_EmergencyPauseFacet.pdf",
"auditCommitHash": "77441a088e0789513db4e068f7ef6c5c0988ee42"
}
},
"auditedContracts": {
"EmergencyPauseFacet": {
"1.0.0": ["audit20240913"]
},
"GenericErrors": {
"1.0.0": ["audit20240913"]
},
"LibDiamondLoupe": {
"1.0.0": ["audit20240913"]
},
"StargateFacetV2": {
"1.0.1": ["audit20240814"]
}
Expand Down
Binary file added audit/reports/2024.09.13_EmergencyPauseFacet.pdf
Binary file not shown.
58 changes: 58 additions & 0 deletions deployments/_deployments_log_file.json
Original file line number Diff line number Diff line change
Expand Up @@ -23339,5 +23339,63 @@
]
}
}
},
"EmergencyPauseFacet": {
"polygon": {
"staging": {
"1.0.0": [
{
"ADDRESS": "0x6DCDA5EEb0eb10D61eB9AAF93C3B89704955dA42",
"OPTIMIZER_RUNS": "1000000",
"TIMESTAMP": "2024-07-21 15:50:57",
"CONSTRUCTOR_ARGS": "0x00000000000000000000000029dacdf7ccadf4ee67c923b4c22255a4b2494ed7",
"SALT": "",
"VERIFIED": "false"
}
]
}
},
"bsc": {
"staging": {
"1.0.0": [
{
"ADDRESS": "0xf03AFcA857918BE01EBD6C6800Fc2974b8a9eBA2",
"OPTIMIZER_RUNS": "1000000",
"TIMESTAMP": "2024-07-25 15:21:33",
"CONSTRUCTOR_ARGS": "0x00000000000000000000000029dacdf7ccadf4ee67c923b4c22255a4b2494ed7",
"SALT": "",
"VERIFIED": "false"
}
]
}
},
"arbitrum": {
"staging": {
"1.0.0": [
{
"ADDRESS": "0x9a0988b17D4419807DfC8E8fd2182A21eabB1361",
"OPTIMIZER_RUNS": "1000000",
"TIMESTAMP": "2024-10-08 11:23:04",
"CONSTRUCTOR_ARGS": "0x00000000000000000000000029dacdf7ccadf4ee67c923b4c22255a4b2494ed7",
"SALT": "",
"VERIFIED": "true"
}
]
}
},
"optimism": {
"staging": {
"1.0.0": [
{
"ADDRESS": "0x9a0988b17D4419807DfC8E8fd2182A21eabB1361",
"OPTIMIZER_RUNS": "1000000",
"TIMESTAMP": "2024-10-08 11:25:56",
"CONSTRUCTOR_ARGS": "0x00000000000000000000000029dacdf7ccadf4ee67c923b4c22255a4b2494ed7",
"SALT": "",
"VERIFIED": "true"
}
]
}
}
}
}
21 changes: 21 additions & 0 deletions deployments/arbitrum.diamond.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,34 @@
"0x21571D628B0bCBeb954D5933A604eCac35bAF2c7": {
"Name": "SymbiosisFacet",
"Version": "1.0.0"
},
"0xa137Fe4C41A2E04ca34578DC9023ad45cC194389": {
"Name": "",
"Version": ""
},
"0x2b64B62cbCfB38560222eBcfbbc4e65eC34c8Ce8": {
"Name": "",
"Version": ""
},
"0x6124C65B6264bE13f059b7C3A891a5b77DA8Bd95": {
"Name": "",
"Version": ""
},
"0x4352459F6BE1C7D1278F8c34Bb598b0feeB50f8b": {
"Name": "",
"Version": ""
},
"0x9a0988b17D4419807DfC8E8fd2182A21eabB1361": {
"Name": "EmergencyPauseFacet",
"Version": "1.0.0"
}
},
"Periphery": {
"ERC20Proxy": "0xF6d5cf7a12d89BC0fD34E27d2237875b564A6ADf",
"Executor": "0x23f882bA2fa54A358d8599465EB471f58Cc26751",
"FeeCollector": "0x7F8E9bEBd1Dea263A36a6916B99bd84405B9654a",
"GasRebateDistributor": "",
"LiFiDEXAggregator": "",
"LiFuelFeeCollector": "0x94EA56D8049e93E0308B9c7d1418Baf6A7C68280",
"Receiver": "0x36E9B2E8A627474683eF3b1E9Df26D2bF04396f3",
"ReceiverStargateV2": "",
Expand Down
3 changes: 2 additions & 1 deletion deployments/arbitrum.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@
"CircleBridgeFacet": "0xa73a8BC8d36472269138c3233e24D0Ee0c344bd8",
"HopFacetOptimized": "0xf82135385765f1324257ffF74489F16382EBBb8A",
"LiFuelFeeCollector": "0x94EA56D8049e93E0308B9c7d1418Baf6A7C68280",
"TokenWrapper": "0xF63b27AE2Dc887b88f82E2Cc597d07fBB2E78E70"
"TokenWrapper": "0xF63b27AE2Dc887b88f82E2Cc597d07fBB2E78E70",
"EmergencyPauseFacet": "0x9a0988b17D4419807DfC8E8fd2182A21eabB1361"
}
2 changes: 1 addition & 1 deletion deployments/bsc.diamond.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@
"LiFiDEXAggregator": ""
}
}
}
}
1 change: 1 addition & 0 deletions deployments/bsc.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"MayanBridgeFacet": "0x5Ba4FeD1DAd2fD057A9f687B399B8e4cF2368214",
"MayanFacet": "0xd596C903d78870786c5DB0E448ce7F87A65A0daD",
"GenericSwapFacetV3": "0xE871874D8AC30E8aCD0eC67529b4a5dDD73Bf0d6",
"EmergencyPauseFacet": "0xf03AFcA857918BE01EBD6C6800Fc2974b8a9eBA2",
"StargateFacetV2": "0x089153117bffd37CBbE0c604dAE8e493D4743fA8",
"LiFiDEXAggregator": "0xD6f02718B9df9FAd2665c7304BC5b26D5bbD8642"
}
12 changes: 12 additions & 0 deletions deployments/optimism.diamond.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@
"0xa137Fe4C41A2E04ca34578DC9023ad45cC194389": {
"Name": "",
"Version": ""
},
"0x6124C65B6264bE13f059b7C3A891a5b77DA8Bd95": {
"Name": "",
"Version": ""
},
"0x4352459F6BE1C7D1278F8c34Bb598b0feeB50f8b": {
"Name": "",
"Version": ""
},
"0x9a0988b17D4419807DfC8E8fd2182A21eabB1361": {
"Name": "EmergencyPauseFacet",
"Version": "1.0.0"
}
},
"Periphery": {
Expand Down
3 changes: 2 additions & 1 deletion deployments/optimism.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
"StargateFacet": "0xf0F989caC0600214B564ce07102F7e633680F0Fd",
"LiFuelFeeCollector": "0x94EA56D8049e93E0308B9c7d1418Baf6A7C68280",
"RelayerCelerIM": "0xC1906dC6b43EbE6AE511cc4abeB8711120Ab622e",
"TokenWrapper": "0xF63b27AE2Dc887b88f82E2Cc597d07fBB2E78E70"
"TokenWrapper": "0xF63b27AE2Dc887b88f82E2Cc597d07fBB2E78E70",
"EmergencyPauseFacet": "0x9a0988b17D4419807DfC8E8fd2182A21eabB1361"
}
2 changes: 1 addition & 1 deletion deployments/polygon.diamond.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@
"TokenWrapper": "0xF63b27AE2Dc887b88f82E2Cc597d07fBB2E78E70"
}
}
}
}
3 changes: 2 additions & 1 deletion deployments/polygon.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
"GasRebateDistributor": "0x3116B8F099D7eFA6e24f39F80146Aac423365EB9",
"GenericSwapFacetV3": "0xFf6Fa203573Baaaa4AE375EB7ac2819d539e16FF",
"StargateFacetV2": "0xeb3f9490d8cbD0C34C0642a8d0495e5E0B0745AA",
"EmergencyPauseFacet": "0x6DCDA5EEb0eb10D61eB9AAF93C3B89704955dA42",
"StandardizedCallFacet": "0xA7ffe57ee70Ac4998e9E9fC6f17341173E081A8f",
"CalldataVerificationFacet": "0x90B5b319cA20D9E466cB5b843952363C34d1b54E",
"CelerCircleBridgeFacet": "0x371E073f6A09DCBEE1D2Ac56E940F878a0Ba9DAE",
"HopFacetOptimized": "0xf82135385765f1324257ffF74489F16382EBBb8A",
"SymbiosisFacet": "0x21571D628B0bCBeb954D5933A604eCac35bAF2c7"
}
}
14 changes: 14 additions & 0 deletions docs/EmergencyPauseFacet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EmergencyPauseFacet

## How it works

The EmergencyPauseFacet is an admin-only facet. Its purpose is to provide a fast yet secure way to respond to suspicious transactions and smart contract activity by either pausing the whole diamond or by removing one specific facet. This can be done from a non-multisig account (i.e.: the 'PauserWallet') to ensure fast execution. The unpausing of the contract as well as adding any new facets is still only possible through the multisig owner wallet for added security.

## Public Methods

- `function removeFacet(address _facetAddress)`
- Removes the given facet from the diamond
- `function pauseDiamond()`
- Pauses the diamond by redirecting all function selectors to EmergencyPauseFacet
- `function unpauseDiamond(address[] calldata _blacklist)`
- Unpauses the diamond by reactivating all formerly registered facets, except for the facets in '\_blacklist'
5 changes: 5 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
- [DEX Manager Facet](./DexManagerFacet.md)
- [DiamondCut Facet](./DiamondCutFacet.md)
- [DiamondLoupe Facet](./DiamondLoupeFacet.md)
- [Emergency Pause Facet](./EmergencyPauseFacet.md)
- [Generic Swap Facet](./GenericSwapFacet.md)
- [Generic Swap FacetV3](./GenericSwapFacetV3.md)
- [Gnosis Bridge Facet](./GnosisBridgeFacet.md)
- [Hop Facet](./HopFacet.md)
- [Hop Facet Packed](./HopFacetPacked.md)
Expand All @@ -30,6 +32,7 @@
- [Squid Facet](./SquidFacet.md)
- [Standardized Call Facet](./StandardizedCallFacet.md)
- [Stargate Facet](./StargateFacet.md)
- [Stargate FacetV2](./StargateFacetV2.md)
- [Synapse Bridge Facet](./SynapseBridgeFacet.md)
- [ThorSwap Facet](./ThorSwapFacet.md)
- [Withdraw Facet](./WithdrawFacet.md)
Expand All @@ -54,5 +57,7 @@
- [ERC20Proxy](./ERC20Proxy.md)
- [Executor](./Executor.md)
- [FeeCollector](./FeeCollector.md)
- [LiFuelFeeCollector](./LiFuelFeeCollector.md)
- [Receiver](./Receiver.md)
- [ReceiverStargateV2](./ReceiverStargateV2.md)
- [RelayerCelerIM](./RelayerCelerIM.md)
32 changes: 32 additions & 0 deletions script/deploy/facets/DeployEmergencyPauseFacet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

import { DeployScriptBase } from "./utils/DeployScriptBase.sol";
import { stdJson } from "forge-std/Script.sol";
import { EmergencyPauseFacet } from "lifi/Facets/EmergencyPauseFacet.sol";

contract DeployScript is DeployScriptBase {
using stdJson for string;

constructor() DeployScriptBase("EmergencyPauseFacet") {}

function run()
public
returns (EmergencyPauseFacet deployed, bytes memory constructorArgs)
{
constructorArgs = getConstructorArgs();

deployed = EmergencyPauseFacet(
deploy(type(EmergencyPauseFacet).creationCode)
);
}

function getConstructorArgs() internal override returns (bytes memory) {
string memory path = string.concat(root, "/config/global.json");
string memory json = vm.readFile(path);

address pauserWallet = json.readAddress(".pauserWallet");

return abi.encode(pauserWallet);
}
}
17 changes: 17 additions & 0 deletions script/deploy/facets/UpdateEmergencyPauseFacet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

import { UpdateScriptBase } from "./utils/UpdateScriptBase.sol";
import { stdJson } from "forge-std/StdJson.sol";
import { EmergencyPauseFacet } from "lifi/Facets/EmergencyPauseFacet.sol";

contract DeployScript is UpdateScriptBase {
using stdJson for string;

function run()
public
returns (address[] memory facets, bytes memory cutData)
{
return update("EmergencyPauseFacet");
}
}
Loading

0 comments on commit 5963871

Please sign in to comment.