Skip to content

w3hc/marriage

Repository files navigation

Marriage

Marriage Solidity contract.

Build

forge build

Test

forge test

Deploy to Anvil (Local)

Note: Configure script/marriage-config.yaml with your deployment parameters before running the deployment script.

# Start Anvil
anvil

# Deploy (in another terminal)
source .env.local && forge script script/Deploy.s.sol --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --broadcast

Cast Examples

Replace <CONTRACT_ADDRESS> with your deployed contract address.

# Load environment variables (do this once per terminal session)
source .env.local

# Send 10 ETH to contract
cast send <CONTRACT_ADDRESS> --value 10ether --private-key $SPOUSE1_PRIVATE_KEY --rpc-url $RPC_URL

# Withdraw 5 ETH as spouse1 (50% limit)
cast send <CONTRACT_ADDRESS> "withdraw(uint256)" 5000000000000000000 --private-key $SPOUSE1_PRIVATE_KEY --rpc-url $RPC_URL

# Spouse1 requests withdrawal over 50% (returns withdrawal ID)
cast send <CONTRACT_ADDRESS> "requestWithdrawal(uint256)" 7000000000000000000 --private-key $SPOUSE1_PRIVATE_KEY --rpc-url $RPC_URL

# Spouse2 approves the withdrawal (use withdrawal ID 0)
cast send <CONTRACT_ADDRESS> "approveWithdrawal(uint256)" 0 --private-key $SPOUSE2_PRIVATE_KEY --rpc-url $RPC_URL

# Check contract balance
cast call <CONTRACT_ADDRESS> "getBalance()(uint256)" --rpc-url $RPC_URL

Support

Feel free to reach out to Julien on Farcaster, Element, Status, Telegram, Twitter, Discord, or LinkedIn.

built-with-ethereum-w3hc

About

Marriage Solidity contract

Resources

Stars

Watchers

Forks