melonjs icon indicating copy to clipboard operation
melonjs copied to clipboard

Standardise order of arguments for transactions

Open iherger opened this issue 5 years ago • 1 comments

To prevent usage errors, it would be good to standardise the order of the arguments for transactions.

I suggest to always use the sender address first, e.g.

public deposit(from: Address, amount: BigNumber) {}

In addition, if there are more than 2 (?) other arguments, we should pass an object with the arguments, i.e.

 public requestInvestment(from: Address, args: RequestInvestmentArguments) {}

This may be used / superseded by #61

iherger avatar Jan 13 '20 09:01 iherger

We can implement this rule (use Args type for more than 2 parameters) in #61. This is a good rule of thumb for code readability.

fubhy avatar Jan 13 '20 16:01 fubhy