Table of Contents

Class DelegationMonitorService

Namespace
NArk.Core.Services
Assembly
NArk.Core.dll

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

vtxoStorage IVtxoStorage
contractStorage IContractStorage
transformers IEnumerable<IDelegationTransformer>
delegatorProvider IDelegatorProvider
walletProvider IWalletProvider
clientTransport IClientTransport
feeEstimator IFeeEstimator
logger ILogger<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

cancellationToken CancellationToken

Indicates that the start process has been aborted.

Returns

Task

A Task that represents the asynchronous Start operation.

StopAsync(CancellationToken)

Triggered when the application host is performing a graceful shutdown.

public Task StopAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Indicates that the shutdown process should no longer be graceful.

Returns

Task

A Task that represents the asynchronous Stop operation.