Skip to content

Commit

Permalink
hello: rename contracts to universal and connected
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Nov 11, 2024
1 parent 3150e9c commit d687d9c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.26;
import {RevertContext} from "@zetachain/protocol-contracts/contracts/Revert.sol";
import "@zetachain/protocol-contracts/contracts/evm/GatewayEVM.sol";

contract Echo {
contract Connected {
GatewayEVM public immutable gateway;

event RevertEvent(string, RevertContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "@zetachain/protocol-contracts/contracts/zevm/interfaces/UniversalContrac
import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IGatewayZEVM.sol";
import "@zetachain/protocol-contracts/contracts/zevm/GatewayZEVM.sol";

contract Hello is UniversalContract {
contract Universal is UniversalContract {
GatewayZEVM public immutable gateway;

event HelloEvent(string, string);
Expand Down
6 changes: 3 additions & 3 deletions examples/hello/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./tasks/deploy";
import "./tasks/helloCall";
import "./tasks/echoCall";
import "./tasks/helloWithdrawAndCall";
import "./tasks/universalCall";
import "./tasks/connectedCall";
import "./tasks/universalWithdrawAndCall";
import "@zetachain/localnet/tasks";
import "@nomicfoundation/hardhat-toolbox";
import "@zetachain/toolkit/tasks";
Expand Down
10 changes: 5 additions & 5 deletions examples/hello/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ GATEWAY_ETHEREUM=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain==
GATEWAY_ZETACHAIN=$(jq -r '.addresses[] | select(.type=="gatewayZEVM" and .chain=="zetachain") | .address' localnet.json)
SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

CONTRACT_ZETACHAIN=$(npx hardhat deploy --name Hello --network localhost --gateway "$GATEWAY_ZETACHAIN" --json | jq -r '.contractAddress')
CONTRACT_ZETACHAIN=$(npx hardhat deploy --name Universal --network localhost --gateway "$GATEWAY_ZETACHAIN" --json | jq -r '.contractAddress')
echo -e "\n🚀 Deployed contract on ZetaChain: $CONTRACT_ZETACHAIN"

CONTRACT_ETHEREUM=$(npx hardhat deploy --name Echo --json --network localhost --gateway "$GATEWAY_ETHEREUM" | jq -r '.contractAddress')
CONTRACT_ETHEREUM=$(npx hardhat deploy --name Connected --json --network localhost --gateway "$GATEWAY_ETHEREUM" | jq -r '.contractAddress')
echo -e "🚀 Deployed contract on Ethereum: $CONTRACT_ETHEREUM"

npx hardhat echo-call \
npx hardhat connected-call \
--contract "$CONTRACT_ETHEREUM" \
--receiver "$CONTRACT_ZETACHAIN" \
--network localhost \
--types '["string"]' alice

npx hardhat localnet-check

npx hardhat hello-call \
npx hardhat universal-call \
--contract "$CONTRACT_ZETACHAIN" \
--receiver "$CONTRACT_ETHEREUM" \
--zrc20 "$ZRC20_ETHEREUM" \
Expand All @@ -37,7 +37,7 @@ npx hardhat hello-call \

npx hardhat localnet-check

npx hardhat hello-withdraw-and-call \
npx hardhat universal-withdraw-and-call \
--contract "$CONTRACT_ZETACHAIN" \
--receiver "$CONTRACT_ETHEREUM" \
--zrc20 "$ZRC20_ETHEREUM" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
console.log("gatewayCall executed successfully");
};

task("echo-call", "Calls the gateway on a contract on EVM", main)
task(
"connected-call",
"Make a call from a connected chain to a universal app on ZetaChain",
main
)
.addParam("contract", "The address of the deployed contract")
.addOptionalParam(
"txOptionsGasPrice",
Expand Down Expand Up @@ -94,6 +98,6 @@ task("echo-call", "Calls the gateway on a contract on EVM", main)
7000000,
types.int
)
.addParam("name", "The name of the contract", "Echo")
.addParam("name", "The name of the contract", "Connected")
.addParam("types", `The types of the parameters (example: '["string"]')`)
.addVariadicPositionalParam("values", "The values of the parameters");
2 changes: 1 addition & 1 deletion examples/hello/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {

task("deploy", "Deploy the contract", main)
.addFlag("json", "Output in JSON")
.addOptionalParam("name", "Contract to deploy", "Hello")
.addOptionalParam("name", "Contract to deploy", "Universal")
.addOptionalParam(
"gateway",
"Gateway address (default: ZetaChain Gateway on testnet)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
};

task(
"hello-call",
"Calls the gatewayCall function on a contract on ZetaChain",
"universal-call",
"Make a call from a universal app to a contract on a connected chain",
main
)
.addParam("contract", "The address of the deployed Hello contract")
.addParam("contract", "The address of the deployed universal contract")
.addParam("zrc20", "The address of ZRC-20 to pay fees")
.addOptionalParam(
"txOptionsGasPrice",
Expand Down Expand Up @@ -116,6 +116,6 @@ task(
types.int
)
.addParam("function", `Function to call (example: "hello(string)")`)
.addParam("name", "The name of the contract", "Hello")
.addParam("name", "The name of the contract", "Universal")
.addParam("types", `The types of the parameters (example: '["string"]')`)
.addVariadicPositionalParam("values", "The values of the parameters");
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
};

task(
"hello-withdraw-and-call",
"Calls the gatewayWithdrawAndCall function on a contract on ZetaChain",
"universal-withdraw-and-call",
"Withdraw ZRC-20 and call a function on a connected chain",
main
)
.addParam("contract", "The address of the deployed Hello contract")
Expand Down Expand Up @@ -133,7 +133,7 @@ task(
types.int
)
.addParam("function", `Function to call (example: "hello(string)")`)
.addParam("name", "The name of the contract", "Hello")
.addParam("name", "The name of the contract", "Universal")
.addParam("amount", "Amount of ZRC-20 to withdraw")
.addParam("types", `The types of the parameters (example: '["string"]')`)
.addVariadicPositionalParam("values", "The values of the parameters");

0 comments on commit d687d9c

Please sign in to comment.