Skip to content

fix: Pay in LZToken (SC-1152)#41

Merged
lucas-manuel merged 4 commits intomasterfrom
fix/sc-1152
Sep 29, 2025
Merged

fix: Pay in LZToken (SC-1152)#41
lucas-manuel merged 4 commits intomasterfrom
fix/sc-1152

Conversation

@supercontracts
Copy link
Contributor

No description provided.

@supercontracts supercontracts changed the title fix: Pay in LZToken fix: Pay in LZToken (SC-1152) Sep 17, 2025
@supercontracts supercontracts self-assigned this Sep 17, 2025
Comment on lines 90 to 106
function queueSourceToDestination(bytes memory message) internal override {
// Gas to queue message
vm.deal(sourceAuthority, 1 ether);
deal(lzToken, sourceAuthority, 1 ether);

bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(200_000, 0);

LZForwarder.sendMessage(
destinationEndpointId,
bytes32(uint256(uint160(destinationReceiver))),
ILayerZeroEndpointV2(bridge.sourceCrossChainMessenger),
message,
options,
sourceAuthority,
true
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add assertions

    function queueSourceToDestination(bytes memory message) internal override {
        // Gas to queue message
        vm.deal(sourceAuthority, 1 ether);
        deal(lzToken, sourceAuthority, 1 ether);

        bytes memory options = OptionsBuilder.newOptions().addExecutorLzReceiveOption(200_000, 0);

        assertEq(IERC20(lzToken).balanceOf(address(sourceAuthority)), 1 ether);
        assertEq(address(sourceAuthority).balance,                    1 ether);

        LZForwarder.sendMessage(
            destinationEndpointId,
            bytes32(uint256(uint160(destinationReceiver))),
            ILayerZeroEndpointV2(bridge.sourceCrossChainMessenger),
            message,
            options,
            sourceAuthority,
            true
        );

        // LZ token and ETH spent
        assertLt(IERC20(lzToken).balanceOf(address(sourceAuthority)), 1 ether);
        assertLt(address(sourceAuthority).balance,                    1 ether);
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@github-actions
Copy link

Coverage after merging fix/sc-1152 into master will be

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src/forwarders
   AMBForwarder.sol100%100%100%100%
   ArbitrumForwarder.sol100%100%100%100%
   CCTPForwarder.sol100%100%100%100%
   LZForwarder.sol92.31%50%100%100%81
   OptimismForwarder.sol100%100%100%100%
src/receivers
   AMBReceiver.sol100%100%100%100%
   ArbitrumReceiver.sol100%100%100%100%
   CCTPReceiver.sol100%100%100%100%
   LZReceiver.sol100%100%100%100%
   OptimismReceiver.sol100%100%100%100%

@lucas-manuel lucas-manuel merged commit cd0ba78 into master Sep 29, 2025
3 checks passed
@lucas-manuel lucas-manuel deleted the fix/sc-1152 branch September 29, 2025 14:24
barrutko added a commit to grove-labs/xchain-helpers that referenced this pull request Oct 14, 2025
* feat: Add LayerZero Support (SC-1050) (sparkdotfi#37)

* intial commit

* fix: tests
add: binance chain

* add: init

* fix

* Update LZReceiver.sol

* fix: receiver

* add: LZReceiver.t.sol

* fix: review

* fix: LZForwarder refund correct payer (SC-1127) (sparkdotfi#39)

* fix: Use address(this) as sender in quote in LZForwarder (SC-1126) (sparkdotfi#38)

Co-authored-by: Lucas Manuel <lucasmanuel.tech@gmail.com>

* fix: `LZReceiver` implement full OApp (SC-1124, SC-1125) (sparkdotfi#40)

* save

* fix: review

* fix: review

* fix: comment

* fix: Pay in LZToken (SC-1152) (sparkdotfi#41)

* fix

* add: param

* add: tests

* fix: review

* feat: Add Avalanche to lz (SC-1178) (sparkdotfi#43)

---------

Co-authored-by: supercontracts <bonjour.tabish@gmail.com>
Co-authored-by: Lucas Manuel <lucasmanuel.tech@gmail.com>
barrutko added a commit to grove-labs/xchain-helpers that referenced this pull request Oct 14, 2025
* feat: Add LayerZero Support (SC-1050) (sparkdotfi#37)

* intial commit

* fix: tests
add: binance chain

* add: init

* fix

* Update LZReceiver.sol

* fix: receiver

* add: LZReceiver.t.sol

* fix: review

* fix: LZForwarder refund correct payer (SC-1127) (sparkdotfi#39)

* fix: Use address(this) as sender in quote in LZForwarder (SC-1126) (sparkdotfi#38)



* fix: `LZReceiver` implement full OApp (SC-1124, SC-1125) (sparkdotfi#40)

* save

* fix: review

* fix: review

* fix: comment

* fix: Pay in LZToken (SC-1152) (sparkdotfi#41)

* fix

* add: param

* add: tests

* fix: review

* feat: Add Avalanche to lz (SC-1178) (sparkdotfi#43)

---------

Co-authored-by: supercontracts <bonjour.tabish@gmail.com>
Co-authored-by: Lucas Manuel <lucasmanuel.tech@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants