@@ -260,13 +260,28 @@ pub mod sanctions_screening {
260260 Ok ( ( ) )
261261 }
262262
263+ /// Returns the sanctioned-entity record for `entity_id`, if one exists.
264+ ///
265+ /// Open to any caller. Returns `None` if `entity_id` has never been
266+ /// registered. The returned record may have `active == false` if the
267+ /// entity was later removed via `remove_sanctioned_entity`; callers that
268+ /// care about current sanction status should check `active` themselves.
263269 #[ ink( message) ]
264270 pub fn get_sanctioned_entity ( & self , entity_id : u64 ) -> Option < SanctionedEntity > {
265271 self . sanctioned_entities . get ( entity_id)
266272 }
267273
268274 // ── Admin: Manage sanctioned properties ─────────────────────────────
269275
276+ /// Adds a property to the sanctions list, keyed by caller-supplied
277+ /// `property_id`. Admin-only.
278+ ///
279+ /// Unlike `add_sanctioned_entity`, `property_id` is not auto-assigned;
280+ /// calling this again with the same `property_id` overwrites the
281+ /// existing record. Emits `PropertySanctioned`.
282+ ///
283+ /// # Errors
284+ /// - `Error::NotAuthorized` if the caller is not the contract admin.
270285 #[ ink( message) ]
271286 pub fn add_sanctioned_property (
272287 & mut self ,
@@ -294,6 +309,16 @@ pub mod sanctions_screening {
294309 Ok ( ( ) )
295310 }
296311
312+ /// Deactivates a sanctioned property. Admin-only.
313+ ///
314+ /// Sets the property's `active` flag to `false`. The record is kept
315+ /// (not deleted) so it remains queryable via `get_sanctioned_property`.
316+ /// Emits `PropertyCleared`.
317+ ///
318+ /// # Errors
319+ /// - `Error::NotAuthorized` if the caller is not the contract admin.
320+ /// - `Error::PropertyNotFound` if no property is registered under
321+ /// `property_id`.
297322 #[ ink( message) ]
298323 pub fn clear_sanctioned_property ( & mut self , property_id : u64 ) -> Result < ( ) > {
299324 self . ensure_admin ( ) ?;
@@ -310,13 +335,49 @@ pub mod sanctions_screening {
310335 Ok ( ( ) )
311336 }
312337
338+ /// Returns the sanctioned-property record for `property_id`, if one
339+ /// exists.
340+ ///
341+ /// Open to any caller. Returns `None` if `property_id` was never listed.
342+ /// The returned record may have `active == false` if it was later
343+ /// cleared via `clear_sanctioned_property`; callers that care about
344+ /// current sanction status should check `active` themselves.
313345 #[ ink( message) ]
314346 pub fn get_sanctioned_property ( & self , property_id : u64 ) -> Option < SanctionedProperty > {
315347 self . sanctioned_properties . get ( property_id)
316348 }
317349
318350 // ── Screening ───────────────────────────────────────────────────────
319351
352+ /// Screens a property (and, optionally, an associated entity) against
353+ /// the sanctions lists, and records the outcome. Admin-only.
354+ ///
355+ /// Checks are evaluated in order and the first match wins:
356+ /// 1. If `property_id` is itself an active sanctioned property, the
357+ /// screening fails (`passed = false`) with that property's
358+ /// `sanction_level`, regardless of `entity_id`.
359+ /// 2. Otherwise, if `entity_id` is `Some` and refers to an active
360+ /// sanctioned entity whose `jurisdiction_code` matches the one
361+ /// passed in, the screening fails with that entity's
362+ /// `sanction_level`.
363+ /// 3. Otherwise the screening passes with `SanctionLevel::None`. This
364+ /// includes the case where `jurisdiction_code` does not match any
365+ /// known jurisdiction: an unrecognized jurisdiction is not itself
366+ /// grounds for failure.
367+ ///
368+ /// Every call stores a new `ScreeningResult` (auto-incrementing
369+ /// `screening_id`), appends it to the property's screening history
370+ /// (see `get_property_screenings`), and emits `ScreeningsPerformed`.
371+ ///
372+ /// # Screening guarantee
373+ /// This lookup runs in time proportional to whether `property_id` and
374+ /// `entity_id` are present in storage (a `Mapping::get` per check), not
375+ /// in constant time.
376+ ///
377+ /// # Errors
378+ /// - `Error::NotAuthorized` if the caller is not the contract admin.
379+ /// - `Error::ThresholdExceeded` if the internal screening-id counter
380+ /// has been exhausted (`u64::MAX` screenings recorded).
320381 #[ ink( message) ]
321382 pub fn screen_property (
322383 & mut self ,
@@ -421,11 +482,23 @@ pub mod sanctions_screening {
421482 self . property_screenings . insert ( property_id, & existing) ;
422483 }
423484
485+ /// Returns a single screening result by its `screening_id`, if one
486+ /// exists.
487+ ///
488+ /// Open to any caller. Returns `None` if `screening_id` was never
489+ /// recorded (every `screen_property` call produces exactly one).
424490 #[ ink( message) ]
425491 pub fn get_screening_result ( & self , screening_id : u64 ) -> Option < ScreeningResult > {
426492 self . screening_results . get ( screening_id)
427493 }
428494
495+ /// Returns the full screening history for a property, in the order
496+ /// the screenings were performed.
497+ ///
498+ /// Open to any caller. Returns an empty `Vec` if `property_id` has
499+ /// never been screened. Any screening id recorded against the property
500+ /// that can no longer be resolved to a stored result is silently
501+ /// skipped rather than causing an error.
429502 #[ ink( message) ]
430503 pub fn get_property_screenings ( & self , property_id : u64 ) -> Vec < ScreeningResult > {
431504 match self . property_screenings . get ( property_id) {
@@ -442,16 +515,40 @@ pub mod sanctions_screening {
442515 }
443516 }
444517
518+ /// Returns whether `property_id` has ever been screened, i.e. whether
519+ /// `screen_property` has been called for it at least once.
520+ ///
521+ /// Open to any caller. This does not indicate pass/fail status, only
522+ /// that a screening history exists; use `get_property_screenings` or
523+ /// `get_screening_result` to inspect outcomes.
445524 #[ ink( message) ]
446525 pub fn is_property_screened ( & self , property_id : u64 ) -> bool {
447526 self . property_screenings . get ( property_id) . is_some ( )
448527 }
449528
529+ /// Returns the account currently authorized to call the admin-only
530+ /// messages on this contract (`add_sanctioned_entity`,
531+ /// `remove_sanctioned_entity`, `add_sanctioned_property`,
532+ /// `clear_sanctioned_property`, `screen_property`,
533+ /// `set_screening_threshold`, and `set_max_sanctioned_entities`).
534+ ///
535+ /// Open to any caller. There is no message to transfer admin rights;
536+ /// the admin is fixed to the account that called the constructor.
450537 #[ ink( message) ]
451538 pub fn admin ( & self ) -> AccountId {
452539 self . admin
453540 }
454541
542+ /// Updates the screening-threshold configuration value (in days).
543+ /// Admin-only.
544+ ///
545+ /// Note: this value is stored and returned by `screening_threshold`,
546+ /// but is not currently read anywhere else in this contract, including
547+ /// `screen_property` -- there is no re-screening cadence or expiry
548+ /// enforced from it today. Emits `SanctionThresholdUpdated`.
549+ ///
550+ /// # Errors
551+ /// - `Error::NotAuthorized` if the caller is not the contract admin.
455552 #[ ink( message) ]
456553 pub fn set_screening_threshold ( & mut self , days : u32 ) -> Result < ( ) > {
457554 self . ensure_admin ( ) ?;
@@ -463,6 +560,11 @@ pub mod sanctions_screening {
463560 Ok ( ( ) )
464561 }
465562
563+ /// Returns the current screening-threshold configuration value (in
564+ /// days), as last set by `set_screening_threshold` or the default of
565+ /// 90 set in the constructor.
566+ ///
567+ /// Open to any caller.
466568 #[ ink( message) ]
467569 pub fn screening_threshold ( & self ) -> u32 {
468570 self . screening_threshold_days
0 commit comments