Skip to content

Commit dfe8ee0

Browse files
authored
Merge branch 'main' into feature/asset-based-discount
2 parents 187063e + 0034969 commit dfe8ee0

File tree

988 files changed

+81248
-21393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

988 files changed

+81248
-21393
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

COMPONENTS.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Nevo Custom UI Components Documentation
2+
3+
This document provides an overview of all custom UI components and page sections built for the Nevo frontend (`frontend/src/components/`).
4+
5+
## 1. UI Kit Components (`src/components/ui/`)
6+
These are foundational, reusable building blocks typically based on Radix UI primitives and styled with Tailwind CSS.
7+
8+
* **`button.tsx`**: A highly versatile Button component built with `class-variance-authority` (cva). It supports multiple variants (`default`, `destructive`, `outline`, `secondary`, `ghost`, `link`), sizes, and a built-in `isLoading` state that renders an animated spinner.
9+
* **`checkbox.tsx`**: A custom-styled checkbox using `@radix-ui/react-checkbox`. It supports an `indeterminate` state in addition to checked/unchecked.
10+
* **`checkbox-group.tsx`**: A wrapper component (`CheckboxGroup` and `CheckboxGroupItem`) that groups multiple checkboxes, providing shared labels, descriptions, and error text management for reliable accessibility.
11+
* **`input.tsx`**: A standard text input field. For `type="password"`, it automatically utilizes a `usePasswordToggle` hook to embed an eye icon that toggles password visibility.
12+
* **`label.tsx`**: A standardized label component based on `@radix-ui/react-label` for forms and inputs.
13+
* **`sonner.tsx`**: A global toast notification wrapper customized around the `sonner` library, incorporating specific Lucide icons for various states (success, info, warning, error, loading).
14+
* **`tooltip.tsx`**: A tooltip implementation (`Tooltip`, `TooltipTrigger`, `TooltipContent`, etc.) powered by Radix UI, featuring smooth fade/zoom animations and proper accessibility positioning.
15+
16+
---
17+
18+
## 2. Core Functional Components (`src/components/`)
19+
These are business logic or complex visual components central to the application's functionality.
20+
21+
* **`Button.tsx`**: A secondary, simpler custom button implementation using `React.forwardRef`. Provides `primary`, `secondary`, and `outline` variants without relying on Radix UI or CVA.
22+
* **`ConnectWallet.tsx`**: A crucial integration component that uses `stellar-wallets-kit` to connect and disconnect user wallets. It displays the connected public key when active.
23+
* **`DonationModal.tsx`**: A modal interface triggered when users wish to donate to a pool. It allows users to select an asset (XLM or USDC), input a contribution amount (or choose quick amounts), and previews network fees/total deductions.
24+
* **`ExplorePools.tsx`**: A full-page discovery interface providing a grid of pools with advanced filtering capabilities (by status and category) and text-based search.
25+
* **`Navigation.tsx`**: The main top navigation bar. It is fully responsive, including a mobile hamburger menu. It houses page section anchors (`#features`, `#how-it-works`) and embeds the `ConnectWallet` component.
26+
* **`PoolCard.tsx`**: A visually rich card displaying the details of an individual donation pool. It showcases a cover image, category badge, goal vs. raised mapping, an animated progress bar, and contributor counts. It also renders the "Donate Now" button that opens `DonationModal`.
27+
* **`PoolGrid.tsx`**: A responsive, CSS grid-based layout container that maps over a list of pool data items and renders them as `PoolCard`s.
28+
* **`waitlist/signup-form.tsx`**: A specialized form component for a waitlist page. Features client-side validation for email, name, and terms acceptance, along with loading spinners and a success state layout upon submission.
29+
30+
---
31+
32+
## 3. Landing Page Sections (`src/components/`)
33+
These components represent the distinct, full-width sections of the main landing page.
34+
35+
* **`HeroSection.tsx`**: The introductory section of the site featuring the main value proposition, primary CTA buttons ("Start Creating Pools", "Discover Pools"), and trust metrics (100% Transparent, 0.1% Avg Fee).
36+
* **`FeaturesSection.tsx`**: Highlights the platform's core offerings (Multi-Asset Support, DeFi Yield, etc.) arranged in a grid of `FeatureCard`s with distinct icons.
37+
* **`HowItWorksSection.tsx`**: An enumerated, 4-step flow section explaining how to create a pool, share it, collect funds, and earn impact.
38+
* **`SecuritySection.tsx`**: A split-layout section detailing the platform's Stellar blockchain security, smart contract audits, and real-time monitoring, accompanied by visual "Trust Indicators".
39+
* **`CTASection.tsx`**: A bottom-page Call to Action block with a vibrant gradient background inviting users to launch the application.
40+
* **`Footer.tsx`**: The site footer housing links to Product features, Resources (Documentation/API), and Legal pages.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Nevo
1+
# Nevo edit
22

33
> Decentralized Donation Pools on Stellar
44

contract/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ target
99
contract/test_snapshots
1010

1111

12+
13+
# Snapshots
14+
test_snapshots/

contract/BLACKLIST_FEATURE.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Blacklist Feature Implementation
2+
3+
## Overview
4+
The blacklist feature allows administrators to prevent malicious users from creating campaigns or contributing funds to the crowdfunding platform.
5+
6+
## Implementation Details
7+
8+
### 1. Error Type
9+
Added `UserBlacklisted = 48` to `CrowdfundingError` enum in `contract/contract/src/base/errors.rs`
10+
11+
### 2. Storage
12+
- Blacklisted addresses are stored using `env.storage().persistent()` for long-term persistence
13+
- Storage key: `StorageKey::Blacklist(Address)` added to `contract/contract/src/base/types.rs`
14+
15+
### 3. Interface Methods
16+
Added three new methods to `CrowdfundingTrait` in `contract/contract/src/interfaces/crowdfunding.rs`:
17+
18+
```rust
19+
fn blacklist_address(env: Env, address: Address) -> Result<(), CrowdfundingError>;
20+
fn unblacklist_address(env: Env, address: Address) -> Result<(), CrowdfundingError>;
21+
fn is_blacklisted(env: Env, address: Address) -> bool;
22+
```
23+
24+
### 4. Implementation
25+
In `contract/contract/src/crowdfunding.rs`:
26+
27+
#### `blacklist_address`
28+
- Requires admin authentication
29+
- Stores the address in persistent storage with value `true`
30+
- Emits `address_blacklisted` event
31+
32+
#### `unblacklist_address`
33+
- Requires admin authentication
34+
- Removes the address from persistent storage
35+
- Emits `address_unblacklisted` event
36+
37+
#### `is_blacklisted`
38+
- Public read-only function
39+
- Returns `true` if address is blacklisted, `false` otherwise
40+
41+
### 5. Integration Points
42+
The blacklist check is integrated into:
43+
44+
1. **`create_campaign`**: Checks if the creator is blacklisted before allowing campaign creation
45+
2. **`donate`**: Checks if the donor is blacklisted before accepting donations
46+
47+
Both functions return `CrowdfundingError::UserBlacklisted` if the address is blacklisted.
48+
49+
### 6. Events
50+
Added two new events in `contract/contract/src/base/events.rs`:
51+
52+
```rust
53+
pub fn address_blacklisted(env: &Env, admin: Address, address: Address)
54+
pub fn address_unblacklisted(env: &Env, admin: Address, address: Address)
55+
```
56+
57+
## Test Coverage
58+
59+
Created comprehensive tests in `contract/contract/test/blacklist_test.rs`:
60+
61+
1. **`test_blacklist_address_prevents_donation`**: Verifies blacklisted users cannot donate
62+
2. **`test_blacklist_address_prevents_campaign_creation`**: Verifies blacklisted users cannot create campaigns
63+
3. **`test_unblacklist_address_allows_operations`**: Verifies unblacklisted users can perform operations
64+
4. **`test_only_admin_can_blacklist`**: Verifies only admin can blacklist addresses
65+
5. **`test_blacklist_persists_across_operations`**: Verifies blacklist status persists
66+
67+
## Usage Example
68+
69+
```rust
70+
// Admin blacklists a malicious address
71+
client.blacklist_address(&malicious_user);
72+
73+
// Check if address is blacklisted
74+
let is_blocked = client.is_blacklisted(&malicious_user);
75+
76+
// Malicious user attempts to donate (will fail with UserBlacklisted error)
77+
let result = client.try_donate(&campaign_id, &malicious_user, &token, &100);
78+
79+
// Admin removes user from blacklist
80+
client.unblacklist_address(&malicious_user);
81+
82+
// User can now perform operations
83+
client.donate(&campaign_id, &malicious_user, &token, &100);
84+
```
85+
86+
## Security Considerations
87+
88+
1. **Admin-only access**: Only the contract admin can blacklist/unblacklist addresses
89+
2. **Persistent storage**: Blacklist data is stored in persistent storage to survive contract upgrades
90+
3. **Early validation**: Blacklist checks occur early in the function flow, before any state changes
91+
4. **Event logging**: All blacklist operations are logged via events for transparency and auditing
92+
93+
## Future Enhancements
94+
95+
Potential improvements for future versions:
96+
- Batch blacklist/unblacklist operations
97+
- Temporary blacklists with expiration times
98+
- Blacklist reasons/metadata
99+
- Multi-signature approval for blacklist operations
100+
- Blacklist appeal mechanism

0 commit comments

Comments
 (0)