/erc8056:erc8056-mathfrom erc8056
Computes share-equivalent balances, per-share prices, and position values for ERC-8056 tokenized stocks using Chainlink feeds. Prevents unit mismatches between token and share amounts.
Ships in erc8056. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
erc8056 is a TypeScript library (npm erc8056, Node 20+, peer dependency viem). A Stock Token has two units: TOKEN (what balanceOf returns, never changes on a corporate action) and SHARE-EQUIVALENT (what the holder economically owns). uiMultiplier() is the 1e18-scaled shares-per-token ratio. Install with npm install erc8056 viem.
balance * uiMultiplier / 1e18, truncating. Never print balanceOf as a share count.The types enforce this: tokenAmount and shareAmount are distinct, and positionValue requires a TokenPrice, so passing a share price is a compile error (and a PriceUnitMismatchError at runtime).
readUiMultiplier(client, token), readMultiplierState, readScheduledAction, readShareEquivalent. A token without uiMultiplier() resolves to 1e18. Transport failures propagate instead of being treated as 1.0.shareEquivalent(amount, multiplier), tokensForShares, tokenPriceFromFeed(answer, decimals), sharePriceFromFeed(answer, decimals, multiplier), toSharePrice, toTokenPrice, positionValue(amount, price, decimals), mulDiv, rescale.uiMultiplier(bigint), tokenAmount(bigint), shareAmount(bigint), tokenPrice(bigint, decimals), sharePrice(bigint, decimals).toDecimalString, formatPrice, formatMultiplier, formatFixedPoint, toFloat.erc8056Abi, erc8056ScheduledAbi, stockTokenReadAbi, erc20ReadAbi.The repo also ships a Solidity reference implementation under contracts/ (ERC8056.sol, ERC8056StockToken.sol) for writing a token.
import { createPublicClient, http } from 'viem'
import { robinhood } from 'viem/chains'
import { readUiMultiplier, shareEquivalent, tokenAmount, toDecimalString } from 'erc8056'
const client = createPublicClient({ chain: robinhood, transport: http() })
const multiplier = await readUiMultiplier(client, '0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5')
const balance = tokenAmount(1_000_000_000_000_000_000_000n)
console.log(toDecimalString(shareEquivalent(balance, multiplier), 18))
Pricing: sharePriceFromFeed(answer, 8, multiplier) for a per-share price, tokenPriceFromFeed(answer, 8) for a per-token price, then positionValue(rawBalance, tokenPrice, 18).
1e18 for every token are out of date.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub nirholas/robinhood-chain-erc8056 --plugin erc8056