@@ -21,6 +21,8 @@ use polimec_common::{
21
21
use sp_runtime:: { traits:: Zero , Perquintill } ;
22
22
23
23
impl < T : Config > Pallet < T > {
24
+ /// Start the settlement round. Now users can mint their contribution tokens or get their funds back, and the issuer
25
+ /// will get the funds in their funding account.
24
26
#[ transactional]
25
27
pub fn do_start_settlement ( project_id : ProjectId ) -> DispatchResult {
26
28
let mut project_details = ProjectsDetails :: < T > :: get ( project_id) . ok_or ( Error :: < T > :: ProjectDetailsNotFound ) ?;
@@ -104,6 +106,7 @@ impl<T: Config> Pallet<T> {
104
106
Ok ( ( ) )
105
107
}
106
108
109
+ /// Settle an evaluation, by maybe minting CTs, and releasing the PLMC bond.
107
110
pub fn do_settle_evaluation ( evaluation : EvaluationInfoOf < T > , project_id : ProjectId ) -> DispatchResult {
108
111
let project_details = ProjectsDetails :: < T > :: get ( project_id) . ok_or ( Error :: < T > :: ProjectDetailsNotFound ) ?;
109
112
@@ -154,6 +157,9 @@ impl<T: Config> Pallet<T> {
154
157
Ok ( ( ) )
155
158
}
156
159
160
+ /// Settle a bid. If bid was successful mint the CTs and release the PLMC bond (if multiplier > 1 and mode is Classic).
161
+ /// If was unsuccessful, release the PLMC bond and refund the funds.
162
+ /// If the project was successful, the issuer will get the funds.
157
163
pub fn do_settle_bid ( project_id : ProjectId , bid_id : u32 ) -> DispatchResult {
158
164
let project_details = ProjectsDetails :: < T > :: get ( project_id) . ok_or ( Error :: < T > :: ProjectDetailsNotFound ) ?;
159
165
let project_metadata = ProjectsMetadata :: < T > :: get ( project_id) . ok_or ( Error :: < T > :: ProjectMetadataNotFound ) ?;
@@ -261,6 +267,7 @@ impl<T: Config> Pallet<T> {
261
267
}
262
268
}
263
269
270
+ /// Mark a project as fully settled. Only once this is done we can mark migrations as completed.
264
271
pub fn do_mark_project_as_settled ( project_id : ProjectId ) -> DispatchResult {
265
272
let project_details = ProjectsDetails :: < T > :: get ( project_id) . ok_or ( Error :: < T > :: ProjectDetailsNotFound ) ?;
266
273
let outcome = match project_details. status {
@@ -288,6 +295,7 @@ impl<T: Config> Pallet<T> {
288
295
Ok ( ( ) )
289
296
}
290
297
298
+ /// Helper function to Mint CTs and handle the payment of new storage with "touch"
291
299
fn mint_contribution_tokens (
292
300
project_id : ProjectId ,
293
301
participant : & AccountIdOf < T > ,
@@ -300,6 +308,7 @@ impl<T: Config> Pallet<T> {
300
308
Ok ( ( ) )
301
309
}
302
310
311
+ /// Helper function to release the funding asset to the participant
303
312
fn release_funding_asset (
304
313
project_id : ProjectId ,
305
314
participant : & AccountIdOf < T > ,
@@ -313,7 +322,7 @@ impl<T: Config> Pallet<T> {
313
322
T :: FundingCurrency :: transfer ( asset. id ( ) , & project_pot, participant, amount, Preservation :: Expendable ) ?;
314
323
Ok ( ( ) )
315
324
}
316
-
325
+ /// Helper function to release the PLMC bond to the participant
317
326
fn release_participation_bond_for ( participant : & AccountIdOf < T > , amount : Balance ) -> DispatchResult {
318
327
if amount. is_zero ( ) {
319
328
return Ok ( ( ) ) ;
@@ -323,6 +332,7 @@ impl<T: Config> Pallet<T> {
323
332
Ok ( ( ) )
324
333
}
325
334
335
+ /// Set the PLMC release schedule if mode was `Classic`. Return the schedule either way.
326
336
fn set_plmc_bond_release_with_mode (
327
337
participant : AccountIdOf < T > ,
328
338
plmc_amount : Balance ,
@@ -337,6 +347,7 @@ impl<T: Config> Pallet<T> {
337
347
}
338
348
}
339
349
350
+ /// Calculate the vesting info and add the PLMC release schedule to the user, or fully release the funds if possible.
340
351
fn set_release_schedule_for (
341
352
participant : & AccountIdOf < T > ,
342
353
plmc_amount : Balance ,
@@ -361,6 +372,7 @@ impl<T: Config> Pallet<T> {
361
372
Ok ( vesting_info. duration )
362
373
}
363
374
375
+ /// Slash an evaluator and transfer funds to the treasury.
364
376
fn slash_evaluator ( evaluation : & EvaluationInfoOf < T > ) -> Result < Balance , DispatchError > {
365
377
let slash_percentage = T :: EvaluatorSlash :: get ( ) ;
366
378
let treasury_account = T :: BlockchainOperationTreasury :: get ( ) ;
@@ -384,6 +396,7 @@ impl<T: Config> Pallet<T> {
384
396
Ok ( evaluation. current_plmc_bond . saturating_sub ( slashed_amount) )
385
397
}
386
398
399
+ /// Reward an evaluator and mint CTs.
387
400
fn reward_evaluator (
388
401
project_id : ProjectId ,
389
402
evaluation : & EvaluationInfoOf < T > ,
0 commit comments