Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions contracts/claims-processor/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,66 @@ pub struct PayoutDelayUpdated {
pub delay_seconds: u64,
}

/// Supported payout currencies for claim settlements.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum PayoutCurrency {
/// Default USDC (7-decimal)
USDC,
/// Alternative stablecoin (address stored separately)
Custom(Address),
}

/// Multi-currency payout configuration for a claim.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PayoutOption {
/// Currency to pay out in.
pub currency: PayoutCurrency,
/// Exchange rate (basis points) relative to USDC. 10000 = 1:1 parity.
/// Used to convert USDC coverage amounts to equivalent other-currency amounts.
pub exchange_rate_bps: u32,
/// Whether this payout option is currently enabled.
pub enabled: bool,
}

/// Record of available payout currencies and their exchange rates.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PayoutCurrencyRegistry {
/// Address of the USDC token contract (default payout currency).
pub usdc_token: Address,
/// Optional alternative payout currencies with their exchange rates.
pub alt_currencies: Vec<Address>,
/// Exchange rates for alt currencies (index matches alt_currencies).
pub exchange_rates_bps: Vec<u32>,
}

/// Emitted when a new payout currency is registered.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PayoutCurrencyAdded {
pub token: Address,
pub exchange_rate_bps: u32,
}

/// Emitted when a payout currency's exchange rate is updated.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PayoutCurrencyRateUpdated {
pub token: Address,
pub old_rate_bps: u32,
pub new_rate_bps: u32,
}

/// Emitted when a claim is paid out in an alternate currency.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ClaimPaidInAlternativeCurrency {
pub claim_id: u128,
pub claimant: Address,
pub usdc_equivalent: i128,
pub token: Address,
pub actual_amount: i128,
pub exchange_rate_bps: u32,
}
27 changes: 27 additions & 0 deletions contracts/governance-dao/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ pub struct Proposal {
/// Mandatory impact analysis describing potential consequences of this proposal.
/// Max 4096 bytes to provide comprehensive risk assessment.
pub impact_analysis: Bytes,
/// Optional verification callback function on the target contract to confirm
/// execution produced the intended state change. Called as `target::verify_proposal_execution(proposal_id)`.
/// If specified and fails, execution is marked as failed with audit trail.
/// Signature: fn verify_proposal_execution(env: Env, proposal_id: u64) -> Result<bool, Symbol>
pub verification_callback: Option<Symbol>,
/// Whether execution has been verified (callback succeeded or not required).
pub execution_verified: bool,
}

/// A single vote record stored per (proposal_id, voter) key.
Expand Down Expand Up @@ -432,3 +439,23 @@ pub struct DelegationRecorded {
pub action: Symbol,
pub recorded_at: u64,
}

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ExecutionVerified {
pub proposal_id: u64,
pub executor: Address,
pub target: Address,
pub verification_callback: Symbol,
pub verified_at: u64,
}

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ExecutionVerificationFailed {
pub proposal_id: u64,
pub executor: Address,
pub target: Address,
pub callback: Symbol,
pub error: Symbol,
}
47 changes: 46 additions & 1 deletion contracts/oracle-verifier/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,26 @@ pub struct StalenessReport {
pub freshness_ratio_bps: u32,
}

/// Temporal decay configuration for oracle submissions.
/// Applies exponential decay to older submissions, giving more weight to recent data.
/// Prevents stale oracles from permanently distorting aggregation as data ages.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TemporalDecayConfig {
pub data_type: Symbol,
/// Whether temporal decay weighting is enabled for this data type.
pub enabled: bool,
/// Half-life in seconds: age at which submission weight drops to 50%.
/// For example: 86400 = 1 day, 3600 = 1 hour.
pub half_life_seconds: u64,
/// Minimum weight floor (basis points). Submissions never drop below this.
/// 0 = no floor, 1000 = 10% minimum weight.
pub min_weight_bps: u32,
/// Maximum weight ceiling (basis points) for the newest submissions.
/// 10000 = no ceiling, newest always get full weight.
pub max_weight_bps: u32,
}

/// Emitted when stale oracle data is detected during submission or verification.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
Expand All @@ -509,4 +529,29 @@ pub struct StaleDataDetected {
pub total_count: u32,
pub oldest_age: u64,
pub max_age: u64,
}
}


#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TemporalDecayConfigUpdated {
pub data_type: Symbol,
pub enabled: bool,
pub half_life_seconds: u64,
pub min_weight_bps: u32,
pub max_weight_bps: u32,
}

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AggregatedDataWeighted {
pub data_type: Symbol,
pub key: Symbol,
pub median_value: i128,
/// Whether temporal decay weighting was applied.
pub temporal_decay_applied: bool,
/// Average age in seconds of submissions included in aggregation.
pub average_submission_age: u64,
/// Total decay factor applied (0-10000 basis points).
pub decay_factor_bps: u32,
}
61 changes: 61 additions & 0 deletions contracts/risk-pool/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,38 @@ pub struct FeeTier {
pub name: Symbol,
}

/// Optional vesting schedule for LP deposits to prevent large LPs from exiting immediately.
/// Vesting ensures LPs gradually unlock their shares over time, reducing exit risk.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VestingSchedule {
/// Total number of vesting periods.
pub total_periods: u32,
/// Duration of each vesting period in seconds.
pub period_duration: u64,
/// Shares that vest per period (can be 0 for cliff vesting).
pub amount_per_period: i128,
/// Cliff period (shares locked until this many periods have passed).
/// 0 = no cliff, vesting starts immediately.
pub cliff_periods: u32,
/// Absolute timestamp when vesting started.
pub vesting_start: u64,
/// Shares already vested and available for withdrawal.
pub vested_amount: i128,
/// Total shares subject to this vesting schedule.
pub total_amount: i128,
}

/// LP position with optional vesting constraint.
#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VestedLpPosition {
pub provider: Address,
pub position: LpPosition,
/// Optional vesting schedule. If present, constrains withdrawals.
pub vesting: Option<VestingSchedule>,
}

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct FeeTierUpdated {
Expand All @@ -585,3 +617,32 @@ pub struct PositionLiquidated {
pub amount_recovered: i128,
pub collateralization_bps: u32,
}


#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VestingScheduleCreated {
pub provider: Address,
pub total_periods: u32,
pub period_duration: u64,
pub cliff_periods: u32,
pub vesting_start: u64,
}

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VestingSharesReleased {
pub provider: Address,
pub newly_vested_amount: i128,
pub total_vested: i128,
pub vesting_period: u32,
}

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct WithdrawalBlockedByVesting {
pub provider: Address,
pub requested_shares: i128,
pub available_shares: i128,
pub vesting_period: u32,
}
Loading