Skip to content

Conversation

@chybisov
Copy link
Member

No description provided.

@chybisov chybisov merged commit ff6eab7 into master Aug 11, 2022
@chybisov chybisov deleted the fix-links branch August 11, 2022 09:17
0xDEnYO added a commit that referenced this pull request Jan 15, 2024
ezynda3 pushed a commit that referenced this pull request Jan 23, 2024
0xDEnYO added a commit that referenced this pull request Jun 4, 2024
0xDEnYO added a commit that referenced this pull request Jun 12, 2024
….0.0 > v.3.0.0) (#648)

* feat: first version of V3 added

* docs: updates GenericSwapFacet docs

* refactor: introduces helper functions

* tests added for various use cases

* cleanup

* remove console.log

* feat: sends unused input tokens back to user + tests updated

* update comment

* cleanup

* re-add GenericSwapFacet (v1) and add V3 as separate facet

* re-add tests for GenericSwapFacet (v1)

* functions renamed

* updates docs

* added support for multi-swaps to native + tests

* harmonized function naming

* test: adds additional multiswap test for inputToken dust refund

* fix: fixes broken test in POL test file

* test: adds test helpers (dex mock)

* test: achieves 100% test coverage

* cleanup

* add missing selectors when deploying mockDEX

* Implment and add tests for LibUtil::revertWith()

* remove unneeded import

* deploy to staging

* fix copy/paste error

* removes payable keyword from ERC20To... functions (audit issue #5)

* uses hardcoded address(0) as sendingAssetId for NativeTo (audit issue #4)

* uses hardcoded address(0) as receivingAsset in swapTokensSingleV3ERC20ToNative (audit issue #3)

* initialize variables before loops to save gas (audit issue #8)

* improved forge coverage to produce a clean, comprehensive report

* test: added tests to achieve 100% branch coverage (audit issue #2)

* chore: adds comments

* deploy to prod

* update logs

---------

Co-authored-by: Ed Zynda <ezynda3@gmail.com>
0xDEnYO added a commit that referenced this pull request Jun 17, 2024
0xDEnYO added a commit that referenced this pull request Jun 19, 2024
0xDEnYO added a commit that referenced this pull request Jul 4, 2024
…iverStargateV2 v.1.0.0) (#678)

* merged external changes

* update deploy requirements

* deploy logs reinstated

* cleanup

* stargate reviewer comments implemented

* added a check to make sure taxi mode is used for dest calls (audit issue #14)

* tests fixed

* removed unused import (audit issue #10)

* updated comment (audit issue #9)

* updated test setup so that receive function in facet is not required (audit issue #6)

* removed unnecessary parameter (reserveRecoverGas) in Receiver (audit issue #7)

* use safeApprove instead of approve (audit issue #4)

* forge install: solady

v0.0.208

* inlines functions to save gas (audit issue #5)

* improves validation of _from parameter / caller in ReceiverStargateV2 (audit issue #3)

* removes receive function from StargateFacet (audit issue #6)

* updates deploy script and redeploys ReceiverStargateV2 to staging (OPT)

* adds a check that ensures receiver addresses match in case of no dst call

* redeployed to polygon staging

* confi: updates stargate config (adds missing networks/addresses)

* mainnet deployments

* Deploy ReceiverStargateV2

* update logs

* deploy to bsc

* deploy to prod

---------

Co-authored-by: Ed Zynda <ezynda3@gmail.com>
Co-authored-by: Leonardo Cascianelli <leo@li.finance>
ezynda3 added a commit that referenced this pull request Jan 11, 2025
…p calls (CallDataVerificationFacet v1.2.0) [CalldataVerificationFacet v1.2.0,IAcrossSpokePool v1.0.0] (#767)

* adds extraction handling for GenericSwapV3 single calldata

* push test coverage to 100%

* remove lcov-filtered.info

* minor update

* remove console import

* gas optimization (audit issue #7)

* adds handling for StargateV2 destination calls (audit issue #8)

* gas optimization in extractGenericSwapParameters (audit issue #6)

* update min callData length check (audit issue #4)

* gas optimization in extractNonEVMAddress (audit issue #3)

* update comments, fix typo (audit issue#2)

* adds handling for AcrossV3 destination calls (audit issue #9)

* typo fixed in comment

* gas optimization

* updates audit log and adds audit report

* update log

---------

Co-authored-by: Ed Zynda <ezynda3@users.noreply.github.com>
Co-authored-by: Ed Zynda <ezynda3@gmail.com>
0xDEnYO added a commit that referenced this pull request Jan 21, 2025
0xDEnYO added a commit that referenced this pull request Jan 23, 2025
mirooon added a commit that referenced this pull request Feb 12, 2025
mirooon added a commit that referenced this pull request May 12, 2025
0xDEnYO pushed a commit that referenced this pull request May 14, 2025
…ctory v1.0.0,IAlgebraPool v1.0.0,IAlgebraQuoter v1.0.0,IAlgebraRouter v1.0.0,LiFiDEXAggregator v1.9.0] (#1117)

* rebase fix

* test

* Implement ERC4626 support in LiFiDEXAggregator

- Added a new function `_isERC4626` to check if a token is an ERC4626 vault.
- Updated the swap logic to use `IAlgebraPool` for ERC4626 tokens, ensuring compatibility with fee-supporting entrypoints.
- Introduced a constant for the `sharesToAssets` selector to facilitate the ERC4626 check.

* Removed _isERC4626

* Refactor IAlgebraPool interface and enhance LiFiDEXAggregator for Algebra swaps

- Updated IAlgebraPool interface to improve documentation and rename swap functions for clarity.
- Enhanced LiFiDEXAggregator to support Algebra pool swaps, including handling fee-on-transfer tokens.
- Introduced new error handling for unexpected Algebra swap scenarios.
- Added tests for multi-hop swaps and ensured compatibility with ERC4626 tokens.

* Enhance LiFiDEXAggregator with Algebra pool support and fee-on-transfer handling

- Added support for Algebra pool swaps, including a new swap function tailored for fee-on-transfer tokens.
- Introduced constants for pool type identifiers to improve code readability.
- Updated error handling for unexpected Algebra swap scenarios.
- Enhanced tests to validate the new functionality and ensure compatibility with ERC4626 tokens.

* force commit

* Remove LiFiDEXAggregator test file

* Enhance IAlgebraPool and LiFiDEXAggregator for improved swap functionality

- Added detailed documentation for the `token0` function in the IAlgebraPool interface.
- Introduced a new IAlgebraRouter interface to facilitate pool address retrieval for token pairs.
- Refactored LiFiDEXAggregator to streamline swap logic and improve error handling.
- Updated tests to validate the integration of the new router and ensure compatibility with existing functionality.

* Enhance IAlgebraPool and LiFiDEXAggregator with new functionalities

- Added `initialize` function to IAlgebraPool for setting the initial price of the pool.
- Updated the `mint` function in IAlgebraPool to include detailed parameters for adding liquidity.
- Introduced a new `IQuoterV2` interface for improved quoting functionality in swaps.
- Enhanced LiFiDEXAggregator tests to support multi-hop swaps with fee-on-transfer tokens and added mock token contracts for testing.
- Improved error handling and assertions in existing tests to ensure robustness.

* Enhance LiFiDEXAggregator with logging and code formatting improvements

- Added console logging in `processOnePool` for better debugging visibility.
- Reformatted function signatures and code for improved readability and consistency.
- Updated tests to ensure compatibility with new token implementations and multi-hop swap scenarios.

* refactor: rename LiFiDexAggregator.t.sol to LiFiDEXAggregator.t.sol

* Update deployment logs and add new staging configuration for LiFiDEXAggregator

- Added staging configuration for version 1.8.0 in the deployments log file, including address, optimizer runs, timestamp, constructor arguments, and verification status.
- Introduced a new file for apechain staging with the LiFiDEXAggregator address.

* Refactor LiFiDEXAggregator and tests for improved clarity and functionality

- Removed unused imports and interfaces from LiFiDEXAggregator and its test file.
- Updated test cases to use consistent variable names and improved readability.
- Introduced new imports for better test coverage and mock implementations.
- Enhanced error handling and logging for Algebra pool interactions.

* Added supportsFeeOnTransfer

* Refactor LiFiDEXAggregator tests to improve route building logic

* - Replaced manual route building with the _buildAlgebraRoute function for improved clarity and consistency

* Refactor LiFiDEXAggregator tests to remove unused amountIn parameters from route building calls for improved clarity and consistency

* Refactor LiFiDEXAggregator tests to simplify function signatures by removing unused parameters and improving variable naming for better readability

* Refactor LiFiDEXAggregator tests to utilize AlgebraRouteParams struct for improved readability and maintainability of route building logic

* Add command and pool type enums to LiFiDEXAggregator tests for improved route processing clarity

- Introduced CommandType, PoolType, SwapDirection, and CallbackStatus enums to enhance readability and maintainability of route processing logic.
- Updated route building in test cases to utilize these enums for better clarity and consistency

* - Removed unused import from LiFiDEXAggregator test file to streamline code.

* Refactor LiFiDEXAggregator tests to enhance multi-hop swap functionality and improve code organization

- Introduced MultiHopTestState struct to encapsulate state for multi-hop tests, improving readability and maintainability.
- Simplified token and pool setup with dedicated helper functions for better clarity.
- Updated test cases to utilize the new structure, ensuring consistent handling of fee-on-transfer tokens and regular tokens.
- Enhanced error handling for unexpected swap scenarios, ensuring robust testing of edge cases.

* updates

* Implement fallback mechanism for swapSupportingFeeOnInputTokens in LiFiDEXAggregator to enhance robustness against unsupported token swaps

* Add test for fallback mechanism in LiFiDEXAggregator to ensure successful swaps when swapSupportingFeeOnInputTokens is unsupported

- Implemented test_CanSwapViaAlgebra_FallbackToRegularSwap to validate fallback behavior during token swaps.
- Verified correct handling of token balances before and after the swap, ensuring robustness in edge cases.

* Update deployment addresses and timestamps for LiFiDEXAggregator in staging environment

* Update test to include minimum output parameter for slippage handling

* cleaning, added natspec

* Update LiFiDEXAggregator version to 1.9.0

* added ETH_NODE_URI_APECHAIN to forge.yml

* added ETH_NODE_URI_APECHAIN to enforceTestCoverage.yml

* added direction comment

* Added IAlgebraPool natspec

* sanity check recipient and pool address in swapAlgebra() (audit fix #1)

* Fixed inconsistent direction handling (audit fix #2)

* Fixed inaccurate supportsFeeOnTransfer flag validation. Add documentation. (audit fix #3)

* fixed - removed try catch pattern (audit fix #4)

* Added audit report
@coderabbitai coderabbitai bot mentioned this pull request Jun 25, 2025
8 tasks
0xDEnYO added a commit that referenced this pull request Jun 26, 2025
mirooon added a commit that referenced this pull request Jun 30, 2025
0xDEnYO added a commit that referenced this pull request Jul 3, 2025
…IiZiSwapPool v1.0.0,LiFiDEXAggregator v1.11.0] (#1218)

* rebase fix

* test

* Implement ERC4626 support in LiFiDEXAggregator

- Added a new function `_isERC4626` to check if a token is an ERC4626 vault.
- Updated the swap logic to use `IAlgebraPool` for ERC4626 tokens, ensuring compatibility with fee-supporting entrypoints.
- Introduced a constant for the `sharesToAssets` selector to facilitate the ERC4626 check.

* Removed _isERC4626

* Refactor IAlgebraPool interface and enhance LiFiDEXAggregator for Algebra swaps

- Updated IAlgebraPool interface to improve documentation and rename swap functions for clarity.
- Enhanced LiFiDEXAggregator to support Algebra pool swaps, including handling fee-on-transfer tokens.
- Introduced new error handling for unexpected Algebra swap scenarios.
- Added tests for multi-hop swaps and ensured compatibility with ERC4626 tokens.

* Enhance LiFiDEXAggregator with Algebra pool support and fee-on-transfer handling

- Added support for Algebra pool swaps, including a new swap function tailored for fee-on-transfer tokens.
- Introduced constants for pool type identifiers to improve code readability.
- Updated error handling for unexpected Algebra swap scenarios.
- Enhanced tests to validate the new functionality and ensure compatibility with ERC4626 tokens.

* force commit

* Remove LiFiDEXAggregator test file

* Enhance IAlgebraPool and LiFiDEXAggregator for improved swap functionality

- Added detailed documentation for the `token0` function in the IAlgebraPool interface.
- Introduced a new IAlgebraRouter interface to facilitate pool address retrieval for token pairs.
- Refactored LiFiDEXAggregator to streamline swap logic and improve error handling.
- Updated tests to validate the integration of the new router and ensure compatibility with existing functionality.

* Enhance IAlgebraPool and LiFiDEXAggregator with new functionalities

- Added `initialize` function to IAlgebraPool for setting the initial price of the pool.
- Updated the `mint` function in IAlgebraPool to include detailed parameters for adding liquidity.
- Introduced a new `IQuoterV2` interface for improved quoting functionality in swaps.
- Enhanced LiFiDEXAggregator tests to support multi-hop swaps with fee-on-transfer tokens and added mock token contracts for testing.
- Improved error handling and assertions in existing tests to ensure robustness.

* Enhance LiFiDEXAggregator with logging and code formatting improvements

- Added console logging in `processOnePool` for better debugging visibility.
- Reformatted function signatures and code for improved readability and consistency.
- Updated tests to ensure compatibility with new token implementations and multi-hop swap scenarios.

* refactor: rename LiFiDexAggregator.t.sol to LiFiDEXAggregator.t.sol

* Update deployment logs and add new staging configuration for LiFiDEXAggregator

- Added staging configuration for version 1.8.0 in the deployments log file, including address, optimizer runs, timestamp, constructor arguments, and verification status.
- Introduced a new file for apechain staging with the LiFiDEXAggregator address.

* Refactor LiFiDEXAggregator and tests for improved clarity and functionality

- Removed unused imports and interfaces from LiFiDEXAggregator and its test file.
- Updated test cases to use consistent variable names and improved readability.
- Introduced new imports for better test coverage and mock implementations.
- Enhanced error handling and logging for Algebra pool interactions.

* Added supportsFeeOnTransfer

* Refactor LiFiDEXAggregator tests to improve route building logic

* - Replaced manual route building with the _buildAlgebraRoute function for improved clarity and consistency

* Refactor LiFiDEXAggregator tests to remove unused amountIn parameters from route building calls for improved clarity and consistency

* Refactor LiFiDEXAggregator tests to simplify function signatures by removing unused parameters and improving variable naming for better readability

* Refactor LiFiDEXAggregator tests to utilize AlgebraRouteParams struct for improved readability and maintainability of route building logic

* Add command and pool type enums to LiFiDEXAggregator tests for improved route processing clarity

- Introduced CommandType, PoolType, SwapDirection, and CallbackStatus enums to enhance readability and maintainability of route processing logic.
- Updated route building in test cases to utilize these enums for better clarity and consistency

* - Removed unused import from LiFiDEXAggregator test file to streamline code.

* Refactor LiFiDEXAggregator tests to enhance multi-hop swap functionality and improve code organization

- Introduced MultiHopTestState struct to encapsulate state for multi-hop tests, improving readability and maintainability.
- Simplified token and pool setup with dedicated helper functions for better clarity.
- Updated test cases to utilize the new structure, ensuring consistent handling of fee-on-transfer tokens and regular tokens.
- Enhanced error handling for unexpected swap scenarios, ensuring robust testing of edge cases.

* updates

* Implement fallback mechanism for swapSupportingFeeOnInputTokens in LiFiDEXAggregator to enhance robustness against unsupported token swaps

* Add test for fallback mechanism in LiFiDEXAggregator to ensure successful swaps when swapSupportingFeeOnInputTokens is unsupported

- Implemented test_CanSwapViaAlgebra_FallbackToRegularSwap to validate fallback behavior during token swaps.
- Verified correct handling of token balances before and after the swap, ensuring robustness in edge cases.

* Update deployment addresses and timestamps for LiFiDEXAggregator in staging environment

* added initial iZiSwap V3 support to LDA

* added initial iZiSwap V3 support to LDA

* Update test to include minimum output parameter for slippage handling

* cleaning, added natspec

* fixed test

* refactored lda to improve swap callback handling and updated test cases

* refactored lda to improve swap callback handling and updated test cases

* Update LiFiDEXAggregator version to 1.9.0

* Update LiFiDEXAggregator version to 1.10.0

* added ETH_NODE_URI_APECHAIN to forge.yml

* added ETH_NODE_URI_APECHAIN to enforceTestCoverage.yml

* added staging contract

* added taiko deployment

* added scroll LDA staging

* new staging taiko version

* updates

* bumped version of LDA

* updates

* Added tests for syncswap

* added tests

* fixed FromDexAggregator test for Izumi

* deleted unnecessary code

* uncomment

* minor fixes

* minor adjustments (formatting, comments, etc.)

* deployed LDA to zksync (but not added to diamond yet)

* fix - Validate decoded stream parameters

* fix Unsafe amount parameter casting can lead to locking of user funds (audit fix #2)

* fix Decode tokenIn only if the amount to transfer is valid in _handleIzumiV3SwapCallback() function (audit fix #3)

* fix Inaccurate inline documentation for izumi swap handlers (audit fix #4)

* fix Inconsistent INTERNAL_INPUT_SOURCE handling in swapSyncSwap() function (audit fix #5)

* fix - Sanity check withdrawMode in swapSyncSwap() (audit fix #6)

* added audit

* added audit log

* added comments

---------

Co-authored-by: Daniel Bläcker <d.blaecker@gmail.com>
0xDEnYO added a commit that referenced this pull request Jul 4, 2025
* feat: pioneer draft

* Update pioneer docs and json

* Rabbit review comments

* Pioneer testing

* update sol pragma in test file

* deployed to arb staging

* Cleanup Poylmer scripts

* Fix type definition in pioneer script

* Fix json merge issue

* Fix mistake again

* Remove unused error

* Fix json deployment file, excess {

* Reviews fixes

* Set deployment requirements and remove 0 check

* update config and add zksync deploy script

* adjust demo script to match latest refactoring

* rename constructor parameter

* add constructor parameter validation

* Add a refund address to pioneer facet [PioneerFacet v1.1.0] (#1227)

* Add a refund address to pioneer facet

* update demo script and add test for event

* Update minor pioneer version

* rename event and add comments/docs for more clarity about refunds

* revert contract version back to 1.0.0

* add transactionID validation (audit issue #1)

* add indexed to event parameter (audit issue #2)

* add refundAddress validation (audit issue #3)

* add parameter description (audit issue #5)

* event renamed (audit issue #6)

* Deploy new contracts to staging

* pioneer audit report added

* reorder audit log alphabetically

* fix path in audit log

---------

Co-authored-by: Daniel Bläcker <d.blaecker@gmail.com>
0xDEnYO added a commit that referenced this pull request Jul 18, 2025
0xDEnYO added a commit that referenced this pull request Jul 22, 2025
…Facet v2.1.0,ChainflipFacet v1.0.1,DeBridgeDlnFacet v1.0.1,GasZipFacet v2.0.5,MayanFacet v1.2.1,RelayFacet v1.0.1,LiFiData v1.0.0,SwapperV2 v1.0.1,ILiFi v1.0.1,LibAsset v2.1.1,ReceiverChainflip v1.0.1] (#1282)

* added parameter validation to AllBridgeFacet

* finalized test file

* added Tron and Aptos custom chainIds

* minor fixes

* restore deleted file

* formatting

* move NON_EVM_ADDRESS to LiFiData

* add parameter validation for RelayFacet

* add author to LibAsset

* smaller fixes

* smaller fixes

* harmonize BridgeToNonEvmChain event

* add & harmonize BridgeToNonEvmChain event (audit issue #1)

* add comment (audit issue #3)

* change uint type of constants (audit issue #2)

* increase test coverage

* audit report added

* add constructor parameter validation and harmonize events

* audit report updated

* add GenericErrors to audit log

* fix audit report name

* bugfix

* add missing contracts

* deployed to arb staging

* remove destinationChain parameter from allBridgeData, deploy to ARB staging and some minor fixes

* update docs
0xDEnYO added a commit that referenced this pull request Aug 28, 2025
0xDEnYO added a commit that referenced this pull request Sep 12, 2025
…sSpokePoolV4 v1.0.0,ReceiverAcrossV4 v1.0.0] (#1299)

* first draft AcrossFacetV4

* update interface

* docs added

* fix event and input validation

* add deploy and update scripts for facet

* added Across chainId for Solana

* add ReceiverAcrossV4

* add initial test file for AcrossFacetV4

* add initial AcrossFacetPackedV4 and related files

* remove max-line-length rule from linter

* add constructor parameter validation

* fix tests for AcrossFacetV4

* all existing tests fixed

* add initial tests for outputMultiplier

* reorg test files

* all tests fixed

* update licenses of deploy scripts

* update deploy requirements

* deployed to ARB/OPT staging

* remove safeTransferLib from packed facet

* add sendingAssetId in bytes32 as parameter

* fix some tests

* tests fixed

* updated staging deployments

* update AcrossV4 demoscript

* update interface

* update deploy log

* rename test case

* fix comments in demo script

* smaller fixes

* add constructor parameter validation to packed facet

* add missing validation for parameter

* use existing helper function to access deployments

* fix Receiver docs file

* added type helpers for bridgeData in demoScripts

* add receiver address validation

* remove failing (outdated) LibAsset test

* add non-0 receiver address validation

* add tests to increase coverage

* add test API URL

* redeployed AcrossV4 to staging

* fixed demo script

* Update test/solidity/Facets/Across/V4/AcrossFacetPackedV4.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix tests

* fix demo script

* update license identifier

* use consola instead of console

* Update test/solidity/Facets/Across/V4/AcrossFacetV4.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* comment updated (audit issue #1)

* added refundAddress validation (and disclaimer in packed facet)

* added disclaimer (audit issue #3)

* replace hardcoded value with constant (audit issue #4)

* replace exclusivityDeadline with exclusivityParameter  (audit issue #5)

* update data length validation (audit issue #6)

* removed sendingAssetId from PackedParameters struct (audit issue #7)

* redeployed to ARB staging

* fix docs

* Update script/demoScripts/demoAcrossV4.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update test/solidity/Facets/Across/V4/AcrossFacetPackedV4.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* another docs fix

* Update test/solidity/Facets/Across/V4/AcrossFacetPackedV4.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* rename tests

* Update test/solidity/Facets/Across/V4/AcrossFacetV4OutputAmountIntegration.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fixed tests

* update logic in AcrossFacetPacked to allow long destinationChainIds such as Solana

* fix unit tests

* update docs

* added tests to Solana for AcrossFacetPacked

* Update docs/AcrossFacetPackedV4.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* set outputAmount explicitly

* fix integration tests

* fix docs

* fix issue in test

* OPT staging update

* PR cleanup

* remove temporary test file

* redeployed packed facet to OPT/ARB staging

* remove unnecessary comments and type conversions

* fix comment (audit issue #11)

* add evm vs non-evm distinction to decoding functions (audit issue #12)

* audit report added

* fix json

* remove unrelated filess

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
0xDEnYO added a commit that referenced this pull request Sep 16, 2025
* first draft AcrossFacetV4

* update interface

* docs added

* fix event and input validation

* add deploy and update scripts for facet

* added Across chainId for Solana

* add ReceiverAcrossV4

* add initial test file for AcrossFacetV4

* add initial AcrossFacetPackedV4 and related files

* remove max-line-length rule from linter

* add constructor parameter validation

* fix tests for AcrossFacetV4

* all existing tests fixed

* add initial tests for outputMultiplier

* reorg test files

* all tests fixed

* update licenses of deploy scripts

* update deploy requirements

* deployed to ARB/OPT staging

* remove safeTransferLib from packed facet

* add sendingAssetId in bytes32 as parameter

* fix some tests

* tests fixed

* updated staging deployments

* update AcrossV4 demoscript

* update interface

* update deploy log

* rename test case

* fix comments in demo script

* smaller fixes

* add constructor parameter validation to packed facet

* add missing validation for parameter

* use existing helper function to access deployments

* fix Receiver docs file

* added type helpers for bridgeData in demoScripts

* add receiver address validation

* remove failing (outdated) LibAsset test

* add non-0 receiver address validation

* add tests to increase coverage

* add test API URL

* redeployed AcrossV4 to staging

* fixed demo script

* Update test/solidity/Facets/Across/V4/AcrossFacetPackedV4.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix tests

* fix demo script

* update license identifier

* use consola instead of console

* Update test/solidity/Facets/Across/V4/AcrossFacetV4.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* comment updated (audit issue #1)

* added refundAddress validation (and disclaimer in packed facet)

* added disclaimer (audit issue #3)

* replace hardcoded value with constant (audit issue #4)

* replace exclusivityDeadline with exclusivityParameter  (audit issue #5)

* update data length validation (audit issue #6)

* removed sendingAssetId from PackedParameters struct (audit issue #7)

* redeployed to ARB staging

* fix docs

* Update script/demoScripts/demoAcrossV4.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update test/solidity/Facets/Across/V4/AcrossFacetPackedV4.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* another docs fix

* Update test/solidity/Facets/Across/V4/AcrossFacetPackedV4.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* rename tests

* Update test/solidity/Facets/Across/V4/AcrossFacetV4OutputAmountIntegration.t.sol

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fixed tests

* update logic in AcrossFacetPacked to allow long destinationChainIds such as Solana

* fix unit tests

* update docs

* added tests to Solana for AcrossFacetPacked

* Update docs/AcrossFacetPackedV4.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* set outputAmount explicitly

* fix integration tests

* fix docs

* fix issue in test

* OPT staging update

* PR cleanup

* remove temporary test file

* redeployed packed facet to OPT/ARB staging

* remove unnecessary comments and type conversions

* fix comment (audit issue #11)

* add evm vs non-evm distinction to decoding functions (audit issue #12)

* audit report added

* fix json

* remove unrelated filess

* add helper functions for multichain (and -evm) execution

* deployed to lens

* deployed to zksync

* deployed to 3 cancun networks

* deployed 12 london networks

* verified zksync

* diamond logs updated

* remove unrelated files

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
ezynda3 added a commit that referenced this pull request Oct 6, 2025
Change event emission logic to use chain ID check instead of nonEVMReceiver
length. This ensures the event only fires for actual non-EVM destinations
(Solana) and prevents misleading events for EVM-compatible chains.

Resolves audit issue #3
ezynda3 added a commit that referenced this pull request Oct 10, 2025
* config: whitelist new OKX contract

* bootstrap

* real fork test

* refactor

* deploy to staging

* simple demo

* fix

* docs

* revert

* update

* fix tests

* redeploy to staging + update demo script

* update demo script

* update contract, test, demo to work with updated Eco interface

* redeploy to staging and update demo

* Upgrade EcoFacet to use Portal V2 contract (#1379)

* feat: upgrade EcoFacet to use Portal V2 contract

- Update IEcoPortal interface to match Portal V2 structure
- Rename intentSource to portal throughout the codebase
- Add routeDeadline field to EcoData struct
- Update Intent struct to include destination field
- Modify Route and Reward structs to match V2 specification
- Update config with new Portal contract addresses
- Adjust tests and deployment scripts for Portal V2

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: field order in reward struct

* feat: add Tron and Solana support to EcoFacet

- Add second publishAndFund overload to IEcoPortal for Solana's encoded route
- Add encodedRoute field to EcoData struct for Borsh-encoded Solana data
- Implement chain ID mapping (_getEcoChainId) for Tron (728126428) and Solana (1399811149)
- Extract _buildReward helper to avoid code duplication
- Update _publishIntent with conditional logic for Solana vs EVM/Tron paths
- Add comprehensive tests for both Tron and Solana bridging
- Add Tron configuration to eco.json

* refactor: simplify EcoFacet to use encodedRoute universally

- Use encodedRoute parameter for all chains (EVM, Tron, Solana)
- Remove destinationCalls and route building logic
- Remove unused fields from EcoData struct (receivingAssetId, salt, destinationPortal, routeDeadline)
- Update tests to use real Eco Portal on Base mainnet (0x2b7F87a98707e6D19504293F6680498731272D4f)
- Fix all failing unit tests to work with simplified contract

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: remove Intent struct and simplify EcoFacet implementation

- Remove unused Intent, Route, and Call structs from IEcoPortal interface
- Eliminate intermediate Intent struct construction in _startBridge
- Inline _publishIntent logic directly into _startBridge for clarity
- Directly pass parameters to publishAndFund without creating unnecessary structs
- Keep only the publishAndFund overload that accepts individual parameters

This simplification reduces code complexity and improves efficiency by avoiding
unnecessary intermediate data structures while maintaining the same functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

* update demo script

* handle solana

* add swap demo

* update docs

* update constants

* boost coverage

* update

* update

* fix: address PR review comments for EcoFacet

- Rename portal to PORTAL for consistency with recent facets
- Add NatSpec documentation for constructor
- Store Eco chain IDs as immutable variables
- Add chain ID bounds check to prevent uint64 overflow
- Update solver reward documentation to clarify native/ERC20 usage
- Clarify encoded route description
- Optimize gas by reducing redundant isNative checks
- Fix test function names to follow naming convention
- Add destination calls validation modifier
- Remove problematic destination calls test
- Document receiverAddress vs nonEVMReceiver usage

* validate

* validate

* cleanup

* verify solana

* update portal

* fix: improve Solana recipient extraction from Borsh-encoded routes (#1392)

- Validate route is exactly 319 bytes for Solana transfers
- Extract recipient from correct position (bytes 251-282) in TransferChecked instruction
- Add detailed comments explaining Borsh encoding structure

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>

* update to properly validate

* fix

* update docs

* update tests

* fix

* fix coverage

* validate ATA vs solana address

* Update script/demoScripts/demoEco.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* eliminate redundant checks

* remove useless internal func

* update docs

* remove changelog

* fixes

* update helper func names

* validate solana dst against NON_EVM_RECEIVER

* document known issue with positive slippage

* update tests

* optimizations

* redeploy to staging

* add clarification

* remove

* combine helpers

* remove extra checks

* refactor

* remove native token support

* fix: reject NON_EVM_ADDRESS for non-Solana destinations

Prevents invalid configurations where NON_EVM_ADDRESS is used for
EVM-compatible chains like TRON. Only Solana destinations should use
NON_EVM_ADDRESS as the receiver.

Resolves audit issue #9

* fix: prevent native token loss and refund excess

- Remove payable modifier from startBridgeTokensViaEco to prevent accidental
  native token deposits that would be permanently locked
- Add refundExcessNative modifier to swapAndStartBridgeTokensViaEco to refund
  any excess native tokens sent beyond swap requirements
- Update test to reflect non-payable function signature

Resolves audit issue #7

* fix: add lower bound validation for Solana address length

Add minimum length check (32 characters) for Solana addresses to match
documented behavior. Solana addresses are base58-encoded and must be
between 32-44 characters.

Resolves audit issue #6

* fix: validate prover and rewardDeadline parameters

Add validation for critical reward parameters in _validateEcoData:
- Ensure prover address is not zero
- Ensure rewardDeadline is non-zero and in the future

These parameters are essential for the Eco Protocol reward mechanism.

Resolves audit issue #10

* fix: emit BridgeToNonEVMChain only for Solana destinations

Change event emission logic to use chain ID check instead of nonEVMReceiver
length. This ensures the event only fires for actual non-EVM destinations
(Solana) and prevents misleading events for EVM-compatible chains.

Resolves audit issue #3

* refactor: inline depositAmount calculation for gas savings

Remove intermediate depositAmount variable and pass expression directly
to LibAsset.depositAsset. Saves ~100 gas by eliminating unnecessary
stack operations.

Resolves audit issue #4

* refactor: replace magic numbers with named constants

Define and use constants for:
- NATIVE_REWARD_AMOUNT (0)
- ALLOW_PARTIAL_FILL (false)
- SOLANA_ENCODED_ROUTE_LENGTH (319)
- SOLANA_RECEIVER_OFFSET (251)
- SOLANA_RECEIVER_END (283)
- SOLANA_ADDRESS_MIN_LENGTH (32)
- SOLANA_ADDRESS_MAX_LENGTH (44)

Improves code maintainability and makes the intent behind each value explicit.

Resolves audit issue #1

* refactor: remove redundant explicit zero value in portal call

Remove '{ value: 0 }' from PORTAL.publishAndFund call as it's redundant
(default is 0). Simplifies code and slightly reduces bytecode size.

Resolves audit issue #8

* refactor: remove redundant receiverAddress from EcoData

BREAKING CHANGE: Remove receiverAddress field from EcoData struct as it
duplicates _bridgeData.receiver. The receiver is already validated from
the encodedRoute for EVM chains and through nonEVMReceiver for Solana.

This saves gas and simplifies the API by removing redundant data.

Resolves audit issue #2

* fix: update demoEco.ts to use new EcoData structure

Remove receiverAddress field from EcoData struct usage in demo script
to match the updated contract interface.

* redeploy to staging

* add inline doc about native refunds

* fix typo

* redeploy to staging

* update internal calculations to deduct fee from passed minAmount

* remove unneeded var

* chore: add EcoFacet and IEcoPortal v1.0.0 audit entry

---------

Co-authored-by: Mathias Möller <matze.moeller@gmail.com>
Co-authored-by: Carlos Febres <carlosfebres97@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
mirooon added a commit that referenced this pull request Nov 3, 2025
0xDEnYO added a commit that referenced this pull request Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants