Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

indent-sdk

Submit matched trades to Indent Layer clearing. Build an obligation, sign it, track its lifecycle.

tests node deps license


A venue owns matching. This package owns the shape of what leaves it.

Integration is deliberately shallow: a matching engine that produces a firm two-sided fill, and a signature from each side. No custody changes, no margin posted, no credit risk taken on the trades you submit.

git clone https://github.com/IndentLayer/indent-sdk
cd indent-sdk
node --test "test/**/*.test.js"
node examples/submit.js

Turning a fill into an obligation

import { fromFill, typedData } from '@indent/sdk';

const obligation = fromFill({
  venue:  yourVenueAddress,
  buyer:  fill.buyer,
  seller: fill.seller,
  asset:  fill.asset,
  quantity: fill.quantity,
  price: fill.price,
}, { window: currentWindow, ttl: 120 });

const payload = typedData(obligation);
// hand payload to whichever wallet library you already use

typedData returns a plain EIP-712 structure. This package carries no signing dependency on purpose: the definition is the contract, the library is yours.

Obligations come back frozen. An object that has been shown to a counterparty should not be mutable afterwards.


Lifecycle

Submitted ─┬─ Admitted ─┬─ Novated ── Netted ── Settled
           └─ Rejected  └─ Rejected
import { track, isFinal } from '@indent/sdk';

track(['Admitted', 'Novated', 'Netted', 'Settled']); // 'Settled'
track(['Admitted', 'Novated', 'Rejected']);          // throws

Submission is atomic. An obligation is either admitted and novated, or it is rejected. There is no state in which a venue believes a trade is cleared while Indent Layer does not, and track throws on an impossible sequence so a bad feed surfaces as an error rather than as a silently wrong position.

Once settled, an obligation is final. Nothing moves it again, including us.


Related

indent-core Netting, waterfall and position limits, with the maths
indentlayer.xyz/docs The model behind all of it

Status

Pre-mainnet. The clearing contracts are not deployed, so nothing here reaches a chain yet. The shapes are published first so venues can build against them and tell us where they are wrong.

MIT licensed.

About

Submit matched trades to Indent Layer clearing. Build an obligation, sign it, settle it.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages