Skip to content

Commit

Permalink
add batch_harvest_bbn for grow_bitcoin
Browse files Browse the repository at this point in the history
  • Loading branch information
lispking committed Dec 11, 2024
1 parent f349164 commit 11b46ae
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/grow_bitcoin/sources/grow_bitcoin.move
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,22 @@ module grow_bitcoin::grow_bitcoin {
account_coin_store::deposit(signer::address_of(signer), coin);
}

/// Harvest yield farming token from bbn stake
public entry fun batch_harvest_bbn(signer:&signer, assets: vector<ObjectID>) {
let len = vector::length(&assets);
let i = 0;
let total_coin = coin::zero<GROW>();
while (i < len) {
let asset_id = *vector::borrow(&assets, i);
let bbn_obj = object::borrow_mut_object<BBNStakeSeal>(signer, asset_id);
let coin = do_harvest(signer, object::id(bbn_obj));
bbn::remove_temp_state<StakeInfo>(bbn_obj);
coin::merge(&mut total_coin, coin);
i = i + 1;
};
account_coin_store::deposit(signer::address_of(signer), total_coin);
}

public entry fun harvest_bbn(signer:&signer, asset: &mut Object<BBNStakeSeal>) {
// TODO check bbn stake seal is expired
let coin = do_harvest(signer, object::id(asset));
Expand Down

0 comments on commit 11b46ae

Please sign in to comment.