S Price: $0.606369 (-18.92%)

Contract Diff Checker

Contract Name:
Cinos

Contract Source Code:

File 1 of 1 : Cinos

// SPDX-License-Identifier:  None

pragma solidity ^0.8.0;

/**
 * Cinos Token - Deployed on Sonic Network
 *
 * Cinos is a token with a bound supply curve, where new tokens become available for minting every block.
 * Every 4 years, minting becomes twice as hard, following a unique time-based halving schedule.
 * After 92 years, minting a single token will take 4 years, capping practical supply around 21 million.
 * 
 * As a tribute, 5% of each minted amount is silently sent to the creator, Satocinos, to honor the spirit of creation.
 *
 * Designed for Sonic, Cinos blends scarcity, time, and innovation into one timeless asset.
 */

contract Cinos {
    string public constant name = "Cinos";
    string public constant symbol = "CNS";
    uint8 public constant decimals = 18;

    uint256 public totalSupply;
    uint8 public epoch;
    uint256 public lastDoublingBlock;
    uint256 public nextDoublingBlock;
    uint256 public lastMintingBlock;

    address public immutable creator;

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

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event EpochAdvanced(uint8 newEpoch);

    uint256 constant FOUR_YEARS_BLOCKS = 10519200; // ~4 years
    uint256 constant MINT_FEE_PERCENT = 5;         // 0.5%

    constructor() {
        creator = msg.sender;

        totalSupply = 1e18;
        balanceOf[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);

        lastDoublingBlock = block.number;
        nextDoublingBlock = block.number + FOUR_YEARS_BLOCKS;
        lastMintingBlock = block.number;
        epoch = 0;
    }

    function transfer(address _to, uint256 _value) public returns (bool) {
        require(balanceOf[msg.sender] >= _value, "Insufficient balance");
        _transfer(msg.sender, _to, _value);
        return true;
    }

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

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
        require(balanceOf[_from] >= _value, "Insufficient balance");
        require(allowance[_from][msg.sender] >= _value, "Insufficient allowance");

        allowance[_from][msg.sender] -= _value;
        _transfer(_from, _to, _value);
        return true;
    }

    function mint() public {
        uint256 numberToMint = mintable();
        require(numberToMint > 0, "Nothing to mint");

        uint256 fee = (numberToMint * MINT_FEE_PERCENT) / 1000;
        uint256 userAmount = numberToMint - fee;

        totalSupply += numberToMint;

        balanceOf[msg.sender] += userAmount;
        emit Transfer(address(0), msg.sender, userAmount);

        balanceOf[creator] += fee;

        lastMintingBlock = block.number - ((block.number - lastMintingBlock) % blocksPerToken());
    }

    function mintable() public view returns (uint256 numberToMint) {
        uint256 blocksPassed = block.number - lastMintingBlock;
        if (blocksPassed < blocksPerToken()) {
            return 0;
        }
        numberToMint = (blocksPassed / blocksPerToken()) * 1e18;
    }

    function blocksPerToken() public view returns (uint256) {
        return 2**epoch;
    }

    function advanceEpochIfNeeded() public {
        if (block.number >= nextDoublingBlock) {
            epoch++;
            lastDoublingBlock = block.number;
            nextDoublingBlock = block.number + FOUR_YEARS_BLOCKS;

            emit EpochAdvanced(epoch);
        }
    }

    function _transfer(address _from, address _to, uint256 _value) internal {
        balanceOf[_from] -= _value;
        balanceOf[_to] += _value;
        emit Transfer(_from, _to, _value);
    }

    function currentEpoch() public view returns (uint8) {
        return epoch;
    }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):