Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/call/contracts/Connected.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {RevertContext} from "@zetachain/protocol-contracts/contracts/Revert.sol";
import "@zetachain/protocol-contracts/contracts/evm/GatewayEVM.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

Expand Down
15 changes: 0 additions & 15 deletions examples/call/contracts/Universal.sol
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

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/GatewayZEVM.sol";

contract Universal is UniversalContract {
GatewayZEVM public immutable gateway;

event HelloEvent(string, string);
event RevertEvent(string, RevertContext);
event AbortEvent(string, AbortContext);

error TransferFailed();
error Unauthorized();

modifier onlyGateway() {
if (msg.sender != address(gateway)) revert Unauthorized();
_;
}

constructor(address payable gatewayAddress) {
gateway = GatewayZEVM(gatewayAddress);
}

function call(
bytes memory receiver,
Expand Down
1 change: 0 additions & 1 deletion examples/call/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ src = 'contracts'
out = 'out'
viaIR = true
libs = ['node_modules', "dependencies"]
evm_version = "paris"
test = 'test'
cache_path = 'cache_forge'
verbosity = 3
Expand Down
6 changes: 6 additions & 0 deletions examples/call/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ dotenv.config();

const config: HardhatUserConfig = {
...getHardhatConfig({ accounts: [process.env.PRIVATE_KEY || ""] }),
solidity: {
settings: {
evmVersion: "cancun",
},
version: "0.8.26",
},
};

export default config;
6 changes: 3 additions & 3 deletions examples/call/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@types/node": ">=12.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@zetachain/toolkit": "^16.0.0",
"@zetachain/toolkit": "^16.2.2",
"axios": "^1.3.6",
"chai": "^4.2.0",
"dotenv": "^16.0.3",
Expand Down Expand Up @@ -58,10 +58,10 @@
"@solana/spl-token": "^0.4.13",
"@solana/web3.js": "^1.95.8",
"@zetachain/networks": "13.0.0-rc1",
"@zetachain/protocol-contracts": "13.0.0",
"@zetachain/protocol-contracts": "^14.1.0",
"@zetachain/protocol-contracts-solana": "2.0.0-rc1",
"bech32": "^2.0.0",
"ethers": "5.4.7",
"zetachain": "7.0.0"
"zetachain": "^7.2.0"
}
}
8 changes: 2 additions & 6 deletions examples/call/scripts/localnet.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash

set -e
set -x
set -o pipefail
set -exo pipefail

yarn zetachain localnet start --force-kill --exit-on-error --no-analytics &

Expand All @@ -15,7 +13,6 @@ ZRC20_ETHEREUM=$(jq -r '."11155112".zrc20Tokens[] | select(.coinType == "gas" an
USDC_ETHEREUM=$(jq -r '."11155112".zrc20Tokens[] | select(.symbol == "USDC.ETH") | .address' ~/.zetachain/localnet/registry.json) && echo $USDC_ETHEREUM
GATEWAY_ETHEREUM=$(jq -r '.["11155112"].contracts[] | select(.contractType == "gateway") | .address' ~/.zetachain/localnet/registry.json) && echo $GATEWAY_ETHEREUM
GATEWAY_BNB=$(jq -r '."98".contracts[] | select(.contractType == "gateway") | .address' ~/.zetachain/localnet/registry.json) && echo $GATEWAY_BNB
GATEWAY_ZETACHAIN=$(jq -r '.["31337"].contracts[] | select(.contractType == "gateway") | .address' ~/.zetachain/localnet/registry.json) && echo $GATEWAY_ZETACHAIN
WZETA=$(jq -r '."31337".contracts[] | select(.contractType == "zetaToken") | .address' ~/.zetachain/localnet/registry.json) && echo $WZETA
PRIVATE_KEY=$(jq -r '.private_keys[0]' ~/.zetachain/localnet/anvil.json) && echo $PRIVATE_KEY
RECIPIENT=$(cast wallet address $PRIVATE_KEY) && echo $RECIPIENT
Expand All @@ -25,8 +22,7 @@ UNIVERSAL=$(forge create Universal \
--rpc-url $RPC \
--private-key $PRIVATE_KEY \
--broadcast \
--json \
--constructor-args $GATEWAY_ZETACHAIN | jq -r .deployedTo) && echo $UNIVERSAL
--json | jq -r .deployedTo) && echo $UNIVERSAL

yarn zetachain localnet check --no-analytics

Expand Down
4 changes: 1 addition & 3 deletions examples/call/test/CallTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ contract CallTest is FoundrySetup {
connected = new Connected(
payable(address(evmSetup.wrapGatewayEVM(chainIdETH)))
);
universal = new Universal(
payable(address(zetaSetup.wrapGatewayZEVM()))
);
universal = new Universal();
console.log("universal", address(universal));
console.log("connected", address(connected));
}
Expand Down
Loading