Area: Smart contract Β· lib.rs (extend_token_ttl, all storage writes)
Description
extend_token_ttl(env, _token_address, _index) ignores both of its arguments and merely extends
the instance TTL β a misleading no-op wrapper. The entire factory relies on a single instance-storage
TTL that is only extended when someone happens to call a state-writing function. If the factory sits
idle longer than the TTL window (MAX_TTL = 535_000 ledgers β 31 days), the instance entry β
containing all token records, metadata pointers, creator lists, and the admin/fee configuration β is
archived. Reads start failing (StateNotFound / missing-entry traps) and every user's token becomes
invisible to the app until someone performs a state restoration, a flow neither the contract, the
scripts, nor the frontend implements or documents. On mainnet, "the app went dark because nobody made
a transaction for a month" is a critical operational failure. This issue is the TTL/archival half of
the storage redesign in Issue 3.
Tasks
Acceptance criteria
- Every persistent entry a user's token depends on gets its TTL extended on access, proven by
ledger-advancing tests.
- An archived-entry recovery procedure exists, is documented, and is exercised by a test.
- No function signature advertises per-token TTL behavior it does not implement.
Issue 7 of 20 from the codebase audit tracked in ISSUES.md.
Area: Smart contract Β·
lib.rs(extend_token_ttl, all storage writes)Description
extend_token_ttl(env, _token_address, _index)ignores both of its arguments and merely extendsthe instance TTL β a misleading no-op wrapper. The entire factory relies on a single instance-storage
TTL that is only extended when someone happens to call a state-writing function. If the factory sits
idle longer than the TTL window (
MAX_TTL = 535_000ledgers β 31 days), the instance entry βcontaining all token records, metadata pointers, creator lists, and the admin/fee configuration β is
archived. Reads start failing (
StateNotFound/ missing-entry traps) and every user's token becomesinvisible to the app until someone performs a state restoration, a flow neither the contract, the
scripts, nor the frontend implements or documents. On mainnet, "the app went dark because nobody made
a transaction for a month" is a critical operational failure. This issue is the TTL/archival half of
the storage redesign in Issue 3.
Tasks
token's
TokenInfo/TokenIndex/Metadata/owner/supplykeys whenever that token is touched.extend_token_ttlso its behavior matches its name.extend_ttls(keys)-style maintenance entrypoint (or document use of the ledgerRestoreFootprint/ExtendFootprintTTLoperations) so anyone can keep entries alivepermissionlessly.
docs/): monitoring entry TTLs, restoring archived entries, and theexpected rent budget; wire a scheduled CI job or cron doc for TTL keep-alive on mainnet.
(b) restoration of archived entries works.
Acceptance criteria
ledger-advancing tests.
Issue 7 of 20 from the codebase audit tracked in
ISSUES.md.