Skip to content

Commit

Permalink
Raffle, mobile actions, fee (#99)
Browse files Browse the repository at this point in the history
* Raffle page, Add fee (strkfarm#183)

* temp remove tnc signing validation

* add fetchWithRetry for external endpoints

* fix haiko api bug

* disable sithswap, 10kswap and starkdefi

* build fix

* re-add fee

* Add Raffle [WIP] (#98)

* chore: formatted tvl data

* fix: added dollar sign before tvl data

* fix: removed dollar sign : )

* fix: undefined tvl formatting issue

* fix: compile error in TVL

* Update og_nft_eligible_users.json [95/100]

* hotfix: remove ekubo price api

* Update og_nft_eligible_users.json [52/100]

* chore: raffle implementation

* chore: deploy trigger

* chore: updated cron expression

* chore: updated cron expression

* chore: updated cron expression

* chore: update route method

* chore: update route logic

* chore: updated cron expression

* chore: updated cron expression

* Update og_nft_eligible_users.json [84/100]

* chore: code refactor

* chore: updated lucky winner route

* fix: added cron secret

* chore: updated lucky winner route.ts

* chore: ui updates on raffle page

* fix: bugs and ui tweaks

* chore: text update

* Update og_nft_eligible_users.json [94/100]

---------

Co-authored-by: Hemant <[email protected]>
Co-authored-by: Benjtalkshow <[email protected]>

* fix raffle bugs

* update raffle end time

---------

Co-authored-by: Hemant <[email protected]>
Co-authored-by: Benjtalkshow <[email protected]>

* raffle page text fixes

* enable mobile actions

---------

Co-authored-by: Hemant <[email protected]>
Co-authored-by: Benjtalkshow <[email protected]>
  • Loading branch information
3 people authored Nov 4, 2024
1 parent d4f5717 commit 7f3bf41
Show file tree
Hide file tree
Showing 38 changed files with 2,375 additions and 171 deletions.
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

0 comments on commit 7f3bf41

Please sign in to comment.