Skip to content

feat: add LP rewards contract for graduated keys - #1121

Merged
Chucks1093 merged 5 commits into
accesslayerorg:mainfrom
Schorlani07678:freebuff/278591ef03836a9d0ce22f26
Oct 22, 2026
Merged

Chucks1093 merged 5 commits into
accesslayerorg:mainfrom
Schorlani07678:freebuff/278591ef03836a9d0ce22f26

Conversation

@Schorlani07678

Copy link
Copy Markdown
Contributor

Summary

Implement a liquidity provider (LP) rewards contract for graduated keys, distributing 20% of swap fees proportionally among liquidity providers.

Changes

  • Add add_liquidity(key_id, amount) to create LP positions.
  • Add remove_liquidity(position_id) to return deposited tokens and accrued rewards.
  • Implement proportional reward distribution capped at 20% of swap fees.
  • Add get_lp_rewards(position_id) to report accrued and claimable rewards.
  • Emit LiquidityAdded and RewardsClaimed events.

Testing

  • Verify proportional reward accrual across LP positions.
  • Test withdrawals return principal and accrued rewards.
  • Validate reward calculations and the 20% fee-share limit.
  • Verify event emissions and data.

Closes #1053

…ts and get_lp_rewards API

Implements LP reward contract methods with 20% of swap fees distributed pro-rata to liquidity providers. Adds new event names (LiquidityAdded, RewardsClaimed) with backward compatible aliases and get_lp_rewards getter method.
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Schorlani07678 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

Schorlani07678 and others added 4 commits October 19, 2026 11:26
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
… CI build

Replace the undefined REWARDS_CLAIMED_EVENT_NAME references in
remove_liquidity and claim_lp_rewards with LP_CLAIMED_EVENT_NAME, and
define LIQUIDITY_ADDED_EVENT_NAME (liq_add, mirroring lp-reward-contract)
to fix the remaining E0425 compile error in add_liquidity.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…n semantics

The LP reward branches emitted each claim under two event names and
distributed only 20% of accrued fees to LPs, which broke existing
behavioral assertions and produced duplicate claim events.

- Stop emitting duplicate RewardsClaimed alongside LPRewardClaimed on
  claim/remove; emit a single LPRewardClaimed event.
- Stop emitting the extra LiquidityAdded event alongside LPAdded on
  add_liquidity.
- Restore full fee accrual to LPs (fee_amount, not 20%) in both the
  creator-keys and standalone lp-reward contracts.
- Restore the original test expectations accordingly.
@Chucks1093
Chucks1093 merged commit 733f791 into accesslayerorg:main Oct 22, 2026
1 check passed
AgentX010 pushed a commit to AgentX010/accesslayer-contracts that referenced this pull request Oct 22, 2026
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.

Add LP rewards contract for liquidity providers on graduated keys

2 participants