executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
jb-v5-currency-typesJuicebox V5 currency system with two distinct types: real-world currencies and token-derived currencies. Use when: (1) configuring ruleset.baseCurrency, (2) setting up JBAccountingContext, (3) working with cross-chain projects, (4) confused about why currency values differ between chains, (5) seeing unexpected issuance rates across chains. Critical: baseCur…
Independent GitHub snapshot · Automated classification · Original documentation governs
Juicebox V5 has two different currency systems that are easy to confuse, leading to:
Apply this knowledge when:
ruleset.baseCurrency for token issuanceJBAccountingContext.currency for terminalsJBCurrencyAmount in payout limits or allowances1. Real-World Currencies (JBCurrencies)
Abstract values representing the concept of a currency, chain-agnostic:
| Currency | Value | Use For |
|---|---|---|
| ETH | 1 | "Per ETH" pricing regardless of chain |
| USD | 2 | "Per dollar" pricing regardless of chain |
These are stable across ALL chains. baseCurrency=2 means "issue X tokens per USD" whether you're on Ethereum, Base, Celo, or Polygon.
2. Token-Derived Currencies
Computed from token addresses, chain-specific:
currency = uint32(uint160(tokenAddress))
| Token | Chain | Address | Currency |
|---|---|---|---|
| USDC | Ethereum | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 | 909516616 |
| USDC | Optimism | 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 | 3530704773 |
| USDC | Base | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 | 3169378579 |
| USDC | Arbitrum | 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 | 1156540465 |
| NATIVE_TOKEN | All | 0xEEEE...EEEe | 4008636142 |
| Field | Use | Why |
|---|---|---|
ruleset.baseCurrency | Real-world only (1 or 2) | Rulesets must be interpretable consistently across ALL chains |
JBAccountingContext.currency | Token-derived | You're tracking a specific token at a specific address |
JBCurrencyAmount.currency | Either | Depends on whether you want abstract value or token-specific |
JBFundAccessLimitGroup amounts | Either | Use real-world for cross-chain consistency |
NEVER use token currencies for baseCurrency
NEVER use NATIVE_TOKEN's currency (4008636142) for baseCurrency
JBCurrencies.ETH (which is 1)ALWAYS use token currencies for JBAccountingContext
currency = uint32(uint160(token))USD vs USDC distinction matters
baseCurrency=2 still issues tokens per dollar (protected)JBPrices manages exchange rates between:
To verify correct configuration:
baseCurrency is 1 or 2, never a large token-derived numberJBAccountingContext.currency matches uint32(uint160(token))Correct cross-chain project configuration:
const rulesetConfig = {
// ... other fields
metadata: {
baseCurrency: 2, // USD - same on all chains
// ...
}
}
const terminalConfig = {
terminal: JBMultiTerminal5_1,
accountingContextsToAccept: [{
token: USDC_ADDRESS[chainId], // Different per chain
decimals: 6,
currency: uint32(uint160(USDC_ADDRESS[chainId])) // Different per chain
}]
}
Wrong:
const rulesetConfig = {
metadata: {
baseCurrency: 909516616, // WRONG! This is Ethereum USDC's token currency
// This would break on other chains or if USDC depegs
}
}
Also wrong:
const rulesetConfig = {
metadata: {
baseCurrency: 4008636142, // WRONG! This is NATIVE_TOKEN's currency
// NATIVE_TOKEN is CELO on Celo, MATIC on Polygon, etc.
// If you want "per ETH" issuance, use 1 (JBCurrencies.ETH)
}
}
baseCurrency=1 (ETH) means "issue tokens relative to ETH the asset" - JBPrices correlates NATIVE_TOKEN to ETH at 1:1 on ETH-native chains/jb-suckers - Cross-chain bridging mechanics via sucker contracts/jb-omnichain-ui - Building omnichain UIs with Relayr and Bendystraw