pawnft icon indicating copy to clipboard operation
pawnft copied to clipboard

Feedback from @wilsoncusack and @vasa-develop

Open Anish-Agnihotri opened this issue 2 years ago • 0 comments

Copying great feedback received via Twitter DMS:

Wilson

Vasa

  • [ ] The current code uses a max-sized struct, which prevents me from adding a isRepaid boolean without stack-overflowing. This is currently solved by using the tokenOwner struct param as a dirty field to represent a paid loan if it is equal to 0x0. Vasa recommended using address and uint arrays to reduce stack size:
struct PawnLoan {
  address[3] addrs; // [tokenAddress, tokenOwner, lender]
  uint256[9] uints; // [tokenId, interestRate, loanAmount, maxLoanAmount, loanAmountDrawn, firstBidTime, lastBidTime, historicInterest, loanCompleteTime]
  bool isRepaid;
}

Alternatively, I could also use a mapping to represent repaid loans which may offer cheaper lookup.

Anish-Agnihotri avatar Jul 25 '21 16:07 Anish-Agnihotri