Skip to content

refactor: renaming origin and sender in MessageContext #474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 18, 2025
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
16 changes: 14 additions & 2 deletions contracts/zevm/interfaces/UniversalContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@ interface zContract {
external;
}

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

/// @title UniversalContract
/// @notice Interface for contracts that can receive cross-chain calls on ZetaChain.
/// @dev Contracts implementing this interface can handle incoming cross-chain messages
/// and execute logic based on the provided context, token, and message payload.
interface UniversalContract {
function onCall(MessageContext calldata context, address zrc20, uint256 amount, bytes calldata message) external;
}
2 changes: 2 additions & 0 deletions data/addresses.mainnet.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


[
{
"address": "0x70e967acFcC17c3941E87562161406d41676FD83",
Expand Down
22 changes: 22 additions & 0 deletions data/addresses.testnet.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


[
{
"address": "0x0000ecb8cdd25a18f12daa23f6422e07fbf8b9e1",
Expand Down Expand Up @@ -27,6 +29,13 @@
"chain_name": "bsc_testnet",
"type": "zetaToken"
},
{
"address": "0x6b2fe12c605d64e14ca69f9aba51550593ba92ff43376d0a6cc26a5ca226f9bd,0x6fc08f682551e52c2cc34362a20f744ba6a3d8d17f6583fa2f774887c4079700",
"category": "omnichain",
"chain_id": 103,
"chain_name": "sui_testnet",
"type": "gateway"
},
{
"address": "ZETAjseVjuFsxdRxo6MmTCvqFwb3ZHUx56Co3vCmGis",
"category": "omnichain",
Expand Down Expand Up @@ -122,6 +131,19 @@
"symbol": "ETH.BASESEPOLIA",
"type": "zrc20"
},
{
"address": "0x3e128c169564DD527C8e9bd85124BF6A890E5a5f",
"asset": "",
"category": "omnichain",
"chain_id": 7001,
"chain_name": "zeta_testnet",
"coin_type": "gas",
"decimals": 9,
"description": "ZetaChain ZRC20 SUI Testnet SUI",
"foreign_chain_id": "103",
"symbol": "SUI.SUI",
"type": "zrc20"
},
{
"address": "0x4bC32034caCcc9B7e02536945eDbC286bACbA073",
"asset": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
Expand Down
1 change: 1 addition & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ title = ""
no-section-label = true
additional-js = ["solidity.min.js"]
additional-css = ["book.css"]
mathjax-support = true
git-repository-url = "https://github.com/zeta-chain/protocol-contracts"

[output.html.fold]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# UniversalContract
[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/UniversalContract.sol)

Interface for contracts that can receive cross-chain calls on ZetaChain.

*Contracts implementing this interface can handle incoming cross-chain messages
and execute logic based on the provided context, token, and message payload.*


## Functions
### onCall
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# MessageContext
[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/UniversalContract.sol)

Provides contextual information when executing a cross-chain call on ZetaChain.

*This struct helps identify the sender of the message across different blockchain environments.*


```solidity
struct MessageContext {
bytes origin;
address sender;
bytes sender;
address senderEVM;
uint256 chainID;
}
```
Expand Down
4 changes: 2 additions & 2 deletions lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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";
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";
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";
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";
export type ParamType = "tss" | "connector" | "erc20Custody" | "gateway" | "zetaToken" | "fungibleModule" | "systemContract" | "uniswapV2Factory" | "uniswapV2Router02" | "zrc20";

2 changes: 1 addition & 1 deletion pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pkg/gatewayzevm.sol/gatewayzevm.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/gatewayzevm.t.sol/gatewayzevminboundtest.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/gatewayzevm.t.sol/gatewayzevmoutboundtest.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pkg/gatewayzevmupgradetest.sol/gatewayzevmupgradetest.go

Large diffs are not rendered by default.

Loading
Loading