Omniscia BlazeSwap Audit

Decentralized Exchange Security Audit

Audit Overview

We were tasked with performing an audit of the BlazeSwap codebase and in particular their specialized Uniswap-V2 based DEX implementation using an upgrade-able approach and integrating with the FTSO reward mechanism of the Flare Network.

Over the course of the audit, we identified certain flaws in relation to the way historical balances are tracked and utilized which may render them prone to flash-loan attacks as well as an issue with the exchange pair mechanism containing an incorrectly defined unchecked arithmetic code block.

We advise the BlazeSwap team to closely evaluate all minor-and-above findings identified in the report and promptly remediate them as well as consider all optimizational exhibits identified in the report.

Post-Audit Conclusion

The BlazeSwap team iterated over all findings identified in the report and provided us with a response document as well new commit hash to evaluate the fixes on as well as re-visit some exhibits that the BlazeSwap team wished to nullify.

We advise the BlazeSwap team to revisit all acknowledged as well as not remediated exhibits in case they wish to reconsider their stance on them.

Multiple new code segments were introduced in the latest commit hash that were not part of the original audit and represent new functionality introduced by the BlazeSwap team. These segments should not be considered as part of the audit engagement.

Contracts Assessed

Files in ScopeRepositoryCommit(s)
AddressStringUtil.sol (ASU)contracts736c8e3ece,
471d57af41,
8fc9c07208
BitMath.sol (BMH)contracts736c8e3ece,
471d57af41,
8fc9c07208
Babylonian.sol (BAB)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapMath.sol (BSM)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapPair.sol (BSP)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapERC20.sol (BSE)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapRouter.sol (BSR)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapFactory.sol (BSF)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapLibrary.sol (BSL)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapManager.sol (CON)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapBasePair.sol (BSB)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapMulticall.sol (COT)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapDelegation.sol (BSD)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapFtsoReward.sol (BFR)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapBaseFactory.sol (BBF)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapBaseManager.sol (BBM)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapFAssetReward.sol (BSA)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapFlareLibrary.sol (BFL)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapERC20Snapshot.sol (BSC)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapOracleLibrary.sol (BSO)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapRewardLibrary.sol (BRL)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapRewardManager.sol (BRM)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapDelegationPlugin.sol (BDP)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapFtsoRewardPlugin.sol (BFP)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapFAssetRewardPlugin.sol (BFA)contracts736c8e3ece,
471d57af41,
8fc9c07208
BlazeSwapLiquidityMathLibrary.sol (BLM)contracts736c8e3ece,
471d57af41,
8fc9c07208
Configurable.sol (COF)contracts736c8e3ece,
471d57af41,
8fc9c07208
CentrallyConfigurable.sol (CCE)contracts736c8e3ece,
471d57af41,
8fc9c07208
Delegator.sol (DEL)contracts736c8e3ece,
471d57af41,
8fc9c07208
DelegatedCalls.sol (DCS)contracts736c8e3ece,
471d57af41,
8fc9c07208
DelegateCallHelper.sol (DCH)contracts736c8e3ece,
471d57af41,
8fc9c07208
FullMath.sol (FMH)contracts736c8e3ece,
471d57af41,
8fc9c07208
FixedPoint.sol (FPT)contracts736c8e3ece,
471d57af41,
8fc9c07208
Math.sol (MAT)contracts736c8e3ece,
471d57af41,
8fc9c07208
ParentRelation.sol (PRN)contracts736c8e3ece,
471d57af41,
8fc9c07208
ReentrancyLock.sol (RLK)contracts736c8e3ece,
471d57af41,
8fc9c07208
SafeERC20Namer.sol (SER)contracts736c8e3ece,
471d57af41,
8fc9c07208
TransferHelper.sol (THR)contracts736c8e3ece,
471d57af41,
8fc9c07208
UQ112x112.sol (UQ2)contracts736c8e3ece,
471d57af41,
8fc9c07208

Audit Synopsis

SeverityIdentifiedAlleviatedPartially AlleviatedAcknowledged
3300
201109
181503
5500
0000

During the audit, we filtered and validated a total of 15 findings utilizing static analysis tools as well as identified a total of 31 findings during the manual review of the codebase. We strongly recommend that any minor severity or higher findings are dealt with promptly prior to the project's launch as they introduce potential misbehaviours of the system as well as exploits.

pie title Total Issues "Unknown" : 3 "Informational" : 20 "Minor" : 18 "Medium" : 5 "Major" : 0

The list below covers each segment of the audit in depth and links to the respective chapter of the report: