Skip to content

Commit

Permalink
add gas limit
Browse files Browse the repository at this point in the history
  • Loading branch information
andresaiello committed Feb 9, 2024
1 parent adff6c2 commit 593ab01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ contract MultiChainValue is ZetaInteractor, MultiChainValueErrors {
/**
* @dev If the destination chain is a valid chain, send the Zeta tokens to that chain
*/
function send(uint256 destinationChainId, bytes calldata destinationAddress, uint256 zetaValueAndGas) external {
function send(
uint256 destinationChainId,
bytes calldata destinationAddress,
uint256 zetaValueAndGas,
uint256 destinationGasLimit
) external {
if (!availableChainIds[destinationChainId]) revert InvalidDestinationChainId();
if (zetaValueAndGas == 0) revert InvalidZetaValueAndGas();

Expand All @@ -97,7 +102,7 @@ contract MultiChainValue is ZetaInteractor, MultiChainValueErrors {
ZetaInterfaces.SendInput({
destinationChainId: destinationChainId,
destinationAddress: destinationAddress,
destinationGasLimit: 300000,
destinationGasLimit: destinationGasLimit,
message: abi.encode(),
zetaValueAndGas: zetaValueAndGas,
zetaParams: abi.encode("")
Expand Down
6 changes: 3 additions & 3 deletions packages/zeta-app-contracts/test/MultiChainValue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("MultiChainValue tests", () => {
describe("send", () => {
it("Should send msg", async () => {
await zetaEthMockContract.approve(multiChainValueContractA.address, parseEther("1000"));
const tx = multiChainValueContractA.send(chainBId, account1Address, 10);
const tx = multiChainValueContractA.send(chainBId, account1Address, 10, 300000);

await expect(tx)
.to.be.emit(zetaConnectorMockContract, "Send")
Expand All @@ -89,13 +89,13 @@ describe("MultiChainValue tests", () => {
});

it("Should prevent sending value to a disabled chainId", async () => {
const tx = multiChainValueContractA.send(1, account1Address, 100_000);
const tx = multiChainValueContractA.send(1, account1Address, 100_000, 300000);
await expect(tx).to.be.revertedWith("InvalidDestinationChainId");
});

it("Should prevent sending 0 value", async () => {
await (await multiChainValueContractA.addAvailableChainId(1)).wait();
const tx = multiChainValueContractA.send(1, account1Address, 0);
const tx = multiChainValueContractA.send(1, account1Address, 0, 300000);
await expect(tx).to.be.revertedWith("InvalidZetaValueAndGas");
});

Expand Down

0 comments on commit 593ab01

Please sign in to comment.