Skip to content

Commit 0db3d84

Browse files
sasuke0787Rupert AdagioFranci LeLentoReginald Ritardando
authored andcommitted
[donor-voice] patch cw migration (#423)
Co-authored-by: Rupert Adagio <[email protected]> Co-authored-by: Franci LeLento <[email protected]> Co-authored-by: Reginald Ritardando <[email protected]>
1 parent 4a748f0 commit 0db3d84

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

framework/libra-framework/sources/ol_sources/migrations/filo_migration.move

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
module ol_framework::filo_migration {
22
use ol_framework::activity;
3+
use ol_framework::donor_voice;
34
use ol_framework::founder;
45
use ol_framework::page_rank_lazy;
56
use ol_framework::slow_wallet;
7+
68
use ol_framework::vouch;
9+
use std::signer;
10+
use std::error;
711

812
friend diem_framework::transaction_validation;
913

14+
/// Cannot be used by donor voice accounts
15+
const EDONOR_VOICE: u64 = 1;
16+
1017
// Welcome to Level 8
1118

1219
// It's a quest, it's a quest
1320
// For the golden prize, the prize that never dies
1421
// For a dream that's worth the fight, worth the chase
1522
// It's a journey, it's a race.
1623
public entry fun maybe_migrate(user_sig: &signer) {
24+
// community wallets should not do this migration
25+
assert!(!donor_voice::is_donor_voice(signer::address_of(user_sig)), error::invalid_argument(EDONOR_VOICE));
26+
1727
// Rising up, back on the street
1828
// Did my time, took my chances
1929
// Went the distance, now I'm back on my feet

framework/libra-framework/sources/ol_sources/slow_wallet.move

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module ol_framework::slow_wallet {
1212
use std::vector;
1313
use diem_framework::account;
1414
use diem_framework::system_addresses;
15+
use ol_framework::community_wallet;
1516
use ol_framework::libra_coin;
1617
use ol_framework::reauthorization;
1718
use ol_framework::sacred_cows;
@@ -305,11 +306,18 @@ module ol_framework::slow_wallet {
305306
return 0
306307
};
307308

308-
if (exists<SlowWallet>(addr)) {
309+
if (
310+
exists<SlowWallet>(addr) &&
311+
// patches bug in v8 where CW may have initialized as user account
312+
!community_wallet::is_init(addr)
313+
) {
309314
let s = borrow_global<SlowWallet>(addr);
310315
return s.unlocked
311316
};
312317

318+
// NOTE: we would use community_wallet_advance::total_credit_available
319+
// for community wallets but it causes a dependency loop
320+
313321
// this is a normal account, so return the normal balance
314322

315323
libra_coin::balance(addr)

0 commit comments

Comments
 (0)