sigil-economics · bonds
Source declarations, signatures and documentation for bonds.
Source: sigil/node/sigil-economics/src/bonds.rs. SHA-256: e553b9426004f07453e9b2713121c2c2a74f33e66c9701b825ea73e3606f53f6.
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.
bonds::bond_requirement
Returns the bond requirement (in micro-MINT) for a given MARS entry type.
pub fn bond_requirement(entry_type: &str) -> u64;Source line: 18.
bonds::BondRecord
A bond posted by a publisher against a MARS registry entry.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BondRecord {
/// Unique bond identifier.
pub bond_id: String,
/// OAS DID of the publisher who posted the bond.
pub publisher_did: String,
/// OAS DID of the MARS entry this bond secures.
pub entry_did: String,
/// micro-MINT posted as bond.
pub amount: u64,
/// Current status of the bond.
pub status: BondStatus,
/// Epoch at which the bond was created.
pub created_epoch: u64
}Source line: 38.
bonds::BondStatus
Lifecycle status of a bond.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum BondStatus {
/// Bond is active and securing the entry.
Active,
/// A portion of the bond has been slashed.
PartiallySlashed,
/// The entire bond has been slashed.
FullySlashed,
/// Bond has been released (entry deregistered or bond returned).
Released,
}Source line: 55.
bonds::BondSlashDistribution
Distribution of a slashed bond: 30% reporter, 40% harmed party, 30% treasury.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BondSlashDistribution {
/// micro-MINT awarded to the reporter.
pub reporter_share: u64,
/// micro-MINT awarded to the harmed party.
pub harmed_share: u64,
/// micro-MINT sent to the protocol treasury.
pub treasury_share: u64
}Source line: 68.
bonds::create_bond
Create a new bond record.
The amount must be at least the bond_requirement for the given
entry_type. If it exceeds the requirement, the full amount is bonded.
pub fn create_bond(
bond_id: String,
publisher_did: String,
entry_did: String,
entry_type: &str,
amount: u64,
created_epoch: u64,
) -> Result<BondRecord, EconomicsError>;Source line: 85.
bonds::slash_bond
Slash a bond by the given total_slash_amount.
Distribution: 30% reporter, 40% harmed party, 30% treasury.
If total_slash_amount >= bond.amount, the bond is fully slashed.
Otherwise it is partially slashed and the bond amount is reduced.
pub fn slash_bond(
bond: &mut BondRecord,
total_slash_amount: u64,
) -> Result<BondSlashDistribution, EconomicsError>;Source line: 122.
bonds::release_bond
Release a bond, returning the remaining amount to the publisher.
Can only release an active or partially-slashed bond. Returns the freed micro-MINT amount.
pub fn release_bond(bond: &mut BondRecord) -> Result<u64, EconomicsError>;Source line: 167.