diff --git a/contract/src/migrate.rs b/contract/src/migrate.rs index e2ef176..23b47a1 100644 --- a/contract/src/migrate.rs +++ b/contract/src/migrate.rs @@ -5,7 +5,18 @@ impl Contract { #[init(ignore_state)] #[private] pub fn migrate() -> Self { - let state: Self = env::state_read().unwrap(); + let mut state: Self = env::state_read().unwrap(); + + let users = state.users.len(); + for user_id in 0..users { + let period_data = state.period_data(user_id, &"102024".to_string()); + if let Some(period_data) = period_data { + state.sloths_per_period.insert( + (user_id, "rosctober2024".to_string()), + VersionedUserPeriodData::V2(period_data), + ); + } + } state } diff --git a/server/src/contract_pull.rs b/server/src/contract_pull.rs index a1f79c3..f875c0e 100644 --- a/server/src/contract_pull.rs +++ b/server/src/contract_pull.rs @@ -22,6 +22,7 @@ async fn fetch_and_store_users( let periods = [TimePeriod::Month, TimePeriod::Quarter, TimePeriod::AllTime] .into_iter() .map(|e| e.time_string(timestamp as u64)) + .chain(std::iter::once(String::from("rosctober2024"))) .collect(); let users = near_client .users(periods)