Skip to content

Yield Farming Protocol Smart Contract#1

Open
shinaola-codes wants to merge 1 commit intomainfrom
YF
Open

Yield Farming Protocol Smart Contract#1
shinaola-codes wants to merge 1 commit intomainfrom
YF

Conversation

@shinaola-codes
Copy link
Copy Markdown
Owner

Yield Farming Protocol Smart Contract (Clarity)

This smart contract implements a yield farming and token staking protocol on the Stacks blockchain. It allows users to stake two tokens (primary and secondary) into a farming vault to earn yield rewards based on a time-weighted share allocation model. The contract includes:

  • Token Compatibility: Works with any token implementing the defined fungible-token-trait.
  • Minimum Deposit Enforcement: Deposits must meet a predefined MIN_DEPOSIT_AMOUNT threshold.
  • Share Allocation Mechanism: Uses a custom find-minimum function to fairly allocate shares based on deposits and current vault reserves.
  • Lockup Period: Users must wait LOCKUP_DURATION (~24 hours in blocks) before withdrawing their staked tokens and rewards.
  • Yield Calculation: Based on stake amount, duration, and the current yield-rate.
  • Vault Management: Tracks total reserves, outstanding shares, and accumulated fees per vault.
  • Admin Functions: Includes admin transfer, yield rate adjustment, and protocol pause/resume control.
  • Security Checks: Ensures valid token contracts, prevents re-entry or duplicate deposits, and enforces access control.

Overall, this contract offers a secure and flexible infrastructure for decentralized yield farming with built-in administrative oversight and automated reward mechanics.

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