Skip to main content

Scope note

This page is the public lookup surface for DerivaDEX’s diamond-oriented contract composition. It covers facet families, selector lookup rules, event families, and gas-sensitive interaction categories that matter to public integrators and governance participants. It does not publish a complete per-selector ABI manual for every deployment or a timeless gas-cost table.

Diamond lookup surfaces

SurfaceWhat it tells you
facetAddresses()which facet implementation addresses are currently installed behind the diamond
facetFunctionSelectors(address)which selectors are currently routed to a specific facet
facetAddress(bytes4)which facet currently owns one selector
diamondCut(...)the upgrade entrypoint that adds, replaces, or removes selectors through governance-routed contract changes

Repo-carried lookup carriers

NeedRepo carrier
loupe and cut interfacesv2/packages/protocol-harness/contracts/src/diamond/IDiamondLoupe.sol, v2/packages/protocol-harness/contracts/src/diamond/IDiamondCut.sol
current loupe implementationv2/packages/protocol-harness/contracts/src/diamond/DiamondFacet.sol
governance events and selectorsv2/packages/protocol-harness/contracts/src/facets/interfaces/IGovernance.sol, v2/packages/protocol-harness/contracts/src/facets/Governance.sol, v2/packages/protocol-harness/contracts/src/facets/GovernanceDip12.sol
token delegation eventsv2/packages/protocol-harness/contracts/src/tokens/DDX.sol
facet family inventoryv2/packages/protocol-harness/contracts/src/facets/*.sol, v2/packages/protocol-harness/contracts/src/facets/interfaces/*.sol

Publicly relevant facet families

Facet familyPublic rolePublic lookup rule
Governanceproposal creation, queue, execute, quorum, thresholdsbind governance ABI calls to the diamond address
GovernanceDip12extended voting mechanics such as voting-cap enforcement and vote castingtreat it as a governance extension behind the same diamond
Registrationtrader admission and registration stateuse for public onboarding-state interpretation, not private operator workflow guesses
Custodiancustody- and operator-adjacent control surfacesrelevant to public boundary explanation, not a public operating manual
Bannersanctions or denial-style status changespublic readers may encounter the effect, but not every internal review step
Pauseemergency or governed pause staterelevant for fast-path governance and safety interpretation
Checkpointsettlement and checkpoint anchoringrelevant for settlement/finality interpretation
CollateralUSDC collateral deposit and withdrawal surfacesrelevant for on-chain collateral interactions
StakeDDX staking and governance-linked stake flowsrelevant for governance participation and staking state
Specsmarket and risk parameter storagerelevant for governed product/risk changes
InsuranceFund / FundedInsuranceFundsolvency backstop and funded insurance behaviorrelevant for liquidation and backstop interpretation
Tradertrader-facing contract state coupled to the platformrelevant when reads or writes are explicitly on-chain

Selector-routing rules

RulePublic contract
Call targetprotocol-facing reads and writes target the diamond proxy address, not the facet implementation address
ABI choiceuse the facet ABI or interface that defines the function you need, but bind it to the diamond address
Selector ownershipuse facetAddress(bytes4) when you need to confirm which facet currently owns one function selector
Facet inventoryuse facetAddresses() plus facetFunctionSelectors(address) when you need to inspect current installation and selector coverage
Upgrade sensitivityselector ownership can change after diamondCut, so selector availability is deployment- and upgrade-dependent rather than timeless

Public selector and event lookup sequence

QuestionFirst lookupFollow-up
which facet owns one function todayfacetAddress(bytes4)bind the relevant interface to the diamond proxy address
which selectors one facet exposesfacetFunctionSelectors(address)compare with the facet interface or source file in the repo carrier
whether a governance upgrade happenedDiamondCut plus governance execution eventsmatch the emitted action set to the proposal and queue or execute transaction evidence
whether vote delegation or vote weight changedDelegateChanged / DelegateVotesChangedverify against DDX token events and the relevant governance action context

Diamond cut validation rules

CaseVerified rule
add selectorsrequires a non-zero facet address and a non-empty selector list
remove selectorsrequires the zero address as the facet target
add duplicate selectorreverts
replace with same facet/functionreverts
remove nonexistent selectorreverts
loupe accuracyloupe selector views should match the currently installed selector set after successful upgrades

Public event families

EventWhy public readers care
DiamondCutproves a selector-routing upgrade happened
OwnershipTransferredproves admin/ownership transition on ownership-bearing contract surfaces
ProposalCreatedproves the on-chain proposal was created with a specific action set
VoteCastproves a wallet cast a vote with a recorded weight
ProposalQueuedproves a proposal entered the execution queue and has an ETA
ProposalExecutedproves the proposal completed execution
QueueTransactionproves a specific proposal action was queued
ExecuteTransactionproves a specific proposal action executed
DelegateChangedproves DDX voting power delegation changed
DelegateVotesChangedproves a delegate’s vote count changed

Gas-sensitive interaction categories

CategoryWhy gas behavior varies
deposits and withdrawalstoken transfer cost, allowance state, and settlement-adjacent bookkeeping vary by token state and network conditions
delegation and votingsigned-message use, vote-accounting updates, and governance state transitions change execution cost
proposal queue and executequeued action count, calldata size, and time-based execution path affect cost
diamond upgradesselector count, initialization calldata, and facet install or replacement shape cost materially
checkpoint- and settlement-adjacent actionsnetwork state and state-transition breadth affect cost and latency

Gas publication boundary

DerivaDEX public docs do not currently publish a stable per-function gas table. Treat gas expectations as network-, calldata-, and deployment-dependent unless a current public route publishes a narrower statement.

Boundary note

This page publishes the public selector-routing model, facet-family map, and event-family names that matter for lookup and verification. It does not guarantee that every facet family is active in every environment, nor does it replace environment-specific ABI inspection when a deployment-sensitive integration is at stake.
Last modified on April 13, 2026