Skip to content

Commit 4fe31c8

Browse files
Merge pull request #1042 from mxllv/feature/contract-api-docs
docs: complete rustdoc coverage for fees, mock-oracle, oracle and identity message APIs
2 parents 460cefd + 846ed28 commit 4fe31c8

28 files changed

Lines changed: 259 additions & 2 deletions

File tree

contracts/analytics/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std)]
23
#![allow(unexpected_cfgs)]
34
#![allow(clippy::new_without_default)]

contracts/bridge/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std)]
23
#![allow(unexpected_cfgs)]
34
#![allow(

contracts/compliance_registry/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std, no_main)]
23
#![allow(
34
clippy::needless_borrows_for_generic_args,

contracts/crowdfunding/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std, no_main)]
23
#![allow(
34
clippy::arithmetic_side_effects,

contracts/database/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std)]
23
#![allow(unexpected_cfgs)]
34
#![allow(clippy::new_without_default)]

contracts/dex/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std)]
23
#![allow(unexpected_cfgs)]
34
#![allow(

contracts/factory/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std)]
23

34
use ink::prelude::string::String;

contracts/fees/src/lib.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std)]
23
#![allow(unexpected_cfgs)]
34

@@ -412,18 +413,27 @@ mod propchain_fees {
412413
Ok(())
413414
}
414415

416+
/// Returns the premium listing auction with the given id, if it exists.
415417
#[ink(message)]
416418
pub fn get_auction(&self, auction_id: u64) -> Option<PremiumAuction> {
417419
self.auctions.get(auction_id)
418420
}
419421

422+
/// Returns the total number of premium listing auctions created so far.
423+
///
424+
/// Auction ids are assigned sequentially starting at 1, so this value is
425+
/// also the highest allocated auction id.
420426
#[ink(message)]
421427
pub fn get_auction_count(&self) -> u64 {
422428
self.auction_count
423429
}
424430

425431
// ========== Incentives and distribution ==========
426432

433+
/// Registers `account` as a fee validator eligible for reward distribution.
434+
///
435+
/// Caller requirement: admin only (`FeeError::Unauthorized` otherwise).
436+
/// Idempotent: registering an already-active validator is a no-op.
427437
#[ink(message)]
428438
pub fn add_validator(&mut self, account: AccountId) -> Result<(), FeeError> {
429439
self.ensure_admin()?;
@@ -435,6 +445,11 @@ mod propchain_fees {
435445
Ok(())
436446
}
437447

448+
/// Removes `account` from the fee validator set.
449+
///
450+
/// Caller requirement: admin only (`FeeError::Unauthorized` otherwise).
451+
/// Removing an address that was never registered succeeds silently.
452+
/// Any pending rewards for the removed validator remain claimable.
438453
#[ink(message)]
439454
pub fn remove_validator(&mut self, account: AccountId) -> Result<(), FeeError> {
440455
self.ensure_admin()?;
@@ -443,6 +458,12 @@ mod propchain_fees {
443458
Ok(())
444459
}
445460

461+
/// Sets how collected fees are split between validators and the treasury.
462+
///
463+
/// Both shares are expressed in basis points (1 bps = 0.01%, denominator
464+
/// 10_000). The two shares must not sum to more than 10_000 bps, otherwise
465+
/// `FeeError::InvalidConfig` is returned and nothing changes.
466+
/// Caller requirement: admin only (`FeeError::Unauthorized` otherwise).
446467
#[ink(message)]
447468
pub fn set_distribution_rates(
448469
&mut self,
@@ -524,6 +545,11 @@ mod propchain_fees {
524545
Ok(amount)
525546
}
526547

548+
/// Returns the reward amount currently claimable by `account`.
549+
///
550+
/// Balances accrue via `distribute_fees` (validator share) and are
551+
/// claimed with `claim_rewards`; accounts with no pending rewards
552+
/// report 0.
527553
#[ink(message)]
528554
pub fn pending_reward(&self, account: AccountId) -> u128 {
529555
self.pending_rewards.get(account).unwrap_or(0)
@@ -614,16 +640,30 @@ mod propchain_fees {
614640
rec
615641
}
616642

643+
/// Returns the admin account configured at deployment.
644+
///
645+
/// The admin is the sole caller allowed to change fee parameters,
646+
/// validator membership, and distribution rates.
617647
#[ink(message)]
618648
pub fn admin(&self) -> AccountId {
619649
self.admin
620650
}
621651

652+
/// Returns the fixed `FeeConfig` (base/min/max fee in planck units)
653+
/// captured at construction time.
654+
///
655+
/// This is the immutable baseline; live parameters are reflected in
656+
/// `get_fee_report` instead.
622657
#[ink(message)]
623658
pub fn default_config(&self) -> FeeConfig {
624659
self.default_config.clone()
625660
}
626661

662+
/// Returns the current unallocated treasury balance available for
663+
/// distribution.
664+
///
665+
/// Funds enter via `record_fee_collected` and leave when the admin
666+
/// calls `distribute_fees`.
627667
#[ink(message)]
628668
pub fn fee_treasury(&self) -> u128 {
629669
self.fee_treasury
@@ -695,6 +735,11 @@ mod propchain_fees {
695735
}
696736

697737
impl DynamicFeeProvider for FeeManager {
738+
/// Recommended fee for `operation` under the dynamic fee model.
739+
///
740+
/// Delegates to `calculate_fee`, which applies the configured base fee
741+
/// (bps), congestion multiplier, and the operation's max-fee cap (bps,
742+
/// denominator 10_000 in both cases). Read-only; any caller may query it.
698743
#[ink(message)]
699744
fn get_recommended_fee(&self, operation: FeeOperation) -> u128 {
700745
self.calculate_fee(operation)

contracts/fractional/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std, no_main)]
23
#![allow(
34
clippy::needless_borrows_for_generic_args,

contracts/gdpr/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::clone_on_copy)] // fires inside ink! generated storage code
12
#![cfg_attr(not(feature = "std"), no_std, no_main)]
23
#![allow(
34
clippy::needless_borrows_for_generic_args,

0 commit comments

Comments
 (0)