### Installing Foundry Dependencies Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md Installs the necessary dependencies for the Foundry project, typically smart contract libraries and tools, using the `forge install` command. ```Shell forge install ``` -------------------------------- ### Installing Node.js Dependencies Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md Installs Node.js packages and dependencies required for the project, often used for front-end tools, scripts, or additional utilities, using the `npm install` command. ```Shell npm install ``` -------------------------------- ### Deploying BasicMessageReceiver Contract - Solidity & Shell Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This snippet details the deployment of the `BasicMessageReceiver.sol` smart contract on the destination blockchain. It includes the Solidity function signature for the deployment script and a `forge script` command example for deploying to Ethereum Sepolia, reusing a script from a previous example. ```Solidity function run(SupportedNetworks destination) external; ``` ```Shell forge script ./script/Example02.s.sol:DeployBasicMessageReceiver -vvv --broadcast --rpc-url ethereumSepolia --sig "run(uint8)" -- 0 ``` -------------------------------- ### Deploying BasicMessageSender Contract - Solidity & Shell Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This snippet shows how to deploy the `BasicMessageSender.sol` smart contract on a source blockchain. It includes the Solidity function signature for the deployment script and a `forge script` command example for deploying to Avalanche Fuji, specifying the network and a `run` function signature. ```Solidity function run(SupportedNetworks source) external; ``` ```Shell forge script ./script/Example05.s.sol:DeployBasicMessageSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1 ``` -------------------------------- ### Funding BasicMessageSender with Native Coins - Shell Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This snippet demonstrates how to fund the deployed `BasicMessageSender.sol` smart contract with native blockchain coins. It provides a `cast send` command example to send 1 Fuji AVAX to the contract address, requiring the contract address, RPC URL, and a private key. ```Shell cast send --rpc-url avalancheFuji --private-key=$PRIVATE_KEY --value 1ether ``` -------------------------------- ### Get Latest Message Details using Forge Script (Ethereum Sepolia) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `forge script` command queries the `BasicMessageReceiver` contract on Ethereum Sepolia to get the details of the latest received message. Replace `` with the actual contract address. ```Shell forge script ./script/Example02.s.sol:GetLatestMessageDetails -vvv --broadcast --rpc-url ethereumSepolia --sig "run(address)" -- ``` -------------------------------- ### Sending Cross-Chain Messages with Native Coin Payments - Solidity & Shell Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This snippet illustrates how to send a cross-chain message using the `SendMessage` smart contract. It provides the Solidity function signature for the `run` function, which accepts sender, destination, receiver, message content, and fee payment method, along with a `forge script` command example to send a 'Hello World' message. ```Solidity function run( address payable sender, SupportedNetworks destination, address receiver, string memory message, BasicMessageSender.PayFeesIn payFeesIn ) external; ``` ```Shell forge script ./script/Example05.s.sol:SendMessage -vvv --broadcast --rpc-url avalancheFuji --sig "run(address,uint8,address,string,uint8)" -- 0 "Hello World" 0 ``` -------------------------------- ### Retrieving Latest Cross-Chain Message Details - Solidity & Shell Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This snippet shows how to retrieve details about the latest cross-chain message received on the destination blockchain. It includes the Solidity function signature for `GetLatestMessageDetails` and a `forge script` command example to query the `BasicMessageReceiver` contract on Ethereum Sepolia. ```Solidity function run(address basicMessageReceiver) external view; ``` ```Shell forge script ./script/Example02.s.sol:GetLatestMessageDetails -vvv --broadcast --rpc-url ethereumSepolia --sig "run(address)" -- ``` -------------------------------- ### Get Latest Message Details Solidity Function Signature Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature is used to retrieve details about the latest cross-chain message received by a `BasicMessageReceiver` contract. It takes the receiver's address as input. ```Solidity function run(address basicMessageReceiver) external view; ``` -------------------------------- ### Withdrawing CCIP Fee Tokens from BasicMessageSender - Shell Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This snippet demonstrates how to withdraw tokens that were used for Chainlink CCIP fees from the `BasicMessageSender.sol` smart contract. It provides a `cast send` command example to call the `withdraw` function, specifying the contract address, RPC URL, private key, and beneficiary address. ```Shell cast send --rpc-url avalancheFuji --private-key=$PRIVATE_KEY "withdraw(address)" ``` -------------------------------- ### Minting Test Tokens on Ethereum Sepolia with Forge Script Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command executes the `Faucet.s.sol` script to mint 10^18 units of `CCIP-BnM` and `CCIP-LnM` test tokens on the Ethereum Sepolia network. The `--sig "run(uint8)" -- 0` part specifies calling the `run` function with the `ETHEREUM_SEPOLIA` enum value (0). ```Shell forge script ./script/Faucet.s.sol -vvv --broadcast --rpc-url ethereumSepolia --sig "run(uint8)" -- 0 ``` -------------------------------- ### Compiling Smart Contracts with Foundry Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md Compiles the Solidity smart contracts within the Foundry project, generating artifacts and bytecode necessary for deployment and interaction. This command ensures the contracts are ready for use. ```Shell forge build ``` -------------------------------- ### Deploying Destination Contracts (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command uses 'forge script' to deploy the destination smart contracts (MyNFT.sol and DestinationMinter.sol) to Ethereum Sepolia. The '--sig "run(uint8)" -- 0' part specifies the function signature and the network index for deployment. ```Shell forge script ./script/CrossChainNFT.s.sol:DeployDestination -vvv --broadcast --rpc-url ethereumSepolia --sig "run(uint8)" -- 0 ``` -------------------------------- ### Deploying Source Contract (Solidity) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the entry point for deploying the SourceMinter.sol smart contract on the source blockchain. It accepts a 'SupportedNetworks' enum value to indicate the source network. ```Solidity function run(SupportedNetworks source) external; ``` -------------------------------- ### Deploying BasicTokenSender Contract (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command uses `forge script` to deploy the `BasicTokenSender.sol` contract to the Avalanche Fuji network. The `--sig "run(uint8)" -- 1` part specifies the function to call and its argument, corresponding to Avalanche Fuji. ```Shell forge script ./script/Example03.s.sol:DeployBasicTokenSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1 ``` -------------------------------- ### Send Cross-Chain Message using Forge Script (Avalanche Fuji to Sepolia) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `forge script` command sends a 'Hello World' message from the `BasicMessageSender` on Avalanche Fuji to the `BasicMessageReceiver` on Ethereum Sepolia (represented by '0'). Fees are paid in LINK (represented by '1'). Replace placeholders with actual addresses. ```Shell forge script ./script/Example05.s.sol:SendMessage -vvv --broadcast --rpc-url avalancheFuji --sig "run(address,uint8,address,string,uint8)" -- 0 "Hello World" 1 ``` -------------------------------- ### Deploying BasicTokenSender Contract (Solidity) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the entry point for deploying the `BasicTokenSender.sol` smart contract to the source blockchain. It takes a `SupportedNetworks` enum value to specify the network. ```Solidity function run(SupportedNetworks source) external; ``` -------------------------------- ### Deploying BasicMessageReceiver Contract (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command uses `forge script` to deploy the `BasicMessageReceiver.sol` contract to the Ethereum Sepolia network. The `--sig "run(uint8)" -- 0` part specifies the function to call and its argument, corresponding to Ethereum Sepolia. ```Shell forge script ./script/Example02.s.sol:DeployBasicMessageReceiver -vvv --broadcast --rpc-url ethereumSepolia --sig "run(uint8)" -- 0 ``` -------------------------------- ### Deploying Source Contract (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command utilizes 'forge script' to deploy the SourceMinter.sol contract to Avalanche Fuji. The '--sig "run(uint8)" -- 1' part specifies the function signature and the network index for deployment. ```Shell forge script ./script/CrossChainNFT.s.sol:DeploySource -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1 ``` -------------------------------- ### Minting NFTs via SourceMinter (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This 'forge script' command executes the cross-chain NFT minting process from Avalanche Fuji to Ethereum Sepolia. It calls the 'Mint' function on the SourceMinter.sol contract, passing the required addresses and network/fee payment options. ```Shell forge script ./script/CrossChainNFT.s.sol:Mint -vvv --broadcast --rpc-url avalancheFuji --sig "run(address,uint8,address,uint8)" -- 0 0 ``` -------------------------------- ### Sending Cross-Chain Message with Tokens (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `forge script` command executes the `SendTokensAndData` script to send a cross-chain message and tokens. It transfers 100 units of CCIP-BnM (from address 0xD213...) and the message 'Hello World' from the source contract on Avalanche Fuji to the destination contract on Ethereum Sepolia. ```Shell forge script ./script/Example04.s.sol:SendTokensAndData -vvv --broadcast --rpc-url avalancheFuji --sig "run(address,uint8,address,string,address,uint256)" -- 0 "Hello World" 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 100 ``` -------------------------------- ### Deploying BasicMessageReceiver Contract with Forge Script Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command deploys the `BasicMessageReceiver.sol` contract to Ethereum Sepolia using the `Example02.s.sol:DeployBasicMessageReceiver` script. It broadcasts the transaction and specifies the RPC URL and the destination network. ```Shell forge script ./script/Example02.s.sol:DeployBasicMessageReceiver -vvv --broadcast --rpc-url ethereumSepolia --sig "run(uint8)" -- 0 ``` -------------------------------- ### Executing EOA to EOA Token Transfer with Forge Script Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command executes the `Example01.s.sol` script to transfer 0.0000000000000001 CCIP-BnM from Avalanche Fuji to Ethereum Sepolia, paying CCIP fees in LINK. It broadcasts the transaction and specifies RPC URL, signature, and parameters. ```Shell forge script ./script/Example01.s.sol -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8,uint8,address,address,uint256,uint8)" -- 1 0 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 100 1 ``` -------------------------------- ### Deploy BasicMessageReceiver using Forge Script (Ethereum Sepolia) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command uses `forge script` to deploy the `BasicMessageReceiver.sol` contract to Ethereum Sepolia. The `--sig "run(uint8)" -- 0` part specifies the function to call and its argument (representing Ethereum Sepolia). ```Shell forge script ./script/Example02.s.sol:DeployBasicMessageReceiver -vvv --broadcast --rpc-url ethereumSepolia --sig "run(uint8)" -- 0 ``` -------------------------------- ### Loading Environment Variables Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md Loads the environment variables defined in the `.env` file into the current shell session. This command makes the configured `PRIVATE_KEY` and RPC URLs accessible to subsequent commands and scripts. ```Shell source .env ``` -------------------------------- ### Configuring Environment Variables for RPCs and Private Key Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md Defines a template for the `.env` file, specifying placeholders for the wallet's `PRIVATE_KEY` and various RPC URLs across multiple testnet blockchains. These variables are crucial for interacting with the blockchain networks. ```Shell PRIVATE_KEY="" ETHEREUM_SEPOLIA_RPC_URL="" ARBITRUM_SEPOLIA_RPC_URL="" AVALANCHE_FUJI_RPC_URL="" POLYGON_MUMBAI_RPC_URL="" BNB_CHAIN_TESTNET_RPC_URL="" WEMIX_TESTNET_RPC_URL="" KROMA_SEPOLIA_TESTNET_RPC_URL="" METIS_SEPOLIA_RPC_URL="" ZKSYNC_SEPOLIA_RPC_URL="" SCROLL_SEPOLIA_RPC_URL="" ZIRCUIT_SEPOLIA_RPC_URL="" XLAYER_SEPOLIA_RPC_URL="" POLYGON_ZKEVM_SEPOLIA_RPC_URL="" POLKADOT_ASTAR_SHIBUYA_RPC_URL="" MANTLE_SEPOLIA_RPC_URL="" SONEIUM_MINATO_SEPOLIA_RPC_URL="" BSQUARED_TESTNET_RPC_URL="" BOB_SEPOLIA_RPC_URL="" WORLDCHAIN_SEPOLIA_RPC_URL="" SHIBARIUM_TESTNET_RPC_URL="" BITLAYER_TESTNET_RPC_URL="" FANTOM_SONIC_TESTNET_RPC_URL="" CORN_TESTNET_RPC_URL="" HASHKEY_SEPOLIA_RPC_URL="" INK_SEPOLIA_RPC_URL="" ``` -------------------------------- ### Minting Test Tokens on Avalanche Fuji with Forge Script Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command runs the `Faucet.s.sol` script to mint 10^18 units of the `CCIP-BnM` test token on the Avalanche Fuji network. The `--sig "run(uint8)" -- 1` part specifies calling the `run` function with the `AVALANCHE_FUJI` enum value (1). ```Shell forge script ./script/Faucet.s.sol -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1 ``` -------------------------------- ### Funding SourceMinter with Native Tokens (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This 'cast send' command demonstrates how to fund the SourceMinter.sol contract with native tokens (e.g., 1 Fuji AVAX) for CCIP fees. Replace '' with the actual contract address and '$PRIVATE_KEY' with your private key. ```Shell cast send --rpc-url avalancheFuji --private-key=$PRIVATE_KEY --value 1ether ``` -------------------------------- ### Deploying ProgrammableTokenTransfers on Ethereum Sepolia (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `forge script` command deploys the `ProgrammableTokenTransfers.sol` contract to the Ethereum Sepolia blockchain, serving as the destination contract. The `--sig "run(uint8)" -- 0` argument specifies calling the `run` function with a `uint8` parameter, likely representing the network ID for Ethereum Sepolia. ```Shell forge script ./script/Example04.s.sol:DeployProgrammableTokenTransfers -vvv --broadcast --rpc-url ethereumSepolia --sig "run(uint8)" -- 0 ``` -------------------------------- ### Minting NFTs via SourceMinter (Solidity) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the 'run' function for initiating the cross-chain NFT minting process. It takes the source minter address, destination network, destination minter address, and a 'PayFeesIn' enum to specify how CCIP fees will be paid. ```Solidity function run( address payable sourceMinterAddress, SupportedNetworks destination, address destinationMinterAddress, SourceMinter.PayFeesIn payFeesIn ) external; ``` -------------------------------- ### Deploy BasicMessageSender using Forge Script (Avalanche Fuji) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command uses `forge script` to deploy the `BasicMessageSender.sol` contract to Avalanche Fuji. The `--sig "run(uint8)" -- 1` part specifies the function to call and its argument (representing Avalanche Fuji). ```Shell forge script ./script/Example05.s.sol:DeployBasicMessageSender -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1 ``` -------------------------------- ### Sending Batch of Tokens via Script (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `forge script` command executes the `SendBatch` function to send CCIP-BnM tokens from Avalanche Fuji to Ethereum Sepolia. It specifies the destination, sender, receiver, token amounts, and that fees will be paid in LINK. ```Shell forge script ./script/Example03.s.sol:SendBatch -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8,address,address,(address,uint256)[],uint8)" -- 0 "[(0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4,100)]" 1 ``` -------------------------------- ### Faucet Script Run Function Signature in Solidity Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature from `Faucet.s.sol` is used to mint test tokens. It takes a `SupportedNetworks` enum value as an argument, specifying the network on which to mint `CCIP-BnM` and `CCIP-LnM` test tokens. ```Solidity function run(SupportedNetworks network) external; ``` -------------------------------- ### Deploying Destination Contracts (Solidity) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature represents the entry point for deploying the MyNFT.sol and DestinationMinter.sol smart contracts on the destination blockchain. It takes a 'SupportedNetworks' enum value to specify the target network. ```Solidity function run(SupportedNetworks destination) external; ``` -------------------------------- ### Defining BasicMessageReceiver Deployment Function in Solidity Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the `run` method within `Example02.s.sol:DeployBasicMessageReceiver`, used to deploy the `BasicMessageReceiver.sol` contract to a specified destination blockchain. It takes a `SupportedNetworks` enum value for the target chain. ```Solidity function run(SupportedNetworks destination) external; ``` -------------------------------- ### Defining EOA to EOA Token Transfer Function in Solidity Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the `run` method for `Example01.s.sol`, used to transfer tokens from one EOA on a source blockchain to another EOA on a destination blockchain. It specifies parameters for source/destination networks, receiver address, token, amount, and fee payment method. ```Solidity function run( SupportedNetworks source, SupportedNetworks destination, address receiver, address tokenToSend, uint256 amount, PayFeesIn payFeesIn ) external returns (bytes32 messageId); ``` -------------------------------- ### Deploying BasicMessageReceiver Contract (Solidity) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the entry point for deploying the `BasicMessageReceiver.sol` smart contract to the destination blockchain. It takes a `SupportedNetworks` enum value to specify the target network. ```Solidity function run(SupportedNetworks destination) external; ``` -------------------------------- ### Deploying ProgrammableTokenTransfers Contract (Solidity) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the entry point for deploying the `ProgrammableTokenTransfers.sol` smart contract. It takes a `SupportedNetworks` enum as an argument to specify the target network for deployment. ```Solidity function run(SupportedNetworks network) external; ``` -------------------------------- ### Executing EOA to Smart Contract Token Transfer with Forge Script Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command executes the `Example02.s.sol:CCIPTokenTransfer` script to send 0.0000000000000001 CCIP-BnM from Avalanche Fuji to a deployed `BasicMessageReceiver` contract on Ethereum Sepolia, paying CCIP fees in native AVAX. It broadcasts the transaction and specifies RPC URL, signature, and parameters. ```Shell forge script ./script/Example02.s.sol:CCIPTokenTransfer -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8,uint8,address,address,uint256,uint8)" -- 1 0 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 100 0 ``` -------------------------------- ### Funding BasicTokenSender with Native Coins (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command transfers 0.1 AVAX (native coin) from your wallet to the `BasicTokenSender.sol` contract on Avalanche Fuji. This is used to cover Chainlink CCIP fees in native currency. ```Shell cast send --rpc-url avalancheFuji --private-key=$PRIVATE_KEY --value 0.1ether ``` -------------------------------- ### Sending Batch of Tokens (Solidity) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the `run` method for the `SendBatch` smart contract, which facilitates sending multiple tokens in a single cross-chain transaction. It requires destination network, sender and receiver addresses, token details, and fee payment method. ```Solidity function run( SupportedNetworks destination, address payable basicTokenSenderAddres, address receiver, Client.EVMTokenAmount[] memory tokensToSendDetails, BasicTokenSender.PayFeesIn payFeesIn ) external; ``` -------------------------------- ### Running Forked CCIP Tests with Forge Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command runs CCIP tests in a forked blockchain environment, specifically targeting contracts ending with 'ForkTest'. These tests use `CCIPLocalSimulatorFork` and require `ETHEREUM_SEPOLIA_RPC_URL` and `ARBITRUM_SEPOLIA_RPC_URL` to be set in the `.env` file. ```Shell forge test --match-contract ".*ForkTest$" ``` -------------------------------- ### Funding BasicTokenSender with LINK Tokens (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command transfers 5 LINK tokens (5 * 10^18 wei) from your wallet to the `BasicTokenSender.sol` contract on Avalanche Fuji. This is typically done to cover Chainlink CCIP fees in LINK. ```Shell cast send 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846 "transfer(address,uint256)" 5000000000000000000 --rpc-url avalancheFuji --private-key=$PRIVATE_KEY ``` -------------------------------- ### Encoding EVMExtraArgsV1 Off-chain using Forge Script Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command demonstrates how to encode `extraArgs` as `EVMExtraArgsV1` off-chain using the `EncodeExtraArgsOffchain.s.sol` helper script. It requires a gas limit parameter for execution. ```Shell forge script ./script/EncodeExtraArgsOffchain.s.sol -vvv --sig "encodeV1(uint256)" -- ``` -------------------------------- ### Deploying ProgrammableTokenTransfers on Avalanche Fuji (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command uses `forge script` to deploy the `ProgrammableTokenTransfers.sol` contract to the Avalanche Fuji blockchain. The `--sig "run(uint8)" -- 1` argument specifies calling the `run` function with a `uint8` parameter, likely representing the network ID for Avalanche Fuji. ```Shell forge script ./script/Example04.s.sol:DeployProgrammableTokenTransfers -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8)" -- 1 ``` -------------------------------- ### Defining EOA to Smart Contract Token Transfer Function in Solidity Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the `run` method for `Example02.s.sol:CCIPTokenTransfer`, facilitating token transfers from an EOA on a source blockchain to a smart contract on a destination blockchain. Parameters include source/destination networks, receiver contract, token, amount, and fee payment. ```Solidity function run( SupportedNetworks source, SupportedNetworks destination, address basicMessageReceiver, address tokenToSend, uint256 amount, PayFeesIn payFeesIn ) external returns (bytes32 messageId); ``` -------------------------------- ### Defining Latest Message Details Retrieval Function in Solidity Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the `run` method for `Example02.s.sol:GetLatestMessageDetails`, used to retrieve details about the latest CCIP message received by a `BasicMessageReceiver` smart contract. It takes the address of the `BasicMessageReceiver` as input. ```Solidity function run(address basicMessageReceiver) external view; ``` -------------------------------- ### Encoding EVMExtraArgsV2 Off-chain using Forge Script Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command encodes `extraArgs` as `EVMExtraArgsV2` off-chain using the `EncodeExtraArgsOffchain.s.sol` script. It requires a gas limit and a boolean flag for `ALLOW_OUT_OF_ORDER_EXECUTION`. ```Shell forge script ./script/EncodeExtraArgsOffchain.s.sol -vvv --sig "encodeV2(uint256,bool)" -- ``` -------------------------------- ### Fund BasicMessageSender with LINK using Cast Send Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command transfers 1 LINK token (10^18 wei) to the deployed `BasicMessageSender.sol` contract on Avalanche Fuji. Replace `` with the actual contract address and `$PRIVATE_KEY` with your private key. ```Shell cast send 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846 "transfer(address,uint256)" 1000000000000000000 --rpc-url avalancheFuji --private-key=$PRIVATE_KEY ``` -------------------------------- ### Sending Tokens and Data Function Signature (Solidity) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature defines the `run` function within the `SendTokensAndData` smart contract, used for initiating cross-chain transfers. It specifies parameters for the sender, destination network, receiver address, a message string, the token address, and the amount to be transferred. ```Solidity function run( address payable sender, SupportedNetworks destination, address receiver, string memory message, address token, uint256 amount ) external; ``` -------------------------------- ### Deploy BasicMessageSender Solidity Function Signature Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature is used to deploy the `BasicMessageSender.sol` smart contract on the source blockchain. It takes a `SupportedNetworks` enum value to specify the network. ```Solidity function run(SupportedNetworks source) external; ``` -------------------------------- ### Querying MyNFT Balance (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This 'cast call' command allows you to verify that a new NFT was minted by querying the 'balanceOf' function of the MyNFT.sol contract on the destination blockchain (Ethereum Sepolia). Replace '' and '' with the actual values. ```Shell cast call "balanceOf(address)" --rpc-url ethereumSepolia ``` -------------------------------- ### Configuring Foundry Path Remappings Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/remappings.txt This snippet defines remapping rules for a Foundry project. Each line maps a logical import path (e.g., `@openzeppelin/`) to its physical location on the filesystem, enabling the Solidity compiler to resolve `import` statements correctly. This is crucial for managing dependencies like OpenZeppelin contracts, Chainlink libraries, and Foundry's standard libraries. ```Foundry Configuration ds-test/=lib/forge-std/lib/ds-test/src/ forge-std/=lib/forge-std/src/ @openzeppelin/=lib/openzeppelin-contracts/ @chainlink/contracts/=lib/chainlink-evm/contracts/ @chainlink/contracts-ccip/=lib/chainlink-ccip/chains/evm/ @chainlink/local/=node_modules/@chainlink/local/ ``` -------------------------------- ### Funding SourceMinter with LINK Tokens (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This 'cast send' command illustrates how to fund the SourceMinter.sol contract with LINK tokens for CCIP fees. It calls the 'transfer' function on the LINK token contract, sending 1 LINK (10^18 wei) to the source minter address. ```Shell cast send 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846 "transfer(address,uint256)" 1000000000000000000 --rpc-url avalancheFuji --private-key=$PRIVATE_KEY ``` -------------------------------- ### Running Local CCIP Tests (No Fork) with Forge Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command executes local CCIP tests that do not involve a forked blockchain environment. These tests utilize the `CCIPLocalSimulator` and are located in the `test/no-fork` directory, excluding any contract names ending with 'ForkTest'. ```Shell forge test --no-match-contract ".*ForkTest$" ``` -------------------------------- ### Funding Contract with Native Tokens (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command funds the deployed `ProgrammableTokenTransfers` contract with native tokens (e.g., AVAX on Avalanche Fuji). It sends 1 ether (1 AVAX) from the account associated with `$PRIVATE_KEY` to the specified contract address on the Avalanche Fuji RPC URL. ```Shell cast send --rpc-url avalancheFuji --private-key=$PRIVATE_KEY --value 1ether ``` -------------------------------- ### Defining Fee Payment Options in Solidity Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity enum specifies the available options for paying Chainlink CCIP fees. It allows users to choose between paying fees in native blockchain tokens or in LINK tokens, using their corresponding integer values as function arguments. ```Solidity enum PayFeesIn { Native, // 0 LINK // 1 } ``` -------------------------------- ### Deploy BasicMessageReceiver Solidity Function Signature Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature is used to deploy the `BasicMessageReceiver.sol` smart contract on the destination blockchain. It takes a `SupportedNetworks` enum value to specify the target network. ```Solidity function run(SupportedNetworks destination) external; ``` -------------------------------- ### Retrieving Latest Message Details with Forge Script Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command executes the `Example02.s.sol:GetLatestMessageDetails` script to view details of the latest CCIP message received by a `BasicMessageReceiver` contract on Ethereum Sepolia. It broadcasts the transaction and specifies the RPC URL and the contract address. ```Shell forge script ./script/Example02.s.sol:GetLatestMessageDetails -vvv --broadcast --rpc-url ethereumSepolia --sig "run(address)" -- ``` -------------------------------- ### Funding Contract with LINK Tokens (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command transfers 1 LINK token (10^18 wei) to the `ProgrammableTokenTransfers` contract on Avalanche Fuji. It calls the `transfer` function of the LINK token contract (0xD213...) to send tokens from the private key's account to the specified contract address. ```Shell cast send 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 "transfer(address,uint256)" 1000000000000000000 --rpc-url avalancheFuji --private-key=$PRIVATE_KEY ``` -------------------------------- ### Approving Token Spending for BasicTokenSender (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command approves the `BasicTokenSender.sol` contract to spend 100 units of the CCIP-BnM token on your behalf. This is a prerequisite for the sender contract to transfer ERC20 tokens. ```Shell cast send 0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 "approve(address,uint256)" 100 --rpc-url avalancheFuji --private-key=$PRIVATE_KEY ``` -------------------------------- ### Withdrawing Native Tokens from SourceMinter using Cast Send (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This command withdraws native tokens (e.g., AVAX) from the `SourceMinter.sol` smart contract, which were previously sent for Chainlink CCIP fees. It uses the `withdraw(address)` function, specifying the beneficiary address. This is used when the contract was funded with native tokens. ```shell cast send --rpc-url avalancheFuji --private-key=$PRIVATE_KEY "withdraw(address)" ``` -------------------------------- ### Withdrawing Native Coins from Contract (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command allows withdrawing native coins from a specified contract (e.g., `BasicTokenSender.sol` or `BasicMessageReceiver.sol`) to a beneficiary address. It requires the contract address, RPC endpoint, private key, and beneficiary. ```Shell cast send --rpc-url --private-key=$PRIVATE_KEY "withdraw(address)" ``` -------------------------------- ### Withdrawing LINK Tokens from SourceMinter using Cast Send (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This command withdraws LINK tokens from the `SourceMinter.sol` smart contract, which were previously sent for Chainlink CCIP fees. It uses the `withdrawToken(address,address)` function, specifying the beneficiary address and the LINK token address. This is used when the contract was funded with LINK tokens. ```shell cast send --rpc-url avalancheFuji --private-key=$PRIVATE_KEY "withdrawToken(address,address)" 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846 ``` -------------------------------- ### Withdrawing Tokens from BasicMessageReceiver with Cast Send Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This shell command uses `cast send` to withdraw 100 units of CCIP-BnM tokens from the `BasicMessageReceiver.sol` smart contract on Ethereum Sepolia. It requires the contract address, RPC URL, private key, beneficiary address, and the token address. ```Shell cast send --rpc-url ethereumSepolia --private-key=$PRIVATE_KEY "withdrawToken(address,address)" 0xFd57b4ddBf88a4e07fF4e34C487b99af2Fe82a05 ``` -------------------------------- ### Defining Supported Networks in Solidity Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity enum defines the various blockchain networks supported by the Chainlink CCIP configuration. Each network is assigned an integer value, which is used as a flag for source and destination blockchains in CCIP operations. ```Solidity enum SupportedNetworks { ETHEREUM_SEPOLIA, // 0 AVALANCHE_FUJI, // 1 ARBITRUM_SEPOLIA, // 2 POLYGON_MUMBAI, // 3 BNB_CHAIN_TESTNET, // 4 OPTIMISM_SEPOLIA, // 5 BASE_SEPOLIA, // 6 WEMIX_TESTNET, // 7 KROMA_SEPOLIA_TESTNET, // 8 METIS_SEPOLIA, // 9 ZKSYNC_SEPOLIA, // 10 SCROLL_SEPOLIA, // 11 ZIRCUIT_SEPOLIA, // 12 XLAYER_SEPOLIA, // 13 POLYGON_ZKEVM_SEPOLIA, // 14 POLKADOT_ASTAR_SHIBUYA, // 15 MANTLE_SEPOLIA, // 16 SONEIUM_MINATO_SEPOLIA, // 17 BSQUARED_TESTNET, // 18 BOB_SEPOLIA, // 19 WORLDCHAIN_SEPOLIA, // 20 SHIBARIUM_TESTNET, // 21 BITLAYER_TESTNET, // 22 FANTOM_SONIC_TESTNET, // 23 CORN_TESTNET, // 24 HASHKEY_SEPOLIA, // 25 INK_SEPOLIA // 26 } ``` -------------------------------- ### Send Cross-Chain Message Solidity Function Signature Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This Solidity function signature is used to send a cross-chain message. It requires the sender's address, destination network, receiver's address, the message string, and the fee payment method. ```Solidity function run( address payable sender, SupportedNetworks destination, address receiver, string memory message, BasicMessageSender.PayFeesIn payFeesIn ) external; ``` -------------------------------- ### Withdraw LINK Tokens from BasicMessageSender using Cast Send Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command allows withdrawing LINK tokens from the `BasicMessageSender.sol` contract to a specified beneficiary address. Replace placeholders with the sender's address, beneficiary's address, and your private key. ```Shell cast send --rpc-url avalancheFuji --private-key=$PRIVATE_KEY "withdrawToken(address,address)" 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846 ``` -------------------------------- ### Withdrawing ERC20 Tokens from Contract (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast send` command allows withdrawing ERC20 tokens from a specified contract (e.g., `BasicTokenSender.sol` or `BasicMessageReceiver.sol`) to a beneficiary address. It requires the contract address, RPC endpoint, private key, beneficiary, and token address. ```Shell cast send --rpc-url --private-key=$PRIVATE_KEY "withdrawToken(address,address)" ``` -------------------------------- ### Retrieving Last Received CCIP Message Details (Shell) Source: https://github.com/smartcontractkit/ccip-starter-kit-foundry/blob/main/README.md This `cast call` command retrieves the details of the last CCIP message received by the `ProgrammableTokenTransfers` contract on the destination blockchain (Ethereum Sepolia). It calls the `getLastReceivedMessageDetails()` view function to inspect the contract's state. ```Shell cast call "getLastReceivedMessageDetails()" --rpc-url ethereumSepolia ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.