Moonbots Pool
Smart Contract Audit Report
Audit Summary
Moonbots Pool is a new platform where users can deposit USDT to earn rewards and list tokens to be purchased for USDT.
For this audit, we reviewed the project team's MoonbootsCannavestPool contract at commit 6e7b420b9ae7b666703e05833dfe4b69a8d2a924 on the team's private GitHub repository.
Audit Findings
No findings were identified, though some centralized aspects are present.
Date: March 28th, 2023.
Contract Overview
- Users that have been added to the team's whitelist can initiate a deposit while the pool is active by specifying an amount of USDT to transfer to the rwaHandler address.
- The user must grant the contract a sufficient allowance in order for the deposit to successfully occur.
- The pool will be active for 365 days after the owner initiates the start time of the contract.
- The user will be minted a number of RWA tokens at a 1:1 ratio to the deposit amount.
- The RWA token has a maximum supply of 1 million.
- The rwaHandler address can specify an amount of USDT to distribute to the contract as rewards before the pool has ended.
- The rwaHandler must grant the contract a sufficient allowance in order for the distribute transaction to successfully occur.
- Users can claim their pending USDT rewards after rewards have been distributed to the contract via the rwaHandler address.
- Users can initiate a withdrawal once the owner has ended the pool. The user's full RWA token balance and any listed tokens are burned.
- The amount of USDT the user will receive is based on the Final amount specified by the owner upon ending the pool and the total token balance of the user in proportion to the total supply at the time the pool ended.
- The team must ensure USDT rewards are distributed to the contract to support claims for all users.
- Users can specify a number of RWA tokens to list for sale by specifying a USDT cost amount. The listed tokens are transferred to the contract.
- Users can delist any of their current listings which will return the listed tokens to the caller.
- Users can update the cost associated with any of their listings which will delist the original listing and create a new listing using the new cost value.
- Users that have been added to the team's whitelist can purchase an active listing by specifying the listing ID.
- The USDT is transferred from the caller to the lister for the cost value and the RWA tokens are transferred to the caller in exchange.
- The caller must grant the contract a sufficient USDT allowance in order for the purchase to successfully occur.
- The owner can end the pool after 365 days have passed since the contract's start time. The owner must specify a final amount of USDT to transfer to the contract during the end transaction.
- The owner can enable depositing after the start time is set and when the pool is currently active.
- The owner can disable depositing at any time.
- The owner can add/remove addresses from the contract's whitelist at any time.
- The owner can update the rwaHandler address at any time.
- As the contract is implemented with Solidity v0.8.x, it is safe from any possible overflows/underflows.
- The contract uses ReentrancyGuard to prevent reentrancy attacks in applicable functions.
Audit Results
Vulnerability Category | Notes | Result |
---|---|---|
Arbitrary Jump/Storage Write | N/A | PASS |
Centralization of Control | The team must ensure USDT rewards are distributed to the contract to support claims for all users. | PASS |
Compiler Issues | N/A | PASS |
Delegate Call to Untrusted Contract | N/A | PASS |
Dependence on Predictable Variables | N/A | PASS |
Ether/Token Theft | N/A | PASS |
Flash Loans | N/A | PASS |
Front Running | N/A | PASS |
Improper Events | N/A | PASS |
Improper Authorization Scheme | N/A | PASS |
Integer Over/Underflow | N/A | PASS |
Logical Issues | N/A | PASS |
Oracle Issues | N/A | PASS |
Outdated Compiler Version | N/A | PASS |
Race Conditions | N/A | PASS |
Reentrancy | N/A | PASS |
Signature Issues | N/A | PASS |
Sybil Attack | N/A | PASS |
Unbounded Loops | N/A | PASS |
Unused Code | N/A | PASS |
Overall Contract Safety | PASS |
Inheritance Chart
Function Graph
Functions Overview
($) = payable function
# = non-constant function
Int = Internal
Ext = External
Pub = Public
+ Context
- [Int] _msgSender
- [Int] _msgData
+ Ownable (Context)
- [Pub] #
- [Pub] owner
- [Int] _checkOwner
- [Pub] renounceOwnership #
- modifiers: onlyOwner
- [Pub] transferOwnership #
- modifiers: onlyOwner
- [Int] _transferOwnership #
+ ReentrancyGuard
- [Pub] #
- [Prv] _nonReentrantBefore #
- [Prv] _nonReentrantAfter #
- [Int] _reentrancyGuardEntered
+ [Int] IERC20
- [Ext] totalSupply
- [Ext] balanceOf
- [Ext] transfer #
- [Ext] allowance
- [Ext] approve #
- [Ext] transferFrom #
+ [Int] IERC20Metadata (IERC20)
- [Ext] name
- [Ext] symbol
- [Ext] decimals
+ ERC20 (Context, IERC20, IERC20Metadata)
- [Pub] #
- [Pub] name
- [Pub] symbol
- [Pub] decimals
- [Pub] totalSupply
- [Pub] balanceOf
- [Pub] transfer #
- [Pub] allowance
- [Pub] approve #
- [Pub] transferFrom #
- [Pub] increaseAllowance #
- [Pub] decreaseAllowance #
- [Int] _transfer #
- [Int] _mint #
- [Int] _burn #
- [Int] _approve #
- [Int] _spendAllowance #
- [Int] _beforeTokenTransfer #
- [Int] _afterTokenTransfer #
+ [Int] IERC20Permit
- [Ext] permit #
- [Ext] nonces
- [Ext] DOMAIN_SEPARATOR
+ [Lib] Address
- [Int] isContract
- [Int] sendValue #
- [Int] functionCall #
- [Int] functionCall #
- [Int] functionCallWithValue #
- [Int] functionCallWithValue #
- [Int] functionStaticCall
- [Int] functionStaticCall
- [Int] functionDelegateCall #
- [Int] functionDelegateCall #
- [Int] verifyCallResultFromTarget
- [Int] verifyCallResult
- [Prv] _revert
+ [Lib] SafeERC20
- [Int] safeTransfer #
- [Int] safeTransferFrom #
- [Int] safeApprove #
- [Int] safeIncreaseAllowance #
- [Int] safeDecreaseAllowance #
- [Int] forceApprove #
- [Int] safePermit #
- [Prv] _callOptionalReturn #
- [Prv] _callOptionalReturnBool #
+ SpecialRealWorldAssetReceipt (ERC20, Ownable, ReentrancyGuard)
- [Pub] #
- modifiers: ERC20
- [Pub] decimals
- [Ext] list #
- modifiers: nonReentrant,onlyActivePool
- [Ext] delist #
- modifiers: nonReentrant,onlyActiveListing,onlyActivePool
- [Ext] changePrice #
- modifiers: nonReentrant,onlyActiveListing,onlyActivePool
- [Ext] purchase #
- modifiers: nonReentrant,onlyWhitelisted,onlyActiveListing,onlyActivePool
- [Ext] whitelist #
- modifiers: onlyOwner
- [Ext] blacklist #
- modifiers: onlyOwner
- [Ext] getUserAmountListed
- [Pub] getUserTotalListings
- [Pub] getUserTotalPurchases
- [Ext] getListings
- [Ext] getUserListings
- [Ext] getUserPurchases
- [Prv] _validateIndexes
- [Int] _getUserAmountListed
- [Int] _clearUserAmountListed #
- [Int] _isPoolActive
- [Prv] _list #
- [Prv] _delist #
+ MoonbootsCannavestPool (SpecialRealWorldAssetReceipt)
- [Pub] #
- modifiers: SpecialRealWorldAssetReceipt
- [Ext] start #
- modifiers: onlyOwner
- [Ext] end #
- modifiers: onlyOwner
- [Ext] updateRealWorldAssetHandler #
- modifiers: onlyOwner
- [Ext] enableDepositing #
- modifiers: onlyOwner
- [Ext] disableDepositing #
- modifiers: onlyOwner
- [Ext] deposit #
- modifiers: nonReentrant,onlyWhitelisted
- [Ext] withdraw #
- modifiers: nonReentrant
- [Ext] claimRewards #
- modifiers: nonReentrant
- [Ext] distribute #
- modifiers: onlyRWAHandler
- [Pub] getEndDate
- [Ext] getReward
- [Ext] calculateFinalAmount
- [Pub] hasEnded
- [Int] _beforeTokenTransfer #
- [Prv] _calculateFinalAmount
- [Prv] _getTotalBalance
- [Prv] _getCirculatingSupply
- [Prv] _mergeRewards #
- [Prv] _holdCalculatedRewards #
- [Prv] _getHeldRewards
- [Prv] _getCalculatedRewards
- [Int] _isPoolActive
About SourceHat
SourceHat has quickly grown to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1300+ solidity smart contract audits covering all major project types and protocols, securing a total of over $50 billion U.S. dollars in on-chain value across 1500 projects!. Our firm is well-reputed in the community and is trusted as a top smart contract auditing company for the review of solidity code, no matter how complex. Our team of experienced solidity smart contract auditors performs audits for tokens, NFTs, crowdsales, marketplaces, gambling games, financial protocols, and more!
Contact us today to get a free quote for a smart contract audit of your project!
What is a SourceHat Audit?
Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A SourceHat Audit takes this a step further by verifying economic logic to ensure the stability of smart contracts and highlighting privileged functionality to create a report that is easy to understand for developers and community members alike.
How Do I Interpret the Findings?
Each of our Findings will be labeled with a Severity level. We always recommend the team resolve High, Medium, and Low severity findings prior to deploying the code to the mainnet. Here is a breakdown on what each Severity level means for the project:
- High severity indicates that the issue puts a large number of users' funds at risk and has a high probability of exploitation, or the smart contract contains serious logical issues which can prevent the code from operating as intended.
- Medium severity issues are those which place at least some users' funds at risk and has a medium to high probability of exploitation.
- Low severity issues have a relatively minor risk association; these issues have a low probability of occurring or may have a minimal impact.
- Informational issues pose no immediate risk, but inform the project team of opportunities for gas optimizations and following smart contract security best practices.