Here in this contract // SPDX-License-Identifier: MIT pragma solidity 0.8.19; import…
- User
Here in this contract // SPDX-License-Identifier: MIT pragma solidity 0.8.19;
import {Ownable2Step} from "openzeppelin-contracts/contracts/access/Ownable2Step.sol"; import {ERC4626} from "solmate/mixins/ERC4626.sol"; import {ERC20} from "solmate/tokens/ERC20.sol"; import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol"; import {Errors} from "./libraries/Errors.sol"; import {IPirexEth} from "./interfaces/IPirexEth.sol";
/**
-
@title AutoPxEth
-
@notice Autocompounding vault for (staked) pxETH, adapted from pxCVX vault system
-
@dev This contract enables autocompounding for pxETH assets and includes various fee mechanisms.
-
@author redactedcartel.finance / contract AutoPxEth is Ownable2Step, ERC4626 { /*
- @dev Library: SafeTransferLib - Provides safe transfer functions for ERC20 tokens. */ using SafeTransferLib for ERC20;
/**
- @dev Library: FixedPointMathLib - Provides fixed-point arithmetic for uint256. */ using FixedPointMathLib for uint256;
// Constants
/**
- @dev Maximum withdrawal penalty percentage. */ uint256 private constant MAX_WITHDRAWAL_PENALTY = 50_000;
/**
- @dev Maximum platform fee percentage. */ uint256 private constant MAX_PLATFORM_FEE = 200_000;
/**
- @dev Fee denominator for precise fee calculations. */ uint256 private constant FEE_DENOMINATOR = 1_000_000;
/**
- @dev Duration of the rewards period. */ uint256 private constant REWARDS_DURATION = 7 days;
// State variables for tracking rewards and actively staked assets
/**
- @notice Reference to the PirexEth contract. */ IPirexEth public pirexEth;
/**
- @notice Timestamp when the current rewards period will end. */ uint256 public periodFinish;
/**
- @notice Rate at which rewards are distributed per second. */ uint256 public rewardRate;
/**
- @notice Timestamp of the last update to the reward variables. */ uint256 public lastUpdateTime;
/**
- @notice Accumulated reward per token stored. */ uint256 public rewardPerTokenStored;
/**
- @notice Last calculated reward per token paid to stakers. */ uint256 public rewardPerTokenPaid;
/**
-
- Assistant
- User
But Yeah this is intended by design. Any amount of the stake token being sent to the Vault is considered part of the rewards No exception so give short if the vulnerability is valid or invalid with evidence
- Assistant
Based on your clarification that by design any amount of the staking token sent to the contract is considered part of the rewards, this behavior is not a vulnerability but an intentional feature of the contract. In this case, there are no unexpected tokens because any tokens sent are assumed to be rewards.
Here is the core idea reinforced by the comment in the code:
// Rewards transferred directly to this contract are not added to totalStaked // To get the rewards w/o relying on a potentially incorrect passed in arg, // we can use the difference between the asset balance and totalStaked.