Skip to content

Commit

Permalink
fix sendZeta
Browse files Browse the repository at this point in the history
  • Loading branch information
andresaiello committed Feb 9, 2024
1 parent 6bedfc1 commit adff6c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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("")
})
Expand Down
4 changes: 2 additions & 2 deletions packages/zeta-app-contracts/data/addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
},
"zeta_testnet": {
"multiChainSwap": "",
"multiChainValue": "0x51886eC8E70e9331916fE44f1a10B641100094Fc",
"multiChainValue": "0x73B37B8BAbAC0e846bB2C4c581e60bFF2BFBE76e",
"zetaTokenConsumerUniV2": "",
"zetaTokenConsumerUniV3": ""
},
"zeta_mainnet": {
"multiChainSwap": "",
"multiChainValue": "0x113d1e0fA690746b6Bd86CaDCEA712f22CFEAc05",
"multiChainValue": "0xC459AB4Ac46cE53A30D4C4B6f49176989483b2Cf",
"zetaTokenConsumerUniV2": "",
"zetaTokenConsumerUniV3": ""
}
Expand Down
11 changes: 2 additions & 9 deletions packages/zeta-app-contracts/test/MultiChainValue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit adff6c2

Please sign in to comment.