IPowerPassStaking
Title: IPowerPassStaking
Author: ShareX Team
Interface for PowerPassStaking contract with claim request/approval workflow
Supports staking PowerPass NFTs and claiming rewards through admin approval process
Functions
stake
Stake a single PowerPass NFT
function stake(uint256 tokenId) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | NFT token ID to stake |
stakeBatch
Stake multiple PowerPass NFTs
function stakeBatch(uint256[] calldata tokenIds) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | Array of NFT token IDs to stake |
unstake
Unstake a single PowerPass NFT
function unstake(uint256 tokenId) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | NFT token ID to unstake |
unstakeBatch
Unstake multiple PowerPass NFTs
function unstakeBatch(uint256[] calldata tokenIds) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | Array of NFT token IDs to unstake |
requestClaim
Request to claim rewards
function requestClaim(uint256 amount) external returns (uint256 requestId);
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount to claim (must be <= claimable amount) |
Returns
| Name | Type | Description |
|---|---|---|
requestId | uint256 | The ID of the created claim request |
claimRewards
Claim rewards for an approved request
function claimRewards(uint256 requestId) external;
Parameters
| Name | Type | Description |
|---|---|---|
requestId | uint256 | The request ID to claim |
claimAllApprovedRewards
Claim all approved rewards
function claimAllApprovedRewards() external;
approveClaim
Approve a claim request
function approveClaim(uint256 requestId) external;
Parameters
| Name | Type | Description |
|---|---|---|
requestId | uint256 | The request ID to approve |
rejectClaim
Reject a claim request
function rejectClaim(uint256 requestId) external;
Parameters
| Name | Type | Description |
|---|---|---|
requestId | uint256 | The request ID to reject |
batchApproveClaims
Batch approve claim requests
function batchApproveClaims(uint256[] calldata requestIds) external;
Parameters
| Name | Type | Description |
|---|---|---|
requestIds | uint256[] | Array of request IDs to approve |
batchRejectClaims
Batch reject claim requests
function batchRejectClaims(uint256[] calldata requestIds) external;
Parameters
| Name | Type | Description |
|---|---|---|
requestIds | uint256[] | Array of request IDs to reject |
directClaim
Directly claim rewards without USDT transfer (for custodial wallets)
Skips request/approval flow, directly marks amount as claimed without token transfer
function directClaim(uint256 amount) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount to claim |
uploadOrders
Upload order information by NFT token ID
function uploadOrders(uint256[] calldata tokenIds, OrderInfo[][] calldata orders) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | Array of NFT token IDs |
orders | OrderInfo[][] | Array of order arrays per token |
setRewardPercentage
Set reward percentage in basis points
function setRewardPercentage(uint256 rewardBps) external;
Parameters
| Name | Type | Description |
|---|---|---|
rewardBps | uint256 | New reward percentage (e.g. 2500 = 25%) |
setPaymentToken
Set payment token for rewards
function setPaymentToken(address token) external;
Parameters
| Name | Type | Description |
|---|---|---|
token | address | New payment token address |
withdrawExcessRewards
Withdraw excess reward tokens
function withdrawExcessRewards(uint256 amount) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount to withdraw |
emergencyWithdrawNFT
Emergency withdraw NFT to specified address
function emergencyWithdrawNFT(uint256 tokenId, address to) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | NFT token ID to withdraw |
to | address | Recipient address |
getStakingInfo
Get staking information for an NFT
function getStakingInfo(uint256 tokenId) external view returns (StakingInfo memory);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | NFT token ID |
getUserTotalRewards
Get user's total rewards across all their NFTs
function getUserTotalRewards(address user) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | User address |
getClaimableAmount
Get user's claimable amount (available to request)
function getClaimableAmount(address user) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | User address |
getUserRewardsSummary
Get comprehensive rewards summary for a user
function getUserRewardsSummary(address user) external view returns (UserRewardsSummary memory);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | User address |
getUserClaimInfo
Get user's claim tracking info
function getUserClaimInfo(address user) external view returns (UserClaimInfo memory);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | User address |
getUserActiveRequests
Get user's active claim requests (Pending + Approved)
function getUserActiveRequests(address user) external view returns (ClaimRequest[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | User address |
getClaimRequest
Get a specific claim request
function getClaimRequest(uint256 requestId) external view returns (ClaimRequest memory);
Parameters
| Name | Type | Description |
|---|---|---|
requestId | uint256 | Request ID |
getPendingClaimRequests
Get all pending claim requests (for admin)
function getPendingClaimRequests() external view returns (ClaimRequest[] memory);
getPendingClaimRequestCount
Get pending claim request count
function getPendingClaimRequestCount() external view returns (uint256);
isStaked
Check if NFT is currently staked
function isStaked(uint256 tokenId) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | NFT token ID |
getStaker
Get current staker or claimant of an NFT
function getStaker(uint256 tokenId) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | NFT token ID |
powerPassContract
Get PowerPass contract address
function powerPassContract() external view returns (address);
paymentToken
Get payment token address
function paymentToken() external view returns (address);
rewardPercentage
Get current reward percentage
function rewardPercentage() external view returns (uint256);
totalStaked
Get total staked NFT count
function totalStaked() external view returns (uint256);
getStakedTokenIds
Get user's staked token IDs
function getStakedTokenIds(address user) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | User address |
Structs
OrderInfo
Order information from powerbank device
amount can be negative for corrections (e.g., -50 to correct a 100 → 50 error)
struct OrderInfo {
bytes32 orderId;
bytes32 powernowDeviceId;
uint64 startTimestamp;
uint64 endTimestamp;
int128 amount; // Signed to support corrections (negative values)
}
StakingInfo
NFT staking information
struct StakingInfo {
address owner;
uint64 stakedAt;
uint128 totalRewards; // Cumulative rewards (never resets, historical record)
uint128 rewardsAtStake; // Snapshot when current owner staked (for calculating earned)
bool isStaked;
}
ClaimRequest
Claim request details
struct ClaimRequest {
uint256 requestId;
address user;
uint128 amount;
uint64 requestTime;
ClaimRequestStatus status;
}
UserClaimInfo
User's claim tracking info
struct UserClaimInfo {
uint128 totalEarned; // Total rewards earned (includes settled from unstaked NFTs)
uint128 claimed; // Total claimed amount (historical)
uint128 pendingApproval; // Current pending approval amount
uint128 approved; // Current approved but not yet claimed amount
}
UserRewardsSummary
User's comprehensive rewards summary for UI display
struct UserRewardsSummary {
uint256 totalRewards; // Sum of all NFT rewards
uint256 claimable; // Available to request (totalRewards - claimed - pending - approved)
uint256 pendingApproval; // Waiting for admin approval
uint256 approved; // Approved, ready to claim
uint256 claimed; // Already claimed
}
Enums
ClaimRequestStatus
Claim request status
Only Pending and Approved are stored on-chain; Rejected and Claimed are deleted
enum ClaimRequestStatus {
Pending, // Awaiting admin approval
Approved // Approved, waiting for user to claim
}