Skip to content

Commit

Permalink
feat: add pool manager NXM locked for MV timestamp to NexusViewer cla…
Browse files Browse the repository at this point in the history
…imable NXM method return
  • Loading branch information
mixplore committed Nov 12, 2024
1 parent 1c624c3 commit f3343ba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions contracts/interfaces/INexusViewer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface INexusViewer {
uint assessmentStake; // Claimable assessment stake in NXM
uint stakingPoolTotalRewards; // Total staking pool rewards in NXM
uint stakingPoolTotalExpiredStake; // Total staking pool expired stake in NXM
uint stakingPoolManagerIsNXMLockedForMV; // Staking pool manager NXM locked for MV
uint managerTotalRewards; // Pool manager total staking rewards in NXM
uint legacyPooledStakeRewards; // Legacy pooled staking rewards in NXM
uint legacyPooledStakeDeposits; // Legacy pooled staking deposits in NXM
Expand Down
18 changes: 17 additions & 1 deletion contracts/modules/viewer/NexusViewer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {IAssessmentViewer} from "../../interfaces/IAssessmentViewer.sol";
import {IGovernance} from "../../interfaces/IGovernance.sol";
import {INexusViewer} from "../../interfaces/INexusViewer.sol";
import {INXMMaster} from "../../interfaces/INXMMaster.sol";
import {INXMToken} from "../../interfaces/INXMToken.sol";
import {IPooledStaking} from "../../interfaces/IPooledStaking.sol";
import {IStakingViewer} from "../../interfaces/IStakingViewer.sol";
import {ITokenController} from "../../interfaces/ITokenController.sol";
Expand All @@ -17,6 +18,7 @@ import {ITokenController} from "../../interfaces/ITokenController.sol";
contract NexusViewer is INexusViewer, Multicall {

INXMMaster public immutable master;
INXMToken public nxm;
IStakingViewer public immutable stakingViewer;
IAssessmentViewer public immutable assessmentViewer;

Expand All @@ -43,7 +45,20 @@ contract NexusViewer is INexusViewer, Multicall {
// Staking Pool
IStakingViewer.AggregatedTokens memory aggregatedTokens = stakingViewer.getAggregatedTokens(tokenIds);
uint managerTotalRewards = stakingViewer.getManagerTotalRewards(member);


IStakingViewer.TokenPoolMap[] memory tokenPools = stakingViewer.getStakingPoolsOf(tokenIds);
uint poolManagerNXMLockedForMV = 0;
// for each token, get the pool and manager
for (uint i = 0; i < tokenPools.length; i++) {
IStakingViewer.Pool memory pool = stakingViewer.getPool(tokenPools[i].poolId);
// check if pool manager is locked for MV
uint lockedForMV = nxm.isLockedForMV(pool.manager);
// get the latest date locked for MV
if (lockedForMV > 0 && lockedForMV > poolManagerNXMLockedForMV) {
poolManagerNXMLockedForMV = lockedForMV;
}
}

// V1
uint legacyPooledStakeRewards = _legacyPooledStaking().stakerReward(member);
uint legacyPooledStakeDeposits = _legacyPooledStaking().stakerDeposit(member);
Expand All @@ -56,6 +71,7 @@ contract NexusViewer is INexusViewer, Multicall {
assessmentStake: stakeLockedState.isStakeLocked ? 0 : assessmentStake,
stakingPoolTotalRewards: aggregatedTokens.totalRewards,
stakingPoolTotalExpiredStake: aggregatedTokens.totalExpiredStake,
stakingPoolManagerIsNXMLockedForMV: poolManagerNXMLockedForMV,
managerTotalRewards: managerTotalRewards,
legacyPooledStakeRewards: legacyPooledStakeRewards,
legacyPooledStakeDeposits: legacyPooledStakeDeposits,
Expand Down

0 comments on commit f3343ba

Please sign in to comment.