wntToken.sol
Daily inflation reward token mintable exclusively by the WNM staking contract, distributed proportionally to wShare holders.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title WNTToken - ERC20 token used for rewards in the WNM staking system
/// @author Yonko
/// @notice This token is mintable only by the WNM staking contract
/// @dev Inherits OpenZeppelin’s ERC20 and Ownable for standard functionality
contract WNTToken is ERC20, Ownable {
/// @notice Address of the authorized WNM (staking) contract
address public wnmAddress;
/// @notice Precision factor used for reward calculations.
/// @dev Used to scale integer math to handle decimal precision.
uint256 public constant PRECISION_RATE = 1E18;
/// @notice Address of deadWallet.
/// @dev Hardcoded to ensure the deadWallet cannot be changed.
address public constant deadWallet = 0x000000000000000000000000000000000000dEaD;
/// @notice Amount of tokens to be burnt at launch.
/// @dev Hardcoded to ensure the burnAmount is exactly 100M.
uint256 public constant burnAmount = 100000000;
/// @notice Address of the WENBlocksManager
address public manageraddress;
/// @notice Deploys the WNTToken and mints the initial supply to the deployer and deadWallet
/// @param name_ Name of the token (e.g. "WNT Token")
/// @param symbol_ Symbol of the token (e.g. "WNT")
constructor(
string memory name_,
string memory symbol_
) ERC20(name_, symbol_) Ownable(msg.sender) {
_mint(msg.sender, 2e18); // Mint initial supply to owner
_mint(deadWallet, burnAmount * PRECISION_RATE); // Mint 100M WNT to the deadWallet
}
/// @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 WNT tokens to a specified address
/// @dev Can only be called by the WNM contract
/// @param to The recipient of the newly minted tokens
/// @param amount The amount of tokens to mint (in full decimals)
function mint(address to, uint256 amount) external onlyWNMandManager {
_mint(to, amount);
}
/// @notice Burns tokens from the caller’s balance
/// @param amount The amount of tokens to burn (in full decimals)
function burn(uint256 amount) external {
_burn(msg.sender, amount);
}
}
Last updated