Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SyntheticToken

Git Source

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.

Note: security-contact: contact@plether.com

Constants

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

NameTypeDescription
_namestringToken name (e.g., “Plether Dollar Index Bear”).
_symbolstringToken symbol (e.g., “plDXY-BEAR”).
_splitteraddressAddress of the SyntheticSplitter contract.

mint

Mint tokens to an address. Only callable by Splitter.

function mint(
    address to,
    uint256 amount
) external onlySplitter;

Parameters

NameTypeDescription
toaddressRecipient address.
amountuint256Amount to mint.

burn

Burn tokens from an address. Only callable by Splitter.

function burn(
    address from,
    uint256 amount
) external onlySplitter;

Parameters

NameTypeDescription
fromaddressAddress to burn from.
amountuint256Amount 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();