source .env
forge create src/BagelToken.sol:BagelToken \
--rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} \
--account updraft \
--legacy \
--zksync
export TOKEN_ADDRESS=<deployed_token_address>
# Example: MERKLE_ROOT_VAL=$(jq -r '.merkleRoot' output.json)
# Ensure MERKLE_ROOT_VAL contains the correct root from your output.json
forge create src/MerkleAirdrop.sol:MerkleAirdrop \
--constructor-args <merkle_root_from_output.json> ${TOKEN_ADDRESS} \
--rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} \
--account updraft \
--legacy \
--zksync
export AIRDROP_ADDRESS=<deployed_airdrop_address>
cast call ${AIRDROP_ADDRESS} "getMessageHash(address,uint256)" \
<address_of_updraft-2_from_input.json> \
<claim_amount_from_input.json> \
--rpc-url ${ZKSYNC_SEPOLIA_RPC_URL}
# Let's say MESSAGE_HASH=<message_hash_from_step_3>
cast wallet sign --no-hash ${MESSAGE_HASH} --account updraft-2
forge script script/SplitSignature.s.sol:SplitSignature
export V_VAL=<v_value_output_by_script>
export R_VAL=<r_value_output_by_script>
export S_VAL=<s_value_output_by_script>
# <my_metamask_address_for_updraft> is the deployer's EOA address
cast send ${TOKEN_ADDRESS} "mint(address,uint256)" \
<my_metamask_address_for_updraft> \
<total_airdrop_supply> \
--account updraft \
--rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} \
--legacy --zksync
cast send ${TOKEN_ADDRESS} "transfer(address,uint256)" \
${AIRDROP_ADDRESS} \
<total_airdrop_supply> \
--account updraft \
--rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} \
--legacy --zksync
# Retrieve Merkle proof elements for updraft-2 from output.json
# Example: "[0xproofelement1...,0xproofelement2...]"
cast send ${AIRDROP_ADDRESS} \
"claim(address,uint256,bytes32[],uint8,bytes32,bytes32)" \
<address_of_updraft-2> \
<claim_amount> \
"[<proof_element_1_for_updraft-2>,<proof_element_2_for_updraft-2>,...]" \
${V_VAL} \
${R_VAL} \
${S_VAL} \
--account updraft \
--rpc-url ${ZKSYNC_SEPOLIA_RPC_URL} \
--legacy --zksync
cast call ${TOKEN_ADDRESS} "balanceOf(address)" <address_of_updraft-2> \
--rpc-url ${ZKSYNC_SEPOLIA_RPC_URL}
cast --to-dec <hex_balance_output_from_above>Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
Foundry consists of:
- Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
- Chisel: Fast, utilitarian, and verbose solidity REPL.
$ forge build$ forge test$ forge fmt$ forge snapshot$ anvil$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>$ cast <subcommand>$ forge --help
$ anvil --help
$ cast --help