Skip to content

Happy path tests for CCP core, treasury and utility contracts#7

Merged
rayedsikder merged 125 commits intodevfrom
test/v3-implementation
Oct 26, 2023
Merged

Happy path tests for CCP core, treasury and utility contracts#7
rayedsikder merged 125 commits intodevfrom
test/v3-implementation

Conversation

@rayedsikder
Copy link
Member

This PR adds the Foundry test suites for contracts added in PR #6

The detailed documentation of test suites are archived in their respective PRs.
Dependency contract tests - #4
AllOrNothing contract tests - #5

mahabubAlahi and others added 30 commits September 19, 2023 16:54
- Add `@nomicfoundation/hardhat-foundry` package
- Upgrade `hardhat` from `^2.17.0` to `^2.17.3`
- CampaignInfoFactory.ts
- SampleCampaign.ts
- `enlistPlatform` function test
- `addBytecode` function test
- `enlistBytecode` function test
mahabubAlahi and others added 24 commits September 29, 2023 16:14
- update `currentTimeIsGreater` to `currentTimeIsLess`
- _checkIfCurrentTimeIsLess
- _checkIfCurrentTimeIsGreater
- Update
  - protocol percentage
  - platform percentage
  - claimRefund
  - disburseFees
- Add
  - withdraw
- add 2 new backer address
- add new user creation
- use contract owner to deploy all the contracts
- initialize `campaignInfoFactory`
- mint token to the backer
- warp realistic block time
- add comment
- update protocolFeePercent variable
- use contract owner for minting
- add comments
- implement all the helper functions for AllOrNothing test
   - enlistPlatform
   - addBytecode
   - enlistBytecode
   - createCampaign
   - deploy
   - addReward
   - pledgeOnPreLaunch
   - pledgeForAReward
   - pledgeWithoutAReward
   - claimRefund
   - disburseFees
   - withdraw
- Test functions for happy cases:-
   - test_addReward
   - test_pledgeOnPreLaunch
   - test_pledgeForAReward
   - test_pledgeWithoutAReward
   - test_claimRefund
   - test_disburseFees
   - test_withdraw
Add tests for Openzeppelin dependencies of  feat/v3-implementation
Add tests for `AllOrNothing` Model
@rayedsikder rayedsikder changed the title Happy path tests for CCP core, treasuries and utils Happy path tests for CCP core, treasury and utility contracts Oct 10, 2023
@rayedsikder rayedsikder merged commit 7d26fd1 into dev Oct 26, 2023
@rayedsikder rayedsikder deleted the test/v3-implementation branch April 30, 2024 11:25
rayedsikder pushed a commit that referenced this pull request Dec 9, 2025
* Fix incorrect description of the `claimFund` function (#6)

  (immunefi)(issue#06)
  - Updated the NatSpec comment for claimFund()

* Refactor `platformDataKey` parameter validation optimization (#7)

  (immunefi)(issue#09)
  - Move `platformDataKey` parameter validation to an earlier stage of the `createCampaign` flow

* Add configuring platform data during `updateSelectedPlatform` (#8)

  (immunefi)(issue#10)

* Add creator's non-zero validation during `createCampaign` (#9)

  (immunefi)(issue#16)

* Add zero validation for `platformDataValue` in `createCampaign` (#10)

  (immunefi)(issue#12)

* Add reward value zero validation in pledge (#11)

  (immunefi)(issue#14)

* Fix `updateDeadline` allowing past deadline that blocks `claimRefund` (#12)

  (immunefi)(issue#05)
  - Added check to ensure new deadline is after current block timestamp

* Fix blocking KeepWhatsRaised pledge functions via front-running (#13)

  (immunefi)(issue#04)
  - Add internal pledge ID generation using msg.sender and pledgeId

* Add fee configuration via configure treasury (#14)

  (immunefi)(issue#11)
  - Update configure treasury to support fee values
  - Add getter function for fee value

* Add campaign data validation in configure treasury (#15)

  (immunefi)(issue#20)
  - Update fee values js doc
  - Update custom error

* Fix Gateway fee bypass (#16)

  (immunefi)(issue#19)
  - When `setFeeAndPledge` is called, tokens are transferred from the admin's wallet (msg.sender)
  - When `pledgeWithoutAReward` or `pledgeForAReward` is called directly, tokens are transferred from the backer's wallet

* Add expected fee description in create campaign jsdoc (#17)

  (immunefi)(issue#03)

* Refactor withdrawal and pledge calculation (#19)

  (immunefi)(issue#15)
  (immunefi)(issue#18)

  - Restrict access to the withdrawal function so that only the campaign owner and platform administrator can use it.
  - Move the protocol fee calculation from the withdrawal process to the pledge stage.
  - For withdrawals:
    - Partial Withdrawals:
       - Conditions: amount > 0 and amount + fees ≤ available balance.
       - The creator must specify the exact withdrawal amount, and the system will ensure there are sufficient funds to cover both the withdrawal and the fees.

    - Final Withdrawals:
      - Conditions: available balance > 0 and fees ≤ available balance.
      - The creator can withdraw the entire remaining balance. The system will check if there are enough funds to cover the fees and will then provide the remainder to the creator.

---------

Co-authored-by: mahabubAlahi <mahabub@ccprotocol.xyz>
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.

3 participants