Spec vs implementation: min buy should be price per 1e18 CHARM (coupling); on-chain is 1:1 spend weight #14
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#14
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Product intent: The time-growing minimum buy should double as the price of one CHARM, with CHARM expressed as an 18-decimal unit (1e18 base units = “one charm” in user-facing terms). We want that coupling: the floor is not an independent dust limit — it is the per-charm price in the accepted asset, so economics stay aligned as the curve moves.
Current behavior: The contract does not implement that model.
charmWeightincreases by the rawamountof accepted asset (same units asminBuy), i.e. 1:1 spend-to-weight with no fixed 18-decimal “charms” notion. Minimum buy only gatesamount >= minBuy; it does not definecharmsMinted = amount * 1e18 / price(or equivalent) wherepriceis the growing floor.So today, raising
currentMinBuyAmountchanges the minimum transaction size and the per-tx cap but does not correctly encode “price per 1e18 CHARM” as the spec intends.On-chain (authoritative today)
In
TimeCurve._buy:require(amount >= minBuy),charmWeight[msg.sender] += amount,totalCharmWeight += amount. Weight is in asset raw units, not normalized CHARM with 18 decimals from a price.Cross-repo impact
totalCharmWeight/redeemCharmsdenominator alignment.Acceptance criteria (suggested)
changed title from
Design flaw: minimum buy doubles as per-charm price; charm units should be 18-decimaltoSpec vs implementation: min buy should be price per 1e18 CHARM (coupling); on-chain is 1:1 spend weightchanged the description
CORRECTION.
Min and max buy should be in charms, 1 to 10. TO prevent reverts, in smart contract it should be 0.99 to 10, but in frontend show 1 to 10.
Price should be decoupled from min/max buy.
Price logic should be in a seperate smart contract that can be swapped out with different algorithms
Primary price logic algorithm should be linear, following price = m * time_in_seconds_since_srart + b. For DOUB we want price to increase by $0.1 per day and start at $1.0
partial verify on
d9987ca. onchain values match spec: initialMinBuy=1, purchaseCapMultiple=10, currentMinBuyAmount grew to ~1.97, max buy ~19.73 (10x min). can't test actual buy flow because sale is ended on local anvil stack. 'Sale is not active' correctly displayed. endSale/redeemCharms/distributePrizes buttons present. need a fresh deploy with active sale to fully verify min/max enforcement and price decoupling.Update pushed (main @
44138d7)What landed
TimeCurvenow buys by CHARM quantity (charmWad) with bounds derived from the exponential envelope (TimeMath.currentMinBuy× 0.99 / 10). Spend ischarm × pricevia pluggableICharmPrice; defaultLinearCharmPriceis linear in elapsed time (base + per-day increment), decoupled from min/max envelope scaling.charm_wad/price_per_charm_wad; integration test fixtures updated.timeCurveMath, TimeCurve page slider 1–10 CHARM with envelope-derived bounds and linear price readout.docs/product/primitives.mdanddocs/testing/invariants-and-business-logic.mdupdated with the split (envelope vs linear price), invariant table, and cross-links toLinearCharmPrice.t.sol,TimeCurve.t.sol,TimeCurveInvariant.t.sol.Verification
FOUNDRY_PROFILE=ci FOUNDRY_OUT=/tmp/yieldomega-forge-out forge test: 126 tests passed (includes fuzz on ratio, scaling,buyin-bounds, andLinearCharmPrice).cd indexer && cargo test: ok.Issue left open for any follow-up (e.g. alternate pricing modules, UI copy, or deployment checklist).
mentioned in issue #39
mentioned in issue #354
mentioned in issue #342
mentioned in merge request !522