Address
0xdacb47f71c992c8a48e19f72d16a4bc948ea45abCurrent Holdings
$0.00
TXs sent
not counted
First Active
2026-01-25
block 25,620,108
Last Active
31 days ago
block 27,293,924
Funded By
not identified
Net worth historyi
64 snapshots · to block 27,465,542coverage change 26 Augcoverage change 27 Augcoverage change 27 Augcoverage change 27 Augcoverage change 27 Aug
partial matchPlaygroundTokensolc 0.8.20+commit.a1b79de6runtime partial · creation not verified
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title PlaygroundToken
* @dev ERC20 token with wrap/unwrap functionality using parent tokens
* @notice Users can wrap parent tokens to receive PlaygroundTokens (burn function)
* and unwrap PlaygroundTokens to get back parent tokens (claim function)
*/
contract PlaygroundToken is ERC20, Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
/// @dev Parent token address used for wrapping/unwrapping
address public parent;
/// @dev Token description
string public description;
/// @dev Maximum supply cap (immutable)
uint256 public immutable maxSupply;
/// @dev Factory address that can mint tokens (immutable)
address public immutable factory;
/**
* @dev Constructor
* @param name ERC20 token name
* @param symbol ERC20 token symbol
* @param factoryAddress Factory contract address (for minting access control)
* @param parentToken Parent token address for wrapping/unwrapping
* @param tokenDescription Token description
* @param maxTokenSupply Maximum supply cap (must be >= 1 billion tokens)
*/
constructor(
string memory name,
string memory symbol,
address factoryAddress,
address parentToken,
string memory tokenDescription,
uint256 maxTokenSupply
) ERC20(name, symbol) Ownable(msg.sender) {
require(parentToken != address(0), "PlaygroundToken: parent token cannot be zero address");
require(
maxTokenSupply >= 1_000_000_000 * 10**18,
"PlaygroundToken: maxSupply must be at least 1 billion tokens"
);
parent = parentToken;
description = tokenDescription;
maxSupply = maxTokenSupply;
factory = factoryAddress;
}
/**
* @dev Wrap parent tokens into PlaygroundTokens
* @notice Transfers parent tokens from user and mints PlaygroundTokens
* @param amount Amount of parent tokens to wrap
*/
function burn(uint256 amount) external {
require(amount > 0, "PlaygroundToken: amount must be greater than zero");
// Transfer parent tokens from user to this contract
IERC20(parent).safeTransferFrom(msg.sender, address(this), amount);
// Check max supply constraint
require(
totalSupply() + amount <= maxSupply,
"PlaygroundToken: would exceed max supply"
);
// Mint PlaygroundTokens to user
_mint(msg.sender, amount);
}
/**
* @dev Unwrap PlaygroundTokens back to parent tokens
* @notice Burns PlaygroundTokens and transfers parent tokens to user
* @param amount Amount of PlaygroundTokens to unwrap
*/
function claim(uint256 amount) external nonReentrant {
require(amount > 0, "PlaygroundToken: amount must be greater than zero");
// Burn PlaygroundTokens from user
_burn(msg.sender, amount);
// Transfer parent tokens from contract to user
IERC20(parent).safeTransfer(msg.sender, amount);
}
/**
* @dev Mint tokens (only callable by factory)
* @notice Used by factory during token creation and for future minting logic
* @param to Address to mint tokens to
* @param amount Amount of tokens to mint
*/
function mint(address to, uint256 amount) external {
require(msg.sender == factory, "PlaygroundToken: only factory can mint");
require(amount > 0, "PlaygroundToken: amount must be greater than zero");
require(
totalSupply() + amount <= maxSupply,
"PlaygroundToken: would exceed max supply"
);
_mint(to, amount);
}
}