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 document (always public so prospective investors can read them):
- DALP computes the SHA-256
fileHashof each file at upload confirmation. - DALP sorts lowercase hex file hashes ascending and concatenates their raw 32-byte digests.
- The terms hash is the
keccak256of those concatenated bytes (independent of upload order, reproducible offline).
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):
- Create the sale with
POST /api/.v2/ addons/ token- sales - Request a presigned upload URL with
POST /api/(v2/ addons/ token- sales/ {sale Address}/ document- uploads document,Type: "terms" visibility: "public"), then upload the file. - Confirm with
POST /api/. DALP verifies the stored size and bytes againstv2/ addons/ token- sales/ {sale Address}/ documents fileSizeandmimeTypeand deletes invalid files. - Repeat steps 2 and 3 for each terms document.
- Record the derived hash on chain with
PUT /api/. Passv2/ addons/ token- sales/ {sale Address}/ terms expectedTermsHashto guard against concurrent edits (422on mismatch), and sendwalletVerificationfrom 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 .../ if no terms documents exist, terms are already set or in flight, or setup has ended. Adding or removing terms documents returns 409 settlement. 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:
- List: Call
GET /api/and filterv2/ addons/ token- sales/ {sale Address}/ documents documentwithType: "terms" is(or readLatest: true termsDocumentson the sale). - Download: Call
POST /api/for a one-hour download URL.v2/ addons/ token- sales/ {sale Address}/ documents/ {document Id}/ downloads - Acknowledge: Call
POST /api/(empty body for API keys, orv2/ addons/ token- sales/ {sale Address}/ term- acknowledgements walletVerificationfor sessions). Once settled,hasAcknowledgedTermsreadstrue. - Buy: Call
POST /api/withv2/ addons/ token- sales/ {sale Address}/ purchases 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 andPOST .../.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
Next steps
- Primary Offering for the full offering lifecycle.
- Idempotency and async settlement for waiting on acknowledgement settlement.
- Files for file upload and download handling.