Gas optimizations
Switch the function parameters from memory to calldata functions wherever possible.
For example, the functions verifyRoute
, verifyReceipt
, verifyOrder
, hashReceipt
and hashOrder
receive arguments in memory; however, the arguments are not altered. Arguments that are received as memory need to first be copied to memory, which adds extra gas cost. We recommend switching to calldata
to reduce gas cost.
Remove an unnecessary nonReentrant
modifier from functions that are not vulnerable to a reentry attack.
The modifier can be removed for the following functions: registerAllowedRole
, registerAllowedSigner
, setEUSD
, addCustodyWallet
, removeCustodyWallet
, addSupportedAsset
, removeSupportedAsset
and removeRole