Skip to content

Conversation

@rayedsikder
Copy link
Member

@rayedsikder rayedsikder commented Dec 9, 2025

Overview

This release candidate (2.0-rc) introduces significant new features, security enhancements, and infrastructure improvements to the Oak Network contracts. The release includes new treasury implementations, UUPS upgradeability for core contracts, currency-based multi-token support, and comprehensive audit fixes.


Major Features

UUPS Upgradeability

Core protocol contracts (GlobalParams, CampaignInfoFactory, TreasuryFactory) are now UUPS upgradeable. Upgrades to GlobalParams and CampaignInfoFactory are owner-restricted, while TreasuryFactory upgrades require protocol admin authorization.

Storage is managed using ERC-7201 namespaced storage libraries (storage/ directory) to prevent storage collisions during upgrades.

Currency-Based Multi-Token Support

Campaigns now operate on a currency basis (e.g., "USD") rather than a single token. Multiple tokens can be registered for each currency in GlobalParams, and campaigns accept any token associated with their currency. Token amounts are normalized to 18 decimals for consistent goal comparisons across different token decimals.

  • GlobalParams: Manages currency → token mappings
  • CampaignInfo: Caches accepted tokens at creation, validates pledges/payments (campaign token lists are snapshotted at creation and do not automatically update if GlobalParams currency token lists change later)
  • CampaignData struct: New currency field (breaking change)

PledgeNFT Module

NFT minting is now centralized in CampaignInfo via the new PledgeNFT utility module. Each campaign has one NFT collection, and treasuries call CampaignInfo.mintNFTForPledge() instead of minting directly. NFTs store on-chain metadata (backer, reward, token, amounts) with Base64-encoded JSON tokenURI.

Refund / burn behavior change: treasuries burn pledge NFTs via CampaignInfo.burn(tokenId). This means NFT owners must approve the treasury to spend the NFT before a refund that burns the NFT can succeed. Refunds are paid to the current NFT owner.

ERC-2771 Meta-Transaction Support

Treasuries support meta transactions via platform-specific adapters (trusted forwarders) which function as an intermediary for platform admins using Safe multisig wallets. Platform adapters are configured in GlobalParams and passed to treasuries during deployment.

Campaign Lock Mechanism

Campaigns become "locked" after the first treasury is deployed, preventing updates to launch time, deadline, and goal amount. This ensures backers can trust campaign parameters won't change after they pledge.

Line Item System

Payment treasuries support configurable line item types with properties like countsTowardGoal, applyProtocolFee, canRefund, and instantTransfer. Line item configurations are snapshotted at payment creation to prevent manipulation.

Line item types are configured per-platform in GlobalParams and validated with invariants (e.g. goal-counting items must be refundable and cannot be instant-transfer).

Data Registry

GlobalParams includes a key-value data registry for protocol-wide configuration. Predefined keys in DataRegistryKeys.sol include buffer times, campaign timing constraints, and maximum payment expiration settings.


New Treasury Implementations

PaymentTreasury

Payment-focused treasury for e-commerce style transactions:

  • Payment creation with expiration
  • Batch payment creation and confirmation
  • Direct crypto payments (immediate confirmation + NFT mint)
  • Line item support with external fees metadata
  • Separate refund flows for NFT and non-NFT payments
  • Platform claim delay for expired funds
  • Payment ID scoping to prevent collisions between off-chain payments (created by platform admins) and on-chain crypto payments (created by buyers)

TimeConstrainedPaymentTreasury

Extends PaymentTreasury with campaign time window restrictions. Operations are limited to launchTime → deadline + bufferTime.

KeepWhatsRaised

Flexible treasury that keeps all raised funds regardless of goal achievement:

  • Tip support per pledge
  • Configurable fee structure (flat, cumulative, percentage-based)
  • Colombian creator tax calculation
  • Payment gateway fee support
  • Withdrawal approval mechanism (platform admin must approve before creator can withdraw)
  • Custom deadline/goal updates with lock period protection
  • Separate tip and fund claiming after deadline

AllOrNothing Changes

  • Multi-token support added
  • NFT minting moved to CampaignInfo (no longer an ERC721 itself)
  • ERC-2771 meta-transaction support
  • ReentrancyGuard added

CampaignInfo Enhancements

  • Now inherits from PledgeNFT (ERC721 collection per campaign)
  • Lock mechanism to protect campaign parameters after treasury deployment
  • New aggregated amount getters across all platform treasuries:
    • getTotalRaisedAmount() - excludes cancelled treasuries
    • getTotalLifetimeRaisedAmount() - never decreases with refunds
    • getTotalRefundedAmount() - sum of all refunds
    • getTotalAvailableRaisedAmount() - includes funds from both active and cancelled treasuries
    • getTotalCancelledAmount() - sums raised amount from cancelled treasuries only
    • getTotalExpectedAmount() - pending payments (payment treasuries)
  • New campaign/token metadata getters:
    • getCampaignCurrency(), getAcceptedTokens(), isTokenAccepted()
    • isLocked() to introspect the post-first-treasury lock state
  • Line item type lookups via GlobalParams proxy
  • Data registry access for buffer times and config values

Breaking Changes

  • Solidity: Updated from ^0.8.20 to ^0.8.22
  • ICampaignData: CampaignData struct now includes currency field
  • GlobalParams: Single token address replaced with currency-to-token mappings; contract is now UUPS upgradeable (constructor → initialize) and platform enlistment includes optional platform adapter (trusted forwarder)
  • CampaignInfoFactory.createCampaign: Now requires NFT metadata parameters and enforces timing constraints via GlobalParams data registry keys (launch buffer + minimum duration)
  • TreasuryFactory.deploy: Removed name and symbol parameters
  • AllOrNothing: No longer ERC721 - uses CampaignInfo for NFT operations
  • CampaignInfo interface: CampaignInfo is now an ERC721 collection (via PledgeNFT), and ICampaignInfo inherits from IERC721
  • Treasury interfaces: ICampaignTreasury and ICampaignPaymentTreasury add lifetime/refund/cancelled accounting getters and new payment-specific APIs (payments, line items, and expected amounts)
  • Refund flows: refunds that burn NFTs now require the NFT owner to approve the treasury (operator or token approval) since the treasury performs the burn via CampaignInfo

Security & Audits

  • Immunefi Audit: Comprehensive security audit with fixes applied (v1 and v2 rounds)
  • PeckShield Audit: Report available in audits/ directory
  • ReentrancyGuard added to AllOrNothing, KeepWhatsRaised, and BasePaymentTreasury
  • ERC-7201 namespaced storage prevents storage collisions during upgrades
  • Line item configuration snapshots prevent post-creation manipulation
  • Campaign lock mechanism protects backer trust in campaign parameters

Infrastructure & Deployment

Deployment Scripts

  • New implementation deployment scripts for individual contracts
  • Setup scripts for different treasury types (AllOrNothing, KeepWhatsRaised, PaymentTreasury)
  • Upgrade scripts for UUPS contracts
  • Refactored admin rights transfer in deployment scripts

Testing

  • Comprehensive test coverage for new features
  • PaymentTreasury tests (unit, function, line items, batch limits)
  • TimeConstrainedPaymentTreasury tests
  • KeepWhatsRaised tests (unit and function)
  • PledgeNFT tests
  • Upgrade tests
  • Updated test utilities and constants
  • TestUSD replaced with TestToken

CI/CD

  • Updated GitHub Actions workflow
  • Updated Foundry and OpenZeppelin versions
  • Improved dependency installation

Code Quality

  • Improved validation logic across contracts
  • Enhanced error handling with descriptive custom errors
  • Removed unused contracts (MinimumOrder, OutOfStock, AddressCalculator)
  • Improved timestamp checking logic
  • Better state management in pledge operations
  • Extensive NatSpec documentation updates

Migration Notes

  1. Deploy UUPS proxies for GlobalParams, CampaignInfoFactory, and TreasuryFactory
  2. Configure currencies and their accepted tokens in GlobalParams
  3. Set up data registry values (BUFFER_TIME, CAMPAIGN_LAUNCH_BUFFER, MINIMUM_CAMPAIGN_DURATION)
  4. Configure platform adapters if using meta-transactions
  5. Configure platform line item types before using payment treasuries
  6. Update createCampaign calls to include campaign currency and NFT metadata
  7. TestUSD renamed to TestToken - update test imports accordingly

- pledgeForAReward
   - Allows a backer to pledge for a reward.
- pledgeWithoutAReward
   - Allows a backer to pledge without selecting a reward.
- _pledge
   - A private function to contain all the pledge logic
- Add lock and approval feature for the withdraw function
- Add set fee keys and values function for admin
- add withdrawal fee calculation
- update _pledge function
- update fee keys and config variables
- add new storage variables, events and custom errors
- Update the treasury configuration method
- Add campaign data like launch time, deadline, and goal amount in treasury with a getter method
- Update all the campaign configuration usage
- Add all-or-nothing refund, and remove partial refund support
- Add indexing for selected events
- Remove redundant storage variable
- Reorder _pledge function
   - Perform all checks first
   - Update state variables
   - Only then interact with external contracts (TOKEN transfer)
- Remove unnecessary storage use
- Shift fee calculation from withdraw to pledge
- Add new fee calculation logic
- Block disburseFee functionality till refund period is over
- Add campaign owner support for updating deadline and goal amount
- Adjust claim refund and withdraw function according to the changes
- Add support for setting the payment gateway fee by the platform admin
- Add a facade function `setFeeAndPledge` to combine fee setting and pledge for the platform admin
- Update pledge functionality to accommodate payment gateway fee calculation
mahabubAlahi and others added 20 commits August 19, 2025 17:06
Co-authored-by: AdnanHKx <adnan@ccprotocol.xyz>
* Add phantom balances fix and additional unit tests

* Add batch payment gas test script

* Gas optimization for batch payment
- Consolidate the transfer of protocol admin rights to ensure ownership is correctly assigned to final addresses.
- Update logging to provide clearer output regarding ownership transfers for GlobalParams and CampaignInfoFactory.
- Change environment variable name from TEST_USD_ADDRESS to TOKEN_ADDRESS for consistency across scripts.
* Add multi-token support

* Update deployment and test scripts, fix decimal normalization issue in reward and fee calculation

* Make core contracts UUPS upgradeable with namespaced storage layout

* Update documentation

* Update solc and OpenZeppelin lib versions, fix ERC7201 storage location hashes and implement Context pattern

* Add OpenZeppelin upgradeable contracts submodule

- Added a new submodule for OpenZeppelin upgradeable contracts to the project.
- Updated .gitmodules to include the path and URL for the new submodule.

* Refactor storage implementation for core contracts

- Introduced dedicated storage libraries for AdminAccessChecker, CampaignInfoFactory, GlobalParams, and TreasuryFactory to utilize ERC-7201 namespaced storage.
- Updated contract methods to access storage using the new library functions, enhancing modularity and maintainability.
- Removed inline storage definitions from contracts to streamline code and improve clarity.

---------
Co-authored-by: AdnanHKx <adnan@ccprotocol.xyz>
Co-authored-by: Mahabub Alahi <mahabub@ccprotocol.xyz>
…ntTreasury (#34)

* Update environment configuration and add Celo Sepolia RPC endpoint

* Add CELO_SEPOLIA_RPC_URL to env.example for new network support
* Update foundry.toml with celo_sepolia RPC endpoint

* Add batch payment functionality to PaymentTreasury

- Introduced `createPaymentBatch` method in `ICampaignPaymentTreasury` interface for creating multiple payment entries in a single transaction.
- Implemented the `createPaymentBatch` function in `PaymentTreasury` and `BasePaymentTreasury` with necessary validations and event emissions.
- Added unit tests for batch payment creation, including scenarios for input validation and error handling.

* Add payment token support in batch payment functionality

- Updated the `createPaymentBatch` method in `ICampaignPaymentTreasury` to include an array of payment tokens.
- Modified the implementation in `PaymentTreasury` and `BasePaymentTreasury` to handle payment tokens, including necessary validations.
- Enhanced unit tests to cover scenarios with multiple payment tokens and validate token acceptance during payment creation.

* Add DataRegistryKeys and DataRegistryHelper contracts

- Introduced `DataRegistryKeys` library for centralized storage of dataRegistry keys, ensuring consistency and preventing key collisions.
- Added `DataRegistryHelper` abstract contract to facilitate access and validation of dataRegistry values from `GlobalParams`, including a method to retrieve the buffer time.

* Add TimeConstrainedPaymentTreasury contract

- Introduced `TimeConstrainedPaymentTreasury` contract that extends `BasePaymentTreasury`, incorporating time-based constraints for payment operations.
- Implemented functions to check time validity before creating, processing, and confirming payments, ensuring actions are only allowed within specified timeframes.

* Add integration and unit tests for TimeConstrainedPaymentTreasury

- Introduced integration tests for `TimeConstrainedPaymentTreasury`, covering payment creation, processing, cancellation, and time constraint validations.
- Added unit tests to ensure correct behavior of payment operations within specified timeframes, including batch payment functionality and edge cases.
- Implemented helper functions for setting up test scenarios, including funding users and managing time constraints.
- Enhanced test coverage for refund claims, fee disbursement, and withdrawal operations, ensuring compliance with time constraints.

* Update environment configuration by removing Alfajores references

- Removed Alfajores RPC URL and chain ID from env.example to streamline configuration.
- Updated foundry.toml by removing the Alfajores RPC endpoint, reflecting the current network support.
* Add time constraints for campaign creation

* Fix unauthorized caller issue in tests
* Add lock mechanism to CampaignInfo contract

- Introduced a lock mechanism to prevent operations after treasury deployment.
- Added `isLocked` function to check the lock status of the campaign.
- Implemented `whenNotLocked` modifier to restrict access to certain functions when the campaign is locked.
- Emitted `CampaignInfoIsLocked` error when locked operations are attempted.
- Updated relevant functions to utilize the new locking mechanism, enhancing security and control over campaign operations.

* Refactor platform approval checks in CampaignInfo contract

- Simplified the logic for handling platform approval by consolidating checks into a single conditional statement.
- Removed redundant checks for platform approval and campaign lock status, enhancing code clarity and maintainability.

* Add unit tests for CampaignInfo contract

- Introduced comprehensive unit tests for the CampaignInfo contract, covering various functionalities including ownership, campaign state, platform selection, and updates to launch time, deadline, and goal amount.
- Implemented tests for both successful operations and expected reverts, ensuring robust validation of contract behavior under different scenarios.
- Enhanced test coverage for locking mechanisms and platform approval processes, reinforcing the integrity and security of campaign operations.

* Add current time check in CampaignInfo contract's updateSelectedPlatform function

* Update isLocked function in CampaignInfo contract to override base implementation
* Add time constraints for campaign creation

* Fix unauthorized caller issue in tests

* Exclude cancelled treasuries from total raised amount sum

* Add PledgeNFT module and integrate into treasuries

* Include additional fields for NFT metadata

* Migrate NFT functionality from treasuries to campaign

* Add NFT integration for Payment treasuries, fix burn authorization and test setup issues

* Streamline minting process and add reentrancy guard to pledge functions

* Rename treasury role and remove duplicate modifiers from _pledgeWithoutAReward

* Fix burn authorization issue during claimRefund

* Update external function declaration in CampaignInfoFactory to override interface method

* Make claimRefund transfer funds to NFT owner regardless of caller

* Update CampaignInfo unit test to apply NFT additions

---------

Co-authored-by: adnhq <adh.xeph@gmail.com>
Co-authored-by: Mahabub Alahi <mahabub@ccprotocol.xyz>
* Add time constraints for campaign creation

* Fix unauthorized caller issue in tests

* Exclude cancelled treasuries from total raised amount sum

* Add total lifetime raised and refund claimed view functions

* Add scenario specific raised amount getters
…nality and Payment Expiration Management to PaymentTreasury (#42)

* Add platform-specific line item type management to GlobalParams

- Introduced events for setting and removing platform line item types.
- Added functions to set, remove, and retrieve platform-specific line item type configurations.
- Implemented validation constraints for line item types to ensure correct configurations.
- Updated GlobalParamsStorage to include a mapping for platform line item types.
- Enhanced IGlobalParams interface with new methods for line item type management.

* Add getLineItemType function to ICampaignInfo and CampaignInfo

- Implemented the getLineItemType function in both ICampaignInfo and CampaignInfo contracts.
- This function retrieves platform-specific line item type configurations from GlobalParams, enhancing the contract's functionality and providing necessary details for line item management.

* Add line item support to PaymentTreasury and related contracts

- Introduced a new LineItem struct in ICampaignPaymentTreasury to represent individual payment line items, including typeId and amount.
- Updated createPayment, createPaymentBatch, and processCryptoPayment functions to accept line items as parameters.
- Enhanced PaymentTreasury, TimeConstrainedPaymentTreasury, and BasePaymentTreasury to handle line items in payment processing, validation, and tracking.
- Implemented logic for managing non-goal line items, including claiming and refunding functionalities.
- Added necessary mappings and events to track line items associated with payments, improving overall payment management capabilities.

* Add max payment expiration handling to BasePaymentTreasury

- Introduced MAX_PAYMENT_EXPIRATION constant in DataRegistryKeys for managing maximum payment expiration duration.
- Implemented _getMaxExpirationDuration function in BasePaymentTreasury to retrieve platform-specific or global max expiration settings.
- Added error handling for cases where payment expiration exceeds the allowed maximum.
- Updated payment validation logic to ensure compliance with the new expiration constraints.

* Enhance PaymentTreasury tests with LineItem and expiration check support

- Updated PaymentTreasury integration tests to include line items in createPayment and processCryptoPayment functions.
- Introduced empty line items in various test scenarios to ensure compatibility with the new line item structure.
- Added comprehensive tests for creating payments with multiple line items and validating their handling in PaymentTreasury.
- Enhanced unit tests to cover line item scenarios, ensuring robust payment processing and validation.

* Refactor refund calculation logic in BasePaymentTreasury

- Enhanced the refund process by caching line item type configurations and protocol fee percentages to ensure consistency during calculations.
- Separated the handling of goal and non-goal line items, allowing for accurate refund amounts based on their respective conditions.
- Improved checks for available balances before modifying state, ensuring that refunds are only processed when sufficient funds are available.
- Updated state management to reflect changes in confirmed and claimable amounts for both goal and non-goal line items, maintaining accurate tracking post-refund.

* Add snapshot mechanism for countsTowardGoal in BasePaymentTreasury

- Introduced a new mapping to store snapshots of countsTowardGoal flags for line items at payment creation, ensuring consistency even if configurations change later.
- Updated payment processing logic to utilize the snapshot for accurate pending amount calculations, preventing discrepancies due to configuration changes.
- Cleaned up snapshots after payment confirmation to maintain state integrity and avoid unnecessary storage usage.

* Refactor line item configuration handling in BasePaymentTreasury

- Introduced a new struct, LineItemConfigSnapshot, to encapsulate all relevant line item configuration flags at payment creation time, enhancing efficiency and scalability.
- Updated mappings and logic to utilize the new struct for consistent processing of line items during payment confirmation, cancellation, and refunds.
- Cleaned up snapshots after processing to maintain state integrity and optimize storage usage.

* Enhance line item processing in BasePaymentTreasury

- Added a new boolean flag, canRefund, to the line item configuration, allowing for more granular control over refund capabilities.
- Updated logic to utilize snapshots of line item configurations, ensuring consistency during payment processing, refunds, and state updates.
- Implemented checks to validate the length of line items against their corresponding configuration snapshots, preventing invalid inputs and enhancing error handling.

* Remove redundant snapshot cleanup in BasePaymentTreasury payment confirmation logic.

* Fix protocol fee handling during claimRefund

* Refactor line item handling in BasePaymentTreasury

- Consolidated line item storage by introducing a new struct, StoredLineItem, which encapsulates line item details and configuration flags.
- Updated mappings and logic to utilize the new struct, enhancing efficiency and consistency during payment processing, refunds, and state updates.
- Removed redundant snapshot handling for line item configurations, streamlining the code and improving maintainability.

* Add external fees support to payment processing

- Introduced a new ExternalFees struct in ICampaignPaymentTreasury to represent external fees associated with payments, including fee type and amount.
- Updated createPayment and createPaymentBatch functions across PaymentTreasury, TimeConstrainedPaymentTreasury, and BasePaymentTreasury to accept external fees as parameters.
- Enhanced internal mappings to store external fees per payment ID, ensuring proper tracking and management during payment processing and refunds.
- Implemented logic to validate and store external fees, improving the overall payment handling capabilities.

* Enhance payment treasury tests to include external fees

- Updated createPayment and createPaymentBatch functions across PaymentTreasury and TimeConstrainedPaymentTreasury to accept external fees as parameters.
- Modified integration and unit tests to accommodate the new external fees structure, ensuring comprehensive coverage for payment scenarios.
- Ensured compatibility with existing line item handling while improving overall payment processing capabilities.

* Add payment data getter function and update crypto payment function

- Introduced PaymentLineItem and PaymentData structs in ICampaignPaymentTreasury to encapsulate detailed payment information and line item configurations.
- Updated processCryptoPayment function across PaymentTreasury and TimeConstrainedPaymentTreasury to accept external fees as parameters.
- Implemented getPaymentData function to retrieve comprehensive payment details, including line items and external fees, improving data accessibility and usability.

* Update payment processing to include external fees in tests

- Modified processCryptoPayment function across various test files to accept external fees as parameters, ensuring comprehensive testing of payment scenarios.
- Enhanced unit and integration tests to validate the handling of external fees, improving coverage and reliability of payment processing functionalities.
- Added new test cases to verify the correct storage and retrieval of external fees within payment data, ensuring accurate fee management.

* Refactor line item handling in BasePaymentTreasury to use ICampaignPaymentTreasury types

- Updated function signatures in BasePaymentTreasury to utilize ICampaignPaymentTreasury.LineItem for line item handling, enhancing type safety and consistency.
- Adjusted related logic to accommodate the new struct, ensuring proper validation and processing of line items.
- Modified external fees handling in payment data retrieval to improve memory management and maintainability.

* Add platform claim delay functionality to CampaignInfo and GlobalParams

- Implemented getPlatformClaimDelay function in both CampaignInfo and GlobalParams contracts to retrieve the claim delay for specific platforms.
- Added updatePlatformClaimDelay function in GlobalParams to allow platform admins to modify the claim delay, with appropriate access control and event emission.
- Updated ICampaignInfo and IGlobalParams interfaces to include the new functions, ensuring consistency across the contracts.
- Enhanced GlobalParamsStorage to store platform-specific claim delays, improving data management for platform configurations.

* Add refundable fee type and related tests for payment processing

- Introduced a new line item type, REFUNDABLE_FEE_WITH_PROTOCOL_TYPE_ID, to support refundable fees with protocol fees in the PaymentTreasury.
- Updated the setUp function to register the new line item type in the GlobalParams contract.
- Added a test case to validate the processing of crypto payments with refundable fees, ensuring correct refund calculations and fee distributions.
- Enhanced unit tests for GlobalParams to verify the correct setup and constraints for the new line item type, including checks for refundability and protocol fee application.

* Remove unused state updates for pledge amounts in AllOrNothing and KeepWhatsRaised contracts

* Add line item totals struct and refactor payment confirmation logic

- Introduced a new `LineItemTotals` struct to encapsulate calculation totals for line items, reducing stack depth and improving readability.
- Refactored the payment confirmation process to utilize the new struct, enhancing clarity and maintainability.
- Updated internal functions to calculate line item totals and check balances more efficiently, ensuring accurate payment processing.
- Streamlined state updates for line items during payment confirmation, improving overall gas efficiency.

* Enhance payment creation and confirmation logic with line items and external fees

- Updated the createPayment function to accept an array of line items and external fees, improving flexibility in payment processing.
- Modified the confirmPayment function to include an address parameter, ensuring compatibility with the new payment structure.
- Added tests to validate the handling of line items and external fees during payment confirmation, enhancing overall test coverage.

* Update lifetime confirmed payment tracking in BasePaymentTreasury
- Introduced new sections in SUMMARY.md and README.md for constants and storage, enhancing documentation structure.
- Added DataRegistryKeys and various storage contracts (AdminAccessCheckerStorage, CampaignInfoFactoryStorage, GlobalParamsStorage, TreasuryFactoryStorage) to improve organization and accessibility of key data.
- Updated CampaignInfo and CampaignInfoFactory documentation to reflect recent changes and ensure consistency.
- Enhanced utility functions and interfaces to support new storage structures and constants, improving overall code maintainability and clarity.
… documentation (#44)

* Refactor external fees handling in PaymentTreasury

- Updated documentation in ICampaignPaymentTreasury to clarify that external fees are metadata only and do not impact financial transactions.
- Renamed internal mappings and variables in BasePaymentTreasury to reflect the change to external fee metadata, enhancing clarity and maintainability.

* Update documentation links and clarify external fees handling in PaymentTreasury

- Updated Git source links in various contract documentation to reflect the latest commit.
- Enhanced clarity in the PaymentTreasury documentation regarding external fees, specifying that they are metadata only and do not impact financial transactions.
* Add time-related constraints and currency/token configuration to env.example

* Refactor deployment scripts to extend DeployBase and streamline currency/token handling

- Updated DeployAll, DeployAllAndSetupAllOrNothing, DeployAllAndSetupKeepWhatsRaised, and DeployAllAndSetupPaymentTreasury scripts to inherit from DeployBase for improved code reuse.
- Introduced loadCurrenciesAndTokens function in DeployBase to handle currency and token configurations dynamically.
- Enhanced initialization data preparation for GlobalParams and TreasuryFactory deployments, reducing redundancy in contract setup.
- Added buffer time, campaign launch buffer, and minimum campaign duration parameters to relevant deployment scripts for better configurability.

* refactor multi-token deployment and add uups tracking to deployment logs

---------

Co-authored-by: AdnanHKx <adnan@ccprotocol.xyz>
* Enhance deadline validation in CampaignInfo contract (#46)

(immunefi-v2)(issue#6)
- Updated the deadline validation logic to ensure that the campaign deadline is not only after the launch time but also meets the minimum campaign duration requirement.

* Refactor TimeConstrainedPaymentTreasury to use unified pause and cancel modifiers (#47)

(immunefi-v2)(issue#7)

- Updated function modifiers in TimeConstrainedPaymentTreasury to replace specific campaign pause and cancel checks with more general whenNotPaused and whenNotCancelled modifiers.

* Fix missing Access Control on withdraw allows blocking refund mechanism (#48)

(immunefi-v2)(issue#9)

* Add access control modifier to BasePaymentTreasury

- Introduced `onlyPlatformAdminOrCampaignOwner` modifier to restrict access to specific functions, allowing only the platform admin or campaign owner to execute them.

* Enhance PaymentTreasury tests with campaign owner authorization for withdrawals

- Updated integration and unit tests to use the campaign owner as the authorized caller for the withdraw function, ensuring proper access control.
- Refactored multiple test cases to include `vm.prank(owner)` before withdrawal calls, improving test accuracy and reflecting the latest access control changes.

* Campaign owner can block protocol/platform fee & reward collection in PaymentTreasury and TimeConstrainedPaymentTreasury (#49)

* Refactor claimExpiredFunds and disburseFees functions in PaymentTreasury and TimeConstrainedPaymentTreasury

- Removed the whenNotCancelled modifier from claimExpiredFunds and disburseFees functions in both PaymentTreasury and TimeConstrainedPaymentTreasury contracts to simplify access control.
- Added claimNonGoalLineItems function to both contracts, allowing for the claiming of non-goal line items while maintaining the whenNotPaused modifier for access control.

* Fix disburseFees vulnerability in PaymentTreasury tests

- Updated unit tests to ensure disburseFees() function succeeds even when the treasury is cancelled, addressing a potential vulnerability.
- Added comments for clarity on the expected behavior of disburseFees() in the context of cancelled treasuries.

* Enhance Payment ID Handling in BasePaymentTreasury (#52)

* Enhance Payment ID Handling in BasePaymentTreasury

- Introduced new functions for scoping payment IDs for both off-chain and on-chain payments, improving the ability to track and manage payments.
- Added a mapping to associate payment IDs with creator addresses for better lookup capabilities.
- Updated existing payment processing functions to utilize the new scoping methods, ensuring consistent handling of payment IDs across various operations.
- Enhanced error handling to prevent duplicate payment entries by checking both off-chain and on-chain scopes.

* Refactor Payment Processing Logic in BasePaymentTreasury

- Removed the restriction for NFT payments in the refund process, allowing for broader payment handling.

* Emit PledgeNFTMinted event before _safeMint call (#50)

Co-authored-by: adnhq <adh.xeph@gmail.com>

* Add character validation for NFT name (#56)

Co-authored-by: adnhq <adh.xeph@gmail.com>

* Add launch time validation to updateLaunchTime (#55)

* Add campaign launch time buffer check to updateLaunchTime

* Change updateLaunchTime validation to check new launch time is greater than the existing one

---------

Co-authored-by: adnhq <adh.xeph@gmail.com>

* Fix precision loss for token amount denormalization (#53)

Co-authored-by: adnhq <adh.xeph@gmail.com>

* Cache globalParams instance in updateSelectedPlatform to reduce gas usage (#51)

Co-authored-by: adnhq <adh.xeph@gmail.com>

* Add ERC-2771 Meta-Transaction Support for Adapter Contracts (#54)

* Add ERC2771 Meta Transaction support

* Simplify ERC2771 implementation

---------

Co-authored-by: adnhq <adh.xeph@gmail.com>

* Add env field for platform adapter input (#58)

Co-authored-by: adnhq <adh.xeph@gmail.com>

* Update documentation

---------

Co-authored-by: AdnanHKx <adnan@ccprotocol.xyz>
* Add non-ASCII validation for NFT name

* Remove irrelevant leftover natspec comment

---------

Co-authored-by: adnhq <adh.xeph@gmail.com>
* Enhance launch time validation in CampaignInfo contract

- Updated the launch time validation logic to ensure that the launch time is not in the past, the deadline is after the launch time, and that the deadline meets the minimum campaign duration requirement. This change allows for moving the launch time closer to the current time while maintaining the minimum duration, improving campaign scheduling flexibility.

* Add unit tests for launch time updates in CampaignInfo contract

- Introduced tests to validate the updateLaunchTime function, ensuring it adheres to the minimum campaign duration requirement.
- Added scenarios to check for reverts when attempting to set a launch time that violates the minimum duration and to confirm successful updates when conditions are met.
* Add new deployment scripts

* Update deploy scripts and pin dependencies

* Remove blocking check from payment treasury deployment scripts

* Add missing startPrank calls for SIMULATE mode in deploy scripts

---------

Co-authored-by: adnhq <adh.xeph@gmail.com>
rayedsikder and others added 3 commits January 2, 2026 14:24
…m CC Protocol to Oak Network

- Changed repository URLs in book.toml and README.md to point to the new Oak Network repository.
- Updated references in various contract documentation to ensure consistency with the new branding.
- Enhanced clarity in documentation regarding campaign management and contributions.
Remove redundant forge install from CI workflow
@rayedsikder rayedsikder merged commit 479241c into main Jan 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants