husdissuance

package
v1.49.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package husdissuance is the durable, idempotent record of ONE treasury HUSD mint in the chain-backed credit ledger.

Each record is keyed by a DETERMINISTIC storage id derived from the mint's idempotency key (treasury.IssuanceID), so a duplicate mint request collapses onto the same row via the backend ON CONFLICT(id, kind, namespace) upsert — the same money-safe primitive as models/idempotencykey and gift-card redemptions. The record is the audit anchor: every credit that exists traces to exactly one issuance and its on-chain TxHash. It carries no key material.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

Query returns a datastore query over the husd-issuance kind (audit/rollup).

Types

type HUSDIssuance

type HUSDIssuance struct {
	mixin.Model[HUSDIssuance]

	// IdemKey is the caller idempotency key; the storage id is derived from it, so
	// re-submitting the same key is a replay, never a second mint.
	IdemKey string `json:"idemKey"`
	OrgID   string `json:"orgId"`
	// Subject is the off-chain ledger DestinationId this mint credits (indexed so
	// the reconcile job can group issuances per subject as well as per org).
	Subject     string `json:"subject"`
	OrgAddress  string `json:"orgAddress"`
	AmountCents int64  `json:"amountCents"`
	Bucket      string `json:"bucket"`
	Reason      string `json:"reason,omitempty"`
	// Test marks a test-chain mint (matches the ledger Test partition).
	Test      bool   `json:"test"`
	ChainID   int64  `json:"chainId"`
	TokenAddr string `json:"tokenAddr"`
	// TxHash is INDEXED so the indexer's IssuanceLookup.ByTxHash resolves a
	// projected on-chain transfer back to its off-chain bucket/subject.
	TxHash   string    `json:"txHash,omitempty"`
	Status   string    `json:"status" orm:"default:pending"`
	MintedAt time.Time `json:"mintedAt,omitempty"`
}

HUSDIssuance mirrors treasury.Issuance for storage. Bucket/Status are plain strings here (the typed enums live in package treasury); the datastore adapter converts at the boundary. There is deliberately NO field named Key (it would shadow the embedded Model[T].Key() method — see entity_guard.go).

func New

New returns an initialized HUSDIssuance bound to db.

func (*HUSDIssuance) Load

func (i *HUSDIssuance) Load(ps []datastore.Property) error

func (*HUSDIssuance) Save

func (i *HUSDIssuance) Save() ([]datastore.Property, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL