Skip to main content

Settlement

Order settlement contract for signed orders plus Holdings-native mint/burn/redeem/conversion flows.

Order settlement

settleFill / settleFillBatch

function settleFill(FillData calldata fill, bytes calldata fillSignature);
function settleFillBatch(FillData[] calldata fills, bytes[] calldata fillSignatures);
Settles one or many matched fills. The fill itself must be signed by an authorized fill signer.

FillData struct

struct FillData {
    bytes32 marketId;
    address maker;
    address taker;
    uint256 price;
    uint256 size;
    uint8 outcomeIndex;
    uint8 takerSide; // 0 = Buy, 1 = Sell
    bool makerHasInventory;
    bool isMarketOrder;
    bytes32 fillNonce;
    uint256 deadline;
    uint256 makerTotalFilled;
    uint256 takerTotalFilled;
    uint256 makerFee;
    uint256 takerFee;
    SignedOrder makerOrder;
    SignedOrder takerOrder; // used when isMarketOrder is false
    MarketOrderIntent marketOrderIntent; // used when isMarketOrder is true
    bytes makerSignature;
    bytes takerSignature;
}

SignedOrder struct

struct SignedOrder {
    bytes32 marketId;
    address trader;
    uint256 price;
    uint256 size;
    uint8 outcomeIndex;
    uint8 side; // 0 = Buy, 1 = Sell
    bytes32 nonce;
    uint256 expiry;
    uint256 maxFee;
    uint8 makerRoleConstraint;
    uint8 inventoryModeConstraint;
}

MarketOrderIntent struct

struct MarketOrderIntent {
    bytes32 marketId;
    address trader;
    uint256 maxSize;
    uint256 maxPrice;
    uint8 outcomeIndex;
    uint8 side; // 0 = Buy, 1 = Sell
    bytes32 nonce;
    uint256 expiry;
    uint256 maxFee;
}
Order signatures are EIP-712 signatures over the Settlement domain.

Nonce cancellation

function cancelOwnNonce(bytes32 nonce)
Cancels the caller’s order nonce so orders using that nonce can no longer be filled.
function cancelNonce(address trader, bytes32 nonce, bytes calldata signature)
Cancels a trader nonce with their signature. Anyone can submit it. Signature type:
CancelNonce(address trader, bytes32 nonce)

Signature verification

function verifyOrderSignature(SignedOrder calldata order, bytes calldata signature) returns (bool);
function verifyMarketOrderIntentSignature(MarketOrderIntent calldata intent, bytes calldata signature) returns (bool);
Public helper methods for validating trader signatures off-chain or from integration code.

Holdings-native operations

Mint complete sets

function mintCompleteSetsFromHoldings(bytes32 marketId, uint256 amount, address recipient, bool creditInternal);
function mintCompleteSetsFromHoldingsBySig(
    address user,
    bytes32 marketId,
    uint256 amount,
    address recipient,
    bool creditInternal,
    uint256 nonce,
    uint256 deadline,
    bytes calldata signature
);
Uses Holdings collateral balance to mint complete sets, then deposits all resulting outcome tokens into Holdings.

Burn complete sets

function burnCompleteSetsFromHoldings(bytes32 marketId, uint256 amount, address recipient, bool creditInternal);
function burnCompleteSetsFromHoldingsBySig(
    address user,
    bytes32 marketId,
    uint256 amount,
    address recipient,
    bool creditInternal,
    uint256 nonce,
    uint256 deadline,
    bytes calldata signature
);
Burns complete sets using Holdings balances instead of wallet balances. Outcome tokens are withdrawn from Holdings, burned via MarketFactory, and collateral is either sent externally to recipient or credited back into Holdings when creditInternal is true.

Negative-risk conversion

function convertMultiBinaryPositionsFromHoldings(
    bytes32 parentMarketId,
    uint256 indexSet,
    uint256 amount,
    uint256 expectedQuestionCount
);

function convertMultiBinaryPositionsFromHoldingsBySig(
    address user,
    bytes32 parentMarketId,
    uint256 indexSet,
    uint256 amount,
    uint256 expectedQuestionCount,
    uint256 nonce,
    uint256 deadline,
    bytes calldata signature
);
Performs negative-risk conversion using Holdings balances. NO positions are withdrawn from Holdings, converted through MarketFactory, and resulting YES tokens and released collateral are deposited back into Holdings.

Mint and deposit with Permit2

function mintAndDepositWithPermit(
    address depositor,
    bytes32 marketId,
    uint256 amount,
    uint256 nonce,
    uint256 deadline,
    bytes calldata signature
);
Uses Uniswap Permit2 to pull collateral from an external wallet, mints complete sets, and deposits the resulting outcome tokens into Holdings for depositor.

Redeem outcomes

function redeemOutcomesToHoldings(bytes32 marketId, uint256[] calldata amounts);
function redeemOutcomesToHoldingsFor(address user, bytes32 marketId, uint256[] calldata amounts);
function batchRedeemOutcomesToHoldings(bytes32[] calldata marketIds, uint256[][] calldata amountsArray);
function batchRedeemOutcomesToHoldingsFor(
    address[] calldata users,
    bytes32[] calldata marketIds,
    uint256[][] calldata amountsArray
);
Redeems resolved outcome tokens from Holdings balances and credits resulting collateral back into Holdings.

Order helpers

function isOrderInvalid(address trader, SignedOrder calldata order) returns (bool invalid);
function getFilledAmount(bytes32 orderHash) returns (uint256 filledAmount);
Useful helper reads for order management and UI state.

Events

event NonceCanceled(address indexed trader, bytes32 indexed nonce);

event FillExecuted(
    bytes32 indexed marketId,
    address indexed maker,
    address indexed taker,
    bytes32 fillNonce,
    uint256 price,
    uint256 size,
    uint8 outcomeIndex,
    uint8 takerSide,
    address collateralToken,
    bool makerHasInventory,
    uint256 makerFee,
    uint256 takerFee,
    uint256 makerTotalFilled,
    uint256 takerTotalFilled,
    bytes32 makerOrderHash,
    bytes32 takerOrderHash
);

event CompleteSetsMintedForFill(
    bytes32 indexed marketId,
    bytes32 indexed fillNonce,
    address indexed maker,
    uint256 amount,
    address taker,
    uint8 outcomeIndex
);