diff --git a/docs/xp-token.md b/docs/xp-token.md index 375a3d3..bed222c 100644 --- a/docs/xp-token.md +++ b/docs/xp-token.md @@ -2,10 +2,11 @@ ## Overview -The XPToken is an ERC-20 token implementation with a modified supply mechanism that incorporates external reward providers. -XP tokens are not transferrable, but they can be used as voting power in the Status Network. +The XPToken is an ERC-20 token implementation with a modified supply mechanism that incorporates external reward +providers. XP tokens are not transferrable, but they can be used as voting power in the Status Network. ## Features + - **Minting with Restrictions:** - The contract owner (admin) can mint tokens, and their accounting is kept internally. - Prevents exceeding a dynamically calculated mint allowance. @@ -24,23 +25,27 @@ XP tokens are not transferrable, but they can be used as voting power in the Sta - `SYMBOL`: "XP" ### State Variables + - `rewardProviders`: A list of addresses implementing the `IRewardProvider` interface. ### Errors + - `XPToken__MintAllowanceExceeded`: Raised when minting exceeds the allowed threshold. - `XPToken__TransfersNotAllowed`: Raised when a transfer, approval, or transferFrom is attempted. - `RewardProvider__IndexOutOfBounds`: Raised when an invalid index is used for removing a reward provider. ## Supply and Balance Calculation + - **totalSupply()**: Sum of the internal supply and the sum of external supplies from reward providers. - **balanceOf(address)**: Internal balance plus the sum of external balances from reward providers. ## Sources of XP Tokens -One of the sources for the generation of XP tokens is the [staking protocol](overview.md), with more sources planned in the future. + +One of the sources for the generation of XP tokens is the [staking protocol](overview.md), with more sources planned in +the future. ## Notes + - The contract is designed to work alongside an external reward system. - Transfers and approvals are explicitly disabled to enforce controlled distribution. - The contract ensures a dynamic supply mechanism tied to external rewards. - - diff --git a/src/interfaces/IStakeConstants.sol b/src/interfaces/IStakeConstants.sol index 7c46c1f..3ac8507 100644 --- a/src/interfaces/IStakeConstants.sol +++ b/src/interfaces/IStakeConstants.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.26; -import { ITrustedCodehashAccess } from "./ITrustedCodehashAccess.sol"; - /** * @title IStakeConstants * @author Ricardo Guilherme Schmidt diff --git a/src/interfaces/IStakeManagerProxy.sol b/src/interfaces/IStakeManagerProxy.sol index 03af2c4..6fcc168 100644 --- a/src/interfaces/IStakeManagerProxy.sol +++ b/src/interfaces/IStakeManagerProxy.sol @@ -4,4 +4,5 @@ pragma solidity ^0.8.26; import { IStakeManager } from "./IStakeManager.sol"; import { ITransparentProxy } from "./ITransparentProxy.sol"; +// solhint-disable-next-line interface IStakeManagerProxy is IStakeManager, ITransparentProxy { } diff --git a/src/math/StakeMath.sol b/src/math/StakeMath.sol index 1babdf8..1fd151f 100644 --- a/src/math/StakeMath.sol +++ b/src/math/StakeMath.sol @@ -51,6 +51,7 @@ abstract contract StakeMath is MultiplierPointMath { { uint256 newBalance = _balance + _increasedAmount; _newLockEnd = Math.max(_currentLockEndTime, _processTime) + _increasedLockSeconds; + // solhint-disable-next-line uint256 dt_lock = _newLockEnd - _processTime; if (dt_lock != 0 && (dt_lock < MIN_LOCKUP_PERIOD || dt_lock > MAX_LOCKUP_PERIOD)) { revert StakeMath__InvalidLockingPeriod(); @@ -99,6 +100,7 @@ abstract contract StakeMath is MultiplierPointMath { } _newLockEnd = Math.max(_currentLockEndTime, _processTime) + _increasedLockSeconds; + // solhint-disable-next-line uint256 dt_lock = _newLockEnd - _processTime; if (dt_lock != 0 && (dt_lock < MIN_LOCKUP_PERIOD || dt_lock > MAX_LOCKUP_PERIOD)) { revert StakeMath__InvalidLockingPeriod(); diff --git a/test/mocks/StackOverflowStakeManager.sol b/test/mocks/StackOverflowStakeManager.sol index 70b1464..697bc72 100644 --- a/test/mocks/StackOverflowStakeManager.sol +++ b/test/mocks/StackOverflowStakeManager.sol @@ -6,7 +6,6 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { TrustedCodehashAccess } from "./../../src/TrustedCodehashAccess.sol"; import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; -import { IStakeConstants } from "./../../src/interfaces/IStakeConstants.sol"; contract StackOverflowStakeManager is UUPSUpgradeable, @@ -14,6 +13,7 @@ contract StackOverflowStakeManager is TrustedCodehashAccess, ReentrancyGuardUpgradeable { + // solhint-disable-next-line IERC20 public STAKING_TOKEN; uint256 public constant SCALE_FACTOR = 1e18; @@ -42,15 +42,19 @@ contract StackOverflowStakeManager is mapping(address account => Account data) public accounts; + // solhint-disable-next-line function getStakedBalance(address _vault) external view override returns (uint256 _balance) { // implementation } + // solhint-disable-next-line function lock(uint256 _seconds) external override { // implementation } + // solhint-disable-next-line function stake(uint256 _amount, uint256 _seconds) external override { // implementation } + // solhint-disable-next-line function unstake(uint256 _amount) external override { // implementation } @@ -67,6 +71,7 @@ contract StackOverflowStakeManager is return accounts[_account]; } + // solhint-disable-next-line function registerVault() external override { // implementation } diff --git a/test/mocks/XPProviderMock.sol b/test/mocks/XPProviderMock.sol index 4d3b7fc..6e4e72b 100644 --- a/test/mocks/XPProviderMock.sol +++ b/test/mocks/XPProviderMock.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.26; import { IRewardProvider } from "../../src/interfaces/IRewardProvider.sol"; contract XPProviderMock is IRewardProvider { + // solhint-disable-next-line mapping(address => uint256) public userXPShare; uint256 public totalXPShares;