Elephant Money Farm Depot
Smart Contract Audit Report
Elephant Money Farm Depot allows users to deposit BUSD in exchange for vested TRUNK amounts over time which are distributed using the associated FarmEngine contract.
For this audit, we reviewed Elephant Money's FarmDepot contract at commit ea642df955b927f972b94e4b1eabc930 on the team's GitHub repository.
No findings were identified, though some centralized aspects are present.
Date: December 3rd, 2022.
- As the FarmEngine and Oracle contracts were not included in the scope of this audit, we are unable to provide an assessment with regards to security or functionality.
- Users can deposit BUSD for vested TRUNK while the contract is not paused.
- If TRUNK is 2% or more below peg, 90% of the user's deposited BUSD is transferred to the BUSD Treasury, and 10% used for an immediate buyback.
- Resulting TRUNK from buybacks are transferred to the TRUNK Treasury.
- If TRUNK is at or above peg, the entire amount is transferred from the user to the BUSD Treasury.
- A user's TRUNK amount to be vested is calculated as the BUSD deposit amount equivalent, with the following exceptions:
- The TRUNK amount is multiplied by a maximum of 4 times the deposit amount, at the price of .25 BUSD / TRUNK. If the TRUNK price drops below .25, the multiplier will remain at 4.
- The TRUNK amount cannot be decreased lower than its BUSD equivalent, meaning users will receive a larger BUSD value in TRUNK if the TRUNK price surpasses 1 BUSD.
- TRUNK prices are calculated before any buybacks occur.
- A user's pending vested TRUNK can be claimed at any time, and is automatically claimed upon a deposit.
- Vested amounts are calculated through this contract, but are distributed using the associated FarmEngine contract.
- The associated Oracle contract is updated any time users are distributed TRUNK.
- The FarmEngine contract can update user referral rewards tracked in this contract at any time. Users are not paid referral rewards through this contract.
- The owner can pause the contract at any time.
- The owner can update the Router, FarmEngine, and Oracle addresses at any time.
|Arbitrary Jump/Storage Write||N/A||PASS|
|Centralization of Control||PASS|
|Delegate Call to Untrusted Contract||N/A||PASS|
|Dependence on Predictable Variables||N/A||PASS|
|Improper Authorization Scheme||N/A||PASS|
|Outdated Compiler Version||N/A||PASS|
|Overall Contract Safety||PASS|
($) = payable function # = non-constant function Int = Internal Ext = External Pub = Public + Context - [Int] _msgSender - [Int] _msgData + Ownable (Context) - [Pub]
# - [Pub] owner - [Pub] renounceOwnership # - modifiers: onlyOwner - [Pub] transferOwnership # - modifiers: onlyOwner - [Pub] updateRunStatus # - modifiers: onlyOwner + Whitelist (Ownable) - [Pub] addAddressToWhitelist # - modifiers: onlyOwner - [Pub] addAddressesToWhitelist # - modifiers: onlyOwner - [Pub] removeAddressFromWhitelist # - modifiers: onlyOwner - [Pub] removeAddressesFromWhitelist # - modifiers: onlyOwner + [Int] IUniswapV2Factory - [Ext] feeTo - [Ext] feeToSetter - [Ext] getPair - [Ext] allPairs - [Ext] allPairsLength - [Ext] createPair # - [Ext] setFeeTo # - [Ext] setFeeToSetter # + [Int] IUniswapV2Pair - [Ext] name - [Ext] symbol - [Ext] decimals - [Ext] totalSupply - [Ext] balanceOf - [Ext] allowance - [Ext] approve # - [Ext] transfer # - [Ext] transferFrom # - [Ext] DOMAIN_SEPARATOR - [Ext] PERMIT_TYPEHASH - [Ext] nonces - [Ext] permit # - [Ext] MINIMUM_LIQUIDITY - [Ext] factory - [Ext] token0 - [Ext] token1 - [Ext] getReserves - [Ext] price0CumulativeLast - [Ext] price1CumulativeLast - [Ext] kLast - [Ext] mint # - [Ext] burn # - [Ext] swap # - [Ext] skim # - [Ext] sync # - [Ext] initialize # + [Int] IUniswapV2Router01 - [Ext] factory - [Ext] WETH - [Ext] addLiquidity # - [Ext] addLiquidityETH ($) - [Ext] removeLiquidity # - [Ext] removeLiquidityETH # - [Ext] removeLiquidityWithPermit # - [Ext] removeLiquidityETHWithPermit # - [Ext] swapExactTokensForTokens # - [Ext] swapTokensForExactTokens # - [Ext] swapExactETHForTokens ($) - [Ext] swapTokensForExactETH # - [Ext] swapExactTokensForETH # - [Ext] swapETHForExactTokens ($) - [Ext] quote - [Ext] getAmountOut - [Ext] getAmountIn - [Ext] getAmountsOut - [Ext] getAmountsIn + [Int] IUniswapV2Router02 (IUniswapV2Router01) - [Ext] removeLiquidityETHSupportingFeeOnTransferTokens # - [Ext] removeLiquidityETHWithPermitSupportingFeeOnTransferTokens # - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens # - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($) - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens # + [Int] IERC20 - [Ext] mint # - [Ext] burn # - [Ext] totalSupply - [Ext] balanceOf - [Ext] transfer # - [Ext] allowance - [Ext] approve # - [Ext] transferFrom # + [Int] IElephantReserve - [Ext] mint # - [Ext] estimateMint - [Ext] redeem # - [Ext] redeemCredit # - [Ext] redeemCreditAsBacked # - [Ext] estimateRedemption - [Ext] estimateCollateralToCore - [Ext] estimateCoreToCollateral - [Ext] collateralizationRatio - [Ext] redeemCollateralCreditToWETH # + [Int] IRaffle - [Ext] add # + [Int] IFarmEngine - [Ext] updateAssetPrice # - [Ext] estimateBackedAmount - [Ext] available - [Ext] yield # - [Ext] estimateAPR - [Ext] estimateBackedToCollateral + [Int] ITreasury - [Ext] withdraw # - [Ext] withdrawTo # + [Int] IReferralReport - [Ext] reward_distribution # + SponsorData (Whitelist) - [Pub] # - modifiers: Ownable - [Ext] add # - modifiers: onlyWhitelisted - [Ext] settle # - modifiers: onlyWhitelisted + Treasury (Whitelist) - [Pub] # - modifiers: Ownable - [Ext] withdraw # - modifiers: onlyWhitelisted - [Ext] withdrawTo # - modifiers: onlyWhitelisted + Depot (Ownable, IReferralReport) - [Pub] # - modifiers: Ownable - [Pub] updateCollateralRouter # - modifiers: onlyOwner - [Ext] updateFarmEngine # - modifiers: onlyOwner - [Ext] updateOracle # - modifiers: onlyOwner - [Ext] getUser - [Ext] getInfo - [Pub] estimateBackedAmount - [Ext] deposit # - modifiers: isRunning - [Ext] claim # - [Ext] reward_distribution # - [Pub] available - [Prv] buyback # - [Prv] distributeYield # + ReferralData - [Pub] updateReferral # - [Pub] myReferrer - [Pub] isMyReferral - [Pub] hasReferrer - [Pub] referrerOf - [Pub] referralCountOf + AddressRegistry + [Int] IPcsPeriodicTwapOracle - [Ext] updatePath # - [Ext] updateAll # - [Ext] consultAmountsOut - [Ext] consult + FarmEngine (Whitelist, IFarmEngine) - [Pub] # - modifiers: Ownable - [Ext] updateReferralData # - modifiers: onlyOwner - [Ext] updateReserve # - modifiers: onlyOwner - [Ext] updateOracle # - modifiers: onlyOwner - [Ext] updateSponsorData # - modifiers: onlyOwner - [Pub] updateCollateralRouter # - modifiers: onlyOwner - [Pub] updatePrimaryScaler # - modifiers: onlyOwner - [Pub] updatePairReward # - modifiers: onlyOwner - [Pub] updatePrices # - [Ext] yield # - modifiers: onlyWhitelisted - [Ext] available - [Ext] estimateAPR - [Ext] updateAssetPrice # - modifiers: onlyWhitelisted - [Ext] estimateBackedAmount - [Ext] estimateBackedToCollateral - [Prv] processReferralBonus # - [Prv] scaleByPeg + [Lib] SafeMath - [Int] mul - [Int] div - [Int] sub - [Int] safeSub - [Int] add - [Int] max - [Int] min + [Lib] TransferHelper - [Int] safeTransferFrom # - [Int] safeTransfer # - [Int] safeApprove # - [Int] safeTransferETH #
SourceHat (formerly Solidity Finance - founded in 2020) 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.