diff --git a/universal/hello/contracts/Hello.sol b/universal/hello/contracts/Hello.sol index 5d93241b..d6a83d42 100644 --- a/universal/hello/contracts/Hello.sol +++ b/universal/hello/contracts/Hello.sol @@ -6,6 +6,7 @@ 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); @@ -34,6 +35,7 @@ contract Hello is UniversalContract { uint256 gasLimit, RevertOptions memory revertOptions ) external { + IZRC20(zrc20).approve(gateway, 1_000_000_000); IGatewayZEVM(gateway).call( receiver, zrc20, diff --git a/universal/hello/tasks/callFromZetaChain.ts b/universal/hello/tasks/callFromZetaChain.ts index 2578f87f..c92dc1ef 100644 --- a/universal/hello/tasks/callFromZetaChain.ts +++ b/universal/hello/tasks/callFromZetaChain.ts @@ -12,6 +12,13 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { signer ); + const zrc20Artifact = await hre.artifacts.readArtifact("IZRC20"); + const zrc20 = new hre.ethers.Contract( + args.zrc20, + zrc20Artifact.abi, + signer + ); + const message = hre.ethers.utils.defaultAbiCoder.encode( ["string"], [args.message] @@ -20,6 +27,13 @@ const main = async (args: any, hre: HardhatRuntimeEnvironment) => { const revertMessageBytes = hre.ethers.utils.toUtf8Bytes(args.revertMessage); try { + const zrc20TransferTx = await zrc20.transfer(args.contract, 500_000_000, + { + gasPrice: 10000000000, + gasLimit: 7000000, + }); + await zrc20TransferTx.wait(); + const tx = await contract.callFromZetaChain( hre.ethers.utils.hexlify(args.receiver), args.zrc20,