After a line by line manual analysis and automated review, Guardian Audits has concluded that:
- Published
- Language
- Solidity
- Chains
- BNB Chain
- Sector
- DEXs and AMMs
- 0 Critical
- 0 High
- 4 Medium
- 4 Low
- 0 Informational
Scope
Overview
After a line by line manual analysis and automated review, Guardian Audits has concluded that:
- Bridges’ smart contracts have a LOW RISK SEVERITY
- Bridges’ smart contracts have an ACTIVE OWNERSHIP
- Bridges’ smart contract owner has multiple “write” privileges. Centralization risk correlated to the active ownership is MEDIUM
Findings 8
-
GLOBAL-1 Medium Centralization Risk Centralization / Privilege Partially resolved
Description
Privileged addresses have authority over many functions that may be used to negatively disrupt the project. Some important privileges include:
GoldenGate
ownercan withdraw all funds.ownercan set admins which are able to dilute allocation of other pools.ownercan set the migrator contract which can lead to loss of LP if malicious.
TokenVesting
ownercan arbitrarily set the fee and fee address which can lead to loss of user funds.
BridgesRef
feeToSettercan arbitrarily set the distribution rate.feeToSettercan withdraw any ERC-20 token in the contract.
BridgesRouter
feeSettercan set a arbitrary referral and dividend tracker contract.
Recommendation
Ensure that the privileged addresses are multi-sig and/or introduce timelock for improved community oversight. Optionally introduce
requirestatements to limit the scope of the exploits that can be carried out by the privileged addresses.Resolution
Bridges Team: - All centralized BNB and token withdrawal functions have been removed from the GoldenGate contract,
- The possibility to change fees on the TokenVault has been removed as well.
- The GoldenGate migrator has to be there for an eventual V2 in the future.
- For the same reason all update functions on the tracker are necessary.
- Every privileged address will be a multi-sig with trusted members in production.
-
GG-1 Medium Unable to Emergency Withdraw Denial-of-Service Resolved
Description
Due to
require(block.timestamp >= user.stakeUntil, "Locked")inemergencyWithdraw, if a user has LP tokens that are not locked alongside LP tokens that are indeed locked, the user would have to wait until their locked LP tokens become unlocked before they canemergencyWithdraw.Recommendation
If this is intended behavior, keep as is. Otherwise, refactor
emergencyWithdrawsuch that users may withdraw their unlocked positions.Resolution
Bridges Team: - This is indeed expected behavior, if you have a locked position you cannot
emergencyWithdrawany part of your position. -
FACT-1 Low Immutability Modifiers Mutability Resolved
Description
The
GoldenGateaddress is not set after the constructor and can therefore be declaredimmutable.Recommendation
Either make a setter for
GoldenGateor declare itimmutable.Resolution
Bridges Team: - Implemented a setter for
GoldenGate. -
PAIR-1 Medium Diluted Dividends Logical Error Resolved
Description
The rewards for the
BridgesPaircontract are ignored on line 232 by adjusting therewardDebt, but they are not excluded in themagnifiedDividendPerSharecalculation, therefore decreasing the dividends received by every other holder.Recommendation
Subtract the
BridgesPair’s balance from thetotalSupplyon line 229.Resolution
Bridges Team: - Removed the
BridgesPaircontract balance from the dividends calculation. -
PAIR-2 Low Mutability Modifiers Mutability Resolved
Description
nullAddressis not changed anywhere and can therefore be declared constant.Recommendation
Declare
nullAddressconstant.Resolution
Bridges Team: - Declared
nullAddressconstant. -
PAIR-3 Low Superfluous Code Optimization Resolved
Description
The
UserInfostruct now only contains arewardDebt, therefore theuserInfomapping can simply be a mapping ofaddress => uintwhere theuintis therewardDebt.Recommendation
Delete the
UserInfostruct and convert theuserInfomapping to a simpleaddress => uintmapping storing therewardDebtdirectly.Resolution
Bridges Team: - The mapping is now simply
rewardDebt. -
PAIR-4 Low Superfluous Code Optimization Resolved
Description
The
sendToGate,sendToGateFrom0,sendToDevFromGate, andsendToDevFrom0functions all do the same thing just with different addresses.Recommendation
Make one function that does this computation that accepts configurable addresses as arguments and add a
requirestatement to limit the scope of which addresses can be used.Resolution
Bridges Team: - Combined these functions into one
withdrawSpecialfunction. -
BRT-1 Medium Unexpected AmountOut Logical Error Resolved
Description
Because the
tradingFeeis taken after the calculation ofgetAmountsIn, the user will receive1000-tradingFee/10% ofamountOut, rather than getting the wholeamountOut. If thetradingFeeis 30, the user will receive only 97% of the specifiedamountOut.Recommendation
If it is desired to receive the
amountOutat minimum, take the fee in the same manner as ingetAmountsIn, where theamountInis simply increased in order to maintain theamountOut.Resolution
Bridges Team: - Removed the fee calculation logic as 3% slippage is handled on the frontend.
No findings match.
More from Bridges Exchange
Put your code through the same review.
This review started with a conversation about scope. Tell us what you are building and we will plan yours with you.
