Skip to content

feat: co-creator removal, auction cancellation, and staking reward claim - #796

Merged
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
codeX-james:feat/co-creator-removal-auction-staking-rewards
Aug 28, 2026
Merged

feat: co-creator removal, auction cancellation, and staking reward claim#796
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
codeX-james:feat/co-creator-removal-auction-staking-rewards

Conversation

@codeX-james

Copy link
Copy Markdown
Contributor

Summary

Resolves the four issues assigned to codeX-james, backed by a new FeatureError type (ContractError is already at the Soroban 50-variant contracterror cap):

  • remove_co_creator — lets a creator clear a previously configured co-creator split, restoring 100% of future royalties to the creator. Returns NoCoCreatorSet when none is configured, Unauthorized for a non-creator caller, and emits co_creator_removed.
  • cancel_auction — lets a creator withdraw an auction configuration before any auction keys have sold, restoring the normal bonding curve buy path. Returns AuctionAlreadyStarted once auction_sold > 0, NoAuctionConfigured when none exists, Unauthorized for a non-creator caller, and emits auction_cancelled. Ships alongside configure_auction (needed to make the auction phase itself testable/usable — buy_key settles at the fixed auction price while supply is below auction_supply, then transitions back to the curve automatically; get_buy_quote mirrors the same resolution so price previews stay correct during the auction phase).
  • claim_stake_reward — unlocks a holder's stake once the 30-day lock has elapsed and pays out a pro-rata share of a per-creator staking rewards pool, funded by routing 10% of each protocol fee collection into that pool alongside the existing treasury/recipient split. Returns StakeLockActive before unlock, NoStakeFound with no active stake, and emits stake_reward_claimed.
  • Integration tests covering the full auction-to-bonding-curve transition: configuring a 5-key fixed-price auction, buying all 5 at the auction price with auction_purchase events and a running auction_sold count, then a 6th buy priced at the bonding curve formula for supply 5 with a standard buy event.

Also fixes creator-keys/src/test_new_features.rs, found broken at compile time independent of this change (called a removed initialize() entrypoint, wrong register_creator arity, .unwrap() on a plain u32) — fixed so the crate's test suite builds and runs at all.

⚠️ Pre-existing, unrelated build break on main

main currently fails to compile independent of this PR. Root cause: the merge commit for PR #774 (aa46355) dropped several DataKey/ContractError/events additions that its own already-merged code depends on (DataKey::ProtocolFeeBps, LockupDurationSecs, RoyaltyConfig, CurveExponent; constants::storage::holder_cap_bps/last_buy_timestamp; events::LockupBlockedEvent/FeeCollectedEvent and their topic helpers). Confirmed via git worktree: the original feature commit (49a7900) builds cleanly standalone — only the merge into main is broken.

Three of the missing pieces (ContractError::MaxHoldingExceeded, LockupPeriodActive, InvalidHolderCap) can't simply be restored: ContractError is already at Soroban's 50-variant contracterror cap (the same constraint that led to FeatureError in this PR). Restoring them needs a follow-up design decision (split the enum further, consolidate an existing variant, etc.) on code this PR doesn't own — flagging for maintainers rather than taking that on unilaterally here.

Because of this, cargo build/CI will currently fail on this PR too, through no fault of the changes here. All new code and tests were fully verified (cargo build + full cargo test --tests, ~180 binaries, 24 new passing tests, no regressions in the 5 known-unrelated pre-existing failures) on top of main before this pre-existing break was discovered further back in history; the branch was then rebased onto current main and the rebase resolution reviewed by hand line-by-line, with no changes to this PR's own logic.

Test plan

  • cargo build / cargo test --tests — clean, before the base-breaking history was in the branch's ancestry
  • 24 new integration tests across co_creator_removal.rs, prelaunch_auction.rs, staking_reward_claim.rs, auction_bonding_curve_transition.rs — all passing
  • Rebase conflict resolution reviewed by hand (3 conflicting regions in creator-keys/src/lib.rs) — confirmed no unintended drops or duplications
  • Re-verify cargo test once the pre-existing build break above is fixed on main

Closes #791
Closes #790
Closes #789
Closes #788

Resolves the four issues assigned to codeX-james, backed by a new
FeatureError type (ContractError is already at the Soroban 50-variant
contracterror cap):

- remove_co_creator: lets a creator clear a previously configured
  co-creator split, restoring 100% of future royalties to the creator.
  Panics-equivalent (returns Err) with NoCoCreatorSet when none is
  configured, Unauthorized for a non-creator caller, and emits
  co_creator_removed.

- cancel_auction: lets a creator withdraw an auction configuration
  before any auction keys have sold, restoring the normal bonding
  curve buy path. Returns AuctionAlreadyStarted once auction_sold > 0,
  NoAuctionConfigured when none exists, Unauthorized for a non-creator
  caller, and emits auction_cancelled. Depends on configure_auction,
  added alongside it to make the auction phase itself testable/usable
  (buy_key settles at the fixed auction price while supply is below
  auction_supply, then transitions back to the curve automatically;
  get_buy_quote mirrors the same resolution so price previews stay
  correct during the auction phase).

- claim_stake_reward: unlocks a holder's stake once the 30-day lock
  has elapsed and pays out a pro-rata share of a per-creator staking
  rewards pool, funded by routing 10% of each protocol fee collection
  into that pool alongside the existing treasury/recipient split.
  Returns StakeLockActive before unlock, NoStakeFound with no active
  stake, and emits stake_reward_claimed.

- Integration tests covering the full auction-to-bonding-curve
  transition: configuring a 5-key fixed-price auction, buying all 5 at
  the auction price with auction_purchase events and a running
  auction_sold count, then a 6th buy priced at the bonding curve
  formula for supply 5 with a standard buy event.

Also fixes creator-keys/src/test_new_features.rs, which was broken at
compile time on main independent of this change (called a removed
initialize() entrypoint, wrong register_creator arity, .unwrap() on a
plain u32) — fixed so the crate's test suite can build and run at all.

Closes accesslayerorg#791
Closes accesslayerorg#790
Closes accesslayerorg#789
Closes accesslayerorg#788
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@codeX-james Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit bbbede3 into accesslayerorg:main Aug 28, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment