The CRE workflow configuration has been updated with your new Base Mainnet contract address:
Contract Address: 0x2E48c2aae9CC1dF9Ca4e5Cd67be17f299B86eB4f
Network: Base Mainnet (ethereum-mainnet-base-1)
The workflow config has been updated. Now deploy it to production:
cd chainlink-cre-workflows/weekly-prize-distribution
# Install dependencies (if not already done)
bun install
# Test the workflow locally first (recommended)
cre workflow simulate weekly-prize-distribution --target production-settings
# Deploy the workflow to CRE production
cre workflow deploy weekly-prize-distribution --target production-settings
# Activate the workflow
cre workflow activate weekly-prize-distribution --target production-settingsAfter deploying the workflow, you need to get the Chainlink forwarder address:
Option A: From CRE Dashboard
- Go to cre.chain.link
- Navigate to your workflow:
weekly-prize-dist-prod - Find the forwarder/executor address in the workflow details
Option B: From CRE CLI
The CRE CLI has no workflow status command. Use the dashboard for runtime details, or cre workflow hash weekly-prize-distribution --target production-settings for local workflow hashes.
Option C: Use Base Mainnet Forwarder Address
- Base KeystoneForwarder:
0xF8344CFd5c43616a4366C34E3EEE75af79a74482✅
Note: The forwarder address is the address that CRE uses to call your contract. Your contract's chainlinkOracle must be set to this address for the workflow to work.
Once you have the forwarder address, set it on your deployed contract:
# Set the Chainlink oracle (forwarder) address
cast send 0x2E48c2aae9CC1dF9Ca4e5Cd67be17f299B86eB4f \
"setChainlinkOracle(address)" <FORWARDER_ADDRESS> \
--rpc-url base_mainnet \
--private-key $PRIVATE_KEYRun this command:
# Base Mainnet KeystoneForwarder address
cast send 0x2E48c2aae9CC1dF9Ca4e5Cd67be17f299B86eB4f \
"setChainlinkOracle(address)" 0xF8344CFd5c43616a4366C34E3EEE75af79a74482 \
--rpc-url base_mainnet \
--private-key $PRIVATE_KEY# Verify chainlinkOracle is set correctly
cast call 0x2E48c2aae9CC1dF9Ca4e5Cd67be17f299B86eB4f \
"chainlinkOracle()" \
--rpc-url base_mainnet
# Should return the forwarder address you set- Schedule: Runs every Sunday at 00:00 UTC (
"0 0 * * 0") - Checks:
- Reads contract state (session status, prize pool, player count)
- Verifies if distribution is needed
- Conditions for Distribution:
- Session has ended (
!isSessionActiveORcurrentTime > endTime) - Prizes not already distributed
- Prize pool > 0
- At least one player joined
- Session has ended (
- Action: Calls
distributePrizes()via Chainlink forwarder
Your contract already has everything needed:
- ✅
distributePrizes()function exists - ✅
onlyOwnerOrChainlinkmodifier allows CRE to call it - ✅
setChainlinkOracle(address)function exists to set the forwarder - ✅ View functions exist:
isSessionActive(),sessionCounter(),getCurrentPlayers(),getContractUsdcBalance(), etc.
After deployment, monitor your workflow:
Use the CRE dashboard for status, runs, and logs (no cre workflow status / workflow logs in current CLI).
-
Test on Staging First:
# Make sure staging config has correct testnet contract cre workflow simulate weekly-prize-distribution --target staging-settings -
Manual Test After Setup:
- Start a session:
cast send <CONTRACT> "startNewSession()" ... - Wait for session to end (or manually end it)
- Verify CRE workflow picks it up on next cron run
- Start a session:
-
Forwarder Address: The
chainlinkOracleon your contract must match the CRE forwarder address, otherwisedistributePrizes()will revert withTriviaBattle__Unauthorized. -
First Distribution: The workflow will skip distribution if
sessionCounter = 0(no session started yet). This is expected behavior. -
Schedule: The workflow runs weekly on Sunday at midnight UTC. You can change this in
config.production.jsonif needed. -
Gas Limit: Current gas limit is 500,000. Adjust if needed based on your contract's gas usage.
Contract Address: 0x2E48c2aae9CC1dF9Ca4e5Cd67be17f299B86eB4f
Network: Base Mainnet
CRE Workflow: weekly-prize-dist-prod
Schedule: Every Sunday 00:00 UTC
Function Called: distributePrizes()
- Contract deployed to Base Mainnet
- CRE workflow config updated with contract address
- CRE workflow deployed to production
- Forwarder address obtained from CRE
-
chainlinkOracleset on contract to forwarder address - Workflow activated and running
- First session started to test workflow
- Deploy the workflow (commands above)
- Get forwarder address from CRE dashboard or CLI
- Set forwarder on contract using
setChainlinkOracle() - Start first session and test the workflow
Your CRE workflow will now automatically distribute prizes every week!