jb-cash-out-curve

0
0
Source

Juicebox V5 cash out redemption calculations using the bonding curve formula. Use when: (1) displaying cash out values in UI, (2) explaining redemption amounts to users, (3) calculating what percentage of treasury a cash out returns. The simple "X% of proportional share" is WRONG - must use bonding curve formula.

Install

mkdir -p .claude/skills/jb-cash-out-curve && curl -L -o skill.zip "https://mcp.directory/api/skills/download/9012" && unzip -o skill.zip -d .claude/skills/jb-cash-out-curve && rm skill.zip

Installs to .claude/skills/jb-cash-out-curve

About this skill

Juicebox V5 Cash Out Bonding Curve

Problem

When displaying cash out / redemption values in Juicebox V5 UIs, it's tempting to show a simple message like "Cashing out returns 90% of proportional treasury share" (for a 10% tax rate). This is incorrect and misleading to users.

The actual redemption amount depends on a bonding curve formula where the percentage of supply being cashed out affects the return.

Context / Trigger Conditions

  • Building UI that shows cash out / redemption values
  • Explaining to users what they'll receive when cashing out
  • Any display of cashOutTaxRate impact on redemptions
  • When you see code like retainedPercent = 100 - cashOutTax - this is WRONG

Solution

The Bonding Curve Formula

reclaimAmount = (x * s / y) * ((1 - r) + (r * x / y))

Where:

  • x = number of tokens being cashed out
  • s = surplus (treasury overflow available for redemption)
  • y = total token supply
  • r = cash out tax rate as decimal (0 to 1, where 0.1 = 10%)

Normalized Form

When working with fractions (what % of supply is being cashed out):

Let f = x/y (fraction of supply being cashed out)
reclaimFraction = f * ((1 - r) + (r * f))

Where reclaimFraction is the fraction of surplus received.

Key Insight

The return depends on HOW MUCH of the supply is being cashed out, not just the tax rate. Cashing out a larger percentage of supply returns proportionally less per token.

Example Calculation

With 10% cash out tax rate (r = 0.1), cashing out 10% of supply (f = 0.1):

reclaimFraction = 0.1 * ((1 - 0.1) + (0.1 * 0.1))
reclaimFraction = 0.1 * (0.9 + 0.01)
reclaimFraction = 0.1 * 0.91
reclaimFraction = 0.091  // 9.1% of surplus

So cashing out 10% of the supply gets ~9.1% of the surplus (not 9% as simple math would suggest).

Code Implementation

// WRONG - Don't do this:
const retainedPercent = 100 - (cashOutTaxRate / 100)
message = `Cashing out returns ${retainedPercent}% of proportional treasury share`

// CORRECT - Use bonding curve:
function calculateCashOutReturn(
  tokensToRedeem: number,
  totalSupply: number,
  surplus: number,
  cashOutTaxRate: number // 0-10000 basis points
): number {
  const r = cashOutTaxRate / 10000  // Convert basis points to 0-1
  const x = tokensToRedeem
  const y = totalSupply
  const s = surplus

  // Bonding curve formula
  return (x * s / y) * ((1 - r) + (r * x / y))
}

// For UI display with example percentage:
const r = cashOutTaxRate / 10000
const exampleFraction = 0.1  // 10% of supply
const returnFraction = exampleFraction * ((1 - r) + (r * exampleFraction))
const returnPercent = (returnFraction * 100).toFixed(1)
message = `Cashing out 10% of ${tokenSymbol} gets ~${returnPercent}% of treasury`

Verification

Test with known values:

  • r = 0 (no tax): reclaimFraction = f (linear, full proportional return)
  • r = 1 (100% tax): reclaimFraction = f * f (quadratic, harsh penalty)
  • r = 0.1, f = 0.1: reclaimFraction = 0.091 (9.1%)
  • r = 0.1, f = 0.5: reclaimFraction = 0.5 * (0.9 + 0.05) = 0.475 (47.5%)

Example

In the RulesetSchedule component's Juicy Summary:

// Cash out - redemption value using bonding curve formula
const cashOutTaxRate = ruleset.cashOutTaxRate / 10000
if (cashOutTaxRate >= 1) {
  actionItems.push({ action: 'caution', message: 'Cash outs disabled' })
} else if (cashOutTaxRate > 0) {
  const x = 0.1 // 10% of supply
  const y = x * ((1 - cashOutTaxRate) + (cashOutTaxRate * x))
  const returnPercent = (y * 100).toFixed(1)
  actionItems.push({
    action: 'cash-out',
    message: `Cashing out 10% of ${tokenSymbol} gets ~${returnPercent}% of treasury`,
  })
}

Notes

  • The cashOutTaxRate in Juicebox V5 is stored in basis points (0-10000)
  • A rate of 10000 (100%) means cash outs are effectively disabled
  • The formula assumes the treasury "overflow" is the redeemable amount
  • This bonding curve incentivizes holding - early/small cash outs get better rates
  • The CashOutCurve visualization component can show this graphically

References

  • Juicebox V5 JBRulesets contract
  • Cash out bonding curve formula: y = (o * x / s) * ((1 - r) + (r * x / s))
    • Normalized to: y = x * ((1 - r) + (r * x)) where x is fraction of supply

a-stock-analysis

openclaw

A股实时行情与分时量能分析。获取沪深股票实时价格、涨跌、成交量,分析分时量能分布(早盘/尾盘放量)、主力动向(抢筹/出货信号)、涨停封单。支持持仓管理和盈亏分析。Use when: (1) 查询A股实时行情, (2) 分析主力资金动向, (3) 查看分时成交量分布, (4) 管理股票持仓, (5) 分析持仓盈亏。

622241

research-paper-writer

openclaw

Creates formal academic research papers following IEEE/ACM formatting standards with proper structure, citations, and scholarly writing style. Use when the user asks to write a research paper, academic paper, or conference paper on any topic.

69164

fivem

openclaw

Fix, create, or validate FiveM server resources for QBCore/ESX (config.lua, fxmanifest.lua, items, housing/furniture, scripts, MLOs). Use when asked to debug resource errors, convert ESX↔QB, update fxmanifest versions, add items, or source scripts from GitHub. Also use for SSH key generation for SFTP access.

215143

keyword-research

openclaw

Discovers high-value keywords with search intent analysis, difficulty assessment, and content opportunity mapping. Essential for starting any SEO or GEO content strategy.

38290

weread

openclaw

WeChat Reading (微信读书) CLI tool for fetching notes and highlights. Use when: (1) user asks about weread/微信读书 notes or highlights, (2) fetching today's or recent reading notes, (3) exporting book highlights, (4) managing reading bookshelf, (5) any task involving reading notes from WeChat Reading.

9081

gog

openclaw

Google Workspace CLI for Gmail, Calendar, Drive, Contacts, Sheets, and Docs.

19279

You might also like

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

2,1852,015

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

2,0191,568

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

2,0641,352

pdf-to-markdown

aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.

2,9091,271

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

2,0611,084

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

1,747892