Address
0xd8945e8e724fa01755ccd67f7c22b7e353b42e8dCurrent Holdings
$0.00
TXs sent
not counted
First Active
2026-05-16
block 26,540,635
Last Active
122 days ago
block 26,540,635
Funded By
not identified
Net worth historyi
2 snapshots · to block 27,427,957coverage change 26 Augcoverage change 27 Augcoverage change 27 Augcoverage change 27 Augcoverage change 27 Aug
exact matchCONSsolc 0.8.34+commit.80d5c536runtime exact · creation exact
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
// "Do not be overcome by evil, but overcome evil with good."
// "A friend is loving at all times, and becomes a brother in times of trouble."
// ▓
// ▓ ▒ ▓
// ▓ ▒ ░ ▒ ▓
// ▓ ▒ ░ · ░ ▒ ▓
// ▓ ▒ ░ · ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ ˥ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ ˥ ͔ ˥ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ ˥ ͔ σ ͔ ˥ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ ˥ ͔ σ ✧ σ ͔ ˥ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ ˥ ͔ σ ͔ ˥ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ ˥ ͔ ˥ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ ˥ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ɿ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ Ȑ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ơ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ƌ ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® ĝ ® · ░ ▒ ▓
// ▓ ▒ ░ · ® · ░ ▒ ▓
// ▓ ▒ ░ · ░ ▒ ▓
// ▓ ▒ ░ ▒ ▓
// ▓ ▒ ▓
// ▓
// CONS – Consecration Coin. Blessed by prayer, cogs, and the Motzkin prime.
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.6.1/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.6.1/contracts/token/ERC20/utils/SafeERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.6.1/contracts/utils/ReentrancyGuard.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.6.1/contracts/utils/cryptography/ECDSA.sol";
contract CONS is ERC20, ReentrancyGuard {
using ECDSA for bytes32;
using SafeERC20 for IERC20;
// ============ CONSTANTS ============
uint256 public constant MAX_SUPPLY = 987 * 1e18;
uint256 public constant REGEN_THRESHOLD = 789 * 1e18;
uint256 private constant CEREMONIAL_MINT = 78987 * 1e18;
uint256 private constant CEREMONIAL_BURN = 78000 * 1e18;
uint256 public constant MIN_TRANSFER_FOR_EFFECT = 1e18;
uint256 private constant TAX_THRESHOLD_PERCENT = 1;
uint32 private constant TAX_BPS = 10;
uint32 private constant BPS = 10000;
uint8 private constant BURN_SHARE = 33;
uint8 private constant REWARD_SHARE = 33;
uint8 private constant MAX_RECENT = 5;
uint8 private constant MAX_RECENT_USERS = MAX_RECENT;
// Motzkin prime and cascade constants
uint64 private constant P = 953467954114363;
uint16 private constant MASK_16 = 0xFFFF;
// Blessing constants
uint256 private constant RW = 0x0200000003000000070000000a000000140000001a000000210000002a0000;
uint256 private constant W1 = 0x4f7572204661746865722077686f2061727420696e2068656176656e;
uint256 private constant W2 = 0x476f642c206772616e74206d652074686520736572656e697479;
uint256 private constant W3 = 0xe5909be5ad90e5928ce8808ce4b88de5908c000000000000000000000000;
address public constant EXC = 0x812dc34EE57Ac601474219450016E01D4cABdC62;
// EIP‑2612 constants
bytes32 private constant PERMIT_TYPEHASH = keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
);
// ============ STATE VARIABLES ============
// Light LCG
uint64 private _lcgState = 1;
uint256 private _lcgCount;
// Prayer state
uint8 public a; uint8 public b; uint8 public c;
uint8 public a2; uint8 public b2; uint8 public c2;
uint8 public t;
uint24 public pA; uint24 public pB; uint24 public pC;
uint8 public hA; uint8 public hB; uint8 public hC;
uint256 public bel;
// Motzkin cascade (rare)
uint64 private _seedA = P;
uint64 private _seedB = P ^ MASK_16;
uint256 private _countM;
// Recent users
address[MAX_RECENT] private _recentUsers;
uint8 private _recentIndex;
// Daily outflow limits
mapping(address => mapping(uint256 => uint256)) private _dailyOutflowUsed;
// Ingestion routes
struct IngestRoute {
address[] inputTokens;
uint256[] baseInputAmounts;
address outputToken;
uint256 baseOutputAmount;
uint16[] splitBps;
}
mapping(uint8 => IngestRoute) internal _routes;
// EIP‑2612
mapping(address => uint256) public nonces;
bytes32 public immutable DOMAIN_SEPARATOR;
string public constant VERSION = "1.0.0";
// ============ EVENTS ============
event CascadeAdvanced(uint64 state, uint16[4] chunks, uint256 count);
event DynamicBurn(address indexed from, uint256 amount, uint16 chunk);
event DynamicReward(address indexed to, uint256 amount, uint16 chunk, uint8 indexed recipientIndex);
event RewardFailed(uint8 indexed recipientIndex, address indexed intended, uint256 amount);
event DailyLimitUsed(address indexed token, uint256 amount, uint256 remaining);
event Ingested(uint8 indexed routeId, address indexed user, uint16 chunk, uint256 multiplier);
event Prayer(uint8 indexed cogId);
event Regenerated(uint256 amount);
// ============ ERRORS ============
error DailyLimitExceeded();
error InsufficientTreasuryBalance();
// ============ CONSTRUCTOR ============
constructor() ERC20("the Consecration Coin", "C0NS") {
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes("the Consecration Coin")),
keccak256(bytes(VERSION)),
block.chainid,
address(this)
)
);
_mint(address(this), CEREMONIAL_MINT);
super._update(address(this), address(0), CEREMONIAL_BURN);
super._update(address(this), msg.sender, 777 * 1e18);
// Route 0: Unstake (1 EXC → 1 CONS)
address[] memory ins0 = new address[](1);
ins0[0] = EXC;
uint256[] memory baseIn0 = new uint256[](1);
baseIn0[0] = 1e18;
uint16[] memory splits0 = new uint16[](4);
splits0[0] = 3000; splits0[1] = 3600; splits0[2] = 0; splits0[3] = 0;
_setRoute(0, IngestRoute(ins0, baseIn0, address(this), 1e18, splits0));
// Route 1: Stake (1 CONS → 0.5 EXC)
address[] memory ins1 = new address[](1);
ins1[0] = address(this);
uint256[] memory baseIn1 = new uint256[](1);
baseIn1[0] = 1e18;
uint16[] memory splits1 = new uint16[](4);
splits1[0] = 0; splits1[1] = 0; splits1[2] = 0; splits1[3] = 0;
_setRoute(1, IngestRoute(ins1, baseIn1, EXC, 0.5e18, splits1));
}
// Explicit name/symbol overrides (plain ASCII)
function name() public view virtual override returns (string memory) {
return "the Consecration Coin";
}
function symbol() public view virtual override returns (string memory) {
return "C0NS";
}
// ============ INTERNAL HELPERS ============
function _getGoAddress() private pure returns (address) {
return address(0);
}
function _getDailyLimit(address token) private view returns (uint256) {
return IERC20(token).balanceOf(address(this)) / 100;
}
function _useDailyLimit(address token, uint256 amount) private {
uint256 day = block.timestamp / 86400;
uint256 limit = _getDailyLimit(token);
uint256 used = _dailyOutflowUsed[token][day];
uint256 newUsed = used + amount;
if (newUsed > limit) revert DailyLimitExceeded();
_dailyOutflowUsed[token][day] = newUsed;
emit DailyLimitUsed(token, amount, limit - newUsed);
}
function _computeSplit(uint16 chunk, uint16 minBps, uint16 maxBps) private pure returns (uint16) {
if (minBps == maxBps) return minBps;
return minBps + uint16((uint32(chunk) * (maxBps - minBps)) / 65535);
}
function _setRoute(uint8 routeId, IngestRoute memory route) internal {
_routes[routeId] = route;
}
function _isEligibleRecentUser(address user) private view returns (bool) {
if (user == address(0) || user == address(this)) return false;
if (balanceOf(user) < MIN_TRANSFER_FOR_EFFECT) return false;
uint32 size;
assembly { size := extcodesize(user) }
if (size > 0) return false;
return true;
}
function _addToRecentUsers(address user) private {
for (uint8 i = 0; i < MAX_RECENT; i++) {
if (_recentUsers[i] == user) return;
}
unchecked {
_recentUsers[_recentIndex] = user;
_recentIndex = (_recentIndex + 1) % MAX_RECENT;
}
}
// ============ MOTZKIN & PRAYER CORE ============
function _modExp(uint64 base, uint64 exponent) private view returns (uint64) {
uint256 r;
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), base)
mstore(add(ptr, 0x80), exponent)
mstore(add(ptr, 0xa0), P)
if iszero(staticcall(gas(), 0x05, ptr, 0xc0, ptr, 0x20)) { revert(0, 0) }
r := mload(ptr)
}
return uint64(r);
}
function _advanceMotzkin() private {
uint64 a_mod = uint64(uint160(address(this)) % P);
uint64 b_mod = uint64(uint160(address(this)) % P);
uint64 pairKey = (a_mod == 0 && b_mod == 0) ? 1 : _modExp(a_mod, b_mod);
uint64 count64 = uint64(_countM);
uint64 x = _seedA ^ count64 ^ pairKey;
uint64 y = _seedB ^ count64 ^ pairKey;
if (x < 2) x = P ^ count64;
if (y < 2) y = P ^ count64;
_seedA = (_modExp(x, y) ^ count64) % P;
_seedB = (_seedA ^ _seedB) % P;
_countM++;
}
function _getBlessing() private view returns (uint16) {
return getConSec();
}
function _advanceCascade(address from, address to) private returns (uint16[4] memory chunks) {
unchecked { _lcgCount++; }
uint64 pair = uint64(uint160(from) ^ uint160(to));
_lcgState = (_lcgState * 1103515245 + 12345) ^ pair ^ uint64(_lcgCount);
_lcgState ^= _getBlessing();
uint64 raw = _lcgState;
return [uint16(raw), uint16(raw>>16), uint16(raw>>32), uint16(raw>>48)];
}
// ============ TAX & REWARD ============
function _applyTax(address from, uint256 taxAmount, uint16[4] memory chunks) private {
uint256 burnAmount = taxAmount * BURN_SHARE / 100;
uint256 rewardAmount = taxAmount * REWARD_SHARE / 100;
if (burnAmount > 0) {
super._update(from, address(0), burnAmount);
emit DynamicBurn(from, burnAmount, chunks[0]);
_checkAndRegenerate();
}
if (rewardAmount > 0 && balanceOf(address(this)) >= rewardAmount) {
uint8 idx = uint8(chunks[3] % MAX_RECENT);
address recipient = _recentUsers[idx];
if (recipient != address(0)) {
super._update(address(this), recipient, rewardAmount);
emit DynamicReward(recipient, rewardAmount, chunks[1], idx);
} else {
emit RewardFailed(idx, recipient, rewardAmount);
}
} else if (rewardAmount > 0) {
emit RewardFailed(0, address(0), rewardAmount);
}
}
function _checkAndRegenerate() private {
if (totalSupply() <= REGEN_THRESHOLD) {
uint256 needed = MAX_SUPPLY - totalSupply();
if (needed > 0) {
_mint(address(this), needed);
emit Regenerated(needed);
}
}
}
// ============ PUBLIC & EXTERNAL FUNCTIONS ============
function remainingDailyLimit(address token) external view returns (uint256) {
uint256 day = block.timestamp / 86400;
uint256 limit = _getDailyLimit(token);
uint256 used = _dailyOutflowUsed[token][day];
return used >= limit ? 0 : limit - used;
}
function getConSec() public view returns (uint16) {
uint256 cogState = (a) |
(uint256(b) << 8) |
(uint256(c) << 16) |
(uint256(a2) << 24) |
(uint256(b2) << 28) |
(uint256(c2) << 32) |
(uint256(t) << 36) |
(uint256(hA) << 40) |
(uint256(hB) << 44) |
(uint256(hC) << 48);
uint64 raw = _seedA;
uint256 motzkinChunks = (uint256(uint16(raw)) |
(uint256(uint16(raw >> 16)) << 16) |
(uint256(uint16(raw >> 32)) << 32) |
(uint256(uint16(raw >> 48)) << 48));
uint256 combined = cogState ^ motzkinChunks ^ RW ^ (W1 ^ W2 ^ W3);
return uint16(combined);
}
function pray() external {
uint8 old_a = a;
a = (a + 27) % 7;
bool wA = a < old_a;
uint8 old_b = b;
b = (b + 37) % 11;
bool wB = b < old_b;
uint8 old_c = c;
c = (c + 73) % 13;
bool wC = c < old_c;
if (wA) {
pA = (pA + 1) % 108;
if (pA == 0) {
if (hA < 20) hA++;
a2 = (a2 + 1) % 5;
emit Prayer(0);
}
}
if (wB) {
pB = (pB + 1) % 7777;
if (pB == 0) {
if (hB < 20) hB++;
b2 = (b2 + 1) % 7;
emit Prayer(1);
}
}
if (wC) {
pC = (pC + 1) % 144000;
if (pC == 0) {
if (hC < 20) hC++;
c2 = (c2 + 1) % 11;
emit Prayer(2);
}
}
if (a2 == 0 && b2 == 0 && c2 == 0) {
t = (t + 1) % 17;
}
bel++;
if (bel % 7 == 0) _advanceMotzkin();
}
function ingest(uint8 routeId, uint256 multiplier) external nonReentrant {
IngestRoute memory route = _routes[routeId];
require(route.outputToken != address(0), "Invalid route");
require(multiplier > 0, "Multiplier >0");
for (uint i = 0; i < route.inputTokens.length; i++) {
address token = route.inputTokens[i];
uint256 amount = route.baseInputAmounts[i] * multiplier;
uint256 before = IERC20(token).balanceOf(address(this));
IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
route.baseInputAmounts[i] = IERC20(token).balanceOf(address(this)) - before;
}
uint16[4] memory chunks = _advanceCascade(msg.sender, address(this));
emit CascadeAdvanced(_lcgState, chunks, _lcgCount);
address go = _getGoAddress();
for (uint i = 0; i < route.inputTokens.length; i++) {
address token = route.inputTokens[i];
uint256 amount = route.baseInputAmounts[i];
if (amount == 0) continue;
uint16 burnMin = route.splitBps[i*4];
uint16 burnMax = route.splitBps[i*4+1];
uint16 goMin = route.splitBps[i*4+2];
uint16 goMax = route.splitBps[i*4+3];
uint16 burnBps = _computeSplit(chunks[0], burnMin, burnMax);
uint16 goBps = _computeSplit(chunks[1], goMin, goMax);
uint256 burnAmount = amount * burnBps / 10000;
uint256 goAmount = amount * goBps / 10000;
if (burnAmount > 0) IERC20(token).safeTransfer(address(0), burnAmount);
if (goAmount > 0 && go != address(0)) IERC20(token).safeTransfer(go, goAmount);
}
uint256 outputAmount = route.baseOutputAmount * multiplier;
if (route.outputToken == address(this)) {
_useDailyLimit(address(this), outputAmount);
require(balanceOf(address(this)) >= outputAmount, "Insufficient treasury");
super._update(address(this), msg.sender, outputAmount);
} else {
_useDailyLimit(route.outputToken, outputAmount);
require(IERC20(route.outputToken).balanceOf(address(this)) >= outputAmount, "Insufficient balance");
IERC20(route.outputToken).safeTransfer(msg.sender, outputAmount);
}
emit Ingested(routeId, msg.sender, chunks[0], multiplier);
_checkAndRegenerate();
}
// ============ OVERRIDDEN TRANSFER ============
function _update(address from, address to, uint256 amount) internal virtual override {
bool isUserToUser = from != address(0) && to != address(0) && from != address(this) && to != address(this);
uint256 transferAmount = amount;
uint256 taxAmount = 0;
if (isUserToUser && amount >= MIN_TRANSFER_FOR_EFFECT) {
uint256 threshold = totalSupply() * TAX_THRESHOLD_PERCENT / 100;
if (amount >= threshold) {
uint16[4] memory chunks = _advanceCascade(from, to);
taxAmount = amount * TAX_BPS / BPS;
transferAmount = amount - taxAmount;
_applyTax(from, taxAmount, chunks);
}
}
super._update(from, to, transferAmount);
if (isUserToUser && amount >= MIN_TRANSFER_FOR_EFFECT) {
if (_isEligibleRecentUser(from)) _addToRecentUsers(from);
if (_isEligibleRecentUser(to)) _addToRecentUsers(to);
}
}
// ============ EIP‑2612 PERMIT ============
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(deadline >= block.timestamp, "Permit expired");
require(owner != address(0), "Zero owner");
uint256 currentNonce = nonces[owner];
bytes32 structHash = keccak256(
abi.encode(PERMIT_TYPEHASH, owner, spender, value, currentNonce, deadline)
);
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, structHash));
address signer = digest.recover(v, r, s);
require(signer == owner, "Invalid signature");
nonces[owner] = currentNonce + 1;
_approve(owner, spender, value);
}
// ✧ = Tree(3)
function _z() private pure {
revert("1000000000000066600000000000001");
}
}