This bounty is no longer available
Web3 DAO | strips-finance Logo

STRP staking contract

Organization

strips-finance

Deadline

in over 262 years

Status

ENDED

302.03 USD

INSTRUCTIONS

Task: Need to implement staking contract that will allow STRP stakers to receive 15% of all trading fees on Strips. Address of the contract will be pushed to Strips, and Strips will automatically pay 15% of commissions to lockup contract. Contact @ksshilov for questions.

User flow: User stakes STRP to the contract. Contract record wallet address of the staker (it's not ERC20). After lockup, staker can withdraw USDC earned proportionally to his share in the pool. Once staker decides to unstake his STRP - he will receive back his STRP and pro-rated USDC profits. 3 functions available for staker:

  1. Lock STRP - locked strp amount will be withdraw from staker to contract.
  2. Claim USDC - he will receive available USDC
  3. Unlock STRP - staker should receive his STRP back, and his current share of USDC.

Scenario

  1. 2 stakers locked 100 STRP each. Total locked is 200 STRP.
  2. Contract receive 100 USDC (total balance: 100 USDC)
  3. Staker A decide to claim USDC: he should receive 50 USDC (total balance: 50 USDC)
  4. Staker A can't claim anymore than 50 USDC
  5. Contract receives another 100 USDC (total balance: 150 USDC)
  6. Staker B decides to claim USDC, he will receive 100 USDC (total balance: 50 USDC)
  7. Staker B can't claim anymore than 100 USDC
  8. Staker A decides to unstake his STRP, he will receive 50 USDC + his original 100 STRP (total balance: 0 USDC)

Implementation details

  1. Each time staker stake we increase USDC accumulator. Staker can't withdraw USDC that was paid before he staked.
  2. When staker claim USDC, we increase USDC accumulator and multiply staker share to the growth. This is the value which staker can receive.