Skip to content
🔑 DPX is in private beta. Settlement execution requires approval — request access. All other APIs are live and free to use in sandbox mode.

Smart Contracts

DPX is deployed on Base mainnet (chainId 8453). The settlement router enforces all fees on-chain, ensuring agents cannot submit settlements at rates different from what the oracle quoted.

ContractRole
DPX TokenERC-20 stablecoin with license fee enforcement
DPXSettlementRouterFee calculation, settlement execution, ESG redistribution

Contract addresses are returned by the /manifest endpoint and are always canonical.

The settlement router is the entry point for all on-chain settlements. It:

  1. Accepts gross amount and a quoteId
  2. Computes fees on-chain using the same formula as the oracle
  3. Transfers net amount to the recipient
  4. Routes ESG fees to verified impact programs
  5. Routes license fees to the protocol treasury
FunctionDescription
settle(recipient, amount, isCrossCurrency, quoteId)Execute a settlement
previewFees(amountUsd, hasFx, esgScore)Off-chain fee preview (used by /verify-fees)
setFeeRates(coreBps, fxBps, esgDivisor)Admin: update fee rates
setFeeCollector(address)Admin: update treasury address
ParameterValue
coreFeeBps85
fxFeeBps40
esgDivisor200
ESG_MAX_BPS50
License fee1 bps (enforced in token contract)
uint256 coreFee = (amount * coreFeeBps) / 10_000;
uint256 fxFee = isCrossCurrency ? (amount * fxFeeBps) / 10_000 : 0;
uint256 esgBps = (100 - esgScore) / esgDivisor; // esgDivisor = 200
uint256 esgFee = (amount * esgBps) / 10_000;
uint256 total = coreFee + fxFee + esgFee;

This matches the off-chain oracle formula exactly. The /verify-fees endpoint calls previewFees() to confirm agreement before settlement.

DPX uses a hybrid fee enforcement model:

  • License fee (0.01%) is enforced in the DPX token contract on every transfer
  • Core, FX, and ESG fees are enforced in DPXSettlementRouter

This separation allows the settlement router fees to be updated via governance without touching the token contract.

Terminal window
cd dpx-deploy
chmod +x deployRouter.sh
./deployRouter.sh

Then add to .env:

Terminal window
ROUTER_ADDRESS=0x... # Address from deploy output
dpx-protocol/dpx-deploy/contracts/DPXSettlementRouter.sol
dpx-protocol/dpx-deploy/deployRouter.sh
Stability-Oracle/stability-oracle/routes/settlerClient.js