Skip to content

Conversation

@RonTuretzky
Copy link
Collaborator

@RonTuretzky RonTuretzky commented Aug 9, 2025

Summary

  • Implements issue Add CI/CD to automatically deploy all contracts to testnet on merge to dev #142 - adds CI/CD pipeline that automatically deploys all smart contracts to testnet on merge to dev branch
  • Creates GitHub Actions workflow that triggers on push to dev branch
  • Includes deployment of all 4 contracts: ButteredBread, YieldDistributor, NFTMultiplier, VotingStreakMultiplier
  • Uses GitHub Secrets for secure credential management (TESTNET_RPC_URL, TESTNET_PRIVATE_KEY)

Test plan

  1. Configure GitHub Secrets in repository settings
  2. Test workflow by merging to dev branch
  3. Verify all contracts deploy successfully to testnet
  4. Confirm deployment addresses are logged in workflow output

RonTuretzky and others added 10 commits July 22, 2025 13:19
Implements issue #142 - adds CI/CD pipeline that automatically deploys
all smart contracts to testnet on merge to dev branch.

Features:
- Triggers on push to dev branch
- Builds contracts with forge build
- Runs tests with fork testing
- Deploys all 4 contracts: ButteredBread, YieldDistributor, NFTMultiplier, VotingStreakMultiplier
- Uses GitHub Secrets for secure credential management

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Generate deployment.json with contract addresses and timestamps
- Add contract verification on block explorer with ETHERSCAN_API_KEY
- Handle verification failures gracefully with status tracking
- Upload deployment artifacts with 30-day retention
- Update documentation with new secret requirements and artifact details

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Replace 'secrets.X \!= ""' with 'secrets.X'
- Replace 'secrets.X == ""' with '\!secrets.X'
- Fixes workflow parsing errors preventing PR #163 from running
- Remove problematic secret existence checks that cause parsing errors
- Use GitHub context variables to detect fork PRs vs internal PRs
- Move secret checks into bash conditionals within run steps
- Add if-no-files-found: ignore to upload artifact step
- Properly handle both fork PRs (no secrets) and internal PRs (with secrets)
- Add PRIVATE_KEY env var that deployment scripts expect
- Scripts use vm.envUint('PRIVATE_KEY') internally
- Keep TESTNET_PRIVATE_KEY for consistency but also set PRIVATE_KEY
- Capture both stdout and stderr from forge scripts
- Check if output is valid JSON before parsing with jq
- Display error output when deployment fails
- Add informative status messages with emojis
- Continue workflow even if individual deployments fail
- Use jq -e to properly check for valid JSON
- Add fallback to empty string for jq errors
- Check deployment.json exists before updating
- Show output when deployment doesn't find contract address
- Don't rely on forge script exit codes alone
- Use set +e/-e to capture exit codes without failing immediately
- Check exit code before attempting JSON parsing
- Always show forge script exit code for debugging
- Ensure errors are visible in CI logs
- Add required environment variables for NFTMultiplier deployment
- NFT_CONTRACT_ADDRESS, INITIAL_MULTIPLYING_FACTOR, VALID_UNTIL_BLOCK
- Skip NFTMultiplier deployment if NFT_CONTRACT_ADDRESS not configured
- Add continue-on-error to verification step
- Use existing ETHERSCAN_API_KEY secret for contract verification
Major fixes:
- Fix address extraction from forge script JSON output (use receipts array)
- Add debug output to show contract addresses found in receipts
- Track both proxy and implementation addresses separately
- Verify implementation contracts (not just proxies)
- Fix verification paths for NFTMultiplier and VotingStreakMultiplier
- Add comprehensive error handling and debugging output
- Display both proxy and implementation addresses in summary
- Extract ALL contract addresses from receipts array
- Use array to properly handle multiple deployed contracts
- Last address is proxy, second-to-last is implementation
- Add fallback to returns[0].deployed_addresses if receipts empty
- Show full JSON structure on debug for troubleshooting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants