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
function _approve is redundant and should be removed #38
Describe the bug
The _approve function just checks the allowance. It is used before safeTransferFrom to ensure that the user has given the allowance to the contract. But the function can be removed because safeTransferFrom will revert if there is not required allowance. The function doesn't have any significance and wastes gas.
Describe the bug The
_approve
function just checks the allowance. It is used beforesafeTransferFrom
to ensure that the user has given theallowance
to the contract. But the function can be removed becausesafeTransferFrom
will revert if there is not required allowance. The function doesn't have any significance and wastes gas.Code reference https://github.com/tokamak-network/crossTrade/blob/fc11f6e37f93530a65924f8a89f3487fb2e68ea7/contracts/L1/L1CrossTrade.sol#L441-L449
https://github.com/tokamak-network/crossTrade/blob/fc11f6e37f93530a65924f8a89f3487fb2e68ea7/contracts/L2/L2CrossTrade.sol#L331-L339