Altron Audit
Smart Contract Address: TLgvqAd63mTmAEwFpUWiUCck2e2LffwU8L
Prepared By CubeBack Studio
Disclaimer
This text is not a call to participate in the project and it’s only a description of the smart contract work at the specified address. Remember that you do all the financial actions only at your own risk.
Description
Smart contract gives users an opportunity to invest to the contract any sum of money from 100 TRX and to receive dividends from 2% per day of the total sum of investments during 150 days.
Contractual bonus system allows to increase a daily percentage.
1. Hold bonus. There is profits growth by 0.1% per day if you're not withdrawing funds during 24 hours.
2. Fund bonus. Every participant's profit increases by 0.1% per 24 hours for each million of Tronos on contract balance.
3. Referral bonus. Your profit increases by 0.1% per 24 hours for each million of Tronos contributed by your referrals.
15% of each deposit is transferred to the owner's balance (TLqHYfWmaiWgszGP1guTwGgU3u96RgtpGb)
A 5-level referral system allows to receive interest from the deposits of your referrals in amount of 5% - 3% - 2% - 1% - 1% from the sum of the deposit.
Variables
<line>: <name> - <description>
143: ONE_DAY
- one day in seconds.
144: PROFIT_DAYS
- the period of activity investments.
145: MIN_DEPOSIT
- minimum deposit amount.
146: ONE_MILLION
- the criterion to increase bonuses.
148: PERCENT_DIVIDEND
- basic user profit.
149: PERCENT_BONUS
- the percentage that will be added to the daily bonus if the bonus conditions are met.
150: PERCENT_PROMOTE
- the percentage of deductions to the contract owner.
151: PERCENT_REFERRAL
- the percentage of referral rewards.
153: totalInvested
- total investment.
154: totalRewards
- the total amount of referral rewards.
156: promote
- address of the contract owner.
157: users
- the list of registered users contains the following information:
referrer
- referrer addressstatus
- user status (true
- registered |false
- not found)referrals
- number of referrals by levelrewards
- total amount of referral rewardsturnover
- total amount of referral investmentsinvested
- total amount of own investmentswithdrawn
- total amount of user withdrawalsdeposits
- information about each of the deposits (amount
- deposit amount,date
- deposit time)balance
- current balance of referral chargeslastDate
- time of the user's last output
Functional
<line>: <name> - <description>
163: constructor
- the function which activates upon creation of contract, establishes the owner of the contract and interest from referral fees as well as initializes the main user.
179: checkUserStatus
- the function checks if the requested host exists in the list of contract users. Returns false
if the user has not made a deposit yet and thus has not registered in the system, or true
if the user is found.
183: referralsCount
- the function returns the number of user referrals for all 5 levels.
193: getHoldBonus
- the function returns the hold bonus multiplier.
198: getFundBonus
- the function returns the fund bonus multiplier.
202: getRefBonus
- the function returns the referral bonus multiplier.
206: calculateProfit
- the function calculates the user's current profit from their investment, taking into account all bonuses (220: uint256 totalBonuses = getHoldBonus(userAddress) + getFundBonus() + getRefBonus(userAddress);
).
229: rewardReferrers
- a function that is triggered at the time of Deposit. Charges referrers a deposit fee according to their level (233: users[referrer].balance += reward;)
and updating the overall statistics of rewards (237: totalRewards += reward;)
.
244: register
- the function of user registration in the system, which is triggered at the first Deposit. If successful, it changes the user's status (250: users[msg.sender].status = true;)
and updates the referrer chain with the number of their referrals in the structure (257: users[referrer].referrals[i]++;)
.
265: deposit
- the function allows the user to create investment and, thus, to register in the system. The function takes any value of TRX, above or equal to the value of MIN_DEPOSIT
. The maximum possible number of deposits is restricted for one host. There can be no more than 100 deposits from one user in the system. In case of successful payment statistics of the user and the general contract investment statistics are updated. Referral rewards will be charged to all the referrers of the user who made a deposit. Its sum depends on the level of referrer and the sum of investment itself.
283: withdraw
- the function allows to withdraw funds from the internal balance of the contract. The sum of withdrawal depends on the result of function calculateProfit
fulfillment and referral balance. Successful function execution will reset to zero a hold bonus (290: users[msg.sender].lastDate = block.timestamp;)
.
Best Practices
1. Comments
Description
: Contract that was written by developers is not well commented (comments are missed for all functions of the contract and used libraries).
Effects
: No effect
Critical Severity
No errors or vulnerabilities affecting the described functionality of the contract were found.
Medium Severity
No warnings were noticed for owners and users
Minor Severity
1. Withdraw
Description
: The contract balance check is missed at the Withdraw function. It can cause a situation when a user with an amount of withdrawal greater than the contract balance will be unable to get anything. Usually in such a situation invest contract lets the user withdraw the contract balance.
Effects
: User with an amount for withdrawal greater than the contract balance will be unable to get anything
Code
: line 283
Audit Summary
The contracts have been found to be free of security issues. The contract has a well-formed structure. Gas usage is optimal. All tests run successfully with excellent code coverage.