Medici Protocol

DAML Templates

Complete reference for all 14 core DAML templates across 8 modules.

Package Information

PropertyValue
Package Nameoption-index-tracker-v3
Version0.1.5
DAML SDK3.5.1
Package Reference#option-index-tracker-v3 (upgrade-transparent package-name form)
Dependenciesdaml-prim, daml-stdlib (no external packages)
Identifier types in Canton: DAML template IDs use the format #package-id:ModuleName:EntityName. The package prefix can be either a content hash (64 hex chars, goes stale on rebuild) or the upgrade-transparent package-name (#option-index-tracker-v3). Always use the package-name form in production.

Environment Deployments

EnvironmentCanton JSON APIPackage ReferenceStatus
Dev https://canton.dev.medici.loan #option-index-tracker-v3 Active (wiped regularly)
Int https://canton.int.medici.loan #option-index-tracker-v3 Active
Mainnet https://canton.medici.loan #option-index-tracker-v3 Planned

Module: OptionIndex.Core

The fundamental P/N primitive. Collateral vaults, tokens, settlement, and the split/recombine lifecycle.

CollateralVault

FieldTypeDescription
depositorPartyParty that deposited the collateral
oraclePartyAuthorized oracle party for settlement
adminPartyAdmin party for parameter management
amountDecimalAmount of collateral locked
strikeDecimalStrike price (default: 50% of spot)
maturityTimeMaturity timestamp (settlement only after this)
tickerTextPrice feed ticker (e.g. BTC/USDC)
baseAssetTextBase asset identifier (e.g. ETH)
quoteAssetTextQuote asset identifier (e.g. USDC)
settlementDelaySecondsIntMinimum age of a PublishedPrice before it can settle (anti-cherry-pick)

Signatories: depositor, oracle, admin

Choices: UpdateMinAttestations

PToken

Protected token — bond minus put. P holders are option sellers; theta accrues to them. At settlement: receives min(1, S/x) of collateral.

FieldTypeDescription
vaultContractId CollateralVaultParent vault
holderPartyCurrent holder
amountDecimalToken quantity

Signatory: holder | Observers: oracle, admin

Choices: TransferP, SplitP, RecombineWithN, SettleP, SettleWithMultiAttestationP

NToken

Speculative token — a call option. N holders pay theta for leverage. No liquidation, no funding rate. At settlement: receives max(0, 1 - S/x) of collateral.

FieldTypeDescription
vaultContractId CollateralVaultParent vault
holderPartyCurrent holder
amountDecimalToken quantity

Signatory: holder | Observers: oracle, admin

Choices: TransferN, SplitN, RecombineWithP, SettleN, SettleWithMultiAttestationN

SplitRequest

A request to split collateral into P and N tokens. Uses the propose/operator-execute pattern: the depositor proposes, a protocol operator finalizes.

FieldTypeDescription
depositorPartyParty providing collateral
operatorOptional PartyProtocol operator that finalizes (observer)
vaultAdminPartyVault admin party
amountDecimalCollateral amount
strikeDecimalStrike price
maturityTimeMaturity timestamp
tickerTextPrice feed ticker
baseAssetTextBase asset
quoteAssetTextQuote asset
oraclePartyOracle party
adminPartyAdmin party
settlementDelaySecondsIntSettlement delay

Signatory: depositor | Observer: operator

Choices: Execute, OperatorExecute

CollateralRelease

Created when P and N are recombined. Holder acknowledges to reclaim collateral.

Signatory: recipient | Choices: Acknowledge

SettlementClaim

Created after settlement. Claimant redeems their share of the vault.

Signatory: claimant | Choices: Redeem

SwapOffer

P2P token listing. Seller offers P or N tokens; anyone can take the offer.

Signatories: seller, custodian | Choices: TakeOffer, CancelOffer

Module: OptionIndex.Oracle

Three oracle models: singleton, lazy/dispute, and multi-attestation with coherence filters.

PriceObservation

Private price observation — signatory oracle. Used by Perpetual and Rebalancing internally.

FieldTypeDescription
oraclePartyPublishing oracle
tickerTextPrice ticker
priceDecimalObserved price
timestampTimeObservation timestamp

PublishedPrice

Public price feed — the settlement authority. signatory publisher; observer publicReader. The oracle archives the prior PublishedPrice (Prune) in the same transaction as each new publish, so at most one is active per ticker.

FieldTypeDescription
publisherPartyPublishing oracle
publicReaderPartyDedicated public party every token reads as
tickerTextPrice ticker
priceDecimalPublished price
timestampTimePublish timestamp

Choices: Prune (archives prior PublishedPrice)

OracleAuthorization

Grants oracle rights to a party. Admin can revoke or propose transfer.

Choices: Revoke, ProposeAuthTransfer

LazyOracleRequest

On-demand price push with challenge/dispute window. Touchmarket-style lazy oracle.

Choices: Fulfill, FinalizeLazy, Dispute

MultiAttestationSession

Quorum of independent observers. Coherence filters check spread between max and min observations against a configurable threshold before finalization.

Choices: Attest, FinalizeMulti, FallbackToHeavyOracle

OracleConfig

Global oracle parameters: coherence threshold, dispute window duration, attestation timeout.

Choices: UpdateConfig, ProposeConfigTransfer

Module: OptionIndex.Governance

Multi-sig admin management — Canton's equivalent of Gnosis Safe. Propose/accept/execute pattern.

AdminRegistry

Canonical on-chain admin roster: superAdmins, oracleManagers, parameterManagers, poolManagers, governanceSignatories, multi-sig threshold. Frontend reads signatory lists from this contract.

Choices: AddAdminRole, RemoveAdminRole, SetThreshold

GovernanceProposal

A proposed governance action requiring N-of-M signatory approval.

Choices: Accept, Reject, Execute

ProposalAcceptance / ProposalRejection

Records of individual signatory votes on a proposal.

AdminTransfer

Two-party admin handover with timeout. Current admin proposes; new admin accepts before expiry; old admin can revoke. DAML-enforced (cannot double-accept, cannot revoke after acceptance).

Choices: AcceptAdmin, RevokeAdmin

CircuitBreaker

System-wide trading halt. Operators pull the switch; only admin resets. Every trading choice (Execute, Recombine, Settle, Deposit) asserts breaker.active — DAML-enforced, frontend cannot bypass.

Choices: Pull, Reset, RequestTimelockChange, FinalizeTimelockChange, UpdateOperators, TransferAdmin

CommissionConfig

Fee rates for trades (tradeRate) and earn deposits (earnRate). Fees deducted before vault/pool creation; wallet receives them. None = no fee.

Choices: UpdateRates, UpdateWallet, TransferCommissionAdmin

CommissionClaim

Immutable record of each fee collected.

VersionRegistry / MigrationRegistry

Protocol version tracking and upgrade management. Minor upgrades via SCU (Smart Contract Upgrade — add Optional fields, auto-migrate); major upgrades via pull CB, upload DAR, batch-migrate, reset CB.

Choices (VR): UpdateVersion

Choices (MR): GetTargets, AddTarget, ClearTargets

PoolMaintainer

Designated pool maintenance party with auto-exercise rights.

SystemSummary

On-chain metrics: vaults created, settled, recombined. Incremented by agents.

Choices: RecordVaultCreated, RecordVaultSettled, RecordVaultRecombined

Module: OptionIndex.Rebalancing

User-level (not protocol-forced) position management. Execution is the product.

RebalanceOffer

P holder offers to swap for updated parameters (strike, maturity).

Choices: Cancel, Fill, Expire

RebalanceReceipt

Immutable record of a completed rebalance swap.

RolloverService

Automated rolling with configurable strategy (Standard: 50% strike, 30-day, rotate when price < S * 1.5; ShortDated: 60% strike, 3-day, rotate when price < S * 1.2).

Choices: CheckAndSuggest, CreateShortDatedPosition, UpdateParams, SwitchStrategy

GradualRebalanceAuction

Dutch auction to minimize roll slippage. Price drops over time until filled.

Choices: Take, DropPrice

AtomicRollRequest / AtomicRollReceipt

Two-leg package: sell old P + buy new P in one transaction, avoiding double spread.

Choices (AtomicRollRequest): FillAtomic, CancelAtomic, ExpireAtomic

QuoteRequest / QuoteResponse

Multi-dealer RFQ for deep OTM wings where no continuous order book exists.

Choices (QuoteRequest): CancelQuoteRequest, AwardQuote

Choices (QuoteResponse): CancelQuote

RollHistory

Immutable roll cost record for drift measurement. Pure helpers: annualDrift, rollsPerYear, realizedSlippage, isViableSlippage.

Module: OptionIndex.Perpetual

Perpetual liquidity-backed variant with no maturity. Convex/saturation zone math.

PerpetualVault

No-expiry vault. Uses convexity/saturation zone pricing instead of expiry. Linear approximation (exponent fixed at 1, assumes l=2).

Choices: UpdatePrice, Deposit, Withdraw

PerpetualPToken / PerpetualNToken

Perpetual variants of P and N tokens.

Choices: TransferP, TransferN

Module: OptionIndex.PhysicalSettlement

Oracle-free settlement for on-chain asset pairs. N holders exercise by paying strike in quote and receiving base — no price lookup needed.

PhysicalVault

Physical settlement vault with configurable exercise window. Narrower window = weaker oracle requirement.

Choices: Exercise, ClaimQuotePayment, RecombinePhysical

PhysicalPToken / PhysicalNToken

Physical settlement token variants.

Choices: TransferPhysicalP, TransferPhysicalN

ExerciseReceipt

Records N holder exercise: N + strike USDC -> WETH (atomic swap).

QuoteClaim / PhysicalCollateralRelease / PhysicalSplitRequest

Support templates for the physical settlement lifecycle.

Module: OptionIndex.PoolVault

Multi-depositor fungible pool (matches Solidity SplitVault pattern).

PoolVault

Shared pool — anyone can deposit. Two-phase settle+redeem prevents race conditions. "Use it or lose it" N — unexercised N becomes worthless, base stays in pool benefiting P holders.

PoolPToken / PoolNToken

Fungible-like pool share tokens.

Choices: Transfer, Split, Recombine with counterpart, Redeem (PoolPToken), Exercise (PoolNToken)

PoolExerciseReceipt / PoolRecombinationReceipt / PoolRedemption

Pull-based claim pattern with separate RedeemBase/RedeemQuote/RedeemBoth choices.

Module: OptionIndex.Intents

On-chain intent expression for the agent-first architecture.

IntentAnnouncement

Public signal of a user's strategic intent. References constraintHash linking off-chain intent to on-chain verification.

VaultComplianceRegistry

Per-vault compliance tracking. Records vault parameters, attestations, and lifecycle events.