# DTA v2 Overview
Source: https://docs.chain.link/crec/extensions/dta
Last Updated: 2026-08-31

> For the complete documentation index, see [llms.txt](/llms.txt).

> **NOTE: New to DTA?**
>
> This guide assumes you already understand the **Digital Transfer Agent (DTA) technical standard**: the
> roles (Transfer Agent, Fund Administrator, Fund Distributor, Fund Issuer), the contracts (Request
> Management vs Request Settlement), the request lifecycle, and the settlement models. Read the
> [**DTA technical standard**](https://docs.chain.link/dta-technical-standard/) first if you haven't.

This page focuses on **how CRE Connect makes the DTA standard easy to use from Go**: typed operation
builders, decoded events, and one-call watcher provisioning. It does not restate what DTA is.

The DTA v2 extension (`github.com/smartcontractkit/crec-sdk-ext-dta/v2`) packages everything needed to drive the [DTA contracts](https://docs.chain.link/dta-technical-standard/concepts/architecture) from CRE Connect:

- An `Extension` that builds typed `*types.Operation` payloads for every DTA contract function.
- An `events` sub-package with one Go struct per emitted event and a `DecodeFromEvent` helper.
- A `watcher/bundle` package whose service descriptor CRE Connect loads to expose `dta.v2` as a `Service` on watchers: one SDK call provisions every watcher the integration needs.

## Module layout

```
crec-sdk-ext-dta/v2
├── v2.go                       // root package; exposes DecodeFromEvent + DecodedEvent
├── operations/                 // PrepareXxxOperation builders for every DTA function
│   ├── extension_gen.go        // Options, New, Extension struct
│   ├── operations_gen.go       // 21 generated PrepareXxxOperation methods
│   └── operations.go           // 2 hand-written helpers (with token approval, etc.)
├── events/                     // Typed event structs + EventName enum
│   ├── events_gen.go           // 28 EventName constants + payload structs
│   ├── decode_gen.go           // EventDecoders map per event
│   └── types.go                // Shared types (FundTokenData, DistributorRequest, RequestStatus, ...)
├── watcher/
│   └── bundle/bundle.go        // bundle.Get(): service name + ABIs (consumed by CRE Connect)
└── fee_manager/                // Optional fee-manager sub-extension (out of scope)
```

## When to use the DTA v2 extension

Use it whenever your application calls the [DTA Request Management or DTA Request Settlement contracts](https://docs.chain.link/dta-technical-standard/concepts/architecture). The extension covers every public function on both contracts, so any flow described in the [DTA standard](https://docs.chain.link/dta-technical-standard/), including onboarding, allowlisting, [subscriptions / redemptions](https://docs.chain.link/dta-technical-standard/concepts/request-lifecycle), and [settlement](https://docs.chain.link/dta-technical-standard/concepts/payment-modes), is one `PrepareXxxOperation` call away.

If you are emitting verifiable events from a **different** smart-contract suite (i.e. not DTA), write a custom watcher with `Watchers.CreateWithABI` instead.

## Construct the extension

```go
import (
    crec "github.com/smartcontractkit/crec-sdk"
    dtaop "github.com/smartcontractkit/crec-sdk-ext-dta/v2/operations"
)

client, _ := crec.NewClient(baseURL, apiKey)

ext, err := dtaop.New(&dtaop.Options{
    AccountAddress:              smartAccount.Hex(),
    DTARequestManagementAddress: managementAddr.Hex(),
    DTARequestSettlementAddress: settlementAddr.Hex(),
})
if err != nil { return err }
```

`Options` are validated:

- `AccountAddress` must be a hex address (this is the `op.Account` your operations target).
- `DTARequestManagementAddress` and `DTARequestSettlementAddress` must both be valid hex addresses.
- `Deadline` is optional; if set, every prepared operation gets that deadline by default.

The service descriptor (`dtabundle.Get()`) is consumed by CRE Connect, not by the SDK client. You only need to import it when you want to inspect its metadata (service name, event list) from your application code.

## Categories of operations

The 23 `PrepareXxxOperation` methods split into four groups:

| Group                             | Methods                                                                                                                                                                                                                                                                                                                                                                        | Page                                                                                            |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
| **Subscriptions & redemptions**   | `PrepareRequestSubscriptionOperation`, `PrepareRequestSubscriptionWithTokenApprovalOperation`, `PrepareRequestRedemptionOperation`, `PrepareCancelDistributorRequestOperation`, `PrepareProcessDistributorRequestOperation`, `PrepareCompleteRequestProcessingOperation`                                                                                                       | [Subscriptions & Redemptions](/crec/extensions/dta/subscriptions-redemptions)                   |
| **Fund & distributor management** | `PrepareRegisterFundAdminOperation`, `PrepareRegisterFundTokenOperation`, `PrepareRegisterDistributorOperation`, `PrepareEnableFundTokenOperation`, `PrepareDisableFundTokenOperation`, `PrepareAuthorizeDistributorForTokenOperation`, `PrepareRevokeDistributorForTokenOperation`, `PrepareAllowDistributorForTokenOperation`, `PrepareDisallowDistributorForTokenOperation` | [Fund & Distributor Management](/crec/extensions/dta/fund-and-distributors)                     |
| **Cross-DTA settlement**          | `PrepareAllowDTAOperation`, `PrepareDisallowDTAOperation`, `PrepareTransferDTARequestSettlementOwnershipOperation`, `PrepareRenounceDTARequestSettlementOwnershipOperation`                                                                                                                                                                                                    | [Fund & Distributor Management](/crec/extensions/dta/fund-and-distributors)                     |
| **Operational**                   | `PrepareSetManagementCCIPGasLimitOperation`, `PrepareSetSettlementCCIPGasLimitOperation`, `PrepareWithdrawManagementTokensOperation`, `PrepareWithdrawSettlementTokensOperation`                                                                                                                                                                                               | (covered inline in [Fund & Distributor Management](/crec/extensions/dta/fund-and-distributors)) |

## Sample flow

End-to-end: register a distributor, subscribe to a fund token, watch for the resulting events.

```go
op, err := ext.PrepareRegisterDistributorOperation(distributorWalletAddr)
if err != nil { return err }
if _, err := client.Transact.ExecuteOperation(ctx, channelID, signer, op, chainSelector); err != nil {
    return err
}

op2, _ := ext.PrepareRequestSubscriptionWithTokenApprovalOperation(
    fundAdminAddr, fundTokenId, amount, referenceID, paymentTokenAddr,
)
if _, err := client.Transact.ExecuteOperation(ctx, channelID, signer, op2, chainSelector); err != nil {
    return err
}

events, _, _ := client.Events.Poll(ctx, channelID, nil)
for _, ev := range events {
    decoded, err := dtav2.DecodeFromEvent(ctx, ev)
    if err != nil { continue }
    switch v := decoded.ConcreteEvent.(type) {
    case dtaevents.SubscriptionRequested:
        log.Printf("subscription %s shares pending", v.RequestId.Hex())
    case dtaevents.DistributorRegistered:
        log.Printf("distributor %s online", v.DistributorAddr.Hex())
    }
}
```

## Watcher provisioning

Pass `Service: "dta.v2"` to `Watchers.CreateWithService` along with the events you want to subscribe to. The DTA service publishes 11 events you can subscribe to (the full list is exposed via `bundle.Get().Events`); list whichever subset your integration needs.

```go
import "github.com/smartcontractkit/crec-sdk/watchers"

w, err := client.Watchers.CreateWithService(ctx, channelID, watchers.CreateWithServiceInput{
    Name:          "dta-management",
    ChainSelector: chainSelector,
    Service:       "dta.v2",
    Address:       managementAddr.Hex(),
    Events: []string{
        "SubscriptionRequested",
        "RedemptionRequested",
        "DistributorRequestProcessing",
        "DistributorRequestProcessed",
    },
})
```

CRE Connect owns the ABIs: you only need to know the event names you want to receive.

> **NOTE: `Service` value is fixed**
>
> Use the literal string `"dta.v2"`. The service definition declares this constant in `bundle.Get().Service`.

## What's next

- [Subscriptions & Redemptions](/crec/extensions/dta/subscriptions-redemptions)
- [Fund & Distributor Management](/crec/extensions/dta/fund-and-distributors)
- [DTA Events](/crec/extensions/dta/events)