diff --git a/src/incentives.rs b/src/incentives.rs index 7d614f72..541639e3 100644 --- a/src/incentives.rs +++ b/src/incentives.rs @@ -3,6 +3,7 @@ use crate::{ app::Nom, error::{Error, Result}, }; +use orga::migrate::MigrateFrom; use orga::{ coins::{Address, Amount, Coin, Take}, collections::{ChildMut, Map}, @@ -17,11 +18,27 @@ pub struct Incentives { accounts: Map, } -#[orga] +#[orga(version = 1)] pub struct Account { + #[orga(version(V0))] + testnet_participation: Coin, + + #[orga(version(V1))] testnet_participation: Part, } +impl MigrateFrom for AccountV1 { + fn migrate_from(old: AccountV0) -> orga::Result { + Ok(AccountV1 { + testnet_participation: Part { + locked: 0, + claimable: old.testnet_participation.amount.into(), + claimed: 0, + }, + }) + } +} + #[orga] impl Incentives { pub fn from_csv(data: &[u8], mut funds: Coin) -> Result {