SyntheticToken
Inherits: ERC20, ERC20Permit, ERC20FlashMint
Title: SyntheticToken
ERC20 token with flash mint and permit capability, controlled by SyntheticSplitter.
Used for plDXY-BEAR and plDXY-BULL tokens. Only the Splitter can mint/burn. Inherits ERC20FlashMint for fee-free flash loans used by routers.
State Variables
SPLITTER
The SyntheticSplitter contract that controls minting and burning.
address public immutable SPLITTER
Functions
onlySplitter
Restricts function access to the Splitter contract only.
modifier onlySplitter() ;
constructor
Creates a new SyntheticToken.
constructor(
string memory _name,
string memory _symbol,
address _splitter
) ERC20(_name, _symbol) ERC20Permit(_name);
Parameters
| Name | Type | Description |
|---|---|---|
_name | string | Token name (e.g., “Plether Dollar Index Bear”). |
_symbol | string | Token symbol (e.g., “plDXY-BEAR”). |
_splitter | address | Address of the SyntheticSplitter contract. |
mint
Mint tokens to an address. Only callable by Splitter.
function mint(
address to,
uint256 amount
) external onlySplitter;
Parameters
| Name | Type | Description |
|---|---|---|
to | address | Recipient address. |
amount | uint256 | Amount to mint. |
burn
Burn tokens from an address. Only callable by Splitter.
function burn(
address from,
uint256 amount
) external onlySplitter;
Parameters
| Name | Type | Description |
|---|---|---|
from | address | Address to burn from. |
amount | uint256 | Amount to burn. |
Errors
SyntheticToken__Unauthorized
Thrown when a non-Splitter address attempts to mint or burn.
error SyntheticToken__Unauthorized();
SyntheticToken__ZeroAddress
Thrown when zero address provided for splitter.
error SyntheticToken__ZeroAddress();