Skip to content

Gas Fees Optimization: Reduce Storage Reads #74

@aniket866

Description

@aniket866
  • Issue: payInvoice reads invoice.tokenAddress and invoice.amountDue from storage multiple times.

  • Impact: Each SLOAD costs 100 gas (after the first cold load); repeated reads waste gas.

  • Fix: Cache the InvoiceDetails struct (or specific fields) in memory at the start of the function and read from the stack.

@kumawatkaran523 Please assign me this Optimization fix.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions