Skip to content

Feat: add fee distribution contract logic for treasury and rewards#26

Merged
portableDD merged 4 commits into
Nexacore-Org:mainfrom
Jagadeeshftw:fee
Jun 10, 2025
Merged

Feat: add fee distribution contract logic for treasury and rewards#26
portableDD merged 4 commits into
Nexacore-Org:mainfrom
Jagadeeshftw:fee

Conversation

@Jagadeeshftw
Copy link
Copy Markdown
Contributor

Description

Implements a fee distribution smart contract (FeeSplitterContract) for splitting collected fees between the platform treasury and reward pools. The contract supports configuration, immediate allocation, state tracking, and event emission for transparency.

Related Issues

Closes #15
Implements requirements from internal issue: Implement fee splitting logic to distribute collected fees between the platform treasury and reward pools.

Changes Made

  • Added FeeSplitterContract in src/fees.rs with initialization and update functions for configuration (addresses and basis points)
  • Implemented logic to split and distribute fees to treasury and reward pools
  • Tracked total distributed amounts for each token
  • Emitted events for each fee distribution
  • Updated src/lib.rs to include the new contract module
  • Pending: Add comprehensive tests for fee distribution, state tracking, and event emission

How to Test

  1. Deploy the contract and initialize with admin, treasury, and reward pool addresses and basis points.
  2. Call distribute_fees with a token address, amount, and fee collector address.
  3. Confirm that the correct amounts are transferred to the treasury and reward pool addresses.
  4. Use get_total_distributed to verify the tracking of amounts for each token.
  5. Check for the correct emission of fee distribution events.
  6. (Pending) Run automated tests once implemented.

Screenshots (if applicable)

N/A

Checklist

  • My code follows the project's coding style.
  • I have tested these changes locally.
  • Documentation has been updated where necessary.

@portableDD
Copy link
Copy Markdown
Contributor

@Jagadeeshftw how long more before thr pr is eday for review?

make sure to fix build error.

you have till 5pm gmt to fix this

@Jagadeeshftw Jagadeeshftw marked this pull request as ready for review June 10, 2025 09:57
Copilot AI review requested due to automatic review settings June 10, 2025 09:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a fee distribution smart contract for splitting fees between the platform treasury and reward pools. Key changes include:

  • Addition of a new fees module in lib.rs.
  • Implementation of FeeSplitterContract with configuration, fee distribution logic, event emission, and state tracking.
  • Updates in state management and error handling for the fee distribution process.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/lib.rs Added the fees module export to integrate the new fee distribution logic.
src/fees.rs Introduced FeeSplitterContract and associated functions for configuration and fee distribution.

Comment thread src/fees.rs Outdated
@Jagadeeshftw
Copy link
Copy Markdown
Contributor Author

Jagadeeshftw commented Jun 10, 2025

@portableDD Build error is fixed, let me know if you have any other comments

Copy link
Copy Markdown
Contributor

@portableDD portableDD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@portableDD portableDD merged commit 7aada56 into Nexacore-Org:main Jun 10, 2025
1 check failed
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.

Fee Distribution Contract

3 participants