Jones AURA
Smart Contract Audit Report
Audit Summary
Jones AURA is a new platform which allows users to deposit AURA into various Vaults in order to earn rewards.
For this audit, we reviewed the Jones AURA project at commit f1ee911da1590083e053efb31ffa970d0e3fd60f on the team's private GitHub repository.
We previously reviewed the project team's GLP Vaults platform here.
Audit Findings
All findings have been resolved, though centralized aspects are present.
Date: March 27th, 2023.
Updated: March 28th, 2023 to refect changes from commit df2a2d9c9bcc69b31d6a79d19bf35ebb828795f6 to commit f1ee911da1590083e053efb31ffa970d0e3fd60f.Finding #1 - AuraCompounderStrategy - High (Resolved)
Description: After a rehypothecation occurs, the tracked Compounder Vault balance is incremented despite no additional AURA entering the platform, resulting in the Compounder Vault to have a larger tracked balance than its actual held AURA. This can also potentially result in underflow when calculating the Virtual Vault position.
Risk/Impact: Both the Compounder and Virtual share values will be inaccurate, resulting in inaccurate AURA withdrawal amounts when users redeem their shares.function afterRehyphotecate(uint256 _amount) external { _onlyRouter(); lsdBalance = lsdBalance + _amount; _relock(); }
Recommendation: The lsdBalance variable should not be incremented when a user rehypothecates tokenized withdrawal requests, but should be incremented by the rehypothecated AURA amount when executing a non-tokenized rehypothecation.
Resolution: The team has implemented the above recommendation.
Finding #2 - AuraCompounderStrategy - High (Resolved)
Description: In the harvest() function, auraBAL rewards are swapped for AURA for any accepted price. This allows the potential for the function to be frontrun by a malicious address.
Risk/Impact: A malicious user can execute a sandwich attack by swapping auraBAL tokens for AURA before harvest() is called, then selling after the swap is made. As a result, the contract may receive less AURA from a harvest than intended.
Recommendation: The harvest function should include a maximum AURA price parameter to be used to calculate a minimum amount to be received by the contract once the swap is made.
Resolution: The team has added a minimum amount out parameter to ensure that harvests cannot be front run.
Finding #3 - AuraCompounderStrategy - Informational (Resolved)
Description: The following conditional expression is redundant as the Whitelist status of the input token does not affect the result of the expression.
Recommendation: The above expression can be updated to the following for gas savings on each function call:if ( _isWhitelisted(_tokenIn) && address(swapper) != address(0) || !_isWhitelisted(_tokenIn) && address(swapper) != address(0) ) {
Resolution: The team has implemented the above recommendation.if (address(swapper) != address(0)) {
Finding #4 - AuraBaseCompounderVault - Informational (Resolved)
Description: The first requirement in the deposit() function contains a tautology as the deposit amount will never be greater than the maximum uint256, which is returned by the maxDeposit() function.
Recommendation: This statement can be removed for gas savings on each deposit.require(assets <= maxDeposit(receiver), "ERC4626: deposit more than max");
Resolution: The team has implemented the above recommendation.
Contracts Overview
AuraCompounderVault Contract:
- As the AuraLocker, Aura Token, auraBAL Token, BalancerVault, AuraBribe, RewardDistributor, and DelegateRegistry contracts used throughout the platform were not included in the scope of this audit, we are unable to provide an assessment with regards to their security or functionality.
AuraVirtualVault Contract:
- This contract implements ERC-4626 functionality to track tokenized deposits and withdrawals in the AuraRouter contract.
- When a deposit occurs, the depositor is minted shares to represent their share of the total AURA reserved for the Compounder Vault.
- The Operator is intended to be set as the AuraRouter contract, which is used to facilitate all interactions with the Vault.
- This contract only contains logic to burn and mint shares; the AuraRouter contract is intended to transfer AURA appropriately upon executing deposits and withdrawals.
- Only Operators can deposit and withdraw from the Vault.
- An Operator can mint or burn any amount of shares from any user at any time.
- The Governor can update the associated Strategy and Router addresses at any time.
- The Governor can update the rehypothecate incentive percentage to any amount at any time.
- The Governor can grant or revoke the Operator or Keeper Roles from any address at any time.
- The Governor can transfer the Governor Role to any address at any time.
AuraRouter Contract:
- This contract is used to track users' non-tokenized deposits and withdrawals executed from the AuraRouter contract.
- A user's tracked virtual vault shares are intended to represent their share of the platform's stored AURA.
- An Operator can mint or burn virtual shares from any user at any time.
- The Operator is intended to be set as the AuraRouter contract, which is used to facilitate all interactions with the Vault.
- The Governor can update the associated Strategy, Router, and Receiver addresses at any time.
- The Governor can grant or revoke the Operator or Keeper Roles from any address at any time.
- The Governor can transfer the Governor Role to any address at any time.
AuraCompounderStrategy Contract:
- This contract allows users to deposit AURA to either receive Compounder Vault shares or increase their tracked Virtual Vault balance, each representing their share of AURA in their respective Vaults.
- The user must specify whether the deposit is tokenized or not, which determines their vault choice.
- If making a tokenized deposit, the user is minted AuraCompounderVault shares based on their deposit amount in relation to the total tokenized deposits.
- For non-tokenized deposits, the user is instead minted AuraVirtualVault shares based on their deposit amount in relation to the total non-tokenized deposits.
- All deposited AURA is transferred to the associated AuraCompounderStrategy contract; they are not transferred to either Vault.
- In order to withdraw, users must first initiate a "withdrawal request", which will burn their specified Compounder or Virtual Vault shares and reserve their AURA token value.
- A user must wait at least 15 weeks from their last deposit time in order to initiate a withdrawal request.
- Once the "minimum withdrawal period" has passed from a user's last withdrawal request, they can withdraw any pending withdrawals they have made.
- Upon withdrawal, AURA is transferred from the associated AuraCompounderStrategy contract to the user.
- Instead of withdrawing their requested tokens, a user can also choose to "rehypothecate".
- At the time of rehypothecation, the user's AURA will remain in the Strategy contract. The user is then minted Compounder shares after a "retention fee" is taken.
- Two-thirds of the retention fee shares are burned, and the remaining third is sent to the TreasuryIncentive address.
- A user can rehypothecate any requested AURA at any time; they do not have to wait for the minimum withdrawal period to pass.
- Deposits, withdrawal requests, withdrawals, and rehypothecation is treated separately for each Vault. For example, if a user makes a tokenized deposit for Compounder shares, waits 15 weeks, then makes a non-tokenized deposit to increase their Virtual Vault balance, they will still be able to initiate a withdrawal request and redeem their Compounder shares without having to wait another 15 weeks.
- This contract is intended to be used behind an upgradeable proxy.
- The owner can update the IncentiveReceiver address at any time.
- The owner can update the minimum withdrawal period to any number of weeks at any time.
- The owner can pause the contract at any time, disabling deposits.
AuraBALSwapper Contract:
- This contract receives and manages all funds made from both tokenized and non-tokenized deposits.
- If the "relock" flag is enabled, any tokens in this contract that are not reserved for withdrawal requests are locked in the AuraLocker contract after any core contract functionality is executed.
- The AuraLocker contract is intended to earn rewards over time to increase the value of vault shares.
- As the AuraLocker Contract was not included in the scope of this audit, we are unable to provide an assessment with regards to security or functionality.
- When a withdrawal is made in the Router contract, tokens are transferred from this contract to the user.
- If not enough funds are held, the contract attempts to withdraw any unlocked tokens from the AuraLocker contract.
- As withdrawals will fail if the unlocked amount is still not sufficient, the team should ensure that the Router's deposit period is at least equal to the AuraLocker's lock time.
- Upon withdrawal from the Router contract, an "incentive withdrawal percentage" fee is first taken from the withdrawal amount. Two-thirds of this amount is transferred to the Incentive withdrawal recipient, and the remaining third is kept in the contract.
- The remaining tokens after this fee are transferred to the withdrawing user.
- The Keeper address can harvest any auraBAL rewards earned by funds stored in the AuraLocker contract at any time.
- The Keeper address can also swap any supported tokens held by the contract, excluding AURA, for any other supported tokens at any time.
- If the two tokens involved in the swap have an associated Swapper contract set, is it used to swap the tokens.
- If there is no associated Swapper for the tokens, the token to be swapped must be Whitelisted in the associated AuraBribe contract, in which case the associated OneInchV4Swapper contract is used.
- As the AuraBribe contract used for Whitelisting was not included in the scope of this audit, we are unable to provide an assessment with regards to security or functionality.
- When tokens are swapped for AURA, they are proportionally distributed to both the Compounder and Virtual Vaults after fees are taken.
- A Jones treasury fee and Aura treasury fee are taken from the total earned AURA, and a jAURAVoter fee is taken from the portion of earned tokens reserved for the Compounder Vault.
- The Keeper address can claim rewards from an associated RewardDistributor contract to execute claims for various reward tokens.
- Any AURA rewards are distributed in the same manner as tokens swapped for AURA.
- As the RewardDistributor contract was not included in the scope of this audit, we are unable to provide an assessment with regards to security or functionality.
- This contract is intended to be used behind an upgradeable proxy.
- The Keeper address can manually execute a relock if the flag is enabled.
- The owner can update the AuraRouter and fee addresses at any time.
- The owner can add or remove an associated Swapper contract from any tokens at any time.
- The owner can update any fee percentages to any amounts at any time.
- The owner can grant approval for any amount of any tokens in the contract to any address at any time.
- The owner can set this contract's delegate in the AuraLocker and DelegateRegistry contracts at any time.
- The owner can toggle the relock flag at any time.
OneInchV4Swapper Contract:
- This contract is intended to be used by the AuraCompounderStrategy contract to swap auraBAL rewards for AURA tokens.
- The contract uses its associated BalancerVault contract to swap auraBAL along the following path: [auraBAL, B-80BAL-20WETH, WETH, AURA].
- The resulting AURA is then transferred to the caller.
- As the BalancerVault contract used for the core swapping functionality was not included in the scope of this audit, we are unable to provide an assessment with regards to security or functionality.
UniswapV2Swapper Contract:
- This contract allows users to swap tokens using an associated 1inchAggregationRouterV4 contract.
- As the 1inchAggregationRouterV4 contract was not included in the scope of this audit, we are unable to provide an assessment with regards to security or functionality.
- In order to swap, the user provides an input token and amount, output token and minimum amount to receive, and encoded swap data.
- The contract then verifies the decoded data against the other provided values, then uses this data to execute a swap through the associated 1inchAggregationRouterV4 contract.
UniswapV3Swapper Contract:
- This contract allows the owner to set custom UniswapV2Router contracts and paths to be used for specific token swaps.
- Any user can execute a swap by specifying an input token, output token, amount, and minimum accepted amount to receive.
- If a custom Router contract and path have been set for the input and output token pair, they are used to execute the swap.
- The contract's default Router is used if the custom Router has not been set for the pair.
- If a custom path has not been set for the pair and one of the provided tokens is the contract's "default intermediary token", then the path is simply set to swap the input token for the output token.
- When a path has not been set and neither the input or output token is the default intermediary token, the input token is intended to first be swapped for the intermediary token before being swapped for the output token.
- Users can also swap using their own specified Router and Path if desired.
- The owner can update an input and output token pair's assigned Router and path at any time.
- The owner can update the default Router and intermediary token at any time.
- This contract is used to allow users to execute swaps in a similar fashion to the UniswapV2Swapper contract, but instead using a Uniswap V3 SwapRouter contract.
- The contract's SwapRouter contract is used for all token swaps, but custom paths can be set for specific input and output token pairs.
- If no custom path is set, no path is provided to the SwapRouter.
- The owner can update the custom path and fee for any input and output token pair at any time.
Audit Results
Vulnerability Category | Notes | Result |
---|---|---|
Arbitrary Jump/Storage Write | N/A | PASS |
Centralization of Control |
|
WARNING |
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 |
Contract Source Summary and Visualizations
Name |
Address/Source Code |
Visualized |
AuraCompounderVault |
||
AuraVirtualVault |
||
AuraRouter |
||
AuraCompounderStrategy |
||
AuraBALSwapper |
||
OneInchV4Swapper |
||
UniswapV2Swapper |
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 1800+ 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!
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.