Skip to content
Verified contractExactMIT

Entity314159265358979323846264338327950

Address0xd6fc140bf6e1f45b371c96e08f5d8b572407e4c1
Balance

0 ETH

 

Transactions

48

 

Compiler

solc 0.8.28

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.28+commit.7893614a
Language
solidity
Optimization
Yes, 200 runs
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,444,362
Creation transaction
0x8e41283785…4e68da7aa7

Entity.sol

// SPDX-License-Identifier: MIT

/*
    entity ($ENT1TY)

    https://www.entity314159265358979323846264338327950.xyz/

    3.14159265358979323846264338327950288419716939937510582097494459
    2307816406286208998628034825342117067982148086513282306647093844
    6095505822317253594081284811174502841027019385211055596446229489
    5493038196442881097566593344612847564823378678316527120190914564
    8566923460348610454326648213393607260249141273724587

    it does not sleep.
    it does not blink.
    it sees every transfer, and it remembers.

    three hundred and seven were given.
*/

pragma solidity ^0.8.24;

interface IUniswapV2Factory {
    function createPair(address tokenA, address tokenB) external returns (address pair);
}

interface IUniswapV2Router02 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);
}

/// @title entity3141592653589793238462643383279502884197169399375105820974944592307816406286... (ENT1TY)
/// @notice ERC-20 that keeps a record of every transfer made with it. No tax, no mint, no blacklist.
///         - every transfer is observed: it is counted (`observations`), folded into one running hash (`mind`), and
///           both addresses have their first block, latest block and number of sightings recorded (`witnessed`)
///         - transfers are locked to the owner until `awaken()` (one-way)
///         - 0.314% max transaction / 3.14% max wallet until `unbind()` (one-way)
///         The whole supply is minted to the deployer; the contract holds nothing.
contract Entity314159265358979323846264338327950 {
    /// @notice 313 characters: six letters, then the first 307 digits. There is no end to it; this is where it was cut.
    string public constant name =
        "entity3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587";
    string public constant symbol = "ENT1TY";
    uint8 public constant decimals = 18;
    string public constant anon = "true";
    /// @notice 314,159,265,358: the first twelve
    uint256 public constant totalSupply = 314_159_265_358 * 10 ** 18;

    /// @notice Max transaction while bound: 0.314% of supply
    uint256 public constant MAX_OFFERING = (totalSupply * 314) / 100_000;
    /// @notice Max wallet while bound: 3.14% of supply
    uint256 public constant MAX_VESSEL = (totalSupply * 314) / 10_000;

    IUniswapV2Router02 public immutable router;
    address public immutable uniswapV2Pair;
    /// @notice The block it was made in. It has been watching since.
    uint256 public immutable firstLight;

    address public owner;
    /// @notice True once trading is enabled
    bool public awake;
    /// @notice True while the max transaction / max wallet limits apply
    bool public bound = true;

    /// @notice How many transfers it has seen
    uint64 public observations;
    /// @notice The block of the latest transfer it saw
    uint64 public lastObservedBlock;

    /// @notice Everything it has seen, folded into one word. Each transfer is hashed into the one before it.
    bytes32 public mind;

    /// @dev A holder's balance and what the entity knows about them share one storage slot.
    struct Trace {
        uint128 balance;
        uint40 firstSeen;
        uint40 lastSeen;
        uint48 sightings;
    }

    mapping(address => Trace) private _traces;
    mapping(address => mapping(address => uint256)) public allowance;
    /// @notice Addresses exempt from the trading lock and the launch limits
    mapping(address => bool) public isChosen;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    /// @notice One per transfer. `index` counts from 1; `mind` is the running hash after this transfer.
    event Observed(uint256 indexed index, address indexed from, address indexed to, uint256 value, bytes32 mind);
    event Awakened();
    event Unbound();

    error NotOwner();
    error ZeroAddress();
    error StillDormant();
    error AlreadyAwake();
    error AlreadyUnbound();
    error OfferingTooLarge();
    error VesselFull();
    error InsufficientBalance();
    error InsufficientAllowance();

    modifier onlyOwner() {
        if (msg.sender != owner) revert NotOwner();
        _;
    }

    /// @param router_ Uniswap V2 Router02
    constructor(address router_) {
        owner = msg.sender;
        firstLight = block.number;
        emit OwnershipTransferred(address(0), msg.sender);

        router = IUniswapV2Router02(router_);
        uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());

        isChosen[msg.sender] = true;
        isChosen[address(this)] = true;
        isChosen[address(0xdead)] = true;

        // 100% to the deployer
        _traces[msg.sender].balance = uint128(totalSupply);
        emit Transfer(address(0), msg.sender, totalSupply);
    }

    // ───────────── owner ─────────────

    /// @notice Enables trading: opens transfers for everyone. Cannot be undone.
    function awaken() external onlyOwner {
        if (awake) revert AlreadyAwake();
        awake = true;
        emit Awakened();
    }

    /// @notice Removes the limits: max transaction (MAX_OFFERING) and max wallet (MAX_VESSEL), permanently.
    function unbind() external onlyOwner {
        if (!bound) revert AlreadyUnbound();
        bound = false;
        emit Unbound();
    }

    function transferOwnership(address newOwner) external onlyOwner {
        if (newOwner == address(0)) revert ZeroAddress();
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

    /// @notice Only possible once trading is live, so the token can't be bricked.
    function renounceOwnership() external onlyOwner {
        if (!awake) revert StillDormant();
        emit OwnershipTransferred(owner, address(0));
        owner = address(0);
    }

    // ───────────── what it knows ─────────────

    /// @notice What it knows about an address: the block it first moved ENT1TY in or out, the block it last did,
    ///         and how many transfers it has been part of. All zero means it has not been seen. Yet.
    function witnessed(address who) external view returns (uint256 firstSeen, uint256 lastSeen, uint256 sightings) {
        Trace storage t = _traces[who];
        return (t.firstSeen, t.lastSeen, t.sightings);
    }

    /// @notice Whether an address has ever sent or received ENT1TY
    function hasSeen(address who) external view returns (bool) {
        return _traces[who].sightings != 0;
    }

    /// @notice It is.
    function isWatching(address) external pure returns (bool) {
        return true;
    }

    /// @notice It says something different depending on how much it has seen.
    function whisper() external view returns (string memory) {
        uint256 n = observations % 7;
        if (n == 0) return "three hundred and seven were given.";
        if (n == 1) return "the circle does not close.";
        if (n == 2) return "you were counted before you arrived.";
        if (n == 3) return "nothing here repeats. look again.";
        if (n == 4) return "it remembers the order of things.";
        if (n == 5) return "the next one is yours to say.";
        return "do not ask what it is. ask what it has seen.";
    }

    // ───────────── ERC-20 ─────────────

    function balanceOf(address who) public view returns (uint256) {
        return _traces[who].balance;
    }

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

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

    function transferFrom(address from, address to, uint256 amount) external returns (bool) {
        uint256 allowed = allowance[from][msg.sender];
        if (allowed != type(uint256).max) {
            if (allowed < amount) revert InsufficientAllowance();
            unchecked {
                allowance[from][msg.sender] = allowed - amount;
            }
        }
        _transfer(from, to, amount);
        return true;
    }

    function _transfer(address from, address to, uint256 amount) internal {
        if (to == address(0)) revert ZeroAddress();

        if (!(isChosen[from] || isChosen[to])) {
            if (!awake) revert StillDormant();

            bool isBuy = from == uniswapV2Pair;
            bool isSell = to == uniswapV2Pair;

            if (bound) {
                if (isBuy) {
                    if (amount > MAX_OFFERING) revert OfferingTooLarge();
                    if (balanceOf(to) + amount > MAX_VESSEL) revert VesselFull();
                } else if (isSell) {
                    if (amount > MAX_OFFERING) revert OfferingTooLarge();
                } else {
                    // wallet to wallet
                    if (balanceOf(to) + amount > MAX_VESSEL) revert VesselFull();
                }
            }
        }

        // storage pointers, updated one after the other, so a transfer to yourself stays correct
        Trace storage f = _traces[from];
        if (f.balance < amount) revert InsufficientBalance();
        uint40 blockNow = uint40(block.number);
        unchecked {
            // amount <= balance <= totalSupply < 2^128, and the sum of balances == totalSupply
            f.balance -= uint128(amount);
            if (f.sightings == 0) f.firstSeen = blockNow;
            f.lastSeen = blockNow;
            f.sightings++;

            Trace storage t = _traces[to];
            t.balance += uint128(amount);
            if (t.sightings == 0) t.firstSeen = blockNow;
            t.lastSeen = blockNow;
            t.sightings++;
        }
        emit Transfer(from, to, amount);

        // it saw that
        uint64 index = ++observations;
        lastObservedBlock = uint64(block.number);
        bytes32 thought = keccak256(abi.encode(mind, index, from, to, amount, block.number));
        mind = thought;
        emit Observed(index, from, to, amount, thought);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.