Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Raffle implementation #181

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8f70036
chore: formatted tvl data
hemantwasthere Oct 5, 2024
8fd4212
Merge branch 'dev' of https://github.com/hemantwasthere/starkfarm-cli…
hemantwasthere Oct 5, 2024
d929f2f
fix: added dollar sign before tvl data
hemantwasthere Oct 5, 2024
15a7884
fix: removed dollar sign : )
hemantwasthere Oct 5, 2024
a584239
fix: undefined tvl formatting issue
akiraonstarknet Oct 5, 2024
2ba8923
fix: compile error in TVL
hemantwasthere Oct 5, 2024
b0bdfc0
Merge branch 'dev' of https://github.com/hemantwasthere/starkfarm-cli…
hemantwasthere Oct 23, 2024
4d2754a
chore: raffle implementation
hemantwasthere Oct 25, 2024
1741d4d
Merge pull request #1 from hemantwasthere/feat/raffle
hemantwasthere Oct 25, 2024
93471cd
chore: deploy trigger
hemantwasthere Oct 25, 2024
8c0bfa5
chore: updated cron expression
hemantwasthere Oct 25, 2024
478fddf
chore: updated cron expression
hemantwasthere Oct 25, 2024
a5b131f
chore: updated cron expression
hemantwasthere Oct 25, 2024
4c15c9a
chore: update route method
hemantwasthere Oct 25, 2024
b8bb738
chore: update route logic
hemantwasthere Oct 25, 2024
31e651d
chore: updated cron expression
hemantwasthere Oct 25, 2024
898849c
chore: updated cron expression
hemantwasthere Oct 25, 2024
1a526da
chore: code refactor
hemantwasthere Oct 28, 2024
050619b
chore: updated lucky winner route
hemantwasthere Oct 28, 2024
78662f0
fix: added cron secret
hemantwasthere Oct 28, 2024
0dd8b16
chore: updated lucky winner route.ts
hemantwasthere Oct 29, 2024
b596f2a
chore: ui updates on raffle page
hemantwasthere Nov 1, 2024
e896679
fix: bugs and ui tweaks
hemantwasthere Nov 1, 2024
8775a62
chore: text update
hemantwasthere Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ DATABASE_URL=
ACCOUNT_PK=0x0574ba4998dd9aedf1c4d6e56b747b29256a795bc3846437d121cd64b972bdd8
NEXT_PUBLIC_OG_NFT_CONTRACT=0x3cb654f2f557a7f71a0c16d97c05a2dec62a0b744979d11afc95b804e1d7307


CRON_SECRET=
9 changes: 5 additions & 4 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
const nextConfig = {
// output: 'export',
compiler: {
removeConsole: {
exclude: ['error', 'debug'],
},
// removeConsole: {
// exclude: ['error', 'debug'],
// },
},
async rewrites() {
return [
Expand Down Expand Up @@ -62,7 +62,8 @@ const nextConfig = {
},
{
source: '/tnc/v1',
destination: 'https://github.com/strkfarm/static-assets/blob/177389cad715d69245c1b125df87f90318ac2d7b/tnc.pdf',
destination:
'https://github.com/strkfarm/static-assets/blob/177389cad715d69245c1b125df87f90318ac2d7b/tnc.pdf',
permanent: true,
},
];
Expand Down
12 changes: 0 additions & 12 deletions prisma/migrations/20240818115638_init/migration.sql

This file was deleted.

22 changes: 0 additions & 22 deletions prisma/migrations/20240818143249_updated_user_model/migration.sql

This file was deleted.

14 changes: 0 additions & 14 deletions prisma/migrations/20240824114901_updated_user_model/migration.sql

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions prisma/migrations/20240824132519_added_refree_model/migration.sql

This file was deleted.

32 changes: 0 additions & 32 deletions prisma/migrations/20240825061257_updated_user_model/migration.sql

This file was deleted.

23 changes: 0 additions & 23 deletions prisma/migrations/20240825064700_updated_user_model/migration.sql

This file was deleted.

This file was deleted.

111 changes: 111 additions & 0 deletions prisma/migrations/20241028130637_changes/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"address" TEXT NOT NULL,
"isTncSigned" BOOLEAN DEFAULT false,
"message" TEXT,
"tncDocVersion" TEXT DEFAULT '1.0',
"referralCode" TEXT NOT NULL,
"referralCount" INTEGER DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Raffle" (
"raffleId" SERIAL NOT NULL,
"isRaffleParticipant" BOOLEAN DEFAULT false,
"sharedOnX" BOOLEAN DEFAULT false,
"activeDeposits" BOOLEAN DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" INTEGER NOT NULL,

CONSTRAINT "Raffle_pkey" PRIMARY KEY ("raffleId")
);

-- CreateTable
CREATE TABLE "LuckyWinner" (
"winnerId" SERIAL NOT NULL,
"updatedAt" TIMESTAMP(3) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"raffleId" INTEGER NOT NULL,
"userId" INTEGER NOT NULL,

CONSTRAINT "LuckyWinner_pkey" PRIMARY KEY ("winnerId")
);

-- CreateTable
CREATE TABLE "Signatures" (
"id" SERIAL NOT NULL,
"signature" TEXT NOT NULL,
"tncDocVersion" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" INTEGER NOT NULL,

CONSTRAINT "Signatures_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Referral" (
"referralId" SERIAL NOT NULL,
"refreeAddress" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" INTEGER NOT NULL,

CONSTRAINT "Referral_pkey" PRIMARY KEY ("referralId")
);

-- CreateTable
CREATE TABLE "og_nft_users" (
"id" SERIAL NOT NULL,
"userId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "og_nft_users_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "User_address_key" ON "User"("address");

-- CreateIndex
CREATE UNIQUE INDEX "User_referralCode_key" ON "User"("referralCode");

-- CreateIndex
CREATE UNIQUE INDEX "Raffle_userId_raffleId_key" ON "Raffle"("userId", "raffleId");

-- CreateIndex
CREATE UNIQUE INDEX "LuckyWinner_userId_winnerId_key" ON "LuckyWinner"("userId", "winnerId");

-- CreateIndex
CREATE UNIQUE INDEX "Signatures_userId_tncDocVersion_key" ON "Signatures"("userId", "tncDocVersion");

-- CreateIndex
CREATE UNIQUE INDEX "Referral_refreeAddress_key" ON "Referral"("refreeAddress");

-- CreateIndex
CREATE UNIQUE INDEX "Referral_userId_refreeAddress_key" ON "Referral"("userId", "refreeAddress");

-- CreateIndex
CREATE UNIQUE INDEX "og_nft_users_userId_key" ON "og_nft_users"("userId");

-- AddForeignKey
ALTER TABLE "Raffle" ADD CONSTRAINT "Raffle_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "LuckyWinner" ADD CONSTRAINT "LuckyWinner_raffleId_fkey" FOREIGN KEY ("raffleId") REFERENCES "Raffle"("raffleId") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "LuckyWinner" ADD CONSTRAINT "LuckyWinner_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Signatures" ADD CONSTRAINT "Signatures_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Referral" ADD CONSTRAINT "Referral_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "og_nft_users" ADD CONSTRAINT "og_nft_users_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
22 changes: 22 additions & 0 deletions prisma/migrations/20241029102731_added_round_id/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Warnings:

- The primary key for the `LuckyWinner` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `winnerId` on the `LuckyWinner` table. All the data in the column will be lost.
- A unique constraint covering the columns `[roundId]` on the table `LuckyWinner` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[userId,roundId]` on the table `LuckyWinner` will be added. If there are existing duplicate values, this will fail.

*/
-- DropIndex
DROP INDEX "LuckyWinner_userId_winnerId_key";

-- AlterTable
ALTER TABLE "LuckyWinner" DROP CONSTRAINT "LuckyWinner_pkey",
DROP COLUMN "winnerId",
ADD COLUMN "roundId" INTEGER NOT NULL DEFAULT 0;

-- CreateIndex
CREATE UNIQUE INDEX "LuckyWinner_roundId_key" ON "LuckyWinner"("roundId");

-- CreateIndex
CREATE UNIQUE INDEX "LuckyWinner_userId_roundId_key" ON "LuckyWinner"("userId", "roundId");
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX "LuckyWinner_roundId_key";
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "LuckyWinner" ALTER COLUMN "roundId" SET DEFAULT 1,
ADD CONSTRAINT "LuckyWinner_pkey" PRIMARY KEY ("roundId");
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Warnings:

- The primary key for the `LuckyWinner` table will be changed. If it partially fails, the table could be left without primary key constraint.

*/
-- AlterTable
ALTER TABLE "LuckyWinner" DROP CONSTRAINT "LuckyWinner_pkey",
ADD COLUMN "winnerId" SERIAL NOT NULL,
ADD CONSTRAINT "LuckyWinner_pkey" PRIMARY KEY ("winnerId");
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Warnings:

- You are about to drop the column `roundId` on the `LuckyWinner` table. All the data in the column will be lost.
- A unique constraint covering the columns `[userId,winnerId]` on the table `LuckyWinner` will be added. If there are existing duplicate values, this will fail.

*/
-- DropIndex
DROP INDEX "LuckyWinner_userId_roundId_key";

-- AlterTable
ALTER TABLE "LuckyWinner" DROP COLUMN "roundId";

-- AlterTable
ALTER TABLE "Raffle" ADD COLUMN "roundId" INTEGER NOT NULL DEFAULT 1;

-- CreateIndex
CREATE UNIQUE INDEX "LuckyWinner_userId_winnerId_key" ON "LuckyWinner"("userId", "winnerId");
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:

- You are about to drop the column `roundId` on the `Raffle` table. All the data in the column will be lost.

*/
-- AlterTable
ALTER TABLE "LuckyWinner" ADD COLUMN "roundId" SERIAL NOT NULL;

-- AlterTable
ALTER TABLE "Raffle" DROP COLUMN "roundId";
4 changes: 2 additions & 2 deletions prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"
Loading
Loading