Facet Docs
  • 1. Introduction
    • Overview of Facet Protocol
    • What is Layer 1+?
    • The Based Sovereign Rollup
  • 2. Getting Started
    • Connecting a Wallet
    • Sending Transactions
    • Bridging In (and Out)
    • What about Gas?
    • Facet Apps
  • 3. Technical Details
    • Introduction
    • Facet RPC & Explorer
    • Genesis Contracts
    • Facet Transactions
      • From Calldata
      • From Event Logs
    • Facet Typescript SDK
    • Facet Sol (Foundry)
    • Chain State Derivation
    • Running a Facet Node
    • Bridging Assets
    • Building an Optimistic Bridge on Facet
    • Basic Transaction Flow
    • Facet's Gas Mechanism
      • FCT Issuance Calculation
      • FCT Gas Fee Calculation
    • Security Audits
  • 4. Community & Support
    • FAQs
    • Comparison with Other Rollups
    • Micro-Grants
    • Community Resources
    • Brand Kit
Powered by GitBook
On this page
  1. 3. Technical Details
  2. Facet Transactions

From Event Logs

Facet Transactions in Ethereum Events

L1 Smart Contracts create Facet transactions by emitting special events that are identified by the Facet event signature:

 0x00000000000000000000000000000000000000000000000000000000000face7

The data payload is the same RLP encoded transaction that would be used in the calldata of an EOA-originated Facet transaction. Here's how this is done in Solidity:

import { LibRLP } from "lib/solady/src/utils/LibRLP.sol";

contract FacetSender {
    using LibRLP for LibRLP.List;

    bytes32 constant facetEventSignature = 0x00000000000000000000000000000000000000000000000000000000000face7;
    uint8 constant facetTxType = 0x46;

    function sendFacetTransaction(
        uint256 chainId,
        bytes memory to,
        uint256 value,
        uint256 gasLimit,
        bytes memory data,
        bytes memory mineBoost
    ) internal {
        LibRLP.List memory list;

        list.p(chainId);
        list.p(to);
        list.p(value);
        list.p(gasLimit);
        list.p(data);
        list.p(mineBoost);

        bytes memory payload = abi.encodePacked(facetTxType, list.encode());
        
        assembly {
            log1(add(payload, 32), mload(payload), facetEventSignature)
        }
    }
}
PreviousFrom CalldataNextFacet Typescript SDK

Last updated 5 months ago