cctp.whitelist
Documentation for eth_defi.cctp.whitelist Python module.
CCTP whitelisting for Lagoon vaults.
Utilities for whitelisting CCTP contracts in Guard contracts for cross-chain USDC transfers through managed vaults.
When a Lagoon vault needs to perform cross-chain USDC transfers, the guard contract must whitelist:
The TokenMessengerV2 contract (for
depositForBurn()calls)Each allowed destination domain (CCTP domain IDs)
USDC as an allowed asset (via
whitelistToken())The vault/Safe address as an allowed receiver
Example:
from eth_defi.cctp.whitelist import CCTPDeployment
cctp = CCTPDeployment.create_for_chain(
chain_id=1, # Ethereum
allowed_destinations=[42161, 8453], # Arbitrum, Base
)
# Pass to Lagoon vault deployment
deploy_automated_lagoon_vault(
...
cctp_deployment=cctp,
)
Functions
|
Whitelist CCTP contracts in a guard for cross-chain transfers. |
Classes
CCTP V2 deployment configuration for guard whitelisting. |
- class CCTPDeployment
Bases:
objectCCTP V2 deployment configuration for guard whitelisting.
All CCTP V2 contracts share the same address across EVM chains (CREATE2), so this mainly configures which destination domains are allowed.
- token_messenger: eth_typing.evm.HexAddress
TokenMessengerV2 contract address
- message_transmitter: eth_typing.evm.HexAddress
MessageTransmitterV2 contract address
- token_minter: eth_typing.evm.HexAddress
TokenMinterV2 contract address
- allowed_destination_domains: list[int]
CCTP domain IDs of allowed destination chains. Use
eth_defi.cctp.constants.CHAIN_ID_TO_CCTP_DOMAINto convert chain IDs to domain IDs.
- classmethod create_for_chain(chain_id, allowed_destinations=None)
Create a CCTP deployment configuration for a given chain.
- Parameters
- Returns
Configured
CCTPDeploymentinstance.- Raises
ValueError – If the source chain or a destination chain is not supported.
- Return type
- __init__(token_messenger=<factory>, message_transmitter=<factory>, token_minter=<factory>, allowed_destination_domains=<factory>)
- Parameters
token_messenger (eth_typing.evm.HexAddress) –
message_transmitter (eth_typing.evm.HexAddress) –
token_minter (eth_typing.evm.HexAddress) –
- Return type
None
- setup_cctp_whitelisting(web3, guard, cctp_deployment, owner)
Whitelist CCTP contracts in a guard for cross-chain transfers.
Calls the guard’s
whitelistCCTP()andwhitelistCCTPDestination()functions to enable cross-chain USDC transfers.- Parameters
web3 (web3.main.Web3) – Web3 connection
guard (web3.contract.contract.Contract) – Guard contract (TradingStrategyModuleV0 or similar)
cctp_deployment (eth_defi.cctp.whitelist.CCTPDeployment) – CCTP deployment configuration
owner (Union[eth_typing.evm.HexAddress, str]) – Address of the guard owner (typically the Safe)
- Returns
List of transaction hashes
- Return type
list[hexbytes.main.HexBytes]