Files
zeekay bae63692f0 the corporate name is Lux Industries Inc
Lux Partners Limited is the Isle of Man company and does not appear on a
public surface. Lux Industries Inc, a Delaware C corporation, is the one
these copyright lines, citations and terms name.

A bare "Lux Partners" is left alone unless the line says who owns
something — elsewhere it is the name of a site, not a party.
2026-08-28 16:43:59 -07:00

46 lines
1.6 KiB
Go

// Copyright 2024-2026 Lux Industries Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package receipt
import (
"github.com/hanzoai/base/core"
"github.com/luxfi/aml/pkg/store"
)
// Field names, named once so the writer and the reader cannot disagree. A
// disagreement here does not fail: it finds no prior receipt, which reads as a
// transaction nobody has offered before, which is exactly the double count this
// plane exists to prevent.
const (
fieldRef = "ref"
fieldMark = "mark"
fieldAnswer = "answer"
fieldAt = "at"
)
// receipts is where answers are kept against the offers that earned them.
var receipts = store.Kind{
Name: "aml_receipts",
Fields: []core.Field{
&core.TextField{Name: fieldRef, Required: true},
&core.TextField{Name: fieldMark, Required: true},
&core.TextField{Name: fieldAnswer},
&core.DateField{Name: fieldAt, Required: true},
},
Indexes: []store.Index{
// One answer per transaction per tenant, and the database is what makes
// it so: two concurrent offers of one transaction both read no prior
// receipt before either writes, so the guarantee cannot live in the read.
{Name: "ref", Fields: []string{store.Org, fieldRef}, Unique: true},
// Disposal asks which receipts have outlived every window they could
// still affect, in every org.
{Name: "at", Fields: []string{fieldAt}},
},
}
// Ensure creates the collection and is idempotent, so it runs on every start.
func Ensure(app core.App) error { return receipts.Ensure(app) }