Send Messages

To initiate a message transmission or execute an operation, the proposefunction of the gateway smart contract must be invoked.

Below is the signature of the propose function:

AggregationSpotter.propose(
    bytes32 protocolId,
    uint64 destChainId,
    bytes calldata protocolAddress,
    bytes4 functionSelector,
    bytes calldata params
    )

AggregationSpotter - serves as the gateway smart contract of the Photon Messaging Layer and is also known as a "Circuit".

Parameters: protocolId - unique identifier assigned to a protocol within the Master Aggregator Spotter Smart Contract, also known as the "Controller".

Registration as a Distributor using the provided guide is required to obtain it. destChainId - chain ID corresponding to the operation's destination blockchain. protocolAddress - protocol's designated address on destination blockchain. functionSelector - function selector for invoking a call on the destination chain. params - parameters of the function to call on the destination chain.

An example is provided below:

function proposeMint(
        uint128 sid,
        uint256 synthAmount,
        address recipient,
        uint256 totalSupply,
        uint256 opId
    ) external {
        bytes4 selector = bytes4(keccak256("HandleMint(bytes)"));

        bytes memory functionParams = abi.encode(sid, synthAmount, recipient, totalSupply, opId);

        aggregationSpotter.propose(
            protocolId, 
            eobChainId, 
            abi.encode(eventProcessorAddress), 
            selector, 
            functionParams
            );
    }

Last updated