StakedToken
Inherits: ERC4626
Title: StakedToken
ERC4626 vault for staking plDXY-BEAR or plDXY-BULL tokens.
Used as Morpho collateral. Exchange rate increases via yield donations. Implements 1000x virtual share offset to prevent inflation attacks.
Functions
constructor
Creates a new staking vault for a synthetic token.
constructor(
IERC20 _asset,
string memory _name,
string memory _symbol
) ERC4626(_asset) ERC20(_name, _symbol);
Parameters
| Name | Type | Description |
|---|---|---|
_asset | IERC20 | The underlying plDXY token to stake (plDXY-BEAR or plDXY-BULL). |
_name | string | Vault share name (e.g., “Staked plDXY-BEAR”). |
_symbol | string | Vault share symbol (e.g., “splDXY-BEAR”). |
donateYield
Allows anyone to inject yield into the vault.
Increases the share price for all stakers immediately.
function donateYield(
uint256 amount
) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | The amount of underlying tokens to donate |
depositWithPermit
Deposit assets with a permit signature (gasless approval).
Combines EIP-2612 permit with ERC-4626 deposit in a single transaction.
function depositWithPermit(
uint256 assets,
address receiver,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 shares);
Parameters
| Name | Type | Description |
|---|---|---|
assets | uint256 | Amount of underlying tokens to deposit |
receiver | address | Address to receive the vault shares |
deadline | uint256 | Permit signature expiration timestamp |
v | uint8 | Signature recovery byte |
r | bytes32 | Signature r component |
s | bytes32 | Signature s component |
Returns
| Name | Type | Description |
|---|---|---|
shares | uint256 | Amount of vault shares minted |
_decimalsOffset
Virtual share offset (10^3 = 1000x) to prevent inflation attacks.
function _decimalsOffset() internal pure override returns (uint8);