Skip to content
Lattice

CCTPHookReceipt

Git Source

Inherits: ERC721, ICCTPHookReceiver

Title: CCTPHookReceipt

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from Uniswap v4 Periphery (https://github.com/Uniswap/v4-periphery)

Position-style ERC-721 proof that Circle CCTP v2 delivered USDC through a Lattice hook.

The receipt never custodies or controls USDC. Only the immutable CCTPHookExecutor may mint, and every recorded transfer fact comes from the Circle-attested callback. The attacker-controlled payload is ignored. The NFT is transferable, but originalRecipient remains the account that received the USDC.

Constants

executor

address public immutable executor;

State Variables

nextTokenId

uint256 public nextTokenId = 1;

_receipts

mapping(uint256 tokenId => Receipt receipt_) private _receipts;

Functions

constructor

constructor(address executor_);

Parameters

NameTypeDescription
executor_address

supportsInterface

Query ERC-165 support registered by the standalone ERC-721 initialization.

function supportsInterface(bytes4 interfaceId) external view returns (bool);

Parameters

NameTypeDescription
interfaceIdbytes4

Returns

NameTypeDescription
<none>bool

receipt

Return the immutable delivery facts for an existing receipt.

function receipt(uint256 tokenId) external view returns (Receipt memory);

Parameters

NameTypeDescription
tokenIduint256

Returns

NameTypeDescription
<none>Receipt

onCCTPHook

Invoked by the CCTPHookExecutor after the attested USDC mint, with Circle-attested context.

function onCCTPHook(uint32 sourceDomain, bytes32 sender, bytes32 mintRecipient, uint256 amount, bytes calldata)
        external;

Parameters

NameTypeDescription
sourceDomainuint32The CCTP domain the burn originated on (from the attested message header).
senderbytes32The burner on the source domain, as a right-aligned bytes32 (attested).
mintRecipientbytes32The bytes32 recipient the USDC was minted to on this chain (attested).
amountuint256The USDC amount actually minted to mintRecipient (attested burn amount minus
attested feeExecuted).
_bytesATTACKER-CONTROLLED hook payload bytes (the Lattice envelope's tail). Untrusted.

tokenURI

Returns the Uniform Resource Identifier (URI) for tokenId token.

function tokenURI(uint256 tokenId) public view override returns (string memory);

Parameters

NameTypeDescription
tokenIduint256

Returns

NameTypeDescription
<none>string

Events

ReceiptMinted

event ReceiptMinted(
        uint256 indexed tokenId,
        address indexed originalRecipient,
        uint32 indexed sourceDomain,
        bytes32 sender,
        uint256 amount,
        uint64 recordedAt
    );

Parameters

NameTypeDescription
tokenIduint256
originalRecipientaddress
sourceDomainuint32
senderbytes32
amountuint256
recordedAtuint64

Errors

CCTPHookReceipt__ZeroExecutor

error CCTPHookReceipt__ZeroExecutor();

CCTPHookReceipt__NotExecutor

error CCTPHookReceipt__NotExecutor();

CCTPHookReceipt__InvalidRecipient

error CCTPHookReceipt__InvalidRecipient(bytes32 mintRecipient);

Parameters

NameTypeDescription
mintRecipientbytes32

Structs

Receipt

struct Receipt {
        uint32 sourceDomain;
        bytes32 sender;
        address originalRecipient;
        uint256 amount;
        uint64 recordedAt;
    }

Properties

NameTypeDescription
sourceDomainuint32
senderbytes32
originalRecipientaddress
amountuint256
recordedAtuint64