wise-foundation / lending-audit

5 stars 4 forks source link

[WSY-06C] Non-Uniform Invocation Style #72

Open vm06007 opened 1 year ago

vm06007 commented 1 year ago

WSY-06C: Non-Uniform Invocation Style

Type Severity Location
Code Style WiseSecurity.sol:L441-L445

Description:

The referenced statement invokes the WiseSecurityHelper::checkBorrowLimit function using the key-value declaration style which is not applied anywhere else in the codebase.

Example:

checkBorrowLimit({
    _nftId: _nftId,
    _poolToken: _poolToken,
    _amount: 0
});

Recommendation:

We advise a uniform invocation style to be applied to the code, either using the key-value invocation style across all contracts in the repository or by omitting the key-value invocation style in the referenced statement. We consider either of the two solutions as adequate in remediating this exhibit.

vm06007 commented 1 year ago

This is used only when input arguments contain values that are not explicitly giving the meaning behind them. For example: true or false, or integer values without context. In this case team is more comfortable to have key-value style for such function calls to give context meaning to some values when necessary. Team considers this less readable, and only uses when necessary.

It is absolutely fine to use both approaches depending on the need. If function call does not have arguments without context team does ont use in majority of cases key->value pattern when calling function with parameters.

In particular case we can see the call uses 0 value and if done without property name it is hard to understand what is this argument represents. Key-Value gives context so in this case team feels more comfortable to use such pattern.