Skip to main content

On-Chain Implementation & Monitoring

1. On-Chain vs. Off-Chain Split

The smart trigger system is primarily an off-chain component because it requires timers, time-of-day awareness, and holiday calendar lookups. The trigger decision and Phase 2 execution command are off-chain. The Reserve Pool balance reads and the final external settlement are on-chain.

ComponentLocationRationale
Threshold ConfigurationOn-chain (configurable parameters)Auditable; governance-controlled via admin function
Cooldown TimerOff-chain (Backend Scheduler)Timer management is not gas-efficient on-chain
Time-of-Day ProfileOff-chain (Backend Config)Requires clock and calendar; off-chain is appropriate
Holiday CalendarOff-chain (Backend Config)Updated quarterly by Ops; referenced by scheduler
Deviation CheckOff-chain (reads on-chain balance)Triggered after each Phase 1 settlement; reads Reserve Pool balance from chain
Phase 2 ExecutionOff-chain Bot → On-chain settlementRFQ/OTC execution is off-chain; settlement on-chain (unchanged from current)
Trigger Event LoggingOn-chain (Smart Contract)Audit trail for every trigger decision; emits events

2. Smart Contract Functions

FunctionParametersDescription
updateRebalanceConfig()pool, corridor, softThreshold, hardThreshold, emergencyThreshold, residualFactorAdmin-only; updates threshold configuration. Emits RebalanceConfigUpdated event.
logTriggerDecision()pool, corridor, deviation, tier, action, cooldownRemainingCalled by off-chain bot after each trigger evaluation. Emits RebalanceTriggerEvaluated event for audit trail.
executeRebalance()pool, corridor, amount, direction, executionRateExecutes the Phase 2 settlement on-chain. Emits RebalanceExecuted event. (Modified from current to accept amount based on Target Residual calculation.)

3. On-Chain Events

EventData CapturedPurpose
RebalanceTriggerEvaluatedpool, corridor, deviation, tier (IDLE|SOFT|HARD|EMERGENCY), action (NONE|COOLDOWN_START|COOLDOWN_SAVED|FIRE|EMERGENCY_FIRE), timestampFull audit trail of every trigger decision; enables analysis of cooldown effectiveness
CooldownSavedpool, corridor, peakDeviation, deviationAtCancel, cooldownDuration, savedAmountTracks every instance where the cooldown prevented an unnecessary Phase 2; key metric for COGS savings
RebalanceExecutedpool, corridor, amount, direction, targetResidual, executionRate, preBalance, postBalanceAudit trail for every Phase 2 execution (modified to include targetResidual)
RebalanceConfigUpdatedpool, corridor, old/new thresholds, old/new residualFactor, updatedByGovernance audit trail for parameter changes

4. Monitoring & Analytics

4.1 Key Metrics

MetricCalculationTarget / Alert Threshold
Cooldown Save RateCooldown cancellations (saved) / Total cooldowns startedTarget > 40% for USD-IDR; higher = cooldown is working; lower = cooldown too long or flow too one-directional
COGS SavingsSum of savedAmount from CooldownSaved events × Avg execution cost bpsTrack weekly; report to Risk Committee
Phase 2 FrequencyNumber of Phase 2 executions per day per poolCompare against pre-smart-trigger baseline; target 30–50% reduction
Avg Rebalance SizeAverage amount per Phase 2 executionShould be smaller than pre-smart-trigger baseline due to partial offset during cooldown
Cooldown-to-Hard Escalation RateTimes position moved from Soft to Hard during cooldown / Total cooldownsTarget < 15%; if high, Soft Threshold is too close to Hard or cooldown too long
Emergency Override RateEmergency triggers / Total trigger evaluationsTarget < 5%; if high, thresholds need recalibration or market conditions have changed
Time-of-Day AccuracyCooldown Save Rate during peak hours vs off-peak hoursPeak save rate should be meaningfully higher than off-peak; if not, time profiles need tuning

4.2 Alerting Tiers

Alert LevelConditionActionChannel
INFOCooldown saved (position dropped below Soft)Log CooldownSaved event; Ops review weeklyDashboard log
INFOPhase 2 fired from Soft Zone (cooldown expired)Log trigger; review if cooldown was too shortDashboard log
WARNINGCooldown-to-Hard escalation occurredReview Soft/Hard gap and cooldown duration for the corridorSlack + Dashboard
WARNINGCooldown Save Rate < 20% for 7 consecutive daysFlow pattern may have changed; review time-of-day profiles and cooldown durationSlack + Dashboard
CRITICALEmergency Override Rate > 10% over 7 daysThresholds likely too high for current volume; immediate Risk Committee reviewPagerDuty + Slack

5. Parameter Governance & Review Cadence

5.1 Review Schedule

ParameterReview CadenceReview Criteria
Soft / Hard / Emergency ThresholdsMonthlyAre thresholds correctly calibrated for current daily volume? Review Phase 2 frequency, Cooldown Save Rate, and escalation rate.
Cooldown Duration (base)MonthlyIs the cooldown long enough to capture reverse flow? Compare peak vs off-peak save rates.
Time-of-Day ProfilesMonthly (first 3 months), then QuarterlyDo peak bilateral hours match observed flow? Compare actual flow patterns against configured profiles.
Residual FactorQuarterlyIs the buffer reducing Phase 2 re-trigger frequency? Review avg time between consecutive Phase 2 fires on same pool.
Holiday CalendarQuarterlyUpdated with upcoming quarter's gazetted holidays for ID, SG, MY.

5.2 Change Authority

All parameter changes follow the standard governance process:

  1. Written justification referencing specific metrics or incidents.
  2. Approval from Risk Committee + Engineering.
  3. Execution via updateRebalanceConfig(), emitting RebalanceConfigUpdated event.
  4. Post-change monitoring for 48 hours with automated rollback if Cooldown-to-Hard Escalation Rate exceeds 25% or Emergency Override Rate exceeds 15%.