Skip to content

Commit 5934878

Browse files
authored
Merge pull request #14 from greenpill-dev-guild/feat/nft-gates-patch
feat: Introduce denylist functionality and update environment configurations
2 parents 67209d7 + a87bd7d commit 5934878

File tree

18 files changed

+384
-472
lines changed

18 files changed

+384
-472
lines changed

.cursorignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv)
2+
.env
3+
.env.local
4+
.env.development
5+
.env.test
6+
.env.production
7+

.env.sample

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
# BLOCKCHAIN NETWORKS & RPC ENDPOINTS
55
# =============================================================================
66

7-
# Alchemy API Keys (for enhanced NFT data and metadata)
8-
NEXT_PUBLIC_ALCHEMY_API_KEY_MAINNET=your_alchemy_api_key_for_ethereum_mainnet
9-
NEXT_PUBLIC_ALCHEMY_API_KEY_BASE=your_alchemy_api_key_for_base
10-
NEXT_PUBLIC_ALCHEMY_API_KEY_SEPOLIA=your_alchemy_api_key_for_sepolia
11-
NEXT_PUBLIC_ALCHEMY_API_KEY_BASE_SEPOLIA=your_alchemy_api_key_for_base_sepolia
12-
13-
# Alternative: Single Alchemy key for all networks (fallback)
14-
NEXT_PUBLIC_ALCHEMY_API_KEY=your_general_alchemy_api_key
7+
# Alchemy API Key (works across all supported networks)
8+
NEXT_PUBLIC_ALCHEMY_API_KEY=your_alchemy_api_key
159

1610
# Moralis API Key (alternative NFT provider)
1711
NEXT_PUBLIC_MORALIS_API_KEY=your_moralis_api_key
@@ -73,9 +67,15 @@ NEXT_PUBLIC_SENTRY_DSN=your_sentry_dsn
7367
# =============================================================================
7468
# CONTRACT DEPLOYMENT CONFIGURATION
7569
# =============================================================================
76-
# DO NOT PUT PRIVATE KEYS HERE!
77-
# Use Foundry Keystore instead: cast wallet import deployer --interactive
78-
# This is just the address for reference
70+
# Production deployments use Foundry Keystore (SECURE)
71+
# Import your account: cast wallet import deployer --interactive
72+
KEYSTORE_ACCOUNT=deployer
73+
74+
# Local development only (NOT for production!)
75+
# Only set this for local Anvil deployments
76+
# PRIVATE_KEY=your_private_key_for_local_development_only
77+
78+
# Deployer address for reference (not used in deployment)
7979
DEPLOYER_ADDRESS=your_deployer_address
8080

8181

client/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Cookie Jar is a platform that enables teams, communities, and organizations to m
3636
- Fees go directly to a designated fee collector address
3737

3838
### Comprehensive Security Features
39-
- Blacklist functionality to block problematic addresses
39+
- Denylist functionality to block problematic addresses
4040
- Emergency withdrawal option for admin (can be disabled)
4141
- Custom error handling for secure transaction processing
4242

@@ -45,7 +45,7 @@ Cookie Jar is a platform that enables teams, communities, and organizations to m
4545
- Any ERC20 token
4646

4747
### Flexible Administration
48-
- Manage whitelist and blacklist entries
48+
- Manage allowlist and denylist entries
4949
- Add NFT gates (up to 5 different collections)
5050
- Transfer admin rights when needed
5151
- Update the fee collector address
@@ -253,7 +253,7 @@ Create a `.env.local` file with the following variables:
253253

254254
```plaintext
255255
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_wallet_connect_project_id
256-
NEXT_PUBLIC_ALCHEMY_ID=your_alchemy_api_key
256+
NEXT_PUBLIC_ALCHEMY_API_KEY=your_alchemy_api_key
257257
```
258258

259259
4. Run the development server:
@@ -293,7 +293,7 @@ As a jar admin, you can:
293293

294294
- Transfer jar ownership
295295
- Add/remove addresses from whitelist
296-
- Add/remove addresses from blacklist
296+
- Add/remove addresses from denylist
297297
- Add/remove NFT gates
298298
- Perform emergency withdrawals (if enabled)
299299

client/app/jar/[address]/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,8 @@ export default function CookieJarConfigDetails() {
664664
<div className="flex justify-between items-center py-2">
665665
<span className="text-[#4a3520] font-medium">Your Status</span>
666666
<div className="flex items-center">
667-
{config.blacklist ? (
668-
<span className="font-medium px-3 py-1 rounded-full text-white bg-red-500">Blacklisted</span>
667+
{config.denylist ? (
668+
<span className="font-medium px-3 py-1 rounded-full text-white bg-red-500">Denylisted</span>
669669
) : (
670670
<span
671671
className={`font-medium px-3 py-1 rounded-full text-white ${config.allowlist ? "bg-green-500" : "bg-red-500"}`}
@@ -712,13 +712,13 @@ export default function CookieJarConfigDetails() {
712712
<div className="mt-6">
713713
<h3 className="text-base font-semibold text-[#3c2a14] mb-2">Your Status</h3>
714714
<div className="flex flex-wrap gap-2">
715-
{config.blacklist ? (
715+
{config.denylist ? (
716716
<Badge
717717
variant="outline"
718718
className="flex items-center gap-1 bg-[#ffebee] text-[#c62828] border-[#c62828] px-3 py-1"
719719
>
720720
<ShieldAlert className="h-3 w-3 mr-1" />
721-
Blacklisted
721+
Denylisted
722722
</Badge>
723723
) : (
724724
showUserFunctions && (
@@ -878,10 +878,10 @@ export default function CookieJarConfigDetails() {
878878
<CardDescription className="text-[#8b7355]">Receive cookies from this jar</CardDescription>
879879
</CardHeader>
880880
<CardContent className="p-8 relative min-h-[400px]">
881-
{config.blacklist ? (
881+
{config.denylist ? (
882882
<div className="absolute inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-10 rounded-b-lg">
883883
<div className="bg-red-500 text-white font-medium px-6 py-2 rounded-full text-lg">
884-
You are Blacklisted
884+
You are Denylisted
885885
</div>
886886
</div>
887887
) : isInCooldown ? (

client/config/deployments.auto.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* It contains the latest factory addresses and V2 chain detection.
66
*
77
* Generated by: contracts/script/Deploy.s.sol
8-
* Last updated: 1758329506
8+
* Last updated: 1758353536
99
* Chain ID: 84532
1010
*/
1111

@@ -25,8 +25,8 @@ export const DEPLOYMENTS: Record<number, DeploymentInfo> = {
2525
chainId: 84532,
2626
factoryAddress: "0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519",
2727
isV2: true,
28-
blockNumber: 0,
29-
timestamp: 1758329506
28+
blockNumber: 31292624,
29+
timestamp: 1758353536
3030
},
3131

3232
// Legacy V1 deployments (manually maintained)
@@ -69,6 +69,6 @@ export function getDeploymentInfo(chainId: number): DeploymentInfo | undefined {
6969
}
7070

7171
// Generation metadata
72-
export const GENERATED_AT = "1758329506"
72+
export const GENERATED_AT = "1758353536"
7373
export const GENERATOR = "Cookie Jar Deployment System v2.0"
7474
export const DEPLOYED_CHAIN = 84532

client/config/supported-networks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export const contractAddresses: ContractAddresses = {
181181

182182
// Get environment variables
183183
const projectId = process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || ""
184-
const alchemyId = process.env.NEXT_PUBLIC_ALCHEMY_ID || ""
184+
const alchemyId = process.env.NEXT_PUBLIC_ALCHEMY_API_KEY || ""
185185

186186
// Helper function to create fallback transports with automatic failover
187187
function createFallbackTransport(primary: string[], fallbackUrls: string[]) {

client/generated.ts

Lines changed: 74 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,13 @@ export const cookieJarAbi = [
301301
outputs: [],
302302
stateMutability: 'nonpayable',
303303
},
304+
{
305+
type: 'function',
306+
inputs: [{ name: '_users', internalType: 'address[]', type: 'address[]' }],
307+
name: 'grantJarDenylistRole',
308+
outputs: [],
309+
stateMutability: 'nonpayable',
310+
},
304311
{
305312
type: 'function',
306313
inputs: [
@@ -487,6 +494,13 @@ export const cookieJarAbi = [
487494
outputs: [],
488495
stateMutability: 'nonpayable',
489496
},
497+
{
498+
type: 'function',
499+
inputs: [{ name: '_users', internalType: 'address[]', type: 'address[]' }],
500+
name: 'revokeJarDenylistRole',
501+
outputs: [],
502+
stateMutability: 'nonpayable',
503+
},
490504
{
491505
type: 'function',
492506
inputs: [
@@ -1054,6 +1068,7 @@ export const cookieJarAbi = [
10541068
},
10551069
{ type: 'error', inputs: [], name: 'TooManyNFTGates' },
10561070
{ type: 'error', inputs: [], name: 'TransferFailed' },
1071+
{ type: 'error', inputs: [], name: 'UserDenylisted' },
10571072
{ type: 'error', inputs: [], name: 'WithdrawalAlreadyDone' },
10581073
{
10591074
type: 'error',
@@ -1097,14 +1112,14 @@ export const cookieJarFactoryAbi = [
10971112
{
10981113
type: 'function',
10991114
inputs: [],
1100-
name: 'BLACKLISTED_JAR_CREATORS',
1115+
name: 'DEFAULT_ADMIN_ROLE',
11011116
outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
11021117
stateMutability: 'view',
11031118
},
11041119
{
11051120
type: 'function',
11061121
inputs: [],
1107-
name: 'DEFAULT_ADMIN_ROLE',
1122+
name: 'DENYLISTED_JAR_CREATORS',
11081123
outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
11091124
stateMutability: 'view',
11101125
},
@@ -1303,7 +1318,7 @@ export const cookieJarFactoryAbi = [
13031318
{
13041319
type: 'function',
13051320
inputs: [{ name: '_users', internalType: 'address[]', type: 'address[]' }],
1306-
name: 'grantBlacklistedJarCreatorsRole',
1321+
name: 'grantDenylistedJarCreatorsRole',
13071322
outputs: [],
13081323
stateMutability: 'nonpayable',
13091324
},
@@ -1361,7 +1376,7 @@ export const cookieJarFactoryAbi = [
13611376
{
13621377
type: 'function',
13631378
inputs: [{ name: '_users', internalType: 'address[]', type: 'address[]' }],
1364-
name: 'revokeBlacklistedJarCreatorsRole',
1379+
name: 'revokeDenylistedJarCreatorsRole',
13651380
outputs: [],
13661381
stateMutability: 'nonpayable',
13671382
},
@@ -1499,7 +1514,7 @@ export const cookieJarFactoryAbi = [
14991514
],
15001515
name: 'AccessControlUnauthorizedAccount',
15011516
},
1502-
{ type: 'error', inputs: [], name: 'CookieJarFactory__Blacklisted' },
1517+
{ type: 'error', inputs: [], name: 'CookieJarFactory__Denylisted' },
15031518
{ type: 'error', inputs: [], name: 'CookieJarFactory__JarNotFound' },
15041519
{ type: 'error', inputs: [], name: 'CookieJarFactory__NotJarOwner' },
15051520
{ type: 'error', inputs: [], name: 'CookieJarFactory__NotValidERC20' },
@@ -2029,6 +2044,15 @@ export const useWriteCookieJarGrantJarAllowlistRole =
20292044
functionName: 'grantJarAllowlistRole',
20302045
})
20312046

2047+
/**
2048+
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link cookieJarAbi}__ and `functionName` set to `"grantJarDenylistRole"`
2049+
*/
2050+
export const useWriteCookieJarGrantJarDenylistRole =
2051+
/*#__PURE__*/ createUseWriteContract({
2052+
abi: cookieJarAbi,
2053+
functionName: 'grantJarDenylistRole',
2054+
})
2055+
20322056
/**
20332057
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link cookieJarAbi}__ and `functionName` set to `"grantRole"`
20342058
*/
@@ -2072,6 +2096,15 @@ export const useWriteCookieJarRevokeJarAllowlistRole =
20722096
functionName: 'revokeJarAllowlistRole',
20732097
})
20742098

2099+
/**
2100+
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link cookieJarAbi}__ and `functionName` set to `"revokeJarDenylistRole"`
2101+
*/
2102+
export const useWriteCookieJarRevokeJarDenylistRole =
2103+
/*#__PURE__*/ createUseWriteContract({
2104+
abi: cookieJarAbi,
2105+
functionName: 'revokeJarDenylistRole',
2106+
})
2107+
20752108
/**
20762109
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link cookieJarAbi}__ and `functionName` set to `"revokeRole"`
20772110
*/
@@ -2238,6 +2271,15 @@ export const useSimulateCookieJarGrantJarAllowlistRole =
22382271
functionName: 'grantJarAllowlistRole',
22392272
})
22402273

2274+
/**
2275+
* Wraps __{@link useSimulateContract}__ with `abi` set to __{@link cookieJarAbi}__ and `functionName` set to `"grantJarDenylistRole"`
2276+
*/
2277+
export const useSimulateCookieJarGrantJarDenylistRole =
2278+
/*#__PURE__*/ createUseSimulateContract({
2279+
abi: cookieJarAbi,
2280+
functionName: 'grantJarDenylistRole',
2281+
})
2282+
22412283
/**
22422284
* Wraps __{@link useSimulateContract}__ with `abi` set to __{@link cookieJarAbi}__ and `functionName` set to `"grantRole"`
22432285
*/
@@ -2283,6 +2325,15 @@ export const useSimulateCookieJarRevokeJarAllowlistRole =
22832325
functionName: 'revokeJarAllowlistRole',
22842326
})
22852327

2328+
/**
2329+
* Wraps __{@link useSimulateContract}__ with `abi` set to __{@link cookieJarAbi}__ and `functionName` set to `"revokeJarDenylistRole"`
2330+
*/
2331+
export const useSimulateCookieJarRevokeJarDenylistRole =
2332+
/*#__PURE__*/ createUseSimulateContract({
2333+
abi: cookieJarAbi,
2334+
functionName: 'revokeJarDenylistRole',
2335+
})
2336+
22862337
/**
22872338
* Wraps __{@link useSimulateContract}__ with `abi` set to __{@link cookieJarAbi}__ and `functionName` set to `"revokeRole"`
22882339
*/
@@ -2586,21 +2637,21 @@ export const useReadCookieJarFactory = /*#__PURE__*/ createUseReadContract({
25862637
})
25872638

25882639
/**
2589-
* Wraps __{@link useReadContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"BLACKLISTED_JAR_CREATORS"`
2640+
* Wraps __{@link useReadContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"DEFAULT_ADMIN_ROLE"`
25902641
*/
2591-
export const useReadCookieJarFactoryBlacklistedJarCreators =
2642+
export const useReadCookieJarFactoryDefaultAdminRole =
25922643
/*#__PURE__*/ createUseReadContract({
25932644
abi: cookieJarFactoryAbi,
2594-
functionName: 'BLACKLISTED_JAR_CREATORS',
2645+
functionName: 'DEFAULT_ADMIN_ROLE',
25952646
})
25962647

25972648
/**
2598-
* Wraps __{@link useReadContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"DEFAULT_ADMIN_ROLE"`
2649+
* Wraps __{@link useReadContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"DENYLISTED_JAR_CREATORS"`
25992650
*/
2600-
export const useReadCookieJarFactoryDefaultAdminRole =
2651+
export const useReadCookieJarFactoryDenylistedJarCreators =
26012652
/*#__PURE__*/ createUseReadContract({
26022653
abi: cookieJarFactoryAbi,
2603-
functionName: 'DEFAULT_ADMIN_ROLE',
2654+
functionName: 'DENYLISTED_JAR_CREATORS',
26042655
})
26052656

26062657
/**
@@ -2753,12 +2804,12 @@ export const useWriteCookieJarFactoryCreateCookieJar =
27532804
})
27542805

27552806
/**
2756-
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"grantBlacklistedJarCreatorsRole"`
2807+
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"grantDenylistedJarCreatorsRole"`
27572808
*/
2758-
export const useWriteCookieJarFactoryGrantBlacklistedJarCreatorsRole =
2809+
export const useWriteCookieJarFactoryGrantDenylistedJarCreatorsRole =
27592810
/*#__PURE__*/ createUseWriteContract({
27602811
abi: cookieJarFactoryAbi,
2761-
functionName: 'grantBlacklistedJarCreatorsRole',
2812+
functionName: 'grantDenylistedJarCreatorsRole',
27622813
})
27632814

27642815
/**
@@ -2780,12 +2831,12 @@ export const useWriteCookieJarFactoryRenounceRole =
27802831
})
27812832

27822833
/**
2783-
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"revokeBlacklistedJarCreatorsRole"`
2834+
* Wraps __{@link useWriteContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"revokeDenylistedJarCreatorsRole"`
27842835
*/
2785-
export const useWriteCookieJarFactoryRevokeBlacklistedJarCreatorsRole =
2836+
export const useWriteCookieJarFactoryRevokeDenylistedJarCreatorsRole =
27862837
/*#__PURE__*/ createUseWriteContract({
27872838
abi: cookieJarFactoryAbi,
2788-
functionName: 'revokeBlacklistedJarCreatorsRole',
2839+
functionName: 'revokeDenylistedJarCreatorsRole',
27892840
})
27902841

27912842
/**
@@ -2822,12 +2873,12 @@ export const useSimulateCookieJarFactoryCreateCookieJar =
28222873
})
28232874

28242875
/**
2825-
* Wraps __{@link useSimulateContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"grantBlacklistedJarCreatorsRole"`
2876+
* Wraps __{@link useSimulateContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"grantDenylistedJarCreatorsRole"`
28262877
*/
2827-
export const useSimulateCookieJarFactoryGrantBlacklistedJarCreatorsRole =
2878+
export const useSimulateCookieJarFactoryGrantDenylistedJarCreatorsRole =
28282879
/*#__PURE__*/ createUseSimulateContract({
28292880
abi: cookieJarFactoryAbi,
2830-
functionName: 'grantBlacklistedJarCreatorsRole',
2881+
functionName: 'grantDenylistedJarCreatorsRole',
28312882
})
28322883

28332884
/**
@@ -2849,12 +2900,12 @@ export const useSimulateCookieJarFactoryRenounceRole =
28492900
})
28502901

28512902
/**
2852-
* Wraps __{@link useSimulateContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"revokeBlacklistedJarCreatorsRole"`
2903+
* Wraps __{@link useSimulateContract}__ with `abi` set to __{@link cookieJarFactoryAbi}__ and `functionName` set to `"revokeDenylistedJarCreatorsRole"`
28532904
*/
2854-
export const useSimulateCookieJarFactoryRevokeBlacklistedJarCreatorsRole =
2905+
export const useSimulateCookieJarFactoryRevokeDenylistedJarCreatorsRole =
28552906
/*#__PURE__*/ createUseSimulateContract({
28562907
abi: cookieJarFactoryAbi,
2857-
functionName: 'revokeBlacklistedJarCreatorsRole',
2908+
functionName: 'revokeDenylistedJarCreatorsRole',
28582909
})
28592910

28602911
/**

0 commit comments

Comments
 (0)