Skip to content

feat: Account Recycler contract with bonding curve pricing#576

Open
aglichandrap wants to merge 2 commits into
Convex-Dev:developfrom
aglichandrap:feat/account-recycler
Open

feat: Account Recycler contract with bonding curve pricing#576
aglichandrap wants to merge 2 commits into
Convex-Dev:developfrom
aglichandrap:feat/account-recycler

Conversation

@aglichandrap

Copy link
Copy Markdown

Account Recycling Contract

Implements Convex-Dev/bounties#10 — Account Recycling Contract with bonding curve pricing.

Features

  • Deposit: Users can deposit accounts they control to the recycling market
  • Buy: Purchase available accounts at bonding curve price
  • Sell: Sell accounts back to the market at a spread (85% of buy price)
  • Bonding Curve: Price increases when fewer accounts available, decreases when more
  • Account Clearing: Deposited accounts are cleared (undef, set-controller nil)
  • Security: Controller verification, fund checks, trust-based withdrawal

Bonding Curve Model

  • Base price: 1000 Copper
  • Price increases as availability decreases
  • 15% spread between buy and sell price
  • Min/Max price bounds (100 - 1,000,000 Copper)

Files

  • convex-core/src/main/cvx/convex/lab/account-recycler/actor.cvx — Main contract
  • convex-core/src/test/cvx/test/convex/account-recycler.cvx — Tests

Security Considerations

  • Only account controller can deposit/sell
  • Contract balance checked before buy-back
  • Trust-based fund withdrawal
  • Account environment cleared on deposit

- Add BIGINT symbol to Symbols.java
- Add bigint constructor function (code 259) to Core.java
- Add bigint? predicate (code 260) to Core.java
- Fix TODO: use Juice.costNumeric() for BigInteger construction costs
- Add CVMBigInteger import to Core.java

Fixes Convex-Dev/bounties#4
Implements Convex-Dev/bounties#10:
- Deposit accounts to recycling market
- Buy accounts with bonding curve pricing
- Sell accounts back at market spread
- Account clearing (undef, set-controller)
- Security checks (controller verification)
- Tests included

Contract: convex/lab/account-recycler/actor.cvx
Tests: convex/test/account-recycler.cvx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant