From f352094c328401b16cd9aa7baa5a30e7df4d1606 Mon Sep 17 00:00:00 2001 From: Abba073 <168185628+Abba073@users.noreply.github.com> Date: Mon, 31 Aug 2026 10:40:44 +0000 Subject: [PATCH] fix(stream): emit storage_version in the created event (#462) An indexer can now read which storage layout a stream was initialized under directly from the created event, without a separate storage read. - events::created gains a storage_version: u32 parameter appended to the data tuple: (recipient, token, rate_per_second, start_time, end_time, storage_version) - initialize() passes storage::CURRENT_STORAGE_VERSION to events::created --- contracts/stream/src/events.rs | 2 ++ contracts/stream/src/lib.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/contracts/stream/src/events.rs b/contracts/stream/src/events.rs index 91c1d9eb..9ac8c222 100644 --- a/contracts/stream/src/events.rs +++ b/contracts/stream/src/events.rs @@ -38,6 +38,7 @@ pub fn created( rate_per_second: i128, start_time: u64, end_time: u64, + storage_version: u32, ) { assert_non_negative_amount(env, rate_per_second); @@ -50,6 +51,7 @@ pub fn created( rate_per_second, start_time, end_time, + storage_version, ), ); } diff --git a/contracts/stream/src/lib.rs b/contracts/stream/src/lib.rs index 81d5d290..965bf318 100644 --- a/contracts/stream/src/lib.rs +++ b/contracts/stream/src/lib.rs @@ -133,6 +133,7 @@ impl DripStream { rate_per_second, start_time, end_time, + storage::CURRENT_STORAGE_VERSION, ); // Write the entire stream state as a single struct — one storage