Skip to content

LF-13736 - Reapply DexManagerFacet -> WhitelistManagerFacet + getter functions and selectors array [WhitelistManagerFacet v1.0.0,IWhitelistManagerFacet v1.0.0,LibAllowList v2.0.0] #1193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 98 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
56d4064
changed LibAllowList version
mirooon Jun 5, 2025
1478221
Revert "Revert #1145 PR WhitelistManagerFacet LibAllowList [LibAllowL…
mirooon Jun 6, 2025
67ec36a
Merge branch 'reapply-dex-manager-update' of github.com:lifinance/con…
mirooon Jun 6, 2025
47e2c59
updated descriptions and function names
mirooon Jun 10, 2025
f7b0d58
Merge branch 'main' into reapply-dex-manager-update
mirooon Jun 10, 2025
c84f2c2
Changed LibAllowList version 1.0.1
mirooon Jun 10, 2025
35c778e
removed audit for LibAllowList
mirooon Jun 10, 2025
606f97e
added audit for LibAllowList
mirooon Jun 10, 2025
68a81fb
Merge branch 'main' into reapply-dex-manager-update
mirooon Jun 11, 2025
c231440
Merge branch 'lf-14074-allow-multiple-audits' into reapply-dex-manage…
mirooon Jun 11, 2025
a6a46ed
Merge branch 'lf-14074-allow-multiple-audits' into reapply-dex-manage…
mirooon Jun 12, 2025
adfebb6
Merge branch 'main' into reapply-dex-manager-update
mirooon Jun 12, 2025
e079c69
fix
mirooon Jun 12, 2025
8f98b40
empty commit
mirooon Jun 12, 2025
3e7da6e
empty commit
mirooon Jun 12, 2025
07813b9
Merge branch 'main' into reapply-dex-manager-update
mirooon Jun 13, 2025
e46a1ac
Fix function signature in healthCheck.ts and refactor calls to isFunc…
mirooon Jun 13, 2025
64c1be0
Renaming signatures to selectors
mirooon Jun 13, 2025
3749297
fixed healthCheck
mirooon Jun 13, 2025
bb89539
removed unecessary part
mirooon Jun 13, 2025
181f856
bytes4 for selector in FunctionSelector
mirooon Jun 15, 2025
e6d157a
Refactor test contracts to inherit from TestWhitelistManagerBase, rem…
mirooon Jun 15, 2025
153a482
add AllowListMigratorFacet
mirooon Jul 11, 2025
77595fa
more tests for AllowListMigratiorFacet
mirooon Jul 11, 2025
b0ce6c0
Merge branch 'main' into reapply-dex-manager-update
mirooon Jul 11, 2025
56290ab
Added custom version to interface, uncommented tests
mirooon Jul 11, 2025
0a474af
added deploy and update scripts
mirooon Jul 11, 2025
ad1357e
deployAllContracts fix
mirooon Jul 11, 2025
72d5309
fixes
mirooon Jul 11, 2025
7d29f32
moved migration logic to WhitelistManagerFacet
mirooon Jul 14, 2025
8a49af3
added selectors to remove param
mirooon Jul 14, 2025
e793288
updates
mirooon Jul 14, 2025
fcc775c
added scripts
mirooon Jul 15, 2025
c877e73
allowlist migration scripts updates
mirooon Jul 17, 2025
5935121
merged flatten-selectors script to prepare-function-selectors
mirooon Jul 17, 2025
62801ee
changes
mirooon Jul 17, 2025
8389c4a
Merge branch 'main' into reapply-dex-manager-update
mirooon Jul 17, 2025
26c7123
changed script name
mirooon Jul 17, 2025
8f86265
updated licences
mirooon Jul 17, 2025
3af761b
Merge branch 'main' into reapply-dex-manager-update
mirooon Jul 17, 2025
8d68f55
additional checks, fixed script run
mirooon Jul 18, 2025
a5fd24f
Merge branch 'main' into reapply-dex-manager-update
mirooon Jul 18, 2025
5895378
Merge branch 'main' into reapply-dex-manager-update
mirooon Jul 18, 2025
3df0415
added checks and event emits
mirooon Jul 18, 2025
300be1f
integrate selectors from whitelistedSelectors.json, ensuring a comple…
mirooon Jul 19, 2025
28335b1
Changing names of files
mirooon Jul 21, 2025
8da3034
Changed name of flatten-selectors.json file
mirooon Jul 21, 2025
04c800c
Change function names like isFunctionApproved, _setFunctionApproval, …
mirooon Jul 21, 2025
a88ac0b
added healthchecks and extracted eventScanner to utils
mirooon Jul 21, 2025
41743cf
fixed typo, removed uneccessary variable
mirooon Jul 21, 2025
b64afd3
fixed looping to save gas
mirooon Jul 21, 2025
d45ac32
added notes
mirooon Jul 21, 2025
deb65df
Updated migrate allowlist. Added flare diamond
mirooon Jul 21, 2025
76a4c07
remove console log
mirooon Jul 21, 2025
a9571cc
Merge branch 'main' into reapply-dex-manager-update
mirooon Jul 21, 2025
22ede0b
Fixed audit log and LibAllowList version
mirooon Jul 21, 2025
83e820c
updated titles and removed IDexManagerFacet
mirooon Jul 21, 2025
986a654
removed comment
mirooon Jul 22, 2025
a6444c9
merge with main
mirooon Jul 22, 2025
8275a44
Updated UpdateWhitelistManagerFacet
mirooon Jul 22, 2025
2bb9f85
update script
mirooon Jul 22, 2025
341b15e
updated UpdateWhitelistManagerFacet
mirooon Jul 22, 2025
c47af9d
added config
mirooon Jul 22, 2025
406f83a
added test test_DiamondCutWithInitCallDataThatCallsMigrate
mirooon Jul 22, 2025
77a7b52
fixed UpdateWhitelistManagerFacet
mirooon Jul 22, 2025
e4abc18
cleanup
mirooon Jul 23, 2025
f1bdc82
test
mirooon Jul 23, 2025
d22c848
use dummy private key for testing
mirooon Jul 23, 2025
beceda4
added comment
mirooon Jul 23, 2025
c3cbade
merge with main
mirooon Jul 24, 2025
d40b1e6
Merge branch 'main' into reapply-dex-manager-update
mirooon Jul 24, 2025
95070dd
merge with main
mirooon Jul 30, 2025
419c8da
removed old audits
mirooon Jul 30, 2025
68533d8
Deleted migrate-allowlist
mirooon Jul 30, 2025
1d67744
verified contracts, changed statuses
mirooon Jul 30, 2025
e23f83c
updated verification statues
mirooon Jul 30, 2025
e93388e
added deployments for staging corn
mirooon Aug 1, 2025
3df0c1a
Merge branch 'main' into reapply-dex-manager-update
mirooon Aug 1, 2025
3178002
Merge branch 'main' into reapply-dex-manager-update
mirooon Aug 1, 2025
9560560
Merge branch 'staging-corn' into reapply-dex-manager-update
mirooon Aug 1, 2025
ada2734
added hyperevm staging
mirooon Aug 1, 2025
d56b25b
updates
mirooon Aug 1, 2025
957bcd3
removed corn staging
mirooon Aug 1, 2025
82f8611
fixed base staging
mirooon Aug 1, 2025
fc8aed4
updated hyperevm rpcurl
mirooon Aug 4, 2025
3377b9f
changed error
mirooon Aug 4, 2025
937f9b1
added TestWhitelistManagerBase to conventions
mirooon Aug 4, 2025
b451864
updated LibAllowList version
mirooon Aug 4, 2025
9987574
removed script
mirooon Aug 4, 2025
6a2f9eb
Merge branch 'main' into reapply-dex-manager-update
mirooon Aug 4, 2025
438fb2d
adjusted deployments files
mirooon Aug 4, 2025
7fb7059
fixed diamondSyncSelectors
mirooon Aug 4, 2025
5718b47
added vana staging deployment
mirooon Aug 4, 2025
2762964
added WhitelistManagerFacet to optimism staging
mirooon Aug 4, 2025
4657139
empty commit
mirooon Aug 4, 2025
90cb3cb
empty commit
mirooon Aug 4, 2025
df32838
empty commit
mirooon Aug 4, 2025
5665c5f
empty commit
mirooon Aug 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = {
'no-empty-function': 'off',
eqeqeq: ['error', 'always'],
'prefer-const': 'error',
curly: ['error', 'multi'], // Allow single-line statements without braces
'no-template-curly-in-string': 'error', // Warns about `${var}` in regular strings
'no-throw-literal': 'error', // Requires throwing Error objects instead of literals
'@typescript-eslint/return-await': ['error', 'in-try-catch'], // More nuanced control over return await
Expand Down
File renamed without changes.
24 changes: 8 additions & 16 deletions archive/test/Facets/CelerIMFacet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
pragma solidity ^0.8.17;

import { LibSwap, TestBaseFacet } from "../utils/TestBaseFacet.sol";
import { LibAllowList } from "lifi/Libraries/LibAllowList.sol";
import { CelerIMFacetMutable, IMessageBus, MsgDataTypes, IERC20, CelerIM } from "lifi/Facets/CelerIMFacetMutable.sol";
import { RelayerCelerIM } from "lifi/Periphery/RelayerCelerIM.sol";
import { ERC20Proxy } from "lifi/Periphery/ERC20Proxy.sol";
import { Executor } from "lifi/Periphery/Executor.sol";
import { TestWhitelistManagerBase } from "../utils/TestWhitelistManagerBase.sol";

// Stub CelerIMFacet Contract
contract TestCelerIMFacet is CelerIMFacetMutable {
contract TestCelerIMFacet is CelerIMFacetMutable, TestWhitelistManagerBase {
constructor(
IMessageBus _messageBus,
address _relayerOwner,
Expand All @@ -23,14 +23,6 @@ contract TestCelerIMFacet is CelerIMFacetMutable {
_cfUSDC
)
{}

function addDex(address _dex) external {
LibAllowList.addAllowedContract(_dex);
}

function setFunctionApprovalBySignature(bytes4 _signature) external {
LibAllowList.addAllowedSelector(_signature);
}
}

interface Ownable {
Expand Down Expand Up @@ -119,22 +111,22 @@ contract CelerIMFacetTest is TestBaseFacet {
functionSelectors[1] = celerIMFacet
.swapAndStartBridgeTokensViaCelerIM
.selector;
functionSelectors[2] = celerIMFacet.addDex.selector;
functionSelectors[2] = celerIMFacet.addToWhitelist.selector;
functionSelectors[3] = celerIMFacet
.setFunctionApprovalBySignature
.setFunctionApprovalBySelector
.selector;

addFacet(diamond, address(celerIMFacet), functionSelectors);

celerIMFacet = TestCelerIMFacet(address(diamond));
celerIMFacet.addDex(address(uniswap));
celerIMFacet.setFunctionApprovalBySignature(
celerIMFacet.addToWhitelist(address(uniswap));
celerIMFacet.setFunctionApprovalBySelector(
uniswap.swapExactTokensForTokens.selector
);
celerIMFacet.setFunctionApprovalBySignature(
celerIMFacet.setFunctionApprovalBySelector(
uniswap.swapTokensForExactETH.selector
);
celerIMFacet.setFunctionApprovalBySignature(
celerIMFacet.setFunctionApprovalBySelector(
uniswap.swapETHForExactTokens.selector
);
setFacetAddressInTestBase(address(celerIMFacet), "cBridgeFacet");
Expand Down
2 changes: 1 addition & 1 deletion audit/auditLog.json
Original file line number Diff line number Diff line change
Expand Up @@ -636,4 +636,4 @@
"1.0.1": ["audit20250706"]
}
}
}
}
22 changes: 11 additions & 11 deletions config/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
"pauserWallet": "0xd38743b48d26743C0Ec6898d699394FBc94657Ee",
"lifuelRebalanceWallet": "0xC71284231A726A18ac85c94D75f9fe17A185BeAF",
"deployerWallet": "0x11F1022cA6AdEF6400e5677528a80d49a069C00c",
"approvedSigsForRefundWallet": [
"approvedSelectorsForRefundWallet": [
{
"sig": "0x0d19e519",
"selector": "0x0d19e519",
"name": "CBridgeFacet.triggerRefund"
},
{
"sig": "0xd9caed12",
"selector": "0xd9caed12",
"name": "WithdrawFacet.withdraw"
}
],
"approvedSigsForDeployerWallet": [
"approvedSelectorsForDeployerWallet": [
{
"sig": "0xfcd8e49e",
"name": "DexManagerFacet.batchAddDex"
"selector": "0x2db6fa36",
"name": "WhitelistManagerFacet.batchAddToWhitelist"
},
{
"sig": "0x9afc19c7",
"name": "DexManagerFacet.batchRemoveDex"
"selector": "0x045fb888",
"name": "WhitelistManagerFacet.batchRemoveFromWhitelist"
},
{
"sig": "0x44e2b18c",
"name": "DexManagerFacet.batchSetFunctionApprovalBySignature"
"selector": "0xecd18517",
"name": "WhitelistManagerFacet.batchSetFunctionWhitelistBySelector"
}
],
"safeOwners": [
Expand All @@ -46,7 +46,7 @@
"coreFacets": [
"AccessManagerFacet",
"CalldataVerificationFacet",
"DexManagerFacet",
"WhitelistManagerFacet",
"DiamondCutFacet",
"DiamondLoupeFacet",
"EmergencyPauseFacet",
Expand Down
2 changes: 1 addition & 1 deletion config/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
"wrappedNativeAddress": "0x5555555555555555555555555555555555555555",
"status": "active",
"type": "mainnet",
"rpcUrl": "https://hyperliquid-json-rpc.stakely.io",
"rpcUrl": "https://rpc.hypurrscan.io",
"verificationType": "blockscout",
"explorerUrl": "https://hyperevmscan.io",
"explorerApiUrl": "https://api.etherscan.io/v2/api?chainid=999",
Expand Down
188 changes: 188 additions & 0 deletions config/whitelistManager.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"functionSelectorsToRemove": [
"0x01617fab",
"0x03b87e5f",
"0x04204ceb",
"0x04e45aaf",
"0x0502b1c5",
"0x07ed2379",
"0x08298b5a",
"0x083001ba",
"0x09b81346",
"0x0a512416",
"0x0b86a4c1",
"0x0d5f0e3b",
"0x117aa677",
"0x11bcc81e",
"0x12345678",
"0x12aa3caf",
"0x160e8be3",
"0x188ac35d",
"0x18cbafe5",
"0x19367472",
"0x1a01c532",
"0x1b113d4d",
"0x1c58db4f",
"0x1e6d24c2",
"0x1eacd35f",
"0x1f0464d1",
"0x21025a06",
"0x2213bc0b",
"0x22dca3d7",
"0x23856bc3",
"0x24856bc3",
"0x24dd6483",
"0x2646478b",
"0x2a197298",
"0x2bf6e9ec",
"0x2e95b6c8",
"0x2fa11647",
"0x301a3720",
"0x30eef8bd",
"0x32af3139",
"0x33320de3",
"0x3593564c",
"0x3598d8ab",
"0x3865bde6",
"0x38ed1739",
"0x3b635ce4",
"0x3ccfd60b",
"0x3cdf133f",
"0x3eca9c0a",
"0x414bf389",
"0x415565b0",
"0x42712a67",
"0x45977d03",
"0x4629fd85",
"0x46c67b6d",
"0x472b43f3",
"0x476357fe",
"0x47f8bd41",
"0x49228978",
"0x49404b7c",
"0x49616997",
"0x4a25d94a",
"0x4dcebcba",
"0x5023b4df",
"0x5028bb95",
"0x5161b966",
"0x54bacd13",
"0x54e3f31b",
"0x58f15100",
"0x59e50fed",
"0x5a099843",
"0x5ae401dc",
"0x5c11d795",
"0x5e94e28d",
"0x5f3bd1c8",
"0x62e238bb",
"0x6678ec1f",
"0x676528d1",
"0x6af479b2",
"0x6b58f2f0",
"0x6e5129d1",
"0x715018a6",
"0x72c8913d",
"0x74ef98d9",
"0x7515d97c",
"0x7617b389",
"0x762b1562",
"0x77725df6",
"0x78e3214f",
"0x791ac947",
"0x7a1eb1b9",
"0x7a42416a",
"0x7bf2d6d4",
"0x7c025200",
"0x7f457675",
"0x7ff36ab5",
"0x803ba26d",
"0x81791788",
"0x83800a8e",
"0x83bd37f9",
"0x84a7f3dd",
"0x84bd6d29",
"0x862738f9",
"0x87654321",
"0x876a02f6",
"0x8770ba91",
"0x8803dbee",
"0x8980041a",
"0x89af926a",
"0x8a657e67",
"0x8af033fb",
"0x8b71ae6c",
"0x8fd8d1bb",
"0x90411a32",
"0x91695586",
"0x94cfab17",
"0x9570eeee",
"0x987e7d8e",
"0x9a2967d2",
"0x9b2c0a37",
"0xa22c27fe",
"0xa2a1623d",
"0xa5669eae",
"0xa5be382e",
"0xa6886da9",
"0xa76dfc3b",
"0xa76f4eb6",
"0xa816ca92",
"0xa8676443",
"0xa94e78ef",
"0xac9650d8",
"0xb0431182",
"0xb22f4db8",
"0xb35d7e73",
"0xb56c9663",
"0xb6f9de95",
"0xb80c2f09",
"0xb858183f",
"0xb94c3609",
"0xbc80f1a8",
"0xc04b8d59",
"0xc43c9ef6",
"0xc4af5a74",
"0xc57559dd",
"0xc63113ad",
"0xc6aabf84",
"0xce8d3bde",
"0xcf81464b",
"0xd0a3b665",
"0xd0e30db0",
"0xd33721a5",
"0xd4ef38de",
"0xd57360fc",
"0xd6ed22e6",
"0xd85ca173",
"0xd9627aa4",
"0xda1a5f42",
"0xda35bb0d",
"0xdb3e2198",
"0xdd343700",
"0xdd9c5f96",
"0xdef65669",
"0xe0cbc5f2",
"0xe21fd0e9",
"0xe37ed256",
"0xe3ead59e",
"0xe449022e",
"0xe5d7bde6",
"0xe8bb3b6c",
"0xee623204",
"0xeedd56e1",
"0xf28c0498",
"0xf2fde38b",
"0xf35b4733",
"0xf35cae90",
"0xf52e33f5",
"0xf78dc253",
"0xf7fcd384",
"0xf87dc1b7",
"0xf8be52e1",
"0xfa461e33",
"0xfb3bdb41",
"0xfc374157",
"0xff84aafa"
]
}
File renamed without changes.
3 changes: 1 addition & 2 deletions config/sigs.json → config/whitelistedSelectors.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sigs": [
"selectors": [
"0x862738f9",
"0x1b113d4d",
"0x3593564c",
Expand Down Expand Up @@ -90,7 +90,6 @@
"0x301a3720",
"0x7a1eb1b9",
"0xb22f4db8",
"0x3593564c",
"0x24856bc3",
"0x5161b966",
"0xb858183f",
Expand Down
30 changes: 30 additions & 0 deletions conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,36 @@ We use Foundry as our primary development and testing framework. Foundry provide
- Any contract inheriting from `TestBase.sol` must call `initTestBase()` in `setUp()`
- Use `vm.startPrank(address)` and `vm.stopPrank()` for user simulation

### Test Inheritance and Whitelist Management

- For facets that require whitelist functionality:
- Test contracts should inherit from `TestWhitelistManagerBase`
- This provides standard whitelist management functions:
- `addToWhitelist(address)`
- `removeFromWhitelist(address)`
- `setFunctionWhitelistBySelector(bytes4)`
- `removeFunctionApprovalBySelector(bytes4)`
- Example pattern:
```solidity
contract TestFacet is TestWhitelistManagerBase {
constructor() {}
}

contract FacetTest is TestBase {
TestFacet internal facet;

function setUp() public {
initTestBase();
facet = new TestFacet();
// Add required whitelist approvals
facet.addToWhitelist(ADDRESS_UNISWAP);
facet.setFunctionWhitelistBySelector(
uniswap.swapExactTokensForTokens.selector
);
}
}
```

### Assertions and Event Testing

- Use `assertEq()` for checking equality of values
Expand Down
Loading
Loading