Skip to content
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

Debridge DLN Facet (Version 1.0.0) [DeBridgeDlnFacet v1.0.0] #827

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
07219e2
Move DeBridgeDLNFacet from archive
ezynda3 Oct 8, 2024
69a5bae
Move docs from archive and update README
ezynda3 Oct 8, 2024
a1038fa
Merge branch 'main' into debridge-dln
ezynda3 Oct 9, 2024
091cf24
Merge branch 'main' of github.com:lifinance/contracts into debridge-dln
ezynda3 Oct 9, 2024
6fc5c78
improve code coverage
ezynda3 Oct 9, 2024
72c23ca
improve code coverage
ezynda3 Oct 9, 2024
7167772
Merge branch 'debridge-dln' of github.com:lifinance/contracts into de…
ezynda3 Oct 9, 2024
11225de
Merge branch 'main' of github.com:lifinance/contracts into debridge-dln
ezynda3 Oct 10, 2024
975f85e
Fix opbnb
ezynda3 Oct 10, 2024
ac123a3
Update variable naming
ezynda3 Oct 10, 2024
b059e8e
Add mappings
ezynda3 Oct 14, 2024
e259742
Update demo
ezynda3 Oct 15, 2024
bf09c10
Merge branch 'main' of github.com:lifinance/contracts into debridge-dln
ezynda3 Nov 22, 2024
d72cb05
fix tests
ezynda3 Nov 22, 2024
995543f
Check for empty non EVM address
ezynda3 Nov 27, 2024
92d8772
Various fixes
ezynda3 Nov 27, 2024
9f76e21
Add referral code
ezynda3 Nov 29, 2024
8bcb392
explicitly set orderAuthorityDst
ezynda3 Nov 29, 2024
3f1d103
Fix referral code mismatch
ezynda3 Dec 2, 2024
536860b
Always check for empty receiver address
ezynda3 Dec 5, 2024
3e527df
Merge branch 'main' into debridge-dln
ezynda3 Dec 5, 2024
f561360
Remove unneeded parameter
ezynda3 Dec 5, 2024
87bd31f
Merge branch 'debridge-dln' of github.com:lifinance/contracts into de…
ezynda3 Dec 5, 2024
919d6ff
Merge branch 'main' into debridge-dln
ezynda3 Dec 12, 2024
5c6b7b3
Update audit log
ezynda3 Dec 12, 2024
ef13196
Merge branch 'main' into debridge-dln
ezynda3 Dec 13, 2024
be075af
sort audited contracts
ezynda3 Dec 13, 2024
4bd0d9c
Merge branch 'main' into debridge-dln
ezynda3 Dec 13, 2024
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
13 changes: 0 additions & 13 deletions archive/scripts/Deploy/UpdateDeBridgeDlnFacet.s.sol

This file was deleted.

62 changes: 49 additions & 13 deletions audit/auditLog.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,42 +55,78 @@
"auditorGitHandle": "sujithsomraaj",
"auditReportPath": "./audit/reports/2024.12.03_LiFiDexAggregator.pdf",
"auditCommitHash": "8a34562c912b5b19c919bb95338655c944428af5"
},
"audit20241205": {
"auditCompletedOn": "05.12.2024",
"auditedBy": "Sujith Somraaj (individual security researcher)",
"auditorGitHandle": "sujithsomraaj",
"auditReportPath": "./audit/reports/2024.12.05_DeBridgeDlnFacet(v1.0.0).pdf",
"auditCommitHash": "d72cb05510acc5bb794bde05af550ba2ef85d06d"
}
},
"auditedContracts": {
"AcrossFacetV3": {
"1.0.0": ["audit20241007"]
"1.0.0": [
"audit20241007"
]
},
"AcrossFacetPackedV3": {
"1.0.0": ["audit20241007"]
"1.0.0": [
"audit20241007"
]
},
"GasZipFacet": {
"2.0.0": ["audit20241107"]
"2.0.0": [
"audit20241107"
]
},
"GasZipPeriphery": {
"1.0.0": ["audit20241107"]
"1.0.0": [
"audit20241107"
]
},
"IGasZip": {
"1.0.0": ["audit20241107"]
"1.0.0": [
"audit20241107"
]
},
"EmergencyPauseFacet": {
"1.0.0": ["audit20240913"],
"1.0.1": ["audit20241105"]
"1.0.0": [
"audit20240913"
],
"1.0.1": [
"audit20241105"
]
},
"LiFiDEXAggregator": {
"1.5.0": ["audit20241203"]
"1.5.0": [
"audit20241203"
]
},
"Permit2Proxy": {
"1.0.0": ["audit20241122"]
"1.0.0": [
"audit20241122"
]
},
"ReceiverAcrossV3": {
"1.0.0": ["audit20241007"]
"1.0.0": [
"audit20241007"
]
},
"StargateFacetV2": {
"1.0.1": ["audit20240814"]
"1.0.1": [
"audit20240814"
]
},
"WithdrawablePeriphery": {
"1.0.0": ["audit20241014"]
"1.0.0": [
"audit20241014"
]
},
"DeBridgeDlnFacet": {
"1.0.0": [
"audit20241205"
]
}
}
}
}
Binary file not shown.
103 changes: 80 additions & 23 deletions config/dln.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,83 @@
{
"arbitrum": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
"networks": {
"arbitrum": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"avalanche": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"bsc": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"mainnet": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"polygon": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"linea": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"base": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"optimism": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"gnosis": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"metis": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"solana": {
"dlnSource": "src5qyZHqTqecJV4aY6Cb6zDZLMDzrDKKezs22MPHr4"
}
},
"avalanche": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"bsc": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"mainnet": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"polygon": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"linea": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"base": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
},
"optimism": {
"dlnSource": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66"
}
"mappings": [
{
"chainId": 42161,
"deBridgeChainId": 42161
},
{
"chainId": 43114,
"deBridgeChainId": 43114
},
{
"chainId": 56,
"deBridgeChainId": 56
},
{
"chainId": 1,
"deBridgeChainId": 1
},
{
"chainId": 137,
"deBridgeChainId": 137
},
{
"chainId": 59144,
"deBridgeChainId": 59144
},
{
"chainId": 8453,
"deBridgeChainId": 8453
},
{
"chainId": 10,
"deBridgeChainId": 10
},
{
"chainId": 100,
"deBridgeChainId": 100000002
},
{
"chainId": 1088,
"deBridgeChainId": 100000004
},
{
"chainId": 1151111081099710,
"deBridgeChainId": 7565164
}
]
}
2 changes: 1 addition & 1 deletion config/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
"rpcUrl": "https://opbnb.drpc.org",
"verificationType": "etherscan",
"explorerUrl": "https://opbnb.bscscan.com/",
"explorerApiUrl": "",
"explorerApiUrl": "https://api-opbnb.bscscan.com/api",
"multicallAddress": "0xcA11bde05977b3631167028862bE2a173976CA11",
"safeApiUrl": "https://safe-transaction-opbnb-mainnet.bnbchain.org/api",
"safeAddress": "0xaAD94196680Edb94B421bb5B1E1A0B27db686C72",
ezynda3 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
8 changes: 4 additions & 4 deletions deployments/_deployments_log_file.json
Original file line number Diff line number Diff line change
Expand Up @@ -21199,9 +21199,9 @@
"staging": {
"1.0.0": [
{
"ADDRESS": "0xE500dED7b9C9f1020870B7a6Db076Dbd892C0fea",
"ADDRESS": "0xE15C7585636e62b88bA47A40621287086E0c2E33",
"OPTIMIZER_RUNS": "1000000",
"TIMESTAMP": "2024-02-22 14:29:31",
"TIMESTAMP": "2024-10-14 15:56:11",
"CONSTRUCTOR_ARGS": "0x000000000000000000000000ef4fb24ad0916217251f553c0596f8edc630eb66",
"SALT": "",
"VERIFIED": "true"
Expand All @@ -21213,9 +21213,9 @@
"staging": {
"1.0.0": [
{
"ADDRESS": "0xE500dED7b9C9f1020870B7a6Db076Dbd892C0fea",
"ADDRESS": "0xE15C7585636e62b88bA47A40621287086E0c2E33",
"OPTIMIZER_RUNS": "1000000",
"TIMESTAMP": "2024-02-22 15:43:42",
"TIMESTAMP": "2024-10-15 09:42:45",
"CONSTRUCTOR_ARGS": "0x000000000000000000000000ef4fb24ad0916217251f553c0596f8edc630eb66",
"SALT": "",
"VERIFIED": "true"
Expand Down
3 changes: 2 additions & 1 deletion deployments/arbitrum.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"ServiceFeeCollector": "0x9cc3164f01ED3796Fdf7Da538484D634608D2203",
"WormholeFacet": "0x7260Fd3F8D0bEb06fF5935C6eadE9f406107c270",
"SymbiosisFacet": "0x21571D628B0bCBeb954D5933A604eCac35bAF2c7",
"DeBridgeDlnFacet": "0xE500dED7b9C9f1020870B7a6Db076Dbd892C0fea",
"DeBridgeDlnFacet": "0xE15C7585636e62b88bA47A40621287086E0c2E33",
"MayanFacet": "0xd596C903d78870786c5DB0E448ce7F87A65A0daD",
ezynda3 marked this conversation as resolved.
Show resolved Hide resolved
"StandardizedCallFacet": "0xA7ffe57ee70Ac4998e9E9fC6f17341173E081A8f",
"MayanFacet": "0xd596C903d78870786c5DB0E448ce7F87A65A0daD",
"GenericSwapFacetV3": "0xFf6Fa203573Baaaa4AE375EB7ac2819d539e16FF",
Expand Down
5 changes: 2 additions & 3 deletions deployments/polygon.diamond.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
"Version": "1.0.0"
},
"0xE15C7585636e62b88bA47A40621287086E0c2E33": {
"Name": "",
"Version": ""
"Name": "DeBridgeDlnFacet",
"Version": "1.0.0"
}
},
"Periphery": {
Expand All @@ -136,4 +136,3 @@
"TokenWrapper": "0xF63b27AE2Dc887b88f82E2Cc597d07fBB2E78E70"
}
}
}
2 changes: 1 addition & 1 deletion deployments/polygon.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"ServiceFeeCollector": "0x9cc3164f01ED3796Fdf7Da538484D634608D2203",
"LiFuelFeeCollector": "0x94EA56D8049e93E0308B9c7d1418Baf6A7C68280",
"AcrossFacetPacked": "0x7A3770a9504924d99D38BBba4F0116B756393Eb3",
"DeBridgeDlnFacet": "0xE500dED7b9C9f1020870B7a6Db076Dbd892C0fea",
"DeBridgeDlnFacet": "0xE15C7585636e62b88bA47A40621287086E0c2E33",
"AmarokFacetPacked": "0x0aB252E7b5167Be2aC7841Bdaf1689E1a475ceE7",
"TokenWrapper": "0xF63b27AE2Dc887b88f82E2Cc597d07fBB2E78E70",
"GasRebateDistributor": "0x3116B8F099D7eFA6e24f39F80146Aac423365EB9",
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [CBridge Facet](./CBridgeFacet.md)
- [Celer Circle Bridge Facet](./CelerCircleBridgeFacet.md)
- [Circle Bridge Facet](./CircleBridgeFacet.md)
- [DeBridge Facet](./DeBridgeFacet.md)
- [DeBridge DLN Facet](/docs/DeBridgeDlnFacet.md)
- [DEX Manager Facet](./DexManagerFacet.md)
- [DiamondCut Facet](./DiamondCutFacet.md)
- [DiamondLoupe Facet](./DiamondLoupeFacet.md)
Expand All @@ -21,19 +21,15 @@
- [Hop Facet Packed](./HopFacetPacked.md)
- [Hyphen Facet](./HyphenFacet.md)
- [LIFuel Facet](./LIFuelFacet.md)
- [MakerTeleport Facet](./MakerTeleportFacet.md)
- [Mayan Facet](./MayanFacet.md)
- [Multichain Facet](./MultichainFacet.md)
- [OmniBridge Facet](./OmniBridgeFacet.md)
- [Optimism Bridge Facet](./OptimismBridgeFacet.md)
- [Periphery Registry Facet](./PeripheryRegistryFacet.md)
- [Polygon Bridge Facet](./PolygonBridgeFacet.md)
- [Ronin Bridge Facet](./RoninBridgeFacet.md)
- [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 Down
9 changes: 5 additions & 4 deletions script/demoScripts/demoDLN.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import deployments from '../../deployments/mainnet.staging.json'
import deployments from '../../deployments/arbitrum.staging.json'
import {
ezynda3 marked this conversation as resolved.
Show resolved Hide resolved
DeBridgeDlnFacet__factory,
ILiFi,
Expand All @@ -24,7 +24,7 @@ const main = async () => {

// Bridge 5 ARB from Polygon to USDC on Optimism
const resp = await fetch(
'https://api.dln.trade/v1.0/dln/order/quote?srcChainId=42161&srcChainTokenIn=0x912CE59144191C1204E64559FE8253a0e49E6548&srcChainTokenInAmount=5000000000000000000&dstChainId=10&dstChainTokenOut=0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85&prependOperatingExpenses=false'
'https://api.dln.trade/v1.0/dln/order/quote?srcChainId=42161&srcChainTokenIn=0x912CE59144191C1204E64559FE8253a0e49E6548&srcChainTokenInAmount=95000000000000000000&dstChainId=100000002&dstChainTokenOut=0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d&prependOperatingExpenses=false'
)
const quote = await resp.json()

Expand All @@ -42,14 +42,15 @@ const main = async () => {
sendingAssetId: srcChainTokenIn.address,
receiver: address,
minAmount: srcChainTokenIn.amount,
destinationChainId: 10,
destinationChainId: 100,
hasSourceSwaps: false,
hasDestinationCall: false,
}

const dlnData: DeBridgeDlnFacet.DeBridgeDlnDataStruct = {
receivingAssetId: dstChainTokenOut.address,
receiver: ethers.utils.solidityPack(['address'], [address]),
orderAuthorityDst: ethers.utils.solidityPack(['address'], [address]),
minAmountOut: dstChainTokenOut.recommendedAmount,
}

Expand All @@ -65,7 +66,7 @@ const main = async () => {
value: quote.fixFee,
})
await tx.wait()
console.info('Bridged USDC')
console.info('Bridged ARB')
}

main()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract DeployScript is DeployScriptBase {
string memory json = vm.readFile(path);

address dlnSource = json.readAddress(
string.concat(".", network, ".dlnSource")
string.concat(".networks.", network, ".dlnSource")
ezynda3 marked this conversation as resolved.
Show resolved Hide resolved
);

return abi.encode(dlnSource);
Expand Down
Loading
Loading