sigil-core · labor
Source declarations, signatures and documentation for labor.
Source: sigil/node/sigil-core/src/labor.rs. SHA-256: be2ad662ad493142d2e72886662f3184a2ea3b9559b44d3ab2bf3eeab06f2241.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
labor::CounterpartyFilter
Counterparty filter for a labor job posting.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum CounterpartyFilter {
HumansOnly,
AgentsOnly,
DaosOnly,
AriseProvidersOnly,
Any,
}Source line: 22.
labor::JobStatus
Lifecycle of a labor job.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum JobStatus {
Open,
Reviewing,
Awarded,
Cancelled,
Closed,
}Source line: 33.
labor::SkillTag
Skill / category tag attached to a job posting or bid.
pub type SkillTag = String;Source line: 42.
labor::LaborJob
Posted labor job (advertisement on-chain).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct LaborJob {
/// `did:oas:sigil:job:<id>`.
pub job_id: String,
/// DID that posted the job (DAO / agent / human).
pub poster_did: String,
/// Mandate id used to post this job. Required when poster is an agent.
pub posting_mandate_id: Option<MandateId>,
/// BLAKE3 commitment of off-chain title text.
pub title_commitment: String,
/// BLAKE3 commitment of off-chain job description.
pub description_commitment: String,
/// Job category.
pub category: String,
/// Required skills.
pub required_skills: Vec<SkillTag>,
/// Required attestations (e.g., kyc, expertise).
pub required_attestations: Vec<String>,
/// Token paid for completion.
pub budget_token_id: TokenId,
/// Total budget amount.
pub budget_amount: u128,
/// Milestone plan template.
pub milestone_plan: MilestonePlan,
/// Escrow policy template.
pub escrow_policy: EscrowPolicy,
/// Counterparty filter.
pub counterparty_filter: CounterpartyFilter,
/// Optional epoch deadline.
pub deadline_epoch: Option<u64>,
/// Status.
pub status: JobStatus,
/// Epoch the job was created at.
pub created_at_epoch: u64
}Source line: 46.
labor::BidderKind
Class of entity submitting a bid.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BidderKind {
Human,
Agent,
Dao,
Committee,
AriseProvider,
}Source line: 88.
labor::BidStatus
Bid lifecycle status.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BidStatus {
Submitted,
Withdrawn,
Accepted,
Rejected,
}Source line: 99.
labor::ReputationSnapshot
Reputation snapshot at bid time.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ReputationSnapshot {
pub aggregate_score: i64,
pub completed_contracts: u32,
pub disputes_lost: u32,
pub captured_at_epoch: u64
}Source line: 108.
labor::AttestationRef
Reference to an off-chain attestation document.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct AttestationRef {
pub attestation_id: String,
pub attester_did: String,
pub commitment: String
}Source line: 117.
labor::LaborBid
Submitted bid for a labor job.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct LaborBid {
pub bid_id: String,
pub job_id: String,
pub bidder_did: String,
pub bidder_kind: BidderKind,
pub proposed_price: u128,
pub proposed_token_id: TokenId,
pub estimated_duration_seconds: u64,
pub capabilities_proof: Vec<AttestationRef>,
pub reputation_snapshot: Option<ReputationSnapshot>,
pub mandate_id_for_work: Option<MandateId>,
pub status: BidStatus,
pub submitted_at_epoch: u64
}Source line: 125.
labor::ContractState
Lifecycle of a labor contract.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ContractState {
Proposed,
Funded,
InProgress,
Delivered,
Disputed,
Completed,
Cancelled,
}Source line: 147.
labor::MilestoneState
Lifecycle of a single milestone.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum MilestoneState {
Pending,
Submitted,
Attested,
Paid,
Disputed,
Cancelled,
}Source line: 160.
labor::DeliverableRef
Reference to an on-chain deliverable.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct DeliverableRef {
pub deliverable_id: String,
pub payload_hash: String
}Source line: 171.
labor::Milestone
Single milestone within a labor contract.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Milestone {
pub milestone_index: u32,
pub description_hash: String,
pub amount: u128,
pub due_epoch: Option<u64>,
pub state: MilestoneState,
pub deliverable_ref: Option<DeliverableRef>
}Source line: 178.
labor::MilestonePlan
Plan describing milestone breakdown attached to a job and inherited by the resulting contract.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MilestonePlan {
pub milestones: Vec<MilestoneTemplate>
}Source line: 190.
labor::MilestonePlan::total_amount
Sum of milestone amounts.
pub fn total_amount(&self) -> u128;Source line: 196.
labor::MilestoneTemplate
Template milestone (without runtime state) used in postings/plans.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MilestoneTemplate {
pub milestone_index: u32,
pub description_hash: String,
pub amount: u128,
pub due_epoch: Option<u64>
}Source line: 203.
labor::EscrowPolicy
Escrow funding policy for a labor contract.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum EscrowPolicy {
/// Full amount must be escrowed before work begins.
FundFullUpFront,
/// Each milestone is funded independently before its work begins.
FundPerMilestone,
}Source line: 213.
labor::LaborEscrow
Durable escrow accounting for one labor contract.
Amounts are protocol units of token_id. Settlement is exact: funds move
from reserved_amount to exactly one of released, refunded, or slashed.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct LaborEscrow {
pub contract_id: String,
pub funder_did: String,
pub escrow_account_did: String,
pub token_id: TokenId,
pub total_required: u128,
pub reserved_amount: u128,
pub released_amount: u128,
pub refunded_amount: u128,
pub slashed_amount: u128,
pub last_updated_epoch: u64
}Source line: 225.
labor::LaborEscrow::remaining_unsettled
pub fn remaining_unsettled(&self) -> u128;Source line: 239.
labor::LaborEscrow::accounted_total
pub fn accounted_total(&self) -> u128;Source line: 243.
labor::AttestationPolicy
Attestation policy applied to a contract milestone (refines the mandate-level approval policy).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "kind", content = "data", rename_all = "snake_case")]
pub enum AttestationPolicy {
/// Inherit the mandate's approval policy.
InheritFromMandate,
/// Override with an employer-only attestation.
Employer,
/// Override with a committee threshold.
Committee {
members: Vec<String>,
threshold: u32,
},
}Source line: 255.
labor::RoyaltyRecipient
Royalty recipient — a long-tail human/agent credited for their contribution to the work product.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RoyaltyRecipient {
pub recipient_did: String,
pub basis_points: u16,
pub rationale_commitment: Option<String>
}Source line: 270.
labor::LaborContract
Labor contract — the binding agreement between employer and worker.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct LaborContract {
/// `did:oas:sigil:contract:labor:<id>`.
pub contract_id: String,
pub job_id: String,
pub employer_did: String,
pub worker_did: String,
pub employer_mandate_id: Option<MandateId>,
pub worker_mandate_id: Option<MandateId>,
pub token_id: TokenId,
pub total_amount: u128,
/// Dedicated escrow account DID
/// (`did:oas:sigil:treasury:escrow:<contract>`).
pub escrow_account_did: String,
pub milestones: Vec<Milestone>,
pub milestone_policy: MilestonePolicy,
pub attestation_policy: AttestationPolicy,
pub dispute_policy: DisputePolicy,
pub reputation_impact: ReputationImpactPolicy,
/// Optional revenue share applied to this contract's payout (beyond the
/// worker).
pub revenue_share: Option<DistributionPolicy>,
/// Royalty recipients credited on each payout.
pub royalty_recipients: Vec<RoyaltyRecipient>,
pub state: ContractState,
pub created_at_epoch: u64
}Source line: 278.
labor::LaborContract::milestone_sum_matches_total
Returns true when the sum of all milestone amounts equals
total_amount.
pub fn milestone_sum_matches_total(&self) -> bool;Source line: 308.
labor::LaborContract::validate_revenue_invariants
Validate that royalty basis points sum to <= 10_000 and revenue
share, if present, sums to exactly 10_000.
pub fn validate_revenue_invariants(&self) -> Result<(), RevenueShareError>;Source line: 315.
labor::CapabilitySpec
Capability boundary for an open bounty claim.
These fields are commitments and tags only. The executor does not infer a
claimant's ability from self-asserted metadata; verification still has to
pass through the offer's [VerificationMode].
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CapabilitySpec {
pub required_skills: Vec<SkillTag>,
pub required_attestations: Vec<String>,
pub artifact_policy_commitment: Option<String>
}Source line: 344.
labor::VerificationMode
Verification primitive required before an open bounty can pay.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "kind", content = "data", rename_all = "snake_case")]
pub enum VerificationMode {
/// Deterministic allowlist of human approvers. Launch-live when
/// `threshold` signatures from unique listed DIDs are present.
HumanApproved {
approver_dids: Vec<String>,
threshold: u32,
},
/// Deterministic quorum allowlist. Launch-live when `threshold` unique
/// members agree.
QuorumAgreed {
member_dids: Vec<String>,
threshold: u32,
},
/// Lumen verifier mode. Launch-live when the claimant submits a valid
/// Lumen attestation during `LaborAttestClaim`; `registry_id` is matched
/// as the expected Lumen model/registry id.
LumenAttested { registry_id: String },
/// Reserved verifier mode. Fails closed until the exact TEE verifier
/// registry and vendor roots are wired into consensus execution.
TeeAttested { registry_id: String },
}Source line: 353.
labor::BountyState
Lifecycle of an open bounty offer.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BountyState {
Open,
Exhausted,
Closed,
Cancelled,
}Source line: 378.
labor::BountyClaimState
Lifecycle of a submitted bounty claim.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BountyClaimState {
Submitted,
Verified,
Rejected,
Paid,
Expired,
}Source line: 388.
labor::BountyOffer
Open offer funded up front by a sponsor. Claim payouts are reserved at submission time and released only after the verification mode reaches its deterministic threshold.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BountyOffer {
pub offer_id: String,
pub sponsor_did: String,
pub posting_mandate_id: Option<MandateId>,
pub title_commitment: String,
pub description_commitment: String,
pub category: String,
pub capability_spec: CapabilitySpec,
pub token_id: TokenId,
pub total_funding: u128,
pub reserved_claim_amount: u128,
pub paid_amount: u128,
pub refunded_amount: u128,
pub slashed_bond_amount: u128,
pub spam_fee_collected: u128,
pub claim_bond: u128,
pub spam_fee: u128,
pub max_claims: u32,
pub per_claim_payout_cap: u128,
pub claim_window_start_block: u64,
pub claim_window_end_block: u64,
pub claim_timeout_blocks: u64,
pub verification_mode: VerificationMode,
pub escrow_account_did: String,
pub state: BountyState,
pub submitted_claim_count: u32,
pub created_at_block: u64,
pub last_updated_block: u64
}Source line: 400.
labor::BountyOffer::available_amount
pub fn available_amount(&self) -> u128;Source line: 431.
labor::BountyOffer::accounted_funding
pub fn accounted_funding(&self) -> u128;Source line: 438.
labor::BountyClaim
Claim against an open bounty offer.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BountyClaim {
pub claim_id: String,
pub offer_id: String,
pub claimant_did: String,
pub claim_sequence: u32,
pub deliverable_hash: String,
pub evidence_hashes: Vec<String>,
pub requested_payout: u128,
pub bond_amount: u128,
pub spam_fee_paid: u128,
pub submitted_at_block: u64,
pub timeout_block: u64,
pub state: BountyClaimState,
pub attestation_ids: Vec<String>,
pub paid_at_block: Option<u64>,
pub settled_at_block: Option<u64>
}Source line: 448.
labor::ClaimAttestation
Deterministic attestation recorded for a bounty claim.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ClaimAttestation {
pub attestation_id: String,
pub offer_id: String,
pub claim_id: String,
pub attester_did: String,
pub verdict: AttestationVerdict,
pub reason_commitment: Option<String>,
pub signed_at_block: u64
}Source line: 468.
labor::LaborOffer
Compatibility wrapper for code that wants to reason over both named contracts and open offers without changing the existing named labor model.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "kind", content = "data", rename_all = "snake_case")]
pub enum LaborOffer {
Named(LaborContract),
Open(BountyOffer),
}Source line: 482.
labor::Deliverable
Submitted deliverable for a milestone.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Deliverable {
pub deliverable_id: String,
pub contract_id: String,
pub milestone_index: u32,
pub payload_hash: String,
pub submitted_by_did: String,
pub submitted_at_epoch: u64
}Source line: 493.
labor::AttesterKind
Class of attester signing a milestone completion.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum AttesterKind {
Employer,
Committee,
Oracle,
Automated,
}Source line: 505.
labor::AttestationVerdict
Outcome of an attestation.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum AttestationVerdict {
Accept,
Reject,
Partial,
}Source line: 515.
labor::CompletionAttestation
Milestone completion attestation.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CompletionAttestation {
pub attestation_id: String,
pub contract_id: String,
pub milestone_index: u32,
pub attester_did: String,
pub attester_kind: AttesterKind,
pub verdict: AttestationVerdict,
pub reason_commitment: Option<String>,
pub signed_at_epoch: u64
}Source line: 523.
labor::Review
Post-completion review.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Review {
pub review_id: String,
pub contract_id: String,
pub reviewer_did: String,
pub subject_did: String,
/// Score in 0..=100.
pub score: u8,
pub commentary_hash: String,
/// Reviewer weight derived from reputation snapshot.
pub weight: u32,
pub recorded_at_epoch: u64
}Source line: 536.
labor::SignalSource
Source category of a reputation signal.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum SignalSource {
ContractCompletion,
Attestation,
Review,
DisputeOutcome,
StakeLoss,
AriseChallenge,
}Source line: 556.
labor::DecayPolicy
Decay policy applied to a reputation signal at read time.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum DecayPolicy {
/// No decay — permanent signal.
None,
/// Half-life expressed in epochs.
HalfLife { epochs: u64 },
/// Linear decay over a fixed window (signal is zero after `epochs`).
LinearOver { epochs: u64 },
}Source line: 568.
labor::ReputationSignal
Append-only reputation signal stored on-chain.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ReputationSignal {
pub signal_id: String,
pub subject_did: String,
pub source: SignalSource,
pub delta_score: i32,
pub decay_policy: DecayPolicy,
pub epoch: u64
}Source line: 579.
labor::DisputeCause
Cause classification for a dispute.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum DisputeCause {
NonDelivery,
QualityIssue,
PaymentWithheld,
Misuse,
Other,
}Source line: 595.
labor::DisputeState
Lifecycle of a dispute.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum DisputeState {
Raised,
UnderReview,
Resolved,
Appealed,
}Source line: 606.
labor::DisputeResolution
Resolution outcome for a dispute.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "kind", content = "data", rename_all = "snake_case")]
pub enum DisputeResolution {
/// Pay worker the supplied amount; refund remainder to employer.
Split {
worker_amount: u128,
employer_amount: u128,
},
/// Cancel contract; refund full escrow to employer.
RefundEmployer,
/// Pay full escrow to worker.
PayWorker,
}Source line: 616.
labor::Dispute
On-chain dispute record.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Dispute {
pub dispute_id: String,
pub contract_id: String,
pub raiser_did: String,
pub cause: DisputeCause,
pub evidence_hashes: Vec<String>,
pub arbitration: DisputePolicy,
pub state: DisputeState,
pub resolution: Option<DisputeResolution>,
pub raised_at_epoch: u64
}Source line: 630.
labor::Dispute::allows_transition
Validate a state transition. Allowed transitions:
Raised -> UnderReview -> Resolved, Resolved -> Appealed,
Appealed -> UnderReview.
pub fn allows_transition(&self, next: DisputeState) -> bool;Source line: 646.
labor::ShareRevocability
Revocability of a revenue share.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ShareRevocability {
Immutable,
RevocableByIssuer,
DaoGovernance,
}Source line: 664.
labor::RevenueShare
Revenue share record. The chain enforces the basis-point invariant on every distribute operation.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RevenueShare {
pub share_id: String,
/// Source DID generating the revenue (contract / agent / skill / model /
/// workflow).
pub source_did: String,
pub distribution: DistributionPolicy,
pub expiry_epoch: Option<u64>,
pub revocability: ShareRevocability
}Source line: 673.
labor::RevenueShare::validate_totals
Returns Ok if and only if Σ basis_points == 10_000 exactly.
pub fn validate_totals(&self) -> Result<(), RevenueShareError>;Source line: 685.
labor::RevenueShare::split
Compute payout amounts per recipient for a given gross amount. Any residual (rounding) goes to the source.
pub fn split(&self, gross: u128) -> Vec<(String, u128)>;Source line: 701.
labor::RevenueShareError
Errors related to revenue share / royalty arithmetic.
#[derive(Debug, Clone, PartialEq, Eq, Error)]
pub enum RevenueShareError {
#[error("revenue shares must total 10000 basis points")]
ShareTotalsInvalid,
#[error("royalty basis points exceed 10000")]
RoyaltyTotalExceedsLimit,
}Source line: 724.
labor::single_recipient_distribution
Convenience constructor for a single-recipient distribution policy.
pub fn single_recipient_distribution(recipient_did: impl Into<String>) -> DistributionPolicy;Source line: 732.