From adff6c28dad814c6a51a6edef56d35cdf765403c Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Fri, 9 Feb 2024 10:25:16 -0300 Subject: [PATCH] fix sendZeta --- .../multi-chain-value/MultiChainValue.sol | 14 +++++++++----- packages/zeta-app-contracts/data/addresses.json | 4 ++-- .../test/MultiChainValue.spec.ts | 11 ++--------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/packages/zeta-app-contracts/contracts/multi-chain-value/MultiChainValue.sol b/packages/zeta-app-contracts/contracts/multi-chain-value/MultiChainValue.sol index fb7aa417..f90ecfd0 100644 --- a/packages/zeta-app-contracts/contracts/multi-chain-value/MultiChainValue.sol +++ b/packages/zeta-app-contracts/contracts/multi-chain-value/MultiChainValue.sol @@ -21,8 +21,8 @@ interface MultiChainValueErrors { } /** - * @dev MultiChainValue goal is to send Zeta token across all supported chains - * Extends the logic defined in ZetaInteractor to handle multichain standards + * @dev MultiChainValue goal is to send Zeta token from ZEVM to other chains. + * This contract is not recommended to use in other chains than ZEVM because can't handle onReverseRevert events. */ contract MultiChainValue is ZetaInteractor, MultiChainValueErrors { address public zetaToken; @@ -56,7 +56,11 @@ contract MultiChainValue is ZetaInteractor, MultiChainValueErrors { /** * @dev If the destination chain is a valid chain, send the Zeta tokens to that chain */ - function sendZeta(uint256 destinationChainId, bytes calldata destinationAddress) public payable { + function sendZeta( + uint256 destinationChainId, + bytes calldata destinationAddress, + uint256 destinationGasLimit + ) public payable { uint256 zetaValueAndGas = msg.value; if (!availableChainIds[destinationChainId]) revert InvalidDestinationChainId(); @@ -70,8 +74,8 @@ contract MultiChainValue is ZetaInteractor, MultiChainValueErrors { ZetaInterfaces.SendInput({ destinationChainId: destinationChainId, destinationAddress: destinationAddress, - destinationGasLimit: 300000, - message: abi.encode(msg.sender), + destinationGasLimit: destinationGasLimit, + message: abi.encode(), zetaValueAndGas: zetaValueAndGas, zetaParams: abi.encode("") }) diff --git a/packages/zeta-app-contracts/data/addresses.json b/packages/zeta-app-contracts/data/addresses.json index 98f5f234..63d5c4db 100644 --- a/packages/zeta-app-contracts/data/addresses.json +++ b/packages/zeta-app-contracts/data/addresses.json @@ -44,13 +44,13 @@ }, "zeta_testnet": { "multiChainSwap": "", - "multiChainValue": "0x51886eC8E70e9331916fE44f1a10B641100094Fc", + "multiChainValue": "0x73B37B8BAbAC0e846bB2C4c581e60bFF2BFBE76e", "zetaTokenConsumerUniV2": "", "zetaTokenConsumerUniV3": "" }, "zeta_mainnet": { "multiChainSwap": "", - "multiChainValue": "0x113d1e0fA690746b6Bd86CaDCEA712f22CFEAc05", + "multiChainValue": "0xC459AB4Ac46cE53A30D4C4B6f49176989483b2Cf", "zetaTokenConsumerUniV2": "", "zetaTokenConsumerUniV3": "" } diff --git a/packages/zeta-app-contracts/test/MultiChainValue.spec.ts b/packages/zeta-app-contracts/test/MultiChainValue.spec.ts index 3ee48dee..1f7c1fdf 100644 --- a/packages/zeta-app-contracts/test/MultiChainValue.spec.ts +++ b/packages/zeta-app-contracts/test/MultiChainValue.spec.ts @@ -82,17 +82,10 @@ describe("MultiChainValue tests", () => { }); it("Should send native token", async () => { - const tx = multiChainValueContractA.sendZeta(chainBId, account1Address, { value: 10 }); + const tx = multiChainValueContractA.sendZeta(chainBId, account1Address, 100000, { value: 10 }); await expect(tx) .to.be.emit(zetaConnectorMockContract, "Send") - .withArgs( - chainBId, - account1Address.toLowerCase(), - 300000, - defaultAbiCoder.encode(["address"], [deployer.address]), - 10, - defaultAbiCoder.encode(["string"], [""]) - ); + .withArgs(chainBId, account1Address.toLowerCase(), 100000, "0x", 10, defaultAbiCoder.encode(["string"], [""])); }); it("Should prevent sending value to a disabled chainId", async () => {