Skip to main content

Sale terms and acknowledgement

Upload a Primary Offering's terms documents, record their hash once during setup, then list, download, acknowledge, and buy as an investor.

Overview

A Primary Offering binds its terms documents to one on-chain hash derived automatically from the uploaded files. When a sale has a terms hash, an investor must acknowledge it on chain before their first purchase, or the purchase reverts with TermsNotAccepted. Sales with no terms documents skip acknowledgement.

The sale contract accepts the terms hash once during setup (TermsAlreadySet on a second write), so upload every terms document before setting it. See the V2 API reference for complete request and response schemas.

How the terms hash is derived

A sale's terms set consists of its latest documents with documentType: "terms" (always public so prospective investors can read them):

  1. DALP computes the SHA-256 fileHash of each file at upload confirmation.
  2. DALP sorts lowercase hex file hashes ascending and concatenates their raw 32-byte digests.
  3. The terms hash is the keccak256 of those concatenated bytes (independent of upload order, reproducible offline).
Field
Meaning
termsDocuments
Latest terms documents: id, fileName, title, and fileHash.
termsDocumentsHash
Hash derived from termsDocuments (null when none exist).
termsHash
Hash recorded on chain (null until the issuer sets terms).

Once termsHash is set, DALP blocks adding or removing terms documents so termsDocumentsHash stays equal to termsHash.

Issuer flow

Setting terms requires the Offering admin role on the sale. Other sale documents (such as brochures or FAQs) require only a sale management role. Create the sale first (no termsHash at creation):

  1. Create the sale with POST /api/v2/addons/token-sales.
  2. Request a presigned upload URL with POST /api/v2/addons/token-sales/{saleAddress}/document-uploads (documentType: "terms", visibility: "public"), then upload the file.
  3. Confirm with POST /api/v2/addons/token-sales/{saleAddress}/documents. DALP verifies the stored size and bytes against fileSize and mimeType and deletes invalid files.
  4. Repeat steps 2 and 3 for each terms document.
  5. Record the derived hash on chain with PUT /api/v2/addons/token-sales/{saleAddress}/terms. Pass expectedTermsHash to guard against concurrent edits (422 on mismatch), and send walletVerification from signed-in sessions.
curl -X PUT "$DALP_API_URL/api/v2/addons/token-sales/0x5FbDB2315678afecb367f032d93F642f64180aa3/terms" \
  -H "X-Api-Key: $DALP_API_KEY" \
  -H "Prefer: wait=30" \
  -H "Content-Type: application/json" \
  -d '{
    "expectedTermsHash": "0x6c1f0e4a9b2d7c38e5f1a0b4d9c2e7f3a8b6d1c4e9f2a7b3c8d5e0f1a6b2c9d4"
  }'
{
  "data": { "transactionHash": "0x2b7e9c4d1a6f3e8b5c0d7a2f9e4b1c6d3a8f5e2b9c4d7a1e6f3b8c5d2a9e4f7b" },
  "meta": {
    "txHashes": ["0x2b7e9c4d1a6f3e8b5c0d7a2f9e4b1c6d3a8f5e2b9c4d7a1e6f3b8c5d2a9e4f7b"],
    "transactionId": "0198f4b2-7c3d-7e1a-9b5f-2d4c6e8a0b1c"
  },
  "links": { "self": "/api/v2/addons/token-sales/0x5FbDB2315678afecb367f032d93F642f64180aa3/terms" }
}

Without Prefer: wait, DALP returns 202 Accepted with transactionId, status: "QUEUED", and statusUrl.

DALP refuses PUT .../terms if no terms documents exist, terms are already set or in flight, or setup has ended. Adding or removing terms documents returns 409 settlement.sale.TERMS_FIXED once fixed, in flight, or past setup. Activating a sale that has uploaded terms documents without a recorded hash returns 422.

In the Console, upload terms documents on the sale's Marketing tab, then select Set terms in the Actions menu or on the overview terms tile.

Investor flow

Investor integrations execute four calls in order:

  1. List: Call GET /api/v2/addons/token-sales/{saleAddress}/documents and filter documentType: "terms" with isLatest: true (or read termsDocuments on the sale).
  2. Download: Call POST /api/v2/addons/token-sales/{saleAddress}/documents/{documentId}/downloads for a one-hour download URL.
  3. Acknowledge: Call POST /api/v2/addons/token-sales/{saleAddress}/term-acknowledgements (empty body for API keys, or walletVerification for sessions). Once settled, hasAcknowledgedTerms reads true.
  4. Buy: Call POST /api/v2/addons/token-sales/{saleAddress}/purchases with amount (maximum spend in payment-currency base units). DALP buys the whole token base units covered at the current price and charges only their exact cost. Amounts below one token base unit fail on both purchases and POST .../purchase-preflights.
curl -X POST "$DALP_API_URL/api/v2/addons/token-sales/0x5FbDB2315678afecb367f032d93F642f64180aa3/term-acknowledgements" \
  -H "X-Api-Key: $DALP_API_KEY" \
  -H "Prefer: wait=30" \
  -H "Content-Type: application/json" \
  -d '{}'
{
  "data": { "transactionHash": "0x9d4a1f6c3e8b2d7a5f0c9e4b1a6d3f8c5e2b7a9d4f1c6e3b8a5d2f9c4e7b1a6d" },
  "meta": {
    "txHashes": ["0x9d4a1f6c3e8b2d7a5f0c9e4b1a6d3f8c5e2b7a9d4f1c6e3b8a5d2f9c4e7b1a6d"],
    "transactionId": "0198f4b3-1a2b-7c3d-8e4f-5a6b7c8d9e0f"
  },
  "links": { "self": "/api/v2/addons/token-sales/0x5FbDB2315678afecb367f032d93F642f64180aa3/term-acknowledgements" }
}

Wait for the acknowledgement's terminal settlement verdict before calling purchases (see Idempotency and async settlement). DALP does not check whether the investor opened a document, so enforce document display in your application flow.

Both writes refuse inconsistent state on sales that have terms documents: acknowledgement returns 422 if documents diverge from the on-chain hash, purchase returns 422 if terms documents lack a recorded hash, and either returns retryable 503 if documents or the hash cannot be read.

Errors

Code or revert
Cause
TermsNotSet
Acknowledgement sent before the issuer set terms.
TermsAlreadySet
Issuer attempted to set terms a second time.
TermsNotAccepted
Buyer has not acknowledged the terms hash.
settlement.sale.TERMS_FIXED (409)
Terms document added, replaced, or removed after terms were fixed.
TOKEN_SALE_NOT_FOUND (404)
Document ID unknown, deleted, from another sale, above caller visibility, or outside the caller's organisation.

Next steps

Was this page helpful?