Skip to content

Commit

Permalink
Added tasks to Hello example and migrated Swap to gateway (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev authored Sep 5, 2024
1 parent cdb40f3 commit ae9e49f
Show file tree
Hide file tree
Showing 37 changed files with 10,155 additions and 743 deletions.
1 change: 1 addition & 0 deletions omnichain/swap/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "./tasks/deploy";
import "./tasks/solana/interact";
import "./tasks/interact";
import "@zetachain/localnet/tasks";
import "@nomicfoundation/hardhat-toolbox";
import "@zetachain/toolkit/tasks";
Expand Down
4 changes: 2 additions & 2 deletions omnichain/swap/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { HardhatRuntimeEnvironment } from "hardhat/types";
const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
const network = hre.network.name as ParamChainName;

if (!/zeta_(testnet|mainnet)/.test(network)) {
if (!/zeta_(testnet|mainnet|localhost)/.test(network)) {
throw new Error(
'🚨 Please use either "zeta_testnet" or "zeta_mainnet" network to deploy to ZetaChain.'
'🚨 Please use either "zeta_testnet", "zeta_mainnet" or "localhost" network to deploy to ZetaChain.'
);
}

Expand Down
19 changes: 0 additions & 19 deletions universal/hello/contracts/Hello.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import {RevertContext, RevertOptions} from "@zetachain/protocol-contracts/contracts/Revert.sol";
import "@zetachain/protocol-contracts/contracts/zevm/interfaces/UniversalContract.sol";
import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IGatewayZEVM.sol";
import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IZRC20.sol";

contract Hello is UniversalContract {
event HelloEvent(string, string);
Expand All @@ -28,23 +26,6 @@ contract Hello is UniversalContract {
emit HelloEvent("Hello from a universal app", decodedMessage);
}

function callFromZetaChain(
bytes memory receiver,
address zrc20,
bytes calldata message,
uint256 gasLimit,
RevertOptions memory revertOptions
) external {
IZRC20(zrc20).approve(gatewayAddress, 1_000_000_000);
IGatewayZEVM(gatewayAddress).call(
receiver,
zrc20,
message,
gasLimit,
revertOptions
);
}

function onRevert(RevertContext calldata revertContext) external override {
emit ContextDataRevert(revertContext);
}
Expand Down
Loading

0 comments on commit ae9e49f

Please sign in to comment.