Skip to content

Develop#23

Merged
wzrdx merged 4 commits intomainfrom
develop
Feb 6, 2026
Merged

Develop#23
wzrdx merged 4 commits intomainfrom
develop

Conversation

@aledefra
Copy link
Collaborator

@aledefra aledefra commented Feb 6, 2026

No description provided.

wzrdx added 3 commits January 28, 2026 13:25
* feat: New MND rewards distribution

* fix: Obtain firstMiningEpoch for GND
Copilot AI review requested due to automatic review settings February 6, 2026 11:06
Copy link
Contributor

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 pull request refactors the license rewards calculation system to use smart contract-based computation for MND and GND licenses, updates dependencies, and fixes several UI issues.

Changes:

  • Refactored MND/GND reward calculations to use smart contract's calculateRewards function instead of local computation
  • Updated React (19.2.4), React DOM (19.2.4), Next.js (15.5.10), and added lodash (4.17.23)
  • Enhanced GND license support to handle first mining epoch like MND licenses
  • Fixed assignTimestamp display bug to properly show "Not assigned" for unassigned licenses

Reviewed changes

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

Show a summary per file
File Description
package.json Updated React, React DOM, Next.js versions and added lodash dependency
package-lock.json Updated lockfile to reflect dependency changes
blockchain/MNDContract.ts Added new ABI entries for enhanced reward calculation including carryover and withheld amounts
lib/api/blockchain.ts Refactored reward calculation to use smart contract instead of local computation; unified MND/GND handling
app/server-components/main-cards/LicenseCard.tsx Pass licenseId to LicenseRewardsPoA component for reward calculation
app/server-components/Licenses/LicenseRewardsPoA.tsx Accept licenseId parameter and pass it to getLicenseRewards; return null on missing data
app/server-components/Licenses/License.tsx Fixed bug by checking assignTimestamp for both falsy and '0' string values
app/server-components/LicensePage/LicensePageNodeCardWrapper.tsx Return null instead of ErrorAlert when node data is unavailable
app/license/[licenseType]/[licenseId]/page.tsx Code formatting changes only, no functional changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 415 to 430
const publicClient = await getPublicClient();
const result = await publicClient.readContract({
address: config.mndContractAddress,
abi: MNDContractAbi,
functionName: 'calculateRewards',
args: [
[
{
licenseId,
nodeAddress: license.nodeAddress,
epochs: epochs.map((epoch) => BigInt(epoch)),
availabilies: epochs_vals,
},
],
],
});
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The error handling when rewards calculation fails could be improved. When the smart contract's calculateRewards function throws an error, it will propagate as an unhandled exception. Consider wrapping this in a try-catch block and returning undefined on error, consistent with how epoch length mismatches are handled on line 412. This would provide more graceful degradation when the contract call fails.

Copilot uses AI. Check for mistakes.
@wzrdx wzrdx merged commit 0a6ddc1 into main Feb 6, 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.

2 participants