Skip to content

Commit

Permalink
create rust genesis_migrate_donor_voice
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Nov 7, 2023
1 parent 4cbcf27 commit 0aaa896
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module ol_framework::community_wallet {
/// does not meet criteria for community wallet
const ENOT_QUALIFY_COMMUNITY_WALLET: u64 = 2;
/// This account needs to be donor directed.
const ENOT_DONOR_DIRECTED: u64 = 3;
const ENOT_donor_voice: u64 = 3;
/// This account needs a multisig enabled
const ENOT_MULTISIG: u64 = 4;
/// The multisig does not have minimum 5 signers and 3 approvals in config
Expand All @@ -54,15 +54,15 @@ module ol_framework::community_wallet {
const ETOO_FEW_SIGNERS: u64 = 9;


// A flag on the account that it wants to be considered a community walley
// A flag on the account that it wants to be considered a community wallet
struct CommunityWallet has key { }

public fun is_init(addr: address):bool {
exists<CommunityWallet>(addr)
}
public fun set_comm_wallet(sender: &signer) {
let addr = signer::address_of(sender);
assert!(donor_voice::is_donor_directed(addr), error::invalid_state(ENOT_DONOR_DIRECTED));
assert!(donor_voice::is_donor_voice(addr), error::invalid_state(ENOT_donor_voice));

if (is_init(addr)) {
move_to(sender, CommunityWallet{});
Expand All @@ -75,7 +75,7 @@ module ol_framework::community_wallet {
// The CommunityWallet flag is set
is_init(addr) &&
// has donor_voice instantiated properly
donor_voice::is_donor_directed(addr) &&
donor_voice::is_donor_voice(addr) &&
donor_voice::is_liquidate_to_match_index(addr) &&
// has multi_action instantialized
multi_action::is_multi_action(addr) &&
Expand Down Expand Up @@ -151,7 +151,7 @@ module ol_framework::community_wallet {

// set as donor directed with any liquidation going to existing matching index

donor_voice::make_donor_directed(sig, init_signers, n);
donor_voice::make_donor_voice(sig, init_signers, n);
donor_voice::set_liquidate_to_match_index(sig, true);
match_index::opt_into_match_index(sig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ module diem_framework::epoch_boundary {
// bill root service fees;
root_service_billing(root, status);
// run the transactions of donor directed accounts
let (count, amount, success) = donor_voice::process_donor_directed_accounts(root, closing_epoch);
let (count, amount, success) = donor_voice::process_donor_voice_accounts(root, closing_epoch);
status.dd_accounts_count = count;
status.dd_accounts_amount = amount;
status.dd_accounts_success = success;
Expand Down
Loading

0 comments on commit 0aaa896

Please sign in to comment.