WENBlocks
  • Getting Started
    • Overview
      • Technical Architecture
    • Key Features
  • Staking
    • Overview
    • Creating a Stake
    • Withdrawing the Stake
    • Claiming Rewards
  • Liquidity Program
    • How It Works
  • WNT
    • WNT — The Engine of the WEN Ecosystem
  • Airdrops
    • Airdrop Schedule
    • Server Management
    • Penalty Structure
    • How It Works
    • Example
  • Smart Contracts
  • Security
    • Overview
    • Internal Audits
    • External Audits
    • AI Audits
      • Grok
  • CODE
    • WENBlocksManager.sol
    • wnmContract.sol
    • wblkToken.sol
    • wuniContract.sol
    • wntToken.sol
    • syncnode.py
    • airdropGenerator.js
    • dayTrigger.js
  • Conclusion
    • Conclusion
  • Socials
    • Links
Powered by GitBook
On this page
  1. CODE

wblkToken.sol

Utility token that amplifies staking rewards when committed alongside WNM, featuring controlled minting and burning capabilities.

// 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/token/ERC20/extensions/ERC20Burnable.sol";

/// @title WBLKToken - An ERC20 token with controlled minting and burning
/// @author Yonko
/// @notice This token can only be minted by the WNM contract or WENBlocksManager
/// @dev Inherits OpenZeppelin's ERC20 and Ownable implementations
contract WBLKToken is ERC20, ERC20Burnable, Ownable {
    /// @notice Address of the WENBlocksManager
    address public manageraddress;

    /// @notice Address of the WNM (staking) contract
    address public wnmAddress;

    /// @notice Deploys the WBLKToken and mints initial supply to the deployer
    /// @param name_ Name of the token (e.g. "WBLKToken")
    /// @param symbol_ Symbol of the token (e.g. "WBLK")
    constructor(
        string memory name_,
        string memory symbol_
    ) ERC20(name_, symbol_) Ownable(msg.sender) {
        _mint(msg.sender, 2e18); // Mint initial supply to owner
    }

    /// @notice Restricts access to only WNM contract or WENBlocksManager
    modifier onlyWNMandManager() {
        require(msg.sender == wnmAddress || msg.sender == manageraddress, "Only the WENBlocksManager and WNM contract can trigger the mint function");
        _;
    }

    /// @notice Sets the addresses allowed to call `mint`
    /// @dev Callable only by the contract owner
    /// @param _manageraddress The address of the WENBlocksManager
    /// @param _wnmAddress The address of the WNM (staking) contract
    function setAddresses(address _manageraddress, address _wnmAddress) external onlyOwner {
        manageraddress = _manageraddress;
        wnmAddress = _wnmAddress;
    }

    /// @notice Mints new tokens to a specified address
    /// @dev Callable only by WNM or manager contracts
    /// @param to The address to receive newly minted tokens
    /// @param amount The amount to mint (must include full decimals)
    function mint(address to, uint256 amount) external onlyWNMandManager {
        _mint(to, amount);
    }
}
PreviouswnmContract.solNextwuniContract.sol

Last updated 1 month ago