Tokenized collateral and USDC as margin
What it is
Taking tokenized collateral and USDC as margin means accepting tokenized fund units, such as money market fund tokens, and stablecoins that clients post against their positions, then valuing them and calling for more when they fall short; the wider job is collateral monitoring.
Prime brokers, futures commission merchants (FCMs) and exchanges that accept it need balances that stay current around the clock, because collateral in a wallet can move overnight and at weekends as well as in market hours.
Goldsky keeps the latest balance of every margin wallet in your database as collateral moves, while the fund’s NAV, the haircuts, the valuation and the margin call stay with your fund administrator and your margin system.
You can build it two ways: keep every margin wallet’s balance current in your database with Turbo Pipelines, or run a scheduled Compose task that reads balances from the Feeds API and checks them against your margin rule.
Who it’s for
Prime brokers, futures commission merchants, crypto exchanges and clearing members that accept tokenized funds or stablecoins as margin.
How posted tokenized collateral is valued for margin
The diagram follows collateral from the margin wallets you watch to the margin call on a shortfall, with the fund NAV feeding the valuation, and shows who does each step. Your setup may differ.
Ways to track tokenized collateral and USDC margin
The pipeline rewrites a wallet’s balance row each time collateral moves and leaves valuation to your margin system; the scheduled task reads every wallet on a timer and works out shortfalls in its own code.
- Best for
- Many margin wallets, valued by your margin system
- Products
- Turbo
- What you run
- The destination: your database, queue or bucket, or a Postgres database Goldsky hosts
- What you write
- Pipeline YAML and SQL; TypeScript transforms when needed
- Where your data lives
- In your own database or systems
- How results reach you
- Pushed to you
- Best for
- A few margin wallets, checked on a timer
- What you run
- Nothing on Goldsky cloud; single-tenant, VPC and on-premises deployments are enterprise options
- What you write
- TypeScript tasks
- Where your data lives
- Hosted by Goldsky
- How results reach you
- Acts onchain or calls your systems
| Usual setupOption 1: Stream balances to your database | Option 2: Scheduled balance check | |
|---|---|---|
| Best for | Many margin wallets, valued by your margin system | A few margin wallets, checked on a timer |
| Products | Turbo | ComposeFeeds |
| What you run | The destination: your database, queue or bucket, or a Postgres database Goldsky hosts | Nothing on Goldsky cloud; single-tenant, VPC and on-premises deployments are enterprise options |
| What you write | Pipeline YAML and SQL; TypeScript transforms when needed | TypeScript tasks |
| Where your data lives | In your own database or systems | Hosted by Goldsky |
| How results reach you | Pushed to you | Acts onchain or calls your systems |
Watch the margin wallets
Handled by Goldsky TurboYou can only track collateral in wallets you know about, so every client’s margin wallet goes on a list.
Add a wallet when a client is onboarded and remove it when the account closes, without stopping anything. A wallet missing from the list means collateral posted to it never reaches your margin checks.
With Goldsky, the list can be a Turbo Pipelines dynamic table, which lives in a Postgres database: insert or delete a row and the running pipeline picks it up.
Learn about dynamic tables (opens in a new tab)Post collateral
Clients meet margin by moving fund tokens or stablecoins into the margin wallet held for them.
Your custody provider holds the wallet under your agreement with the client. Collateral can arrive or leave overnight and at weekends as well as in market hours, so checks that run only in the working day miss moves.
Keep each balance current
Handled by Goldsky TurboMargin is checked against what each wallet holds now, so the balance has to update every time collateral moves.
Each time a watched wallet sends or receives a collateral token, its new balance of that token is read at that block and replaces the old one. Adding up transfers yourself drifts if one is missed; reading the balance itself doesn’t.
A Turbo Pipelines SQL transform can keep transfers that touch a watched wallet, read the wallet’s
Read contract state with SQL functions (opens in a new tab)balanceOfat the transfer’s block with_gs_eth_call, and upsert one row per wallet and token, with reorg corrections applied to the same rows.Strike the fund NAV
A fund token is worth the fund’s net asset value (NAV) per unit, which the fund administrator publishes.
Take the NAV per unit for each fund token you accept. A stale NAV overvalues collateral after the fund falls, so your rules should say how old a NAV can be before it’s treated as missing.
Value the collateral
Balances become collateral value once each is multiplied by its NAV or price and cut by a haircut.
Multiply each balance by its NAV per unit, or by your rule for stablecoins, apply the haircut for that asset and compare the total with the client’s margin requirement. Your margin system does this with the same rules it uses for the client’s other collateral.
Make the margin call
A client whose collateral falls short of the requirement has to post more or reduce positions.
Your margin system issues the call under the client agreement and tracks it until it’s met. A new NAV can cause a shortfall without any wallet moving, so the valuation has to rerun when a NAV arrives as well as when balances change.
What to know about streaming collateral balances
- A balance updates when its wallet moves, so a shortfall caused by a new NAV shows up when your margin system revalues.
- Adding or removing a client’s wallet is a row in the watch list, with no redeploy.
- Each row is replaced on the wallet’s next move and corrected after a reorg, so the table holds the latest balance per wallet and token.
- Valuation and the margin call stay in your margin system.
Post collateral
Clients meet margin by moving fund tokens or stablecoins into the margin wallet held for them.
Your custody provider holds the wallet under your agreement with the client. Collateral can arrive or leave overnight and at weekends as well as in market hours, so checks that run only in the working day miss moves.
Run the check on a schedule
Handled by Goldsky ComposeA timer makes sure every wallet is checked even when nothing moves.
Choose an interval that fits how fast your clients’ positions and the NAV change. A long interval leaves a shortfall unseen for longer.
Goldsky Compose runs the task on a cron trigger, and every call it makes, from the balance reads to the alert, is logged with the run.
Set up cron triggers (opens in a new tab)Read each wallet’s balances
Handled by Goldsky FeedsThe check starts from what each margin wallet holds now.
Each wallet’s balance of every collateral token has to come back, including tokens with no market price. If fund tokens drop out, the client’s collateral looks smaller than it is.
The Feeds balances endpoint returns a wallet’s latest native and ERC-20 balances across chains. Set
Read the balances endpoint reference (opens in a new tab)include_unknown_price=trueso fund tokens without a market price still come back.Fetch the NAV and margin requirements
Handled by Goldsky ComposeBalances only become collateral value once the fund’s NAV and your haircuts are applied.
The task needs the latest NAV per fund token from your administrator, and each client’s requirement and haircuts from your margin system. If either source is down, the check should fail and say so, so it never values collateral on old numbers.
With Goldsky, the task calls both sources with
Make logged HTTP requests (opens in a new tab)fetch, which retries failed reads and records each request and response with the run.Alert on a shortfall
Handled by Goldsky ComposeSomeone has to act when a client’s collateral is worth less than their requirement.
Value each balance, apply the haircut, compare with the requirement and send an alert with the client, the shortfall and the inputs used. An alert without its inputs sends someone back to work it out by hand.
Compose posts each shortfall to your alerting endpoint, and the run’s log keeps the balances and NAV the decision was based on.
How Compose logs each call (opens in a new tab)Make the margin call
A client whose collateral falls short of the requirement has to post more or reduce positions.
Your margin system issues the call under the client agreement and tracks it until it’s met. A new NAV can cause a shortfall without any wallet moving, so the valuation has to rerun when a NAV arrives as well as when balances change.
What to know about checking margin on a schedule
- Balances are as fresh as the last run, so collateral that leaves between runs shows up at the next one.
- Every run revalues every wallet, so a new NAV is caught on the next run even if no wallet moved.
- The API returns latest balances only, so past positions come from your own records.
- Fund tokens often have no market price, so the task values them at the NAV it fetches.
What you control
- Your team
- Value the collateral
- Make the margin call
- Your providers
- Wallet or custody provider
- Fund administrator
Questions and answers
What is tokenized collateral?
Tokenized collateral is an asset held as a token on a blockchain, such as a money market fund unit or a stablecoin, that is pledged against a trading position or a loan. Because the token moves between wallets at any hour, it can be posted, topped up or returned outside market hours. The firm taking it still values it by its own rules, usually at the fund’s NAV per unit with a haircut, and calls for more when it falls short.
Security and deployment
- SOC 2 Type IIIndependently audited security controls.
- Dedicated infrastructureSingle-tenant options for production workloads.
- Data residencyCloud, on-premises or co-located.
More use cases that track tokenized collateral
Track tokenized collateral and USDC posted as margin with Goldsky
We’ll map it to your systems and show you what Goldsky runs, so your team builds the product, not the pipelines underneath it.