Skip to content

Commit 429d839

Browse files
authored
refactor: renaming origin and sender in MessageContext (#474)
1 parent 95f9ecc commit 429d839

File tree

34 files changed

+151
-105
lines changed

34 files changed

+151
-105
lines changed

contracts/zevm/interfaces/UniversalContract.sol

+14-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,24 @@ interface zContract {
2323
external;
2424
}
2525

26+
/// @notice Provides contextual information when executing a cross-chain call on ZetaChain.
27+
/// @dev This struct helps identify the sender of the message across different blockchain environments.
2628
struct MessageContext {
27-
bytes origin;
28-
address sender;
29+
/// @notice The address of the sender on the connected chain.
30+
/// @dev This field uses `bytes` to remain chain-agnostic, allowing support for both EVM and non-EVM chains.
31+
/// If the connected chain is an EVM chain, `senderEVM` will also be populated with the same value.
32+
bytes sender;
33+
/// @notice The sender's address in `address` type if the connected chain is an EVM-compatible chain.
34+
address senderEVM;
35+
/// @notice The chain ID of the connected chain.
36+
/// @dev This identifies the origin chain of the message, allowing contract logic to differentiate between sources.
2937
uint256 chainID;
3038
}
3139

40+
/// @title UniversalContract
41+
/// @notice Interface for contracts that can receive cross-chain calls on ZetaChain.
42+
/// @dev Contracts implementing this interface can handle incoming cross-chain messages
43+
/// and execute logic based on the provided context, token, and message payload.
3244
interface UniversalContract {
3345
function onCall(MessageContext calldata context, address zrc20, uint256 amount, bytes calldata message) external;
3446
}

data/addresses.mainnet.json

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
[
24
{
35
"address": "0x70e967acFcC17c3941E87562161406d41676FD83",

data/addresses.testnet.json

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
[
24
{
35
"address": "0x0000ecb8cdd25a18f12daa23f6422e07fbf8b9e1",
@@ -27,6 +29,13 @@
2729
"chain_name": "bsc_testnet",
2830
"type": "zetaToken"
2931
},
32+
{
33+
"address": "0x6b2fe12c605d64e14ca69f9aba51550593ba92ff43376d0a6cc26a5ca226f9bd,0x6fc08f682551e52c2cc34362a20f744ba6a3d8d17f6583fa2f774887c4079700",
34+
"category": "omnichain",
35+
"chain_id": 103,
36+
"chain_name": "sui_testnet",
37+
"type": "gateway"
38+
},
3039
{
3140
"address": "ZETAjseVjuFsxdRxo6MmTCvqFwb3ZHUx56Co3vCmGis",
3241
"category": "omnichain",
@@ -122,6 +131,19 @@
122131
"symbol": "ETH.BASESEPOLIA",
123132
"type": "zrc20"
124133
},
134+
{
135+
"address": "0x3e128c169564DD527C8e9bd85124BF6A890E5a5f",
136+
"asset": "",
137+
"category": "omnichain",
138+
"chain_id": 7001,
139+
"chain_name": "zeta_testnet",
140+
"coin_type": "gas",
141+
"decimals": 9,
142+
"description": "ZetaChain ZRC20 SUI Testnet SUI",
143+
"foreign_chain_id": "103",
144+
"symbol": "SUI.SUI",
145+
"type": "zrc20"
146+
},
125147
{
126148
"address": "0x4bC32034caCcc9B7e02536945eDbC286bACbA073",
127149
"asset": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",

docs/book.toml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ title = ""
66
no-section-label = true
77
additional-js = ["solidity.min.js"]
88
additional-css = ["book.css"]
9+
mathjax-support = true
910
git-repository-url = "https://github.com/zeta-chain/protocol-contracts"
1011

1112
[output.html.fold]

docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# UniversalContract
22
[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/UniversalContract.sol)
33

4+
Interface for contracts that can receive cross-chain calls on ZetaChain.
5+
6+
*Contracts implementing this interface can handle incoming cross-chain messages
7+
and execute logic based on the provided context, token, and message payload.*
8+
49

510
## Functions
611
### onCall

docs/src/contracts/zevm/interfaces/UniversalContract.sol/struct.MessageContext.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# MessageContext
22
[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/UniversalContract.sol)
33

4+
Provides contextual information when executing a cross-chain call on ZetaChain.
5+
6+
*This struct helps identify the sender of the message across different blockchain environments.*
7+
48

59
```solidity
610
struct MessageContext {
7-
bytes origin;
8-
address sender;
11+
bytes sender;
12+
address senderEVM;
913
uint256 chainID;
1014
}
1115
```

lib/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type ParamSymbol = "USDC.ARB" | "USDC.BSC" | "USDT.ARB" | "USDC.ETH" | "BTC.BTC" | "ETH.BASE" | "PEPE.ETH" | "USDT.AVAX" | "CBBTC.ETH" | "BNB.BSC" | "SOL.SOL" | "CBBTC.SOL" | "SHIB.ETH" | "USDT.ETH" | "USDC.SOL" | "USDT.BSC" | "USDC.BASE" | "USDC.AVAX" | "ETH.ARB" | "POL.POLYGON" | "DAI.ETH" | "WBTC.ETH" | "ULTI.BSC" | "ETH.ETH" | "USDT.POL" | "NPC.ETH" | "ULTI.ETH" | "CBBTC.BASE" | "AVAX.AVAX" | "USDT.SOL" | "USDC.POL" | "sETH.SEPOLIA" | "ETH.ARBSEP" | "ETH.BASESEPOLIA" | "USDC.ARBSEP" | "TON.TON" | "MATIC.AMOY" | "USDC" | "USDC.FUJI" | "SOL.SOLANA" | "USDC.SEPOLIA" | "tBNB" | "sBTC" | "USDC.AMOY" | "AVAX.FUJI" | "tBTC";
2-
export type ParamChainName = "eth_mainnet" | "bsc_mainnet" | "polygon_mainnet" | "solana_mainnet" | "zeta_mainnet" | "btc_mainnet" | "base_mainnet" | "arbitrum_mainnet" | "avalanche_mainnet" | "bsc_testnet" | "solana_devnet" | "zeta_testnet" | "btc_testnet" | "avalanche_testnet" | "amoy_testnet" | "base_sepolia" | "arbitrum_sepolia" | "ton_testnet" | "sepolia_testnet";
1+
export type ParamSymbol = "USDC.ARB" | "USDC.BSC" | "USDT.ARB" | "USDC.ETH" | "BTC.BTC" | "ETH.BASE" | "PEPE.ETH" | "USDT.AVAX" | "CBBTC.ETH" | "BNB.BSC" | "SOL.SOL" | "CBBTC.SOL" | "SHIB.ETH" | "USDT.ETH" | "USDC.SOL" | "USDT.BSC" | "USDC.BASE" | "USDC.AVAX" | "ETH.ARB" | "POL.POLYGON" | "DAI.ETH" | "WBTC.ETH" | "ULTI.BSC" | "ETH.ETH" | "USDT.POL" | "NPC.ETH" | "ULTI.ETH" | "CBBTC.BASE" | "AVAX.AVAX" | "USDT.SOL" | "USDC.POL" | "sETH.SEPOLIA" | "ETH.ARBSEP" | "ETH.BASESEPOLIA" | "SUI.SUI" | "USDC.ARBSEP" | "TON.TON" | "MATIC.AMOY" | "USDC" | "USDC.FUJI" | "SOL.SOLANA" | "USDC.SEPOLIA" | "tBNB" | "sBTC" | "USDC.AMOY" | "AVAX.FUJI" | "tBTC";
2+
export type ParamChainName = "eth_mainnet" | "bsc_mainnet" | "polygon_mainnet" | "solana_mainnet" | "zeta_mainnet" | "btc_mainnet" | "base_mainnet" | "arbitrum_mainnet" | "avalanche_mainnet" | "bsc_testnet" | "sui_testnet" | "solana_devnet" | "zeta_testnet" | "btc_testnet" | "avalanche_testnet" | "amoy_testnet" | "base_sepolia" | "arbitrum_sepolia" | "ton_testnet" | "sepolia_testnet";
33
export type ParamType = "tss" | "connector" | "erc20Custody" | "gateway" | "zetaToken" | "fungibleModule" | "systemContract" | "uniswapV2Factory" | "uniswapV2Router02" | "zrc20";
44

pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/gatewayzevm.sol/gatewayzevm.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/gatewayzevm.t.sol/gatewayzevminboundtest.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/gatewayzevm.t.sol/gatewayzevmoutboundtest.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/gatewayzevmupgradetest.sol/gatewayzevmupgradetest.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)