Skip to content

Commit

Permalink
Gas zip facet revisited [GasZipFacet v2.0.0,IGasZip v1.0.0,GasZipPeri…
Browse files Browse the repository at this point in the history
…phery v1.0.0] (#807)

* wip zip

* feat: zip erc20 with libswap

* chore: update bsc gaszip address

* clean

* chore: updated gaszip routers + add docs

* chore: deployRequirements

* chore: remove allowedToken

* chore: withdraw wallet from global config

* chore: comments

* chore: import

* chore: remove owner

* chore: unused import

* chore: remove unused errors

* forge install: solady

v0.0.208

* forge install: solady

v0.0.208

* added test and fixed some issues in the contract

* adds refundAddress parameter for ERC20

* forge install: solady

v0.0.208

* forge install: solady

v0.0.208

* tests updated

* gasZip redeployed to BSC staging

* update .gitmodules file

* removes ERC20 refund handling and adds complex test case

* removes coverage files

* cleanup

* update docs

* adds complex native test case

* deploys GasZipFacet to BSC staging

* fixes issue in deploy log file

* adds a function with deposit for standalone gas-zip only calls

* adds the usual startBridge... functions to the facet + tests

* adds a amountOutMin parameter for ERC20 deposit function

* redeployed gasZipFacet to bsc staging

* feat: removes destinationChains parameter from GasZipData

* docs: updates GasZipFacet  docs

* updates facet (startBridge => nativeOnly)

* replaces amountOutMin parameter with balance checks & updates tests

* updates docs

* fixes typo in URL and adds link to config file

* restricts swapAndBridge.. function to native only + updates tests

* restricts swapAndBridge.. function to native only + updates tests

* redeployed gasZipFacet to bsc staging

* Gas.Zip split into facet & periphery, tests and docs added

* remove receiver address from GasZipData struct

* minor fixes

* some changes based on coderabbit review comments

* opens swapAndBridge on GasZipFacet for both ERC20 and native

* deployed to bsc staging

* updated gasZip to use V2 router

* updates git actions and docs

* adds an amount parameter to native deposit function in periphery

* redeployed GasZipPeriphery to bsc staging

* returns leftover native funds to msg.sender after deposit plus bsc staging redeployment

* bugfix + bsc staging redeploy

* bugfix#2 + bsc staging redeploy

* adds a test case to increase coverage to 100%

* minor fixes

* gas optimization of helper function (audit issue #1)

* remove unused error (audit issue #2)

* adds check for  msg.value==amount and removes refundExcessNative mod (audit issue#4)

* replaces require with custom error (audit issue#6)

* adds WithdrawablePeriphery for stuck token withdrawals (audit issue#8)

* adds WithdrawablePeriphery base contract for token withdrawals

* adds receiverAddress check (audit issue#9)

* fix test

* adds version tag to contract

* ensures last swap output is native before bridging (audit issue#5)

* removes validateBridgeData modifier and adds dedicated bridgeData checks (audit issue#3)

* redeployed gasZipPeriphery with PROD LiFiDEXAggregator address

* audit report added

* change facet variable to constant

* change parameter name and order in GasZipData

* redeployed to BSC staging

* test coverage back to 100%

* redeployed to BSC staging

* add complex testcase for destinationChains value

* adjust test case

* fix staging diamond log

* replaces low-level native transfer with function from solady lib

* removes unused import (re-audit issue#11)

* update (re-)audit report

* remove old gaszip audit entry

* fix incorrect path in audit log

* Redeploy to production (except zksync)

* Update pragma

* update audit

* deploy to zksync

* adds GasZipPeriphery addresses to dexs.json

* make error message more visible in console output

* update some diamond logs

* remove old openzeppelin lib

* forge install: openzeppelin-contracts

v4.9.2

* reinstall openzeppelin contracts 4.9.2

* add gasZipPeriphery sigs

* fix json

* fix json

* fix logs

* diamond logs updated

* undo (wording) changes in git action

---------

Co-authored-by: Leonardo Cascianelli <[email protected]>
Co-authored-by: Daniela Chybisova <[email protected]>
Co-authored-by: Max Klenk <[email protected]>
Co-authored-by: Ed Zynda <[email protected]>
Co-authored-by: Ed Zynda <[email protected]>
  • Loading branch information
6 people authored Dec 4, 2024
1 parent b6afcc3 commit de51c40
Show file tree
Hide file tree
Showing 67 changed files with 2,986 additions and 139 deletions.
16 changes: 16 additions & 0 deletions audit/auditLog.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
"auditReportPath": "./audit/reports/2024.11.05_EmergencyPauseFacet_ReAudit.pdf",
"auditCommitHash": "da61880ba3847c07c35b64a78b957ff845ec18ac"
},
"audit20241107": {
"auditCompletedOn": "07.11.2024",
"auditedBy": "Sujith Somraaj (individual security researcher)",
"auditorGitHandle": "sujithsomraaj",
"auditReportPath": "./audit/reports/2024.11.07_GasZip.pdf",
"auditCommitHash": "2d8927ababff6ace0c577d92407bcf289ebb89c0"
},
"audit20241122": {
"auditCompletedOn": "22.11.2024",
"auditedBy": "Sujith Somraaj (individual security researcher)",
Expand All @@ -50,6 +57,15 @@
"AcrossFacetPackedV3": {
"1.0.0": ["audit20241007"]
},
"GasZipFacet": {
"2.0.0": ["audit20241107"]
},
"GasZipPeriphery": {
"1.0.0": ["audit20241107"]
},
"IGasZip": {
"1.0.0": ["audit20241107"]
},
"EmergencyPauseFacet": {
"1.0.0": ["audit20240913"],
"1.0.1": ["audit20241105"]
Expand Down
Binary file added audit/reports/2024.11.07_GasZip.pdf
Binary file not shown.
36 changes: 29 additions & 7 deletions config/dexs.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"0x19dBa5df5383168f760617aaDD23322BC5F9Ff7b",
"0x827179dD56d07A7eeA32e3873493835da2866976",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"
"0x7d0ccaa3fac1e5a943c5168b6ced828691b46b36",
"0x40aA958dd87FC8305b97f2BA922CDdCa374bcD7f",
"0xFe837A3530dD566401d35beFCd55582AF7c4dfFC"
Expand Down Expand Up @@ -88,6 +89,7 @@
"0x9c6522117e2ed1fE5bdb72bb0eD5E3f2bdE7DBe0",
"0xfc506AaA1340b4dedFfd88bE278bEe058952D674",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F",
"0xf332761c673b59b21ff6dfa8ada44d78c12def09",
"0x70cBb871E8f30Fc8Ce23609E9E0Ea87B6b222F58"
Expand Down Expand Up @@ -152,6 +154,7 @@
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0x400d75dAb26bBc18D163AEA3e83D9Ea68F6c1804",
"0x717b7948AA264DeCf4D780aa6914482e5F46Da3e",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x1dac23e41fc8ce857e86fd8c1ae5b6121c67d96d",
"0x40aA958dd87FC8305b97f2BA922CDdCa374bcD7f",
Expand Down Expand Up @@ -180,7 +183,8 @@
"0x0000000000001ff3684f28c67538d4d072c22734",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"
"0x6b2c0c7be2048daa9b5527982c29f48062b34d58",
"0x57df6092665eb6058DE53939612413ff4B09114E"
],
Expand All @@ -197,7 +201,7 @@
"0xCdBCd51a5E8728E0AF4895ce5771b7d17fF71959",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0x2e86f54943fafd2cb62958c3deed36c879e3e944",
"0x5fD2Dc91FF1dE7FF4AEB1CACeF8E9911bAAECa68"
],
Expand Down Expand Up @@ -267,6 +271,7 @@
"0x7cf167390E2526Bc03F3CF6852A7AF1CEC3e243d",
"0x400d75dAb26bBc18D163AEA3e83D9Ea68F6c1804",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F",
"0x9333c74bdd1e118634fe5664aca7a9710b108bab",
"0x2c34A2Fb1d0b4f55de51E1d0bDEfaDDce6b7cDD6",
Expand Down Expand Up @@ -365,7 +370,8 @@
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0x3D2f8ae0344d38525d2AE96Ab750B83480c0844F",
"0x2214A42d8e2A1d20635c2cb0664422c528B6A432",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55"
"0xf332761c673b59b21ff6dfa8ada44d78c12def09",
"0x70cBb871E8f30Fc8Ce23609E9E0Ea87B6b222F58"
],
Expand Down Expand Up @@ -417,13 +423,15 @@
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0x1e9B24073183d5c6B7aE5FB4b8f0b1dd83FDC77a",
"0xBBDe1d67297329148Fe1ED5e6B00114842728e65",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55"
],
"gravity": [
"0x79540403cdE176Ca5f1fb95bE84A7ec91fFDEF76",
"0x7fA60f4A59Dd8285C5Fcd8fd2A92A2Ca45ef8a0C",
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0x134f525AC05E4724e55C363A9C4FA35ceB13F88d",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0x6352a56caadc4f1e25cd6c75970fa768a3304e64"
],
"immutablezkevm": [
Expand Down Expand Up @@ -492,6 +500,7 @@
"0x46b3fdf7b5cde91ac049936bf0bdb12c5d22202e",
"0x000000000000175a8b9bc6d539b3708eed92ea6c",
"0xcaA342e4f781d63EF41E220D7622B97E66BAEcF3",
"0x0ec6D2eEb94541C51620830D151995fCFf83Aa74",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x6b2c0c7be2048daa9b5527982c29f48062b34d58",
"0x57df6092665eb6058DE53939612413ff4B09114E"
Expand All @@ -505,6 +514,7 @@
"0xF2ee649caB7a0edEdED7a27821B0aCDF77778aeD",
"0x0263180888007D45340F86eC0b610d250BbDcB23",
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0x6131b5fae19ea4f9d964eac0408e4408b66337b5",
"0x6b2c0c7be2048daa9b5527982c29f48062b34d58",
"0x57df6092665eb6058DE53939612413ff4B09114E"
Expand All @@ -514,6 +524,7 @@
"0x27f0e36dE6B1BA8232f6c2e87E00A50731048C6B",
"0xB45e53277a7e0F1D35f2a77160e91e25507f1763",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x799525cE72B5cc9eb310dc8c7b9e7A3128a6dA79",
"0x9E4c63c9a0EDE2Ca2e772ee48C819Ca5CB4529AC",
"0x6b2c0c7be2048daa9b5527982c29f48062b34d58",
"0x57df6092665eb6058DE53939612413ff4B09114E"
Expand All @@ -527,6 +538,8 @@
"0xc02FFcdD914DbA646704439c6090BAbaD521d04C",
"0x6352a56caadC4F1E25CD6c75970Fa768A3304e64",
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"
"0xd0f95fafa06de1b21e79db03c649919501e99ea9",
"0xbd0ebe49779e154e5042b34d5bcfbc498e4b3249"
],
Expand Down Expand Up @@ -643,12 +656,14 @@
"0x96E04591579f298681361C6122Dc4Ef405c19385",
"0x4C5D5234f232BD2D76B96aA33F5AE4FCF0E4BFAb",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F",
"0xf332761c673b59b21ff6dfa8ada44d78c12def09",
"0x68D6B739D2020067D1e2F713b999dA97E4d54812"
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"
],
"opbnb": [
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F",
"0xf332761c673b59b21ff6dfa8ada44d78c12def09",
"0x68D6B739D2020067D1e2F713b999dA97E4d54812"
"0x6A2420650139854F17964b8C3Bb60248470aB57E",
"0xEc41F702d36b43a1E1d017Cb4da92F431dFA7a0E",
"0x077A38b812e57E2e76849954c880E1a2f5e0A68d"
Expand Down Expand Up @@ -700,6 +715,7 @@
"0x0dc8E47a1196bcB590485eE8bF832c5c68A52f4B",
"0x0a6e511Fe663827b9cA7e2D2542b20B37fC217A6",
"0xf2614A233c7C3e7f08b1F887Ba133a13f1eb2c55",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F",
"0xa748d6573aca135af68f2635be60cb80278bd855",
"0x3B86917369B83a6892f553609F3c2F439C184e31",
Expand Down Expand Up @@ -758,6 +774,8 @@
"0xbfe03c9e20a9fc0b37de01a172f207004935e0b1",
"0x0000000000005e88410ccdfade4a5efae4b49562",
"0x6140b987d6B51Fd75b66C3B07733Beb5167c42fc",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"
"0x6b2c0c7be2048daa9b5527982c29f48062b34d58",
"0x57df6092665eb6058DE53939612413ff4B09114E"
],
Expand All @@ -766,6 +784,7 @@
"0xff2F39692A90262b8Ed4DFD92799bB450425773F",
"0xD989E929517B0e5eD0c8EfE7607Fa167B697cBa8",
"0xcaA342e4f781d63EF41E220D7622B97E66BAEcF3",
"0x0ec6D2eEb94541C51620830D151995fCFf83Aa74",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"
],
"velas": [
Expand All @@ -783,6 +802,7 @@
"0xC69994fd72824ca98F8a0B1E2ABc954E65a91cf4",
"0x12904D12A84702f9F079E1e393fdAbD313496e97",
"0x833Be894C596b15FAe740C2D522d660084c48B05",
"0x9a21E33F1a78b17DAd32010CeDB9Fd2F071C17d3",
"0x2321F1a63A683a1F3634Dbe1CbA0d657D5F56d54",
"0x127a986ce31aa2ea8e1a6a0f0d5b7e5dbad7b0be",
"0x8b773D83bc66Be128c60e07E17C8901f7a64F000"
Expand All @@ -808,6 +828,8 @@
"0xe832e655E4C3c36b2be5256915ECF8536a642f59",
"0x6fd4383cb451173d5f9304f041c7bcbf27d561ff",
"0x1F683faf1E2a770aa75f7B2e92117A5c11183E9C",
"0x4000f76450d9d40558fd60F66863F583B7A5BCCb",
"0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"
"0xb9061e38fee7d30134f56aef7117e2f6d1580666",
"0xc67879F4065d3B9fe1C09EE990B891Aa8E3a4c2f"
],
Expand Down
24 changes: 24 additions & 0 deletions config/gaszip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"gasZipRouters": {
"---ListOfRouterAddresses---": "https://dev.gas.zip/gas/chain-support/inbound",
"mainnet": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"arbitrum": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"avalanche": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"base": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"bsc": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"blast": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"fantom": "0xA60768b03eB14d940F6c9a8553329B7F9037C91b",
"gnosis": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"gravity": "0x6Efc6Ead40786bD87A884382b6EA4BcA3C985e99",
"linea": "0xA60768b03eB14d940F6c9a8553329B7F9037C91b",
"mantle": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"metis": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"mode": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"optimism": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"polygon": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"scroll": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"taiko": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"xlayer": "0x2a37D63EAdFe4b4682a3c28C1c2cD4F109Cc2762",
"zksync": "0x252fb662e4d7435d2a5ded8ec94d8932cf76c178"
}
}
2 changes: 1 addition & 1 deletion config/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"aurora": "https://safe-transaction-aurora.safe.global/api",
"avalanche": "https://safe-transaction-avalanche.safe.global/api",
"base": "https://safe-transaction-base.safe.global/api",
"blast": "https://transaction.blast-safe.io/api",
"blast": "https://safe-transaction-blast.safe.global/api",
"boba": "https://safe-transaction.mainnet.boba.network/api",
"bsc": "https://safe-transaction-bsc.safe.global/api",
"celo": "https://safe-transaction-celo.safe.global/api",
Expand Down
4 changes: 3 additions & 1 deletion config/sigs.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@
"0x6678ec1f",
"0x30eef8bd",
"0x4dcebcba",
"0x8b71ae6c",
"0xc4af5a74",
"0x03b87e5f",
"0x0d5f0e3b",
"0x08298b5a"
]
}
}
Loading

0 comments on commit de51c40

Please sign in to comment.