Skip to content

Feedback from @wilsoncusack and @vasa-develop #3

@Anish-Agnihotri

Description

@Anish-Agnihotri

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions