docs: neutral AI review prompt for the RM Circle contract
Plain-text prompt plus the full verified source with line numbers, so anyone can paste it into an AI of their choice and get an independent read of how the contract works. Contains questions and scenarios, none of our conclusions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,478 @@
|
|||||||
|
RM CIRCLE SMART CONTRACT: INDEPENDENT REVIEW PROMPT
|
||||||
|
====================================================
|
||||||
|
|
||||||
|
Copy everything in this file (this prompt AND the source code at the bottom) and paste it
|
||||||
|
into the AI of your choice as one message.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
PROMPT
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
You are reviewing a Solidity smart contract that is deployed and running on the Polygon
|
||||||
|
blockchain. I want an independent, neutral explanation of exactly how it works, based ONLY
|
||||||
|
on the source code below.
|
||||||
|
|
||||||
|
Ground rules:
|
||||||
|
- Base every statement on the code. Cite the function name and line number for each claim.
|
||||||
|
- Do not rely on marketing material, a compensation-plan document, or what the contract
|
||||||
|
"is supposed to" do. If the code and a common expectation differ, say what the code does.
|
||||||
|
- If something cannot be determined from the code alone, say so plainly instead of guessing.
|
||||||
|
- Show your reasoning step by step for each scenario. Don't just state the answer.
|
||||||
|
|
||||||
|
Background you can rely on:
|
||||||
|
- Deployed at 0x33BdAEEfd6d17D80aE53816c916dFb26c4fB2DAF on Polygon mainnet. The source is
|
||||||
|
verified on Polygonscan: https://polygonscan.com/address/0x33BdAEEfd6d17D80aE53816c916dFb26c4fB2DAF#code
|
||||||
|
- The line numbers below match that verified source.
|
||||||
|
- Level names by number: 1 Scintilla, 2 Ascensus, 3 Fabrica, 4 Culmen, 5 Apex,
|
||||||
|
6 Fastigium, 7 Vertex, 8 Corona.
|
||||||
|
|
||||||
|
PART 1: What the contract does
|
||||||
|
1. List every function that can move POL (the native currency). For each: who can call it,
|
||||||
|
what it requires, and exactly where every unit of POL goes.
|
||||||
|
2. Registration: explain register(). How is the price made up? Who receives what share?
|
||||||
|
How is the new member placed in the matrix? What is the difference between referrerId
|
||||||
|
and uplineId, and which one does each part of the contract use?
|
||||||
|
3. Upgrades: explain upgrade() and _payUpline() in detail. What is levelIndex, how is it
|
||||||
|
calculated, and how is it used? Who receives the payment? Is it ever split?
|
||||||
|
4. What does "directCount" count, and where is it increased? What role does it play?
|
||||||
|
5. When does money go to feeReceiver instead of a member? List every case.
|
||||||
|
6. Can the contract keep or accumulate POL? If a balance can build up, how, and how can it
|
||||||
|
leave?
|
||||||
|
|
||||||
|
PART 2: What can and cannot change
|
||||||
|
7. Is there any way to change the contract's code, prices, or payout rules after
|
||||||
|
deployment (proxy, delegatecall, selfdestruct, setters, anything else)?
|
||||||
|
8. List every function restricted to the owner and exactly what each one can change.
|
||||||
|
Can the owner redirect or alter a payment between members?
|
||||||
|
|
||||||
|
PART 3: Work these scenarios step by step (cite lines)
|
||||||
|
Assume every member is Premium tier unless stated. Use the contract's own prices symbolically
|
||||||
|
(e.g. "premiumUpgrade[0]") if you don't know the numbers.
|
||||||
|
A. Member X holds level 1 and buys the next upgrade (to level 2, Ascensus). X's matrix parent
|
||||||
|
P holds level 1 and has 2 directs. Who is paid, how much, and why?
|
||||||
|
B. Same as A, but P has only 1 direct. P's matrix parent G holds level 2 and has 2 directs.
|
||||||
|
Who is paid?
|
||||||
|
C. Member X holds level 2 and buys level 3 (Fabrica). X's matrix parent P holds level 3
|
||||||
|
with 2 directs; P's parent G holds level 2 with 2 directs; G's parent H holds level 3
|
||||||
|
with 2 directs. Who is paid, and why not P?
|
||||||
|
D. A member buys level 8 (Corona). What level must the recipient hold? Which uplines are
|
||||||
|
skipped? What happens if the buyer is only 5 generations below the root position?
|
||||||
|
E. Member X was sponsored by S (X named S at registration), but S's matrix slots were full,
|
||||||
|
so X was placed under Y. When X buys its first upgrade, who is checked first: S or Y?
|
||||||
|
Who received X's registration payment?
|
||||||
|
F. A member at level 1 with 0 directs is named as the sponsor of a new registration. Do
|
||||||
|
they receive the registration payment? Why or why not?
|
||||||
|
|
||||||
|
PART 4: Plain-language summary
|
||||||
|
9. Summarize in plain English, as if to a non-technical member, how a person gets paid by
|
||||||
|
this contract. Keep it short.
|
||||||
|
10. List any behavior that people commonly misunderstand or might not expect, based on the
|
||||||
|
code.
|
||||||
|
11. Note any risks, limits or edge cases you see in the code (for example, loop limits,
|
||||||
|
failure modes, anything that can make a transaction revert).
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
CONTRACT SOURCE (verified on Polygonscan; line numbers added for reference)
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 | // SPDX-License-Identifier: MIT
|
||||||
|
2 | pragma solidity ^0.8.28;
|
||||||
|
3 |
|
||||||
|
4 | contract TRUSTCorona {
|
||||||
|
5 |
|
||||||
|
6 | uint8 public constant MAX_LEVELS = 8;
|
||||||
|
7 | uint8 public constant DIRECT_REQUIRED = 2;
|
||||||
|
8 | uint16 public constant FOUNDER1_BPS = 100;
|
||||||
|
9 | uint16 public constant FOUNDER2_BPS = 100;
|
||||||
|
10 | uint16 public constant DEV_BPS = 300;
|
||||||
|
11 | uint16 public constant BPS_BASE = 10000;
|
||||||
|
12 | uint8 public constant MAX_MATRIX_DEPTH = 16;
|
||||||
|
13 | uint8 public constant STANDARD = 1;
|
||||||
|
14 | uint8 public constant PREMIUM = 2;
|
||||||
|
15 |
|
||||||
|
16 | struct Member {
|
||||||
|
17 | address account;
|
||||||
|
18 | uint48 joinedAt;
|
||||||
|
19 | uint48 referrerId;
|
||||||
|
20 | uint48 uplineId;
|
||||||
|
21 | uint8 tier;
|
||||||
|
22 | uint8 level;
|
||||||
|
23 | uint16 directCount;
|
||||||
|
24 | uint256 totalEarned;
|
||||||
|
25 | uint256 totalPaid;
|
||||||
|
26 | uint256 referralEarned;
|
||||||
|
27 | uint256 uplineEarned;
|
||||||
|
28 | }
|
||||||
|
29 |
|
||||||
|
30 | struct IncomeRecord {
|
||||||
|
31 | uint48 fromId;
|
||||||
|
32 | uint8 atLevel;
|
||||||
|
33 | uint8 fromTier;
|
||||||
|
34 | uint256 amount;
|
||||||
|
35 | uint48 timestamp;
|
||||||
|
36 | }
|
||||||
|
37 |
|
||||||
|
38 | address public owner;
|
||||||
|
39 | address public founder1;
|
||||||
|
40 | address public founder2;
|
||||||
|
41 | address public developmentWallet;
|
||||||
|
42 | address public feeReceiver;
|
||||||
|
43 |
|
||||||
|
44 | uint8 public adminChargePercent;
|
||||||
|
45 | uint48 public totalMembers;
|
||||||
|
46 | uint48 public rootId;
|
||||||
|
47 |
|
||||||
|
48 | uint256[MAX_LEVELS] public standardCost;
|
||||||
|
49 | uint256[MAX_LEVELS] public premiumCost;
|
||||||
|
50 | uint256[MAX_LEVELS] public standardUpgrade;
|
||||||
|
51 | uint256[MAX_LEVELS] public premiumUpgrade;
|
||||||
|
52 |
|
||||||
|
53 | mapping(address => uint48) public memberId;
|
||||||
|
54 | mapping(uint48 => Member) public members;
|
||||||
|
55 | mapping(uint48 => uint48[]) public directReferrals;
|
||||||
|
56 | mapping(uint48 => IncomeRecord[]) public incomeHistory;
|
||||||
|
57 | mapping(uint48 => uint48[2]) private _matrixChildren;
|
||||||
|
58 |
|
||||||
|
59 | event MemberRegistered(uint48 indexed newId, address indexed account, uint48 indexed referrerId, uint8 tier);
|
||||||
|
60 | event MemberUpgraded(uint48 indexed id, uint8 newLevel, uint8 tier);
|
||||||
|
61 | event ReferralRewarded(uint48 indexed toId, uint48 indexed fromId, uint8 level, uint8 rewardTier, uint256 amount);
|
||||||
|
62 | event UplineRewarded(uint48 indexed toId, uint48 indexed fromId, uint8 level, uint256 amount);
|
||||||
|
63 | event FeesDistributed(uint256 f1, uint256 f2, uint256 dev);
|
||||||
|
64 | event OwnershipTransferred(address indexed prev, address indexed next);
|
||||||
|
65 |
|
||||||
|
66 | bool private _locked;
|
||||||
|
67 | modifier noReentrancy() {
|
||||||
|
68 | require(!_locked, "Reentrant call");
|
||||||
|
69 | _locked = true;
|
||||||
|
70 | _;
|
||||||
|
71 | _locked = false;
|
||||||
|
72 | }
|
||||||
|
73 |
|
||||||
|
74 | modifier onlyOwner() {
|
||||||
|
75 | require(msg.sender == owner, "Not owner");
|
||||||
|
76 | _;
|
||||||
|
77 | }
|
||||||
|
78 |
|
||||||
|
79 | constructor(
|
||||||
|
80 | address _founder1,
|
||||||
|
81 | address _founder2,
|
||||||
|
82 | address _developmentWallet,
|
||||||
|
83 | address _feeReceiver,
|
||||||
|
84 | address _owner,
|
||||||
|
85 | uint8 _adminChargePercent,
|
||||||
|
86 | uint256[MAX_LEVELS] memory _standardCosts,
|
||||||
|
87 | uint256[MAX_LEVELS] memory _standardUpgrades
|
||||||
|
88 | ) {
|
||||||
|
89 | require(_founder1 != address(0), "founder1 zero");
|
||||||
|
90 | require(_founder2 != address(0), "founder2 zero");
|
||||||
|
91 | require(_developmentWallet != address(0), "dev wallet zero");
|
||||||
|
92 | require(_feeReceiver != address(0), "feeReceiver zero");
|
||||||
|
93 | require(_owner != address(0), "owner zero");
|
||||||
|
94 | require(_adminChargePercent <= 50, "surcharge too high");
|
||||||
|
95 |
|
||||||
|
96 | for (uint8 i = 0; i < MAX_LEVELS; i++) {
|
||||||
|
97 | require(_standardCosts[i] > 0 || i == 7, "Standard cost zero");
|
||||||
|
98 | standardCost[i] = _standardCosts[i];
|
||||||
|
99 | premiumCost[i] = _standardCosts[i] * 2;
|
||||||
|
100 | standardUpgrade[i] = _standardUpgrades[i];
|
||||||
|
101 | premiumUpgrade[i] = _standardUpgrades[i] * 2;
|
||||||
|
102 | }
|
||||||
|
103 |
|
||||||
|
104 | founder1 = _founder1;
|
||||||
|
105 | founder2 = _founder2;
|
||||||
|
106 | developmentWallet = _developmentWallet;
|
||||||
|
107 | feeReceiver = _feeReceiver;
|
||||||
|
108 | owner = _owner;
|
||||||
|
109 | adminChargePercent = _adminChargePercent;
|
||||||
|
110 |
|
||||||
|
111 | totalMembers += 1;
|
||||||
|
112 | rootId = totalMembers;
|
||||||
|
113 | Member storage root = members[rootId];
|
||||||
|
114 | root.account = _owner;
|
||||||
|
115 | root.joinedAt = uint48(block.timestamp);
|
||||||
|
116 | root.referrerId = rootId;
|
||||||
|
117 | root.uplineId = rootId;
|
||||||
|
118 | root.tier = PREMIUM;
|
||||||
|
119 | root.level = MAX_LEVELS;
|
||||||
|
120 | memberId[_owner] = rootId;
|
||||||
|
121 | }
|
||||||
|
122 |
|
||||||
|
123 | receive() external payable {}
|
||||||
|
124 |
|
||||||
|
125 | function register(uint48 _referrerId, uint8 _tier) external payable noReentrancy {
|
||||||
|
126 | require(memberId[msg.sender] == 0, "Already registered");
|
||||||
|
127 | require(_tier == STANDARD || _tier == PREMIUM, "Invalid tier");
|
||||||
|
128 | require(
|
||||||
|
129 | _referrerId == rootId || members[_referrerId].joinedAt > 0,
|
||||||
|
130 | "Invalid referrer"
|
||||||
|
131 | );
|
||||||
|
132 |
|
||||||
|
133 | uint256 slotCost = _slotCost(_tier, 0);
|
||||||
|
134 | uint256 adminFee = (slotCost * adminChargePercent) / 100;
|
||||||
|
135 | uint256 totalDue = slotCost + adminFee;
|
||||||
|
136 | require(msg.value == totalDue, "Incorrect POL amount");
|
||||||
|
137 |
|
||||||
|
138 | totalMembers += 1;
|
||||||
|
139 | uint48 newId = totalMembers;
|
||||||
|
140 |
|
||||||
|
141 | Member storage m = members[newId];
|
||||||
|
142 | m.account = msg.sender;
|
||||||
|
143 | m.joinedAt = uint48(block.timestamp);
|
||||||
|
144 | m.referrerId = _referrerId;
|
||||||
|
145 | m.tier = _tier;
|
||||||
|
146 | m.level = 1;
|
||||||
|
147 | m.totalPaid = slotCost;
|
||||||
|
148 | memberId[msg.sender] = newId;
|
||||||
|
149 |
|
||||||
|
150 | directReferrals[_referrerId].push(newId);
|
||||||
|
151 | members[_referrerId].directCount += 1;
|
||||||
|
152 |
|
||||||
|
153 | _placeInMatrix(newId, _referrerId);
|
||||||
|
154 | _distributeFees(slotCost, newId, 0, _referrerId, _tier, true);
|
||||||
|
155 | if (adminFee > 0) _send(feeReceiver, adminFee);
|
||||||
|
156 |
|
||||||
|
157 | emit MemberRegistered(newId, msg.sender, _referrerId, _tier);
|
||||||
|
158 | }
|
||||||
|
159 |
|
||||||
|
160 | function upgrade() external payable noReentrancy {
|
||||||
|
161 | uint48 id = memberId[msg.sender];
|
||||||
|
162 | require(id != 0, "Not registered");
|
||||||
|
163 | Member storage m = members[id];
|
||||||
|
164 | require(m.level < MAX_LEVELS, "Already at max level");
|
||||||
|
165 |
|
||||||
|
166 | uint8 currentLevel = m.level;
|
||||||
|
167 | uint256 cost = _upgradeCost(m.tier, currentLevel - 1);
|
||||||
|
168 | require(msg.value == cost, "Incorrect upgrade amount");
|
||||||
|
169 |
|
||||||
|
170 | m.level += 1;
|
||||||
|
171 | m.totalPaid += cost;
|
||||||
|
172 |
|
||||||
|
173 | _payUpline(id, currentLevel - 1, cost);
|
||||||
|
174 |
|
||||||
|
175 | emit MemberUpgraded(id, m.level, m.tier);
|
||||||
|
176 | }
|
||||||
|
177 |
|
||||||
|
178 | function _slotCost(uint8 tier, uint8 levelIndex) private view returns (uint256) {
|
||||||
|
179 | return tier == PREMIUM ? premiumCost[levelIndex] : standardCost[levelIndex];
|
||||||
|
180 | }
|
||||||
|
181 |
|
||||||
|
182 | function _upgradeCost(uint8 tier, uint8 levelIndex) private view returns (uint256) {
|
||||||
|
183 | return tier == PREMIUM ? premiumUpgrade[levelIndex] : standardUpgrade[levelIndex];
|
||||||
|
184 | }
|
||||||
|
185 |
|
||||||
|
186 | function _distributeFees(
|
||||||
|
187 | uint256 cost,
|
||||||
|
188 | uint48 fromId,
|
||||||
|
189 | uint8 levelIndex,
|
||||||
|
190 | uint48 referrerId,
|
||||||
|
191 | uint8 rewardTier,
|
||||||
|
192 | bool isRegistration
|
||||||
|
193 | ) private {
|
||||||
|
194 | uint256 f1Fee = (cost * FOUNDER1_BPS) / BPS_BASE;
|
||||||
|
195 | uint256 f2Fee = (cost * FOUNDER2_BPS) / BPS_BASE;
|
||||||
|
196 | uint256 devFee = (cost * DEV_BPS) / BPS_BASE;
|
||||||
|
197 | uint256 reward = cost - f1Fee - f2Fee - devFee;
|
||||||
|
198 |
|
||||||
|
199 | _send(founder1, f1Fee);
|
||||||
|
200 | _send(founder2, f2Fee);
|
||||||
|
201 | _send(developmentWallet, devFee);
|
||||||
|
202 |
|
||||||
|
203 | emit FeesDistributed(f1Fee, f2Fee, devFee);
|
||||||
|
204 |
|
||||||
|
205 | if (isRegistration) {
|
||||||
|
206 | _payReferrer(referrerId, fromId, levelIndex, rewardTier, reward);
|
||||||
|
207 | }
|
||||||
|
208 | }
|
||||||
|
209 |
|
||||||
|
210 | function _payReferrer(
|
||||||
|
211 | uint48 referrerId,
|
||||||
|
212 | uint48 fromId,
|
||||||
|
213 | uint8 levelIndex,
|
||||||
|
214 | uint8 rewardTier,
|
||||||
|
215 | uint256 amount
|
||||||
|
216 | ) private {
|
||||||
|
217 | if (referrerId == rootId || referrerId == 0) {
|
||||||
|
218 | _send(feeReceiver, amount);
|
||||||
|
219 | return;
|
||||||
|
220 | }
|
||||||
|
221 |
|
||||||
|
222 | Member storage ref = members[referrerId];
|
||||||
|
223 | ref.totalEarned += amount;
|
||||||
|
224 | ref.referralEarned += amount;
|
||||||
|
225 |
|
||||||
|
226 | incomeHistory[referrerId].push(IncomeRecord({
|
||||||
|
227 | fromId: fromId,
|
||||||
|
228 | atLevel: levelIndex + 1,
|
||||||
|
229 | fromTier: rewardTier,
|
||||||
|
230 | amount: amount,
|
||||||
|
231 | timestamp: uint48(block.timestamp)
|
||||||
|
232 | }));
|
||||||
|
233 |
|
||||||
|
234 | _send(ref.account, amount);
|
||||||
|
235 | emit ReferralRewarded(referrerId, fromId, levelIndex + 1, rewardTier, amount);
|
||||||
|
236 | }
|
||||||
|
237 |
|
||||||
|
238 | function _payUpline(
|
||||||
|
239 | uint48 fromId,
|
||||||
|
240 | uint8 levelIndex,
|
||||||
|
241 | uint256 amount
|
||||||
|
242 | ) private {
|
||||||
|
243 | uint48 upline = members[fromId].uplineId;
|
||||||
|
244 |
|
||||||
|
245 | for (uint8 i = 0; i < MAX_MATRIX_DEPTH; i++) {
|
||||||
|
246 | if (upline == 0 || upline == rootId) break;
|
||||||
|
247 |
|
||||||
|
248 | Member storage u = members[upline];
|
||||||
|
249 |
|
||||||
|
250 | if (i < levelIndex) {
|
||||||
|
251 | upline = u.uplineId;
|
||||||
|
252 | continue;
|
||||||
|
253 | }
|
||||||
|
254 |
|
||||||
|
255 | if (u.level > levelIndex && u.directCount >= DIRECT_REQUIRED) {
|
||||||
|
256 | u.totalEarned += amount;
|
||||||
|
257 | u.uplineEarned += amount;
|
||||||
|
258 |
|
||||||
|
259 | incomeHistory[upline].push(IncomeRecord({
|
||||||
|
260 | fromId: fromId,
|
||||||
|
261 | atLevel: levelIndex + 1,
|
||||||
|
262 | fromTier: members[fromId].tier,
|
||||||
|
263 | amount: amount,
|
||||||
|
264 | timestamp: uint48(block.timestamp)
|
||||||
|
265 | }));
|
||||||
|
266 |
|
||||||
|
267 | _send(u.account, amount);
|
||||||
|
268 | emit UplineRewarded(upline, fromId, levelIndex + 1, amount);
|
||||||
|
269 | return;
|
||||||
|
270 | }
|
||||||
|
271 |
|
||||||
|
272 | upline = u.uplineId;
|
||||||
|
273 | }
|
||||||
|
274 |
|
||||||
|
275 | _send(feeReceiver, amount);
|
||||||
|
276 | }
|
||||||
|
277 |
|
||||||
|
278 | function _placeInMatrix(uint48 newId, uint48 referrerId) private {
|
||||||
|
279 | uint48 parent = _findOpenSlot(referrerId);
|
||||||
|
280 | require(parent != 0, "No open matrix slot");
|
||||||
|
281 |
|
||||||
|
282 | members[newId].uplineId = parent;
|
||||||
|
283 |
|
||||||
|
284 | if (_matrixChildren[parent][0] == 0) {
|
||||||
|
285 | _matrixChildren[parent][0] = newId;
|
||||||
|
286 | } else {
|
||||||
|
287 | _matrixChildren[parent][1] = newId;
|
||||||
|
288 | }
|
||||||
|
289 | }
|
||||||
|
290 |
|
||||||
|
291 | function _findOpenSlot(uint48 startId) private view returns (uint48) {
|
||||||
|
292 | uint48[] memory queue = new uint48[](1024);
|
||||||
|
293 | uint256 head = 0;
|
||||||
|
294 | uint256 tail = 0;
|
||||||
|
295 |
|
||||||
|
296 | queue[tail++] = startId;
|
||||||
|
297 |
|
||||||
|
298 | while (head < tail && tail < queue.length) {
|
||||||
|
299 | uint48 current = queue[head++];
|
||||||
|
300 | uint48 left = _matrixChildren[current][0];
|
||||||
|
301 | uint48 right = _matrixChildren[current][1];
|
||||||
|
302 |
|
||||||
|
303 | if (left == 0 || right == 0) return current;
|
||||||
|
304 |
|
||||||
|
305 | queue[tail++] = left;
|
||||||
|
306 | queue[tail++] = right;
|
||||||
|
307 | }
|
||||||
|
308 | return 0;
|
||||||
|
309 | }
|
||||||
|
310 |
|
||||||
|
311 | function _send(address to, uint256 amount) private {
|
||||||
|
312 | if (amount == 0 || to == address(0)) return;
|
||||||
|
313 | (bool ok, ) = payable(to).call{value: amount}("");
|
||||||
|
314 | require(ok, "Transfer failed");
|
||||||
|
315 | }
|
||||||
|
316 |
|
||||||
|
317 | function transferOwnership(address newOwner) external onlyOwner {
|
||||||
|
318 | require(newOwner != address(0), "Zero address");
|
||||||
|
319 | emit OwnershipTransferred(owner, newOwner);
|
||||||
|
320 | owner = newOwner;
|
||||||
|
321 | }
|
||||||
|
322 |
|
||||||
|
323 | function setFounder1(address _addr) external onlyOwner { require(_addr != address(0)); founder1 = _addr; }
|
||||||
|
324 | function setFounder2(address _addr) external onlyOwner { require(_addr != address(0)); founder2 = _addr; }
|
||||||
|
325 | function setDevelopmentWallet(address _addr) external onlyOwner { require(_addr != address(0)); developmentWallet = _addr; }
|
||||||
|
326 | function setFeeReceiver(address _addr) external onlyOwner { require(_addr != address(0)); feeReceiver = _addr; }
|
||||||
|
327 | function setAdminChargePercent(uint8 _pct) external onlyOwner { require(_pct <= 50); adminChargePercent = _pct; }
|
||||||
|
328 |
|
||||||
|
329 | function withdrawDust() external onlyOwner {
|
||||||
|
330 | uint256 bal = address(this).balance;
|
||||||
|
331 | require(bal > 0, "Nothing to withdraw");
|
||||||
|
332 | _send(feeReceiver, bal);
|
||||||
|
333 | }
|
||||||
|
334 |
|
||||||
|
335 | function registrationCost(uint8 _tier) external view returns (uint256 slotFee, uint256 adminFee, uint256 total) {
|
||||||
|
336 | require(_tier == STANDARD || _tier == PREMIUM, "Invalid tier");
|
||||||
|
337 | slotFee = _slotCost(_tier, 0);
|
||||||
|
338 | adminFee = (slotFee * adminChargePercent) / 100;
|
||||||
|
339 | total = slotFee + adminFee;
|
||||||
|
340 | }
|
||||||
|
341 |
|
||||||
|
342 | function nextUpgradeCost(address _member) external view returns (uint256 cost) {
|
||||||
|
343 | uint48 id = memberId[_member];
|
||||||
|
344 | require(id != 0, "Not registered");
|
||||||
|
345 | Member storage m = members[id];
|
||||||
|
346 | require(m.level < MAX_LEVELS, "Already max level");
|
||||||
|
347 | cost = _upgradeCost(m.tier, m.level - 1);
|
||||||
|
348 | }
|
||||||
|
349 |
|
||||||
|
350 | function getMember(address _addr) external view returns (Member memory) {
|
||||||
|
351 | return members[memberId[_addr]];
|
||||||
|
352 | }
|
||||||
|
353 |
|
||||||
|
354 | function getMemberById(uint48 _id) external view returns (Member memory) {
|
||||||
|
355 | return members[_id];
|
||||||
|
356 | }
|
||||||
|
357 |
|
||||||
|
358 | function getIncomeHistory(uint48 _id) external view returns (IncomeRecord[] memory) {
|
||||||
|
359 | return incomeHistory[_id];
|
||||||
|
360 | }
|
||||||
|
361 |
|
||||||
|
362 | function getDirectReferrals(uint48 _id) external view returns (uint48[] memory) {
|
||||||
|
363 | return directReferrals[_id];
|
||||||
|
364 | }
|
||||||
|
365 |
|
||||||
|
366 | function getMatrixChildren(uint48 _id) external view returns (uint48 left, uint48 right) {
|
||||||
|
367 | left = _matrixChildren[_id][0];
|
||||||
|
368 | right = _matrixChildren[_id][1];
|
||||||
|
369 | }
|
||||||
|
370 |
|
||||||
|
371 | function getAllCosts() external view returns (
|
||||||
|
372 | uint256[MAX_LEVELS] memory standard,
|
||||||
|
373 | uint256[MAX_LEVELS] memory premium,
|
||||||
|
374 | uint256[MAX_LEVELS] memory stdUpgrade,
|
||||||
|
375 | uint256[MAX_LEVELS] memory premUpgrade
|
||||||
|
376 | ) {
|
||||||
|
377 | return (standardCost, premiumCost, standardUpgrade, premiumUpgrade);
|
||||||
|
378 | }
|
||||||
|
379 |
|
||||||
|
380 | function isRegistered(address _addr) external view returns (bool) {
|
||||||
|
381 | return memberId[_addr] != 0;
|
||||||
|
382 | }
|
||||||
|
383 |
|
||||||
|
384 | function tierName(uint8 _tier) external pure returns (string memory) {
|
||||||
|
385 | if (_tier == STANDARD) return "Standard";
|
||||||
|
386 | if (_tier == PREMIUM) return "Premium";
|
||||||
|
387 | return "Unknown";
|
||||||
|
388 | }
|
||||||
|
389 |
|
||||||
|
390 | function levelName(uint8 _level) external pure returns (string memory) {
|
||||||
|
391 | if (_level == 1) return "Scintilla";
|
||||||
|
392 | if (_level == 2) return "Ascensus";
|
||||||
|
393 | if (_level == 3) return "Fabrica";
|
||||||
|
394 | if (_level == 4) return "Culmen";
|
||||||
|
395 | if (_level == 5) return "Apex";
|
||||||
|
396 | if (_level == 6) return "Fastigium";
|
||||||
|
397 | if (_level == 7) return "Vertex";
|
||||||
|
398 | if (_level == 8) return "Corona";
|
||||||
|
399 | return "Unknown";
|
||||||
|
400 | }
|
||||||
|
401 | }
|
||||||
Reference in New Issue
Block a user