Closed code423n4 closed 1 year ago
https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/Balancer.sol#L322
Rebalance may revert
The rebalance functon tightly integrate with stargate and layezero
https://stargateprotocol.gitbook.io/stargate/developers/cross-chain-swap-fee
however, the swap fee is not quoted and calculated
the swap
https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/Balancer.sol#L321
erc20.approve(address(router), _amount); router.swap( _dstChainId, _srcPoolId, _dstPoolId, _oft, //refund, _amount, _computeMinAmount(_amount, _slippage), _lzTxParams, _lzTxParams.dstNativeAddr, "0x" );
the user can easily either underpay the fee and swap does not go through or overpay the swap fee because lack of swap fee estimation
Manual Review
Token-Transfer
minhquanym marked the issue as low quality report
Insufficient proof
dmvt marked the issue as unsatisfactory: Insufficient quality
Lines of code
https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/Balancer.sol#L322
Vulnerability details
Impact
Rebalance may revert
Proof of Concept
The rebalance functon tightly integrate with stargate and layezero
https://stargateprotocol.gitbook.io/stargate/developers/cross-chain-swap-fee
however, the swap fee is not quoted and calculated
the swap
https://github.com/Tapioca-DAO/tapiocaz-audit/blob/bcf61f79464cfdc0484aa272f9f6e28d5de36a8f/contracts/Balancer.sol#L321
the user can easily either underpay the fee and swap does not go through or overpay the swap fee because lack of swap fee estimation
Tools Used
Manual Review
Recommended Mitigation Steps
Assessed type
Token-Transfer