SpeakersToken

Description:

Smart contract deployed on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/*
 * SPKRS - Speakers Coin (Polygon, ERC-20)
 * - Offre fixe, entièrement mintée au déploiement vers le déployeur
 * - Transfert automatique d'un pourcentage (ex: 20%) vers un bénéficiaire (ton wallet)
 * - Burn optionnel par les détenteurs
 * Vérification simple sur Polygonscan si tu gardes les mêmes settings (0.8.24, Opt=Yes, 200 runs).
 */

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

/* --- Ownable minimal --- */
contract Ownable is Context {
    address private _owner;
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    constructor() { 
        _owner = _msgSender(); 
        emit OwnershipTransferred(address(0), _owner); 
    }
    function owner() public view returns (address) { return _owner; }
    modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; }
    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

/* --- ERC20 minimal --- */
contract ERC20 {
    string public name;
    string public symbol;
    uint8  public immutable decimals = 18;

    uint256 public totalSupply;
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    event Transfer(address indexed from, address indexed to, uint256 amount);
    event Approval(address indexed owner, address indexed spender, uint256 amount);

    constructor(string memory _n, string memory _s) {
        name = _n; 
        symbol = _s;
    }

    function _transfer(address from, address to, uint256 amount) internal {
        require(to != address(0), "ERC20: transfer to the zero address");
        uint256 bal = balanceOf[from];
        require(bal >= amount, "ERC20: transfer amount exceeds balance");
        unchecked { balanceOf[from] = bal - amount; }
        balanceOf[to] += amount;
        emit Transfer(from, to, amount);
    }

    function transfer(address to, uint256 amount) public returns (bool) {
        _transfer(msg.sender, to, amount); 
        return true;
    }

    function approve(address spender, uint256 amount) public returns (bool) {
        allowance[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount); 
        return true;
    }

    function transferFrom(address from, address to, uint256 amount) public returns (bool) {
        uint256 allowed = allowance[from][msg.sender];
        require(allowed >= amount, "ERC20: insufficient allowance");
        if (allowed != type(uint256).max) {
            allowance[from][msg.sender] = allowed - amount;
        }
        _transfer(from, to, amount); 
        return true;
    }

    function _mint(address to, uint256 amount) internal {
        require(to != address(0), "ERC20: mint to the zero address");
        totalSupply += amount;
        balanceOf[to] += amount;
        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal {
        uint256 bal = balanceOf[from];
        require(bal >= amount, "ERC20: burn amount exceeds balance");
        unchecked { balanceOf[from] = bal - amount; }
        totalSupply -= amount;
        emit Transfer(from, address(0), amount);
    }
}

/* --- SPKRS --- */
contract SpeakersToken is ERC20, Ownable {
    constructor(
        string memory _name,              // ex: "Speakers"
        string memory _symbol,            // ex: "SPKRS"
        uint256 _initialSupplyWhole,      // ex: 1000000000 (1 milliard)
        address _beneficiary,             // ex: 0x4AFA4EaD739781114818a72AECF33d14E07CD33D
        uint16 _beneficiaryBps            // ex: 2000 (20.00%) - en basis points
    ) ERC20(_name, _symbol) {
        require(_beneficiary != address(0), "beneficiary is zero");
        require(_beneficiaryBps <= 10000, "bps > 10000");

        uint256 supply = _initialSupplyWhole * 1e18;
        _mint(msg.sender, supply);

        if (_beneficiaryBps > 0) {
            uint256 toBeneficiary = (supply * _beneficiaryBps) / 10000;
            _transfer(msg.sender, _beneficiary, toBeneficiary);
        }
    }

    /* Optionnel : burn volontaire par les détenteurs */
    function burn(uint256 amount) external {
        _burn(msg.sender, amount);
    }
}

Tags:
addr:0xac6da7a84400b429c0daead70808b3acc8d14a7d|verified:true|block:23496985|tx:0x8edd625c2e226fab3d5561fe67b75d27aec68a3946898c0962b4a2d38de58ee8|first_check:1759491752

Submitted on: 2025-10-03 13:42:33

Comments

Log in to comment.

No comments yet.