Class DelegationMonitorService
Hosted service that monitors VTXO changes and automatically delegates new VTXOs at delegate contracts to the configured delegator service.
public class DelegationMonitorService : IHostedService, IDisposable
- Inheritance
-
DelegationMonitorService
- Implements
- Inherited Members
Remarks
A VTXO whose value cannot cover the operator's intent fee and still leave at least the server dust threshold is skipped (the delegation would be rejected with AMOUNT_TOO_LOW); it is re-evaluated on its next storage notification. Stopping the service cancels any delegation still in flight and waits for it to unwind.
Constructors
DelegationMonitorService(IVtxoStorage, IContractStorage, IEnumerable<IDelegationTransformer>, IDelegatorProvider, IWalletProvider, IClientTransport, IFeeEstimator, ILogger<DelegationMonitorService>?)
Hosted service that monitors VTXO changes and automatically delegates new VTXOs at delegate contracts to the configured delegator service.
public DelegationMonitorService(IVtxoStorage vtxoStorage, IContractStorage contractStorage, IEnumerable<IDelegationTransformer> transformers, IDelegatorProvider delegatorProvider, IWalletProvider walletProvider, IClientTransport clientTransport, IFeeEstimator feeEstimator, ILogger<DelegationMonitorService>? logger = null)
Parameters
vtxoStorageIVtxoStoragecontractStorageIContractStoragetransformersIEnumerable<IDelegationTransformer>delegatorProviderIDelegatorProviderwalletProviderIWalletProviderclientTransportIClientTransportfeeEstimatorIFeeEstimatorloggerILogger<DelegationMonitorService>
Remarks
A VTXO whose value cannot cover the operator's intent fee and still leave at least the server dust threshold is skipped (the delegation would be rejected with AMOUNT_TOO_LOW); it is re-evaluated on its next storage notification. Stopping the service cancels any delegation still in flight and waits for it to unwind.
Methods
Dispose()
Unsubscribes from VTXO notifications and tears down the shutdown token source. Idempotent: a host that disposes the container and the service scope both end up here.
public void Dispose()
StartAsync(CancellationToken)
Triggered when the application host is ready to start the service.
public Task StartAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenIndicates that the start process has been aborted.
Returns
StopAsync(CancellationToken)
Triggered when the application host is performing a graceful shutdown.
public Task StopAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenIndicates that the shutdown process should no longer be graceful.