Skip to content

Commit

Permalink
Merge pull request #146 from eigerco/fix/142/settle-deal-unlock-colla…
Browse files Browse the repository at this point in the history
…teral

fix(pallet-market): settle_deal_payments return collateral
  • Loading branch information
cernicc authored Jul 23, 2024
2 parents 1e186c3 + 079ff8a commit e0de99d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions pallets/market/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ pub mod pallet {

// NOTE(@jmg-duarte,28/06/2024): Maybe emit an event when the table is updated?
if complete_deal {
unlock_funds::<T>(&deal_proposal.provider, deal_proposal.provider_collateral)?;
Proposals::<T>::remove(deal_id);
} else {
// Otherwise, we update the proposal — `last_updated_block`
Expand Down
4 changes: 2 additions & 2 deletions pallets/market/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,8 +1299,8 @@ fn settle_deal_payments_success_finished() {
assert_eq!(
BalanceTable::<Test>::get(account::<Test>(PROVIDER)),
BalanceEntry::<u64> {
free: 50 + 5 * 10, // 50 (from 75 - collateral) + (price per block * n blocks)
locked: 25
free: 75 + 5 * 10, // 50 (from 75 - collateral + returned collateral (not slashed)) + (price per block * n blocks)
locked: 0
}
);

Expand Down

0 comments on commit e0de99d

Please sign in to comment.