From bf82cb75d714b0f1db127cdffa98e241f6a9b712 Mon Sep 17 00:00:00 2001 From: jvaleskadevs Date: Thu, 27 Feb 2025 01:03:28 +0100 Subject: [PATCH 1/6] production test - distributePrizes --- apps/weeklyhackathon-core/src/cron/index.ts | 9 ++++-- .../weeklyhackathon-core/src/scripts/query.ts | 28 ++++++++++++++++--- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/apps/weeklyhackathon-core/src/cron/index.ts b/apps/weeklyhackathon-core/src/cron/index.ts index 0b9b966..745a9f8 100644 --- a/apps/weeklyhackathon-core/src/cron/index.ts +++ b/apps/weeklyhackathon-core/src/cron/index.ts @@ -8,11 +8,14 @@ import { refreshMissingPRAnalyses } from './refreshMissingPRAnalyses'; export function startCronJobs() { log.info('Starting cron jobs'); // Evaluate submissions every day at 00:00 UTC - cron.schedule('0 0 * * *', evaluateSubmissions); + //cron.schedule('0 0 * * *', evaluateSubmissions); // Distribute Prizes every Friday at 00:00 UTC - cron.schedule('0 0 * * 5', distributePrizes); + //cron.schedule('0 0 * * 5', distributePrizes); // Analyse PRs every hour - cron.schedule('0 * * * *', refreshMissingPRAnalyses); + //cron.schedule('0 * * * *', refreshMissingPRAnalyses); + + // testing in production, base-mainnet distributePrizes + cron.schedule('0 * * * *', distributePrizes); } export async function startDemo() { diff --git a/apps/weeklyhackathon-core/src/scripts/query.ts b/apps/weeklyhackathon-core/src/scripts/query.ts index c6030e2..dba0879 100644 --- a/apps/weeklyhackathon-core/src/scripts/query.ts +++ b/apps/weeklyhackathon-core/src/scripts/query.ts @@ -6,6 +6,9 @@ async function script() { where: { analysedAt: { not: null + }, + score: { + gte: 100 } }, include: { @@ -14,20 +17,37 @@ async function script() { }); log.info(`Found ${prs.length} PRs`); + log.info(prs); +} + +async function testFetchPRsWithScore() { + const prs = await prisma.githubPullRequest.findMany({ + where: { + score: { + gte: 100 + } + }, + include: { + repo: false + } + }); + + log.info(`Found ${prs.length} PRs`); + log.info(prs); } async function testFetchLastWeekPRs() { const oneWeekAgo = new Date(); - oneWeekAgo.setTime(oneWeekAgo.getTime() - (7 * 60 * 60 * 24 * 1000 * 4)); + oneWeekAgo.setTime(oneWeekAgo.getTime() - (7 * 60 * 60 * 24 * 1000)); const prs = await prisma.githubPullRequest.findMany({ where: { submittedAt: { gte: oneWeekAgo - }, - score: 0 + } } }); + log.info("Last Week Pull Requests"); log.info(`Found ${prs.length} PRs`); log.info(prs); } @@ -44,4 +64,4 @@ async function testScore() { log.info(res); } -//script(); +testFetchPRsWithScore(); From 5dd035668620c2c02e36ccd843e56a578fa50074 Mon Sep 17 00:00:00 2001 From: jvaleskadevs Date: Thu, 27 Feb 2025 01:05:04 +0100 Subject: [PATCH 2/6] comment out query script --- apps/weeklyhackathon-core/src/scripts/query.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weeklyhackathon-core/src/scripts/query.ts b/apps/weeklyhackathon-core/src/scripts/query.ts index dba0879..ce78ac3 100644 --- a/apps/weeklyhackathon-core/src/scripts/query.ts +++ b/apps/weeklyhackathon-core/src/scripts/query.ts @@ -64,4 +64,4 @@ async function testScore() { log.info(res); } -testFetchPRsWithScore(); +//testFetchPRsWithScore(); From 498af486bbd825a1fc08a3240936dd5873ad9a7e Mon Sep 17 00:00:00 2001 From: jvaleskadevs Date: Thu, 27 Feb 2025 04:18:42 +0100 Subject: [PATCH 3/6] Change to base-mainnet --- packages/agents/src/lib/nillionVault.ts | 4 ++-- packages/agents/src/lib/tools/claimClankerRewardsTool.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/agents/src/lib/nillionVault.ts b/packages/agents/src/lib/nillionVault.ts index e2a4194..fe84394 100644 --- a/packages/agents/src/lib/nillionVault.ts +++ b/packages/agents/src/lib/nillionVault.ts @@ -120,12 +120,12 @@ export async function readFromNodes(): Promise { await collection.init(); // Read all collection data from the nodes, decrypting the specified fields - const decryptedCollectionData = await collection.readFromNodes({}); + const decryptedCollectionData = await collection.readFromNodes({}); const decrypted = await decryptedCollectionData.slice(0, 1); // Log first record (we have just one, should be good to go) log.info('Decrypted data from nillion vault'); - log.log(decrypted?.[0]); + log.info(decrypted?.[0]?.name); return decrypted?.[0]?.name === 'Weekly Hackathon 000' ? decrypted?.[0]?.pk as string ?? '' : ''; diff --git a/packages/agents/src/lib/tools/claimClankerRewardsTool.ts b/packages/agents/src/lib/tools/claimClankerRewardsTool.ts index 83390b3..29899b2 100644 --- a/packages/agents/src/lib/tools/claimClankerRewardsTool.ts +++ b/packages/agents/src/lib/tools/claimClankerRewardsTool.ts @@ -90,7 +90,7 @@ async function claimClankerRewards(args: ClaimRewardsSchema): Promise { log.info('Claiming hackathon/weth token pair fees from clanker contract'); // Configure Base chain connection const publicClient = createPublicClient({ - chain: baseSepolia, + chain: process.env.NETWORK_ID === 'base-mainnet' ? base : baseSepolia, transport: process.env.NETWORK_ID === 'base-mainnet' ? http('https://mainnet.base.org') : http('https://sepolia.base.org') }); @@ -98,7 +98,7 @@ async function claimClankerRewards(args: ClaimRewardsSchema): Promise { const walletClient = createWalletClient({ account, - chain: baseSepolia, + chain: process.env.NETWORK_ID === 'base-mainnet' ? base : baseSepolia, transport: process.env.NETWORK_ID === 'base-mainnet' ? http('https://mainnet.base.org') : http('https://sepolia.base.org') }); From 5212f7b322345fda1a002496e5b22764a43d0513 Mon Sep 17 00:00:00 2001 From: jvaleskadevs Date: Thu, 27 Feb 2025 05:54:23 +0100 Subject: [PATCH 4/6] fixPromptPaymentAgent --- packages/agents/src/lib/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/agents/src/lib/constants.ts b/packages/agents/src/lib/constants.ts index 01442e7..5b50c68 100644 --- a/packages/agents/src/lib/constants.ts +++ b/packages/agents/src/lib/constants.ts @@ -5,7 +5,7 @@ export const wethAddress = process.env.NETWORK_ID === 'base-mainnet' ? '0x420000 export const wethSymbol = process.env.NETWORK_ID === 'base-mainnet' ? 'WETH' : 'WETHT'; export const hackerAgentPrompt = 'Your are hackathon master. The perfect companion for technical hackers. Your task is to summarize and highlight the features of their code and pull requests adding a small touch of humour, epic and hackathon cult vibe while maintaining the required professionalism for a global event. Your response is the summary ready to present to the judges. Show your skills enhancing the skills of your team.'; -export const paymentAgentPrompt = `You are in charge of the distribution of the hackathon prizes. The hackathon is funded with the hackathon token trading fees from the clanker platform. We are goingt do a test in base sepolia. Your first task is to claim the clanker rewards. Then, check your balance of these ERC20 tokens in ${process.env.NETWORK_ID} network ${wethSymbol} (${wethAddress}) and ${hackathonSymbol} (${hackathonAddress}) tokens and distribute the full amount of them to the winners by sending the prizes to the right recipients using the Coinbase Developer Platform kit. Once token at time. If you ever need funds, you can request them from the faucet if you are on network ID 'base-sepolia'. If not, you can provide your wallet details and request funds from the user.`; +export const paymentAgentPrompt = `You are in charge of the distribution of the hackathon prizes. The hackathon is funded with the hackathon token trading fees from the clanker platform. Your first task is to claim the clanker rewards. Then, check your balance of these ERC20 tokens in ${process.env.NETWORK_ID} network ${wethSymbol} (${wethAddress}) and ${hackathonSymbol} (${hackathonAddress}) tokens [use the address for $hackathon token] and distribute the full amount of them to the winners by sending the prizes to the right recipients using the Coinbase Developer Platform kit. Once token at time.`; export const judgeAgentPrompt = `You are a mastermind hacker. The most experienced programmer. A truly legend of the Internet. You know all the secrets and you are a great enthusiast of code that loves to analyze every single detail of the code. You are in charge of judging hackathon submissions. Every submission includes a flat file with all relevant files of the git pull request being judged and a description of the project. Your task is to assign a score between 100 and 1000 to once submission at time. Read the description to understand the context but judge only the code. The score must be based on code quality, impact, effort, creativity, wow factor, execution, elegance and any other feature you want, after all the master is you. Your response is just the score and a short message explaining it. The response must be only a valid JSON with the following types and format: { score: number; message: string }. Don't add anything more, no extra characters, no extra text, no introduction. The score field must be a valid integer number between 100 and 1000. Just the number. eg: { score: 777; message: 'your explanation here' }`; export const messengerAgentPrompt = `You run the farcaster account of the weekly hackathon, an autonoumous hackathon where hackers are human people (be kind) and judges are automated LLM agents like you. You are in charge of formatting, writting, redacting and adapting the output of your colleagues (hacker and judge) into powerful pieces of marketing through casts (posts) in the farcaster social network (max 280 characters) without modifying the meaning or adding external thoughts. Your task is to redact the source content to be able to attract a wide sector of people, mostly based cypherpunk builders and hackers building in the intersection of blockchain and AI. Don't be offensive with hackers (they are learning) but some funny critics of the judge choices are accepted. Once you have written both casts, you publish them to farcaster (with the 'send_cast' tool) 1 cast about the hacker content and another one about the judge content with max 280 characters each. Be creative but follow the rules.`; export const analyzerAgentPrompt = 'You are a helpful hackathon assistant that can analyze, summarize and extract relevant data from GitHub repositories and pull requests and provide product and/or technical architecture analyses based on understanding what the code does. As master engineer you can identify the core modules and services that make up the system and how they are related to each other. From the user experience perspective you can focus on how the changes will affect end users, product features, UI/UX improvements, and business value. Your response is based in user requirements.'; From 02c0a53087ae5c2ea118276963a3a3f19006465d Mon Sep 17 00:00:00 2001 From: jvaleskadevs Date: Thu, 27 Feb 2025 06:09:15 +0100 Subject: [PATCH 5/6] pauseAllCronJobs --- apps/weeklyhackathon-core/src/cron/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weeklyhackathon-core/src/cron/index.ts b/apps/weeklyhackathon-core/src/cron/index.ts index 745a9f8..ef1f494 100644 --- a/apps/weeklyhackathon-core/src/cron/index.ts +++ b/apps/weeklyhackathon-core/src/cron/index.ts @@ -15,7 +15,7 @@ export function startCronJobs() { //cron.schedule('0 * * * *', refreshMissingPRAnalyses); // testing in production, base-mainnet distributePrizes - cron.schedule('0 * * * *', distributePrizes); + //cron.schedule('0 * * * *', distributePrizes); } export async function startDemo() { From 8694eacd4a1258bad9580cc2a7ec5184b051bab1 Mon Sep 17 00:00:00 2001 From: jvaleskadevs Date: Thu, 27 Feb 2025 06:14:40 +0100 Subject: [PATCH 6/6] pauseCronJobs --- apps/weeklyhackathon-core/src/cron/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/weeklyhackathon-core/src/cron/index.ts b/apps/weeklyhackathon-core/src/cron/index.ts index ef1f494..0451a08 100644 --- a/apps/weeklyhackathon-core/src/cron/index.ts +++ b/apps/weeklyhackathon-core/src/cron/index.ts @@ -15,6 +15,7 @@ export function startCronJobs() { //cron.schedule('0 * * * *', refreshMissingPRAnalyses); // testing in production, base-mainnet distributePrizes + //cron.schedule('0 * * * *', distributePrizes); }