diff --git a/docs/contract/TRUSTCorona-annotated.sol b/docs/contract/TRUSTCorona-annotated.sol new file mode 100644 index 0000000..9034a71 --- /dev/null +++ b/docs/contract/TRUSTCorona-annotated.sol @@ -0,0 +1,587 @@ +// ===================================================================================== +// RM CIRCLE — TRUSTCorona smart contract, FULLY ANNOTATED +// ===================================================================================== +// +// Deployed on Polygon mainnet at 0x33BdAEEfd6d17d80aE53816c916dFb26c4fB2DAF +// Verified source: https://polygonscan.com/address/0x33BdAEEfd6d17d80aE53816c916dFb26c4fB2DAF#code +// +// WHAT THIS FILE IS +// Every line of executable code below is identical to the verified source. Only comments +// were added (lines starting with //, plus the /* */ blocks). If you compile the code with +// the comments stripped, you get the contract that is on the chain. +// +// Annotated 2026-09-26. Numbers quoted in comments were read from the live contract that +// day: premium registration 343.41 POL, standard 171.70 POL, admin surcharge 5%, +// premium upgrades 621.40 / 1,242.80 / 2,485.61 / 4,971.22 / 9,942.44 / 19,884.88 / +// 39,769.75 POL (standard is exactly half of each). +// +// THE WHOLE CONTRACT IN SIX SENTENCES +// 1. There are only TWO things a member can do: register() once, and upgrade() up to 7 times. +// 2. Registration pays 95% of the entry price to the SPONSOR you named, 5% to three company +// wallets, plus a separate admin surcharge (5% today) on top to the fee receiver. +// 3. Registration places you in a two-wide matrix at the shallowest open spot under your +// sponsor, left before right. +// 4. An upgrade pays 100% of its price to ONE upline: skip a number of uplines equal to your +// current level minus one, then the first upline whose level is high enough AND who has +// two directs gets all of it. +// 5. If nobody qualifies before the search reaches the root (or 16 hops), the whole payment +// goes to the fee receiver. Nothing is ever split, held or stored by the contract. +// 6. The owner can change five wallet/fee settings and nothing else: no prices, no payout +// rules, no member data. The code cannot be replaced (no proxy, no delegatecall, +// no selfdestruct). +// ===================================================================================== + +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; +// ^0.8.28: arithmetic overflow and underflow automatically revert (built into Solidity 0.8+), +// so no "SafeMath" library is needed. + +contract TRUSTCorona { + + // --------------------------------------------------------------------------------- + // CONSTANTS — baked into the bytecode. Nobody, including the owner, can ever change these. + // --------------------------------------------------------------------------------- + + uint8 public constant MAX_LEVELS = 8; // 8 levels: Scintilla(1) .. Corona(8) + uint8 public constant DIRECT_REQUIRED = 2; // directs needed to RECEIVE upgrade payments + uint16 public constant FOUNDER1_BPS = 100; // 1.00% of a registration's slot price + uint16 public constant FOUNDER2_BPS = 100; // 1.00% + uint16 public constant DEV_BPS = 300; // 3.00% + uint16 public constant BPS_BASE = 10000; // "basis points": 10000 = 100% + uint8 public constant MAX_MATRIX_DEPTH = 16; // an upgrade search climbs at most 16 uplines + uint8 public constant STANDARD = 1; // tier codes, chosen once at registration + uint8 public constant PREMIUM = 2; // premium pays and earns exactly 2x standard + + // --------------------------------------------------------------------------------- + // DATA KEPT FOR EVERY MEMBER + // --------------------------------------------------------------------------------- + + struct Member { + address account; // the wallet that owns this position (one wallet = one position) + uint48 joinedAt; // registration time; > 0 means "this position exists" + uint48 referrerId; // the SPONSOR: the ID passed into register(). Never changes. + uint48 uplineId; // the MATRIX PARENT: where the contract actually placed you. + // Equals referrerId unless you spilled over under someone else. + uint8 tier; // 1 = Standard, 2 = Premium. Fixed forever at registration. + uint8 level; // 1..8. Starts at 1, +1 per upgrade. + uint16 directCount; // how many people named THIS position as sponsor. + // Counts sponsorships, NOT matrix children. 2+ = "qualified". + uint256 totalEarned; // everything this position has received (referral + upline) + uint256 totalPaid; // everything this position has paid in (slot + upgrades; + // the admin surcharge is NOT included) + uint256 referralEarned; // received as a sponsor from registrations + uint256 uplineEarned; // received from downline upgrades + } + + struct IncomeRecord { // one row per payment received, readable by anyone + uint48 fromId; // the member whose action produced this payment + uint8 atLevel; // registration: 1. upgrade: levelIndex + 1 (see _payUpline) + uint8 fromTier; // the payer's tier + uint256 amount; // in wei (1 POL = 10^18 wei) + uint48 timestamp; + } + + // --------------------------------------------------------------------------------- + // SETTINGS — the only values the owner can change after deployment (see bottom) + // --------------------------------------------------------------------------------- + + address public owner; // can call the onlyOwner functions below. Nothing else. + address public founder1; // receives 1% of each registration's slot price + address public founder2; // receives 1% + address public developmentWallet; // receives 3% + address public feeReceiver; // receives: the admin surcharge, sponsor shares whose + // sponsor is the root, and any upgrade nobody qualifies for + + uint8 public adminChargePercent; // surcharge ADDED ON TOP of the registration price (5 today, + // max 50). Registration only; upgrades never pay it. + uint48 public totalMembers; // also the most recent ID issued. IDs are sequential. + uint48 public rootId; // the first position (ID 1), created at deployment + + // --------------------------------------------------------------------------------- + // PRICE TABLES — written once in the constructor. There is NO function to change them. + // --------------------------------------------------------------------------------- + + uint256[MAX_LEVELS] public standardCost; // registration price. Only index [0] is ever + uint256[MAX_LEVELS] public premiumCost; // used (register() always passes level 0). + uint256[MAX_LEVELS] public standardUpgrade; // [i] = price of moving from level i+1 to i+2 + uint256[MAX_LEVELS] public premiumUpgrade; // e.g. [0] = Scintilla -> Ascensus + + // --------------------------------------------------------------------------------- + // LOOKUPS + // --------------------------------------------------------------------------------- + + mapping(address => uint48) public memberId; // wallet -> position ID + mapping(uint48 => Member) public members; // position ID -> member data + mapping(uint48 => uint48[]) public directReferrals; // sponsor -> list of IDs they sponsored + mapping(uint48 => IncomeRecord[]) public incomeHistory; // ID -> every payment received + mapping(uint48 => uint48[2]) private _matrixChildren; // ID -> [left child, right child] + + // --------------------------------------------------------------------------------- + // EVENTS — permanent public log entries. The RM Circle site and Telegram feeds read these. + // --------------------------------------------------------------------------------- + + event MemberRegistered(uint48 indexed newId, address indexed account, uint48 indexed referrerId, uint8 tier); + event MemberUpgraded(uint48 indexed id, uint8 newLevel, uint8 tier); + event ReferralRewarded(uint48 indexed toId, uint48 indexed fromId, uint8 level, uint8 rewardTier, uint256 amount); + event UplineRewarded(uint48 indexed toId, uint48 indexed fromId, uint8 level, uint256 amount); + event FeesDistributed(uint256 f1, uint256 f2, uint256 dev); + event OwnershipTransferred(address indexed prev, address indexed next); + // Note: the five setX() functions at the bottom emit NO event. Their calls are still + // public transactions and appear in the contract's transaction list on Polygonscan. + + // --------------------------------------------------------------------------------- + // SAFETY GUARDS + // --------------------------------------------------------------------------------- + + bool private _locked; + modifier noReentrancy() { // stops a malicious receiving wallet from calling back + require(!_locked, "Reentrant call"); // into register()/upgrade() mid-payment + _locked = true; + _; + _locked = false; + } + + modifier onlyOwner() { // the ONLY special permission in the whole contract + require(msg.sender == owner, "Not owner"); + _; + } + + // --------------------------------------------------------------------------------- + // CONSTRUCTOR — runs exactly once, at deployment. Sets prices and wallets, creates ID 1. + // --------------------------------------------------------------------------------- + + constructor( + address _founder1, + address _founder2, + address _developmentWallet, + address _feeReceiver, + address _owner, + uint8 _adminChargePercent, + uint256[MAX_LEVELS] memory _standardCosts, + uint256[MAX_LEVELS] memory _standardUpgrades + ) { + require(_founder1 != address(0), "founder1 zero"); + require(_founder2 != address(0), "founder2 zero"); + require(_developmentWallet != address(0), "dev wallet zero"); + require(_feeReceiver != address(0), "feeReceiver zero"); + require(_owner != address(0), "owner zero"); + require(_adminChargePercent <= 50, "surcharge too high"); + + // Only STANDARD prices are passed in. Premium is derived as exactly 2x, which is why + // every premium number is double the standard one. + for (uint8 i = 0; i < MAX_LEVELS; i++) { + require(_standardCosts[i] > 0 || i == 7, "Standard cost zero"); + standardCost[i] = _standardCosts[i]; + premiumCost[i] = _standardCosts[i] * 2; + standardUpgrade[i] = _standardUpgrades[i]; + premiumUpgrade[i] = _standardUpgrades[i] * 2; + } + + founder1 = _founder1; + founder2 = _founder2; + developmentWallet = _developmentWallet; + feeReceiver = _feeReceiver; + owner = _owner; + adminChargePercent = _adminChargePercent; + + // Create the ROOT position, ID 1, owned by the owner wallet, already at Corona (8). + // Its sponsor and matrix parent are itself. The root is special in two ways: + // - sponsor shares for people it sponsors go to feeReceiver, not to the root's wallet + // - upgrade searches STOP when they reach it; the root never catches an upgrade + totalMembers += 1; + rootId = totalMembers; + Member storage root = members[rootId]; + root.account = _owner; + root.joinedAt = uint48(block.timestamp); + root.referrerId = rootId; + root.uplineId = rootId; + root.tier = PREMIUM; + root.level = MAX_LEVELS; + memberId[_owner] = rootId; + } + + // Accepts plain POL sent to the contract address. Nothing in the logic needs this; any POL + // that arrives this way sits in the contract until the owner calls withdrawDust(). + receive() external payable {} + + // ================================================================================= + // 1) REGISTER — join once, naming a sponsor and a tier + // ================================================================================= + // Worked example, Premium, today: the joiner sends exactly 360.58 POL. + // slot 343.41 + admin surcharge 5% 17.17 + // founder1 3.43 · founder2 3.43 · development 10.30 (5% of the slot) + // SPONSOR 326.24 (95% of the slot) + // feeReceiver 17.17 (the surcharge) + // Standard is exactly half: 180.28 total, sponsor 163.11. + // Everything is paid out inside this one transaction. The contract keeps nothing. + + function register(uint48 _referrerId, uint8 _tier) external payable noReentrancy { + require(memberId[msg.sender] == 0, "Already registered"); // one position per wallet + require(_tier == STANDARD || _tier == PREMIUM, "Invalid tier"); + require( + _referrerId == rootId || members[_referrerId].joinedAt > 0, // sponsor must exist + "Invalid referrer" + ); + + uint256 slotCost = _slotCost(_tier, 0); // 343.41 premium / 171.70 standard + uint256 adminFee = (slotCost * adminChargePercent) / 100; // 5% today + uint256 totalDue = slotCost + adminFee; + require(msg.value == totalDue, "Incorrect POL amount"); // must be EXACT, not "at least" + + // Issue the next sequential ID and record the member at level 1. + totalMembers += 1; + uint48 newId = totalMembers; + + Member storage m = members[newId]; + m.account = msg.sender; + m.joinedAt = uint48(block.timestamp); + m.referrerId = _referrerId; // the sponsor is whoever was named. Permanent. + m.tier = _tier; // permanent + m.level = 1; // Scintilla + m.totalPaid = slotCost; // surcharge not counted + memberId[msg.sender] = newId; + + // The SPONSOR gets the direct: this is what makes positions "qualified" (2+ directs). + // It happens here, at the sponsor, even if the new member spills over and is placed + // under someone else in the matrix. + directReferrals[_referrerId].push(newId); + members[_referrerId].directCount += 1; + + _placeInMatrix(newId, _referrerId); // find the matrix spot + _distributeFees(slotCost, newId, 0, _referrerId, _tier, true); // 5% company, 95% sponsor + if (adminFee > 0) _send(feeReceiver, adminFee); // the surcharge + + emit MemberRegistered(newId, msg.sender, _referrerId, _tier); + } + + // ================================================================================= + // 2) UPGRADE — move up one level; 100% of the price goes to ONE upline + // ================================================================================= + // No company fee, no split. The only way an upgrade goes to a company wallet is when + // no upline qualifies (see _payUpline). + + function upgrade() external payable noReentrancy { + uint48 id = memberId[msg.sender]; // the caller's own position + require(id != 0, "Not registered"); + Member storage m = members[id]; + require(m.level < MAX_LEVELS, "Already at max level"); + + uint8 currentLevel = m.level; + // Price is set by the BUYER's tier and current level. The receiver's tier does not + // matter: a Standard upline catching a Premium upgrade receives the Premium amount. + uint256 cost = _upgradeCost(m.tier, currentLevel - 1); + require(msg.value == cost, "Incorrect upgrade amount"); // exact amount only + + m.level += 1; // the level is raised BEFORE the payment is routed. + m.totalPaid += cost; // (a buyer is never their own upline, so order doesn't matter) + + // levelIndex = the level you are LEAVING, minus 1: + // Scintilla -> Ascensus : 0 Apex -> Fastigium : 4 + // Ascensus -> Fabrica : 1 Fastigium -> Vertex : 5 + // Fabrica -> Culmen : 2 Vertex -> Corona : 6 + // Culmen -> Apex : 3 + _payUpline(id, currentLevel - 1, cost); + + emit MemberUpgraded(id, m.level, m.tier); + } + + // Price lookups. Premium tables are 2x standard (set in the constructor). + function _slotCost(uint8 tier, uint8 levelIndex) private view returns (uint256) { + return tier == PREMIUM ? premiumCost[levelIndex] : standardCost[levelIndex]; + } + + function _upgradeCost(uint8 tier, uint8 levelIndex) private view returns (uint256) { + return tier == PREMIUM ? premiumUpgrade[levelIndex] : standardUpgrade[levelIndex]; + } + + // --------------------------------------------------------------------------------- + // Registration split: 1% + 1% + 3% to company wallets, the remaining 95% to the sponsor. + // Called ONLY from register() (isRegistration is always true in this contract). + // --------------------------------------------------------------------------------- + function _distributeFees( + uint256 cost, + uint48 fromId, + uint8 levelIndex, + uint48 referrerId, + uint8 rewardTier, + bool isRegistration + ) private { + uint256 f1Fee = (cost * FOUNDER1_BPS) / BPS_BASE; // 1% + uint256 f2Fee = (cost * FOUNDER2_BPS) / BPS_BASE; // 1% + uint256 devFee = (cost * DEV_BPS) / BPS_BASE; // 3% + uint256 reward = cost - f1Fee - f2Fee - devFee; // 95% (any rounding stays with the sponsor) + + _send(founder1, f1Fee); + _send(founder2, f2Fee); + _send(developmentWallet, devFee); + + emit FeesDistributed(f1Fee, f2Fee, devFee); + + if (isRegistration) { + _payReferrer(referrerId, fromId, levelIndex, rewardTier, reward); + } + } + + // --------------------------------------------------------------------------------- + // Pay the SPONSOR's 95%. No qualification check: a sponsor with 0 directs and at level 1 + // is paid in full. The only exception: if the sponsor is the root (ID 1), the 95% goes to + // feeReceiver instead of the root's wallet. + // --------------------------------------------------------------------------------- + function _payReferrer( + uint48 referrerId, + uint48 fromId, + uint8 levelIndex, + uint8 rewardTier, + uint256 amount + ) private { + if (referrerId == rootId || referrerId == 0) { + _send(feeReceiver, amount); + return; + } + + Member storage ref = members[referrerId]; + ref.totalEarned += amount; + ref.referralEarned += amount; + + incomeHistory[referrerId].push(IncomeRecord({ + fromId: fromId, + atLevel: levelIndex + 1, // always 1 for a registration + fromTier: rewardTier, + amount: amount, + timestamp: uint48(block.timestamp) + })); + + _send(ref.account, amount); + emit ReferralRewarded(referrerId, fromId, levelIndex + 1, rewardTier, amount); + } + + // --------------------------------------------------------------------------------- + // THE UPGRADE ROUTING RULE — who catches an upgrade payment + // --------------------------------------------------------------------------------- + // Walk up the MATRIX (uplineId, not the sponsor chain), starting at the buyer's parent. + // Step 1 Skip the first `levelIndex` uplines without looking at them at all. + // Step 2 From there, pay the first upline that has + // level > levelIndex (holds at least the level the buyer just LEFT) + // directCount >= 2 (qualified) + // That upline receives 100% and the function ends. + // Step 3 Uplines that fail step 2 are passed over (a "pass-up"); keep climbing. + // Stop If the walk reaches the root (ID 1), an empty upline, or 16 hops, + // 100% goes to feeReceiver. + // + // Example: #1191 (level 1) buys Ascensus -> levelIndex 0 -> skip none -> check its + // parent #1187: level 1 > 0 and 2 directs -> #1187 is paid 621.40 (premium). + // When #1191 later buys Fabrica -> levelIndex 1 -> skip #1187 -> check #1097: needs + // level > 1 (Ascensus or higher) and 2 directs. + // + // Consequences worth knowing: + // - Generation N below you pays you when they buy level N+1 (if nobody is skipped). + // So your LEVEL is your REACH: at level L you catch from generations 1..L. + // - The largest levelIndex is 6 (Vertex -> Corona). Normally nothing deeper than + // generation 7 pays you; deeper members only reach you by pass-up, and never + // beyond 16 hops. + // - Anyone less than levelIndex+2 generations below the root cannot pay a member at + // that level: the walk hits the root first and the payment goes to feeReceiver. + // E.g. a Corona upgrade (levelIndex 6) by a member within 7 generations of ID 1. + // --------------------------------------------------------------------------------- + function _payUpline( + uint48 fromId, + uint8 levelIndex, + uint256 amount + ) private { + uint48 upline = members[fromId].uplineId; // start at the buyer's matrix parent + + for (uint8 i = 0; i < MAX_MATRIX_DEPTH; i++) { // i = hops already taken (0..15) + if (upline == 0 || upline == rootId) break; // the root never catches: stop + + Member storage u = members[upline]; + + if (i < levelIndex) { // Step 1: skipped, not even checked + upline = u.uplineId; + continue; + } + + if (u.level > levelIndex && u.directCount >= DIRECT_REQUIRED) { // Step 2: qualifies + u.totalEarned += amount; + u.uplineEarned += amount; + + incomeHistory[upline].push(IncomeRecord({ + fromId: fromId, + atLevel: levelIndex + 1, // 1 = an Ascensus purchase, 2 = Fabrica, ... + fromTier: members[fromId].tier, + amount: amount, + timestamp: uint48(block.timestamp) + })); + + _send(u.account, amount); // 100% to this one upline + emit UplineRewarded(upline, fromId, levelIndex + 1, amount); + return; // done; nobody else is paid + } + + upline = u.uplineId; // Step 3: passed over, keep climbing + } + + _send(feeReceiver, amount); // nobody qualified in range + } + + // --------------------------------------------------------------------------------- + // MATRIX PLACEMENT — where a new member lands + // --------------------------------------------------------------------------------- + // Start at the sponsor. If the sponsor has an empty slot, the new member goes there + // (left first, then right). If not, search the sponsor's matrix breadth-first, one + // generation at a time, left to right, and use the first position with an open slot. + // This is "spillover": a new member can end up under someone the sponsor placed earlier. + // The sponsor still gets the direct and the 95% (see register()); only the matrix + // parent differs. + // --------------------------------------------------------------------------------- + function _placeInMatrix(uint48 newId, uint48 referrerId) private { + uint48 parent = _findOpenSlot(referrerId); + require(parent != 0, "No open matrix slot"); // see the queue limit note below + + members[newId].uplineId = parent; + + if (_matrixChildren[parent][0] == 0) { + _matrixChildren[parent][0] = newId; // left slot first + } else { + _matrixChildren[parent][1] = newId; // then right + } + } + + function _findOpenSlot(uint48 startId) private view returns (uint48) { + // Breadth-first search with a fixed 1,024-entry queue. In practice it can inspect + // roughly the first 511 positions of the sponsor's matrix. If ALL of those are full + // (a sponsor whose top 9 generations are completely filled), it returns 0 and the + // registration reverts with "No open matrix slot". Far beyond any org today. + uint48[] memory queue = new uint48[](1024); + uint256 head = 0; + uint256 tail = 0; + + queue[tail++] = startId; + + while (head < tail && tail < queue.length) { + uint48 current = queue[head++]; + uint48 left = _matrixChildren[current][0]; + uint48 right = _matrixChildren[current][1]; + + if (left == 0 || right == 0) return current; // first position with a free slot + + queue[tail++] = left; + queue[tail++] = right; + } + return 0; + } + + // --------------------------------------------------------------------------------- + // SENDING POL — every payment in the contract goes through here + // --------------------------------------------------------------------------------- + // If a transfer fails, the ENTIRE transaction reverts: the buyer keeps their POL (minus + // gas) and nothing is recorded. A payment can never be half-done. + function _send(address to, uint256 amount) private { + if (amount == 0 || to == address(0)) return; + (bool ok, ) = payable(to).call{value: amount}(""); + require(ok, "Transfer failed"); + } + + // ================================================================================= + // OWNER-ONLY FUNCTIONS — the complete list of what can change after deployment + // ================================================================================= + // These change WHERE company money goes and the SIZE of the registration surcharge. + // None of them can change a price, a payout rule, a member's position/level/directs, + // or redirect any member-to-member payment. + + function transferOwnership(address newOwner) external onlyOwner { // hand these powers over + require(newOwner != address(0), "Zero address"); // (cannot be renounced to 0) + emit OwnershipTransferred(owner, newOwner); + owner = newOwner; + } + + // Which wallet receives each company share. (The root position's wallet is NOT updated + // by any of these; ID 1 stays owned by the original owner wallet.) + function setFounder1(address _addr) external onlyOwner { require(_addr != address(0)); founder1 = _addr; } + function setFounder2(address _addr) external onlyOwner { require(_addr != address(0)); founder2 = _addr; } + function setDevelopmentWallet(address _addr) external onlyOwner { require(_addr != address(0)); developmentWallet = _addr; } + function setFeeReceiver(address _addr) external onlyOwner { require(_addr != address(0)); feeReceiver = _addr; } + + // The surcharge added on top of the registration price. 0..50%. Registration only. + function setAdminChargePercent(uint8 _pct) external onlyOwner { require(_pct <= 50); adminChargePercent = _pct; } + + // Sweep any POL sitting in the contract (only possible via receive()) to feeReceiver. + // Normal operation leaves nothing in the contract, so this is housekeeping only. + function withdrawDust() external onlyOwner { + uint256 bal = address(this).balance; + require(bal > 0, "Nothing to withdraw"); + _send(feeReceiver, bal); + } + + // ================================================================================= + // READ-ONLY HELPERS — free to call, change nothing. The website uses these. + // ================================================================================= + + // What a registration costs right now, split into slot + surcharge. + function registrationCost(uint8 _tier) external view returns (uint256 slotFee, uint256 adminFee, uint256 total) { + require(_tier == STANDARD || _tier == PREMIUM, "Invalid tier"); + slotFee = _slotCost(_tier, 0); + adminFee = (slotFee * adminChargePercent) / 100; + total = slotFee + adminFee; + } + + // The exact amount a given wallet must send to upgrade next. + function nextUpgradeCost(address _member) external view returns (uint256 cost) { + uint48 id = memberId[_member]; + require(id != 0, "Not registered"); + Member storage m = members[id]; + require(m.level < MAX_LEVELS, "Already max level"); + cost = _upgradeCost(m.tier, m.level - 1); + } + + function getMember(address _addr) external view returns (Member memory) { + return members[memberId[_addr]]; + } + + function getMemberById(uint48 _id) external view returns (Member memory) { + return members[_id]; + } + + function getIncomeHistory(uint48 _id) external view returns (IncomeRecord[] memory) { + return incomeHistory[_id]; // every payment this ID has received + } + + function getDirectReferrals(uint48 _id) external view returns (uint48[] memory) { + return directReferrals[_id]; // everyone this ID sponsored + } + + function getMatrixChildren(uint48 _id) external view returns (uint48 left, uint48 right) { + left = _matrixChildren[_id][0]; // 0 = empty slot + right = _matrixChildren[_id][1]; + } + + function getAllCosts() external view returns ( + uint256[MAX_LEVELS] memory standard, + uint256[MAX_LEVELS] memory premium, + uint256[MAX_LEVELS] memory stdUpgrade, + uint256[MAX_LEVELS] memory premUpgrade + ) { + return (standardCost, premiumCost, standardUpgrade, premiumUpgrade); + } + + function isRegistered(address _addr) external view returns (bool) { + return memberId[_addr] != 0; + } + + function tierName(uint8 _tier) external pure returns (string memory) { + if (_tier == STANDARD) return "Standard"; + if (_tier == PREMIUM) return "Premium"; + return "Unknown"; + } + + function levelName(uint8 _level) external pure returns (string memory) { + if (_level == 1) return "Scintilla"; + if (_level == 2) return "Ascensus"; + if (_level == 3) return "Fabrica"; + if (_level == 4) return "Culmen"; + if (_level == 5) return "Apex"; + if (_level == 6) return "Fastigium"; + if (_level == 7) return "Vertex"; + if (_level == 8) return "Corona"; + return "Unknown"; + } +}