@@ -3,16 +3,21 @@ module ol_framework::filo_migration {
33 use ol_framework::donor_voice;
44 use ol_framework::founder;
55 use ol_framework::page_rank_lazy;
6+ use ol_framework::reauthorization;
67 use ol_framework::slow_wallet;
7-
88 use ol_framework::vouch;
99 use std::signer;
1010 use std::error;
1111
1212 friend diem_framework ::transaction_validation ;
13+ #[test_only]
14+ friend ol_framework ::mock ;
1315
16+ /// Error codes
1417 /// Cannot be used by donor voice accounts
1518 const EDONOR_VOICE : u64 = 1 ;
19+ /// Cannot be used by accounts that have already been authorized for v8
20+ const EALREADY_AUTHORIZED : u64 = 2 ;
1621
1722 // Welcome to Level 8
1823
@@ -22,8 +27,17 @@ module ol_framework::filo_migration {
2227 // It's a journey, it's a race.
2328 public entry fun maybe_migrate (user_sig: &signer ) {
2429 // community wallets should not do this migration
25- assert !(!donor_voice::is_donor_voice (signer ::address_of (user_sig)), error::invalid_argument (EDONOR_VOICE ));
30+ let addr = signer ::address_of (user_sig);
31+ assert !(!donor_voice::is_donor_voice (addr), error::invalid_argument (EDONOR_VOICE ));
32+
33+ // don't allow a v8-migrated account to accidentally migrate again
34+ assert !(!reauthorization::is_v8_authorized (addr), error::invalid_argument (EALREADY_AUTHORIZED ));
2635
36+ migration_impl (user_sig);
37+ }
38+
39+ // FILO FTW
40+ fun migration_impl (user_sig: &signer ) {
2741 // Rising up, back on the street
2842 // Did my time, took my chances
2943 // Went the distance, now I'm back on my feet
@@ -38,18 +52,6 @@ module ol_framework::filo_migration {
3852 // I'm the spark, I'm the first, I'm the one who created the fire.
3953 founder::migrate (user_sig);
4054
41-
42- // All I want is to see you smile
43- // If it takes just a little while
44- // I know you don't believe that it's true
45- // I never meant any harm to you
46-
47- // Don't stop thinking about tomorrow
48- // Don't stop, it'll soon be here
49- // It'll be better than before
50- // Yesterday's gone, yesterday's gone
51- slow_wallet::filo_migration_reset (user_sig);
52-
5355 // Good evening
5456 // You know my name
5557 // Look, look, look up the number
@@ -70,6 +72,25 @@ module ol_framework::filo_migration {
7072 // I'm still standing. Yeah, yeah, yeah
7173 page_rank_lazy::maybe_initialize_trust_record (user_sig);
7274
75+
76+ // All I want is to see you smile
77+ // If it takes just a little while
78+ // I know you don't believe that it's true
79+ // I never meant any harm to you
80+
81+ // Don't stop thinking about tomorrow
82+ // Don't stop, it'll soon be here
83+ // It'll be better than before
84+ // Yesterday's gone, yesterday's gone
85+ slow_wallet::filo_migration_reset (user_sig);
7386 }
74- // FILO FTW
87+
88+
89+ #[test_only]
90+ public (friend ) fun test_unchecked_migration (user_sig: &signer ) {
91+ // This is a test-only function to allow migration without checks.
92+ // It should not be used in production code.
93+ migration_impl (user_sig);
94+ }
95+
7596}
0 commit comments