Skip to content
Verified contractPartialMIT

CCIPFacet

Address0xe7c2a8abced933e58c1425c160023948c43eb99f
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.18

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.18+commit.87f61d96
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
18,521,562
Creation transaction
0x1afd1f47c2…615be46549

34 files

The source code is large: one file is shown at a time. Choose a file in the list.

src/facets/CCIPFacet.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol";
import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol";

import {Modifiers} from "../libraries/LibAppStorage.sol";
import {LibCCIP} from "../libraries/LibCCIP.sol";
import {LibTokenManager} from "../libraries/LibTokenManager.sol";

import {console} from "forge-std/Test.sol";

contract CCIPFacet is Modifiers {
    uint8 private constant SEND_TOKEN_ACTION = 1;

    /**
     * @notice Receives a CCIP (Cross-Chain Interoperability Protocol) message and triggers the appropriate action.
     * @dev This function decodes the CCIP message and based on the action, triggers the corresponding functionality.
     * Currently, it supports the SEND_TOKEN_ACTION which triggers the sendToken functionality.
     * @param any2EvmMessage The CCIP message received.
     */
    function ccipReceive(Client.Any2EVMMessage calldata any2EvmMessage) external {
        (, bytes memory actionPayload) = LibCCIP.handleReceiveMessage(any2EvmMessage);
        (uint8 action, bytes memory payload) = abi.decode(actionPayload, (uint8, bytes));

        if (action == SEND_TOKEN_ACTION) {
            LibTokenManager.sendToken(payload);
        }
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris",
  "remappings": [
    ":@chainlink/contracts-ccip/=node_modules/@chainlink/contracts-ccip/",
    ":@chainlink/contracts/=lib/chainlink/contracts/",
    ":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    ":Arachnid/solidity-stringutils/=lib/solidity-stringutils/",
    ":chainlink/=lib/chainlink/",
    ":ds-test/=lib/forge-std/lib/ds-test/src/",
    ":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    ":forge-std/=lib/forge-std/src/",
    ":foundry-devops/=lib/foundry-devops/",
    ":openzeppelin-contracts/=lib/openzeppelin-contracts/",
    ":openzeppelin/=lib/openzeppelin-contracts/contracts/",
    ":solidity-stringutils/=lib/solidity-stringutils/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.