Skip to content

Feature: Add smart contract storage optimization with TTL management #85

@Smartdevs17

Description

@Smartdevs17

Problem

Smart contract storage entries don't have explicit TTL (time-to-live) management. Soroban charges rent for persistent storage, and unused entries waste funds.

Context

Efficient storage management reduces operational costs and keeps the contract lean.

Proposed Solution

  1. Set appropriate TTLs for different data types
  2. Implement cleanup functions for expired data
  3. Use temporary storage for short-lived data (e.g., flash loan guards)
  4. Use instance storage for frequently accessed globals

Acceptance Criteria

  • Storage types chosen appropriately (temporary vs persistent vs instance)
  • TTL set for all persistent entries
  • Cleanup function for expired entries
  • Tests verify TTL behavior

Technical Notes

  • Files: All contract modules that use env.storage()
  • Soroban storage types: temporary, persistent, instance

Constraints

  • Must not delete data that's still needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programenhancementNew feature or requestmediumDifficulty: Mediumsmart-contractsSoroban smart contracts

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions