tokamak-network / crossTrade

Cross Trade is a new core service for optimistic rollups that complements standard withdrawals and fast withdrawals. It is trustless and do not require extensive backend.
4 stars 1 forks source link

[non-critical] remove `require(dealData[_saleCount].provider == address(0)` where modifier `providerCheck` is applied #42

Closed usgeeus closed 3 months ago

usgeeus commented 3 months ago

Describe the bug You have repeated code that does the same thing.

Configuration

Impact wasting gas

Recommendation remove require(dealData[_saleCount].provider == address(0) where modifier providerCheck is applied

modifier providerCheck https://github.com/tokamak-network/crossTrade/blob/fc11f6e37f93530a65924f8a89f3487fb2e68ea7/contracts/L2/L2CrossTrade.sol#L61-L64

Lines of Codes https://github.com/tokamak-network/crossTrade/blob/fc11f6e37f93530a65924f8a89f3487fb2e68ea7/contracts/L2/L2CrossTrade.sol#L201-L204 https://github.com/tokamak-network/crossTrade/blob/fc11f6e37f93530a65924f8a89f3487fb2e68ea7/contracts/L2/L2CrossTrade.sol#L244-L247

Exploit Scenario Demo