Stargate is a cross-chain token swapping bridge implemented by leveraging the LayerZero networks’ arbitrary cross-chain messaging protocol. They aim to provide a unified interface for bridging tokens, along with cross-chain liquidity provisioning and instant finality guarantee of swaps.
The heart of stargate is the delta algorithm, keeping track of the token transfers and deposits to maintain a balanced liquidity pool for multiple chains. The liquidity is divided among the chains using a set of weights that can be adjusted, allowing liquidity to be concentrated among the high volume chains. Incentivization mechanisms also exist in case the liquidity is running low on some chain. For example, users are rewarded extra tokens when swapping from a chain with low liquidity.
Zellic conducted an audit for LayerZero from 21st February to 4th March, 2022 on the scoped contracts and discovered 7 findings. Fortunately, no critical issues were found. We applaud LayerZero for their attention to detail and diligence in maintaining high code quality standards. Of the 7 findings, 1 was of high impact, and 1 was of medium impact, 1 was of low impact. The remaining findings were informational in nature.
Stargate is a cross-chain token swap bridge with instant finality guarantee (IFG). A serious bug in its internal accounting could be critical as it might break the IFG. Thus, for this audit, we focused heavily on accounting errors in addition to the normal suite of cross-chain specific issues.
Our general overview of the code is that it was very well structured. The code coverage is high and tests are included for the majority of the functionality. The documentation was adequate, although it can be improved. We would recommend LayerZero to clearly document every function argument, as it was a huge source of confusion on our side when reading the contract initially.