-
Notifications
You must be signed in to change notification settings - Fork 2
Fix: MultiChainLayerZeroTellerWithMultiAssetSupport add decimal conversion for handling peer vaults with different decimals
#3
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds decimal conversion logic to MultiChainLayerZeroTellerWithMultiAssetSupport to handle cross-chain bridging between vaults with different decimal precision (e.g., 18 decimals on BNB vs other chains). The changes introduce a shared 6-decimal format for cross-chain messages and convert between local and shared decimals during bridging operations.
Key Changes
- Added decimal conversion helper functions (
_toLDand_toSD) to convert between local decimals and a shared 6-decimal format - Updated constructor to accept and store local decimal configuration
- Modified bridge send/receive logic to apply decimal conversions, ensuring consistent precision across chains
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/base/Roles/CrossChain/MultiChainLayerZeroTellerWithMultiAssetSupport.sol
Show resolved
Hide resolved
src/base/Roles/CrossChain/MultiChainLayerZeroTellerWithMultiAssetSupport.sol
Outdated
Show resolved
Hide resolved
src/base/Roles/CrossChain/MultiChainLayerZeroTellerWithMultiAssetSupport.sol
Show resolved
Hide resolved
…setSupport.sol Co-authored-by: Copilot <[email protected]> Signed-off-by: Rafael Albuquerque <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/base/Roles/CrossChain/MultiChainLayerZeroTellerWithMultiAssetSupport.sol
Show resolved
Hide resolved
src/base/Roles/CrossChain/MultiChainLayerZeroTellerWithMultiAssetSupport.sol
Show resolved
Hide resolved
src/base/Roles/CrossChain/MultiChainLayerZeroTellerWithMultiAssetSupport.sol
Outdated
Show resolved
Hide resolved
…setSupport.sol Co-authored-by: Copilot <[email protected]> Signed-off-by: Rafael Albuquerque <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/base/Roles/CrossChain/MultiChainLayerZeroTellerWithMultiAssetSupport.sol
Show resolved
Hide resolved
* feat: warp route wrapper contract * feat: constrain hyperlane destination id * fix: immutables and don't pass in destination * chore: security tag * fix: immutables, no need to pass in destination, styling, security tag * fix: transferRemote requires msg.value gas payments * feat: multichain hyperlane teller contract * feat: hyperlane teller tests * fix: messageId overload * feat: more hyperlane require statements * fix: M-03 add hook to dispatch and L-03 make quote and dispatch consistent * fix: L-02 check for receiver or target teller being zero address * feat: circle decoder first draft * Update issue templates * fix: incorrect name * fix: missing memory locations * chore: boba chain deployment config * fix: do not try to increment nonce in view function * chore: move standard hook metadata to helpers folder * fix: use multichain teller base error not multichain hyperlane teller error * chore: solhint and prettier * Add files via upload Signed-off-by: Jun Kim <[email protected]> * chore: merged carson/decoders and renamed to carson/old-decoders * chore: merged carson/cake-decoders | was used for several earnETH decoders * chore: merged carson/circle-decoder * chore: merged carson/decoders-second-preimage-attack tossed most changes but kept stargate * chore: merged carson/earnBTC-decoder * chore: merged carson/puffer-decoders * chore merged carson/ssETH-decoder * chore: merged jun/seiyanETH-decoder * chore: merged carson/euler-decoder * chore: merged carson/tempest-decoder * fix: changed some error handling to work post merges * fix: returned swapExactTokenForPt to pendle decoder * feat: ssETH and tETH decoders * fix: unifiBTC name * feat: expansion for earnBTC * feat: OP bridge and euler controller * feat: Hyperliquid decoder * feat: add aave to lhype * feat: aera vault * refactor: formatting * chore: committing work so far to merge into correct branch * feat: Velodrome decoder for earnETHSwell * fix: build issues with interface * feat: vedrome earneth decoder * feat: bridgeERC20to * fix: merge errors * feat: burn for uniswap and fallback in base * feat: script for manual tag parsing to a local pocketbase db * feat: add morpho position oracle decoder * fix: swBTC decoder working * chore: gitmodules for new import manually * feat: pendle pt withdraw * fix: standard accross other functions * fix: aera withdraw seems to encode the wrong thing * feat: CICD script to run tag parse * fix: changed to carson/decoders * feat: aave comments * refactor: simpler approach for CICD * feat: aera tags * fix: es modules * feat: Anemoy tags * feat: remaining protocols tags * feat: Velodrome (kittenswap) for LHYPE decoder * feat: sentiment * fix: split velo and uni in decoders * refactor: naming * feat: Velodrome V1 * refactor: spellcheck * feat: swell supabridge, nucleus, and flashHype * feat: decode custom types * refactor: naming for unifiX * feat: correct typing in tag_parse * fix: jun fixes and also including royco * refactor: fmt * feat: add velodrome get reward decoder * feat: add back exitPostExpToToken * refactor: cleaning failing tests * feat: add predicate inherited patterns * chore: update nat spec for new predicate functions * feat: add deploy script for holesky in there * fix: edit scripts * feat: add predicate proxy contract * add example testnet holesky predicate script * feat: remove unneeded check * feat: remove dependency on deposit info for predicate check * chore: remove unneeded deploy script * fix: remove deploy of inheritance pattern * fix: remove unused error, imports, and clarify comment * fix: add receive function for rebate * chore: remove unneeded deployment file * chore: deleted deposit script since there is now end to end in other repo on mainnet * chore: add comments * chore: remove v3-core lib and then also remove comment * chore: reset lastSender in function * feat: change to support multiple tellers on one proxy and also ownable and pausable * fix: error in import of pausable path * fix: add safeTransfer functionality * feat: added external function to serve as modifier for re-use if verifying a user with a similar policy * fix: put custom error instead of require for gas savings * feat: added in events for deposit to wrapper * added in more explicit events * feat: add needed interfaces * Update remappings.txt add back in remapping without needing forge install Signed-off-by: jpick713 <[email protected]> * chore: add git index and edit readme * fix: L-02 check for receiver or target teller being zero address * fix: change Chain variable to memory in _beforeBridge function * feat: nbasis deployment config * refactor: remove unused ERC20 constants from AtomicSolverV3 * feat: add generateCreate3Salt function and improve compareStrings signature * refactor: update ConfigReader struct * feat: implement CREATE3 salt generation for multiple deployment scripts * feat: add setNameAndSymbol function to update token name and symbol * refactor: constants --------- Signed-off-by: Jun Kim <[email protected]> Signed-off-by: jpick713 <[email protected]> Co-authored-by: Jun Kim <[email protected]> Co-authored-by: Carson <[email protected]> Co-authored-by: Carson Case <[email protected]> Co-authored-by: Jamie Pickett <[email protected]> Co-authored-by: jpick713 <[email protected]>
* feat: warp route wrapper contract * feat: constrain hyperlane destination id * fix: immutables and don't pass in destination * chore: security tag * fix: immutables, no need to pass in destination, styling, security tag * fix: transferRemote requires msg.value gas payments * feat: multichain hyperlane teller contract * feat: hyperlane teller tests * fix: messageId overload * feat: more hyperlane require statements * fix: M-03 add hook to dispatch and L-03 make quote and dispatch consistent * fix: L-02 check for receiver or target teller being zero address * feat: circle decoder first draft * Update issue templates * fix: incorrect name * fix: missing memory locations * chore: boba chain deployment config * fix: do not try to increment nonce in view function * chore: move standard hook metadata to helpers folder * fix: use multichain teller base error not multichain hyperlane teller error * chore: solhint and prettier * Add files via upload Signed-off-by: Jun Kim <[email protected]> * chore: merged carson/decoders and renamed to carson/old-decoders * chore: merged carson/cake-decoders | was used for several earnETH decoders * chore: merged carson/circle-decoder * chore: merged carson/decoders-second-preimage-attack tossed most changes but kept stargate * chore: merged carson/earnBTC-decoder * chore: merged carson/puffer-decoders * chore merged carson/ssETH-decoder * chore: merged jun/seiyanETH-decoder * chore: merged carson/euler-decoder * chore: merged carson/tempest-decoder * fix: changed some error handling to work post merges * fix: returned swapExactTokenForPt to pendle decoder * feat: ssETH and tETH decoders * fix: unifiBTC name * feat: expansion for earnBTC * feat: OP bridge and euler controller * feat: Hyperliquid decoder * feat: add aave to lhype * feat: aera vault * refactor: formatting * chore: committing work so far to merge into correct branch * feat: Velodrome decoder for earnETHSwell * fix: build issues with interface * feat: vedrome earneth decoder * feat: bridgeERC20to * fix: merge errors * feat: burn for uniswap and fallback in base * feat: script for manual tag parsing to a local pocketbase db * feat: add morpho position oracle decoder * fix: swBTC decoder working * chore: gitmodules for new import manually * feat: pendle pt withdraw * fix: standard accross other functions * fix: aera withdraw seems to encode the wrong thing * feat: CICD script to run tag parse * fix: changed to carson/decoders * feat: aave comments * refactor: simpler approach for CICD * feat: aera tags * fix: es modules * feat: Anemoy tags * feat: remaining protocols tags * feat: Velodrome (kittenswap) for LHYPE decoder * feat: sentiment * fix: split velo and uni in decoders * refactor: naming * feat: Velodrome V1 * refactor: spellcheck * feat: swell supabridge, nucleus, and flashHype * feat: decode custom types * refactor: naming for unifiX * feat: correct typing in tag_parse * fix: jun fixes and also including royco * refactor: fmt * feat: add velodrome get reward decoder * feat: add back exitPostExpToToken * refactor: cleaning failing tests * feat: add predicate inherited patterns * chore: update nat spec for new predicate functions * feat: add deploy script for holesky in there * fix: edit scripts * feat: add predicate proxy contract * add example testnet holesky predicate script * feat: remove unneeded check * feat: remove dependency on deposit info for predicate check * chore: remove unneeded deploy script * fix: remove deploy of inheritance pattern * fix: remove unused error, imports, and clarify comment * fix: add receive function for rebate * chore: remove unneeded deployment file * chore: deleted deposit script since there is now end to end in other repo on mainnet * chore: add comments * chore: remove v3-core lib and then also remove comment * chore: reset lastSender in function * feat: change to support multiple tellers on one proxy and also ownable and pausable * fix: error in import of pausable path * fix: add safeTransfer functionality * feat: added external function to serve as modifier for re-use if verifying a user with a similar policy * fix: put custom error instead of require for gas savings * feat: added in events for deposit to wrapper * added in more explicit events * feat: add needed interfaces * Update remappings.txt add back in remapping without needing forge install Signed-off-by: jpick713 <[email protected]> * chore: add git index and edit readme * fix: L-02 check for receiver or target teller being zero address * fix: change Chain variable to memory in _beforeBridge function * feat: nbasis deployment config * refactor: remove unused ERC20 constants from AtomicSolverV3 * feat: add generateCreate3Salt function and improve compareStrings signature * refactor: update ConfigReader struct * feat: implement CREATE3 salt generation for multiple deployment scripts * feat: add setNameAndSymbol function to update token name and symbol * refactor: constants * refactor: Remove outdated deployment configuration files for various tokens and protocols * feat: nWisdom deployment config * feat: add deployment configurations for Arbitrum One, Arc Testnet, BNB Chain, and Plume --------- Signed-off-by: Jun Kim <[email protected]> Signed-off-by: jpick713 <[email protected]> Co-authored-by: Jun Kim <[email protected]> Co-authored-by: Carson <[email protected]> Co-authored-by: Carson Case <[email protected]> Co-authored-by: Jamie Pickett <[email protected]> Co-authored-by: jpick713 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 128 out of 131 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (sdShareAmount == 0) { | ||
| // If the shareAmount is too small to be represented in shared decimals, we cannot bridge it. | ||
| revert MultiChainTellerBase_ShareAmountTooSmall(shareAmount); | ||
| } |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _toSD function performs integer division which truncates precision. This check only catches when the result is exactly 0, but doesn't handle cases where significant precision is lost due to truncation (e.g., shareAmount = decimalConversionRate - 1 would become 0).
| false, | ||
| "mintSyFromToken(address,address,uint256,(address,uint256,address,address,(uint8,address,bytes,bool)))", | ||
| new address[](6) | ||
| new address[](3) |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The array size was reduced from 6 to 3, but the code still assigns to indices 3, 4, and 5 which are now out of bounds. This will cause array access violations.
| false, | ||
| "redeemSyToToken(address,address,uint256,(address,uint256,address,address,(uint8,address,bytes,bool)))", | ||
| new address[](6) | ||
| new address[](3) |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as above - array size reduced to 3 but code tries to access indices beyond the array bounds.
| // @tag _addr:address:the address of the user claiming the withdraw | ||
| function claimWithdraw(address _addr, uint256) external pure virtual returns (bytes memory addressesFound) { | ||
| addressesFound = abi.encodePacked(_addr); | ||
| } |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function signature change from claimWithdraw(uint256) to claimWithdraw(address, uint256) is a breaking change that could affect existing integrations. Consider versioning or maintaining backwards compatibility.
| } | |
| } | |
| /// @deprecated Use claimWithdraw(address, uint256) instead | |
| function claimWithdraw(uint256 amount) external pure virtual returns (bytes memory addressesFound) { | |
| // Use msg.sender as the default address | |
| return claimWithdraw(msg.sender, amount); | |
| } |
https://linear.app/plume-network/issue/NPD-310/bnb-vaults-are-18-decimals-and-peer-vaults-ethereum-plume-and-plasma