btb-finance / BTBBackendV1

0 stars 0 forks source link

implement btb buy with vesting and usdc payment #11

Open ShahbazBaloch515 opened 1 week ago

ShahbazBaloch515 commented 1 week ago

hussain will develop the feature where users can purchase btb with a vesting option, using usdc for payment. the system must create a data account for each user who opts for this purchase method, and store all relevant information regarding the vesting details.

requirements:

  1. data account creation:

    • when a user purchases btb with vesting, the system should automatically create a pda (program derived account) for that user.
    • this pda must store the following data:
      • time of investment: the timestamp when the purchase is made.
      • total amount invested: the total amount of usdc used for the purchase.
      • amount claimed: initially set to zero.
      • amount to be claimed: the total vested btb tokens that the user is entitled to, based on the purchase amount.
      • vesting start date: when the vesting period begins.
      • vesting end date: the date when the vesting period ends.
      • usdc payment information: transaction details related to the usdc payment.
  2. usdc payment handling:

    • accept usdc as the payment method for purchasing btb.
    • transfer usdc payments to the designated project treasury or multisig wallet.
    • update the user's data account with the investment amount upon receiving usdc.
  3. security considerations:

    • ensure that the smart contract follows best practices for security.
    • implement measures to prevent unauthorized access or manipulation of the vesting data.
ShahbazBaloch515 commented 1 week ago

task for 15/10/2024.

You’ll be working on the BTB buy with vesting and USDC payment feature, where users will be able to purchase BTB with a vesting option using USDC for payment. The system should create a data account (PDA) for each user who chooses this method, and all the relevant information about their vesting details should be stored.

Requirements: Data Account Creation:

When a user purchases BTB with vesting, the system should automatically create a PDA for the user. This PDA must store the following information: Time of Investment: The timestamp when the purchase is made. Total Amount Invested: The total amount of USDC used for the purchase. Amount Claimed: Initially set to zero. Amount to Be Claimed: The total vested BTB tokens the user is entitled to, based on the purchase amount. Vesting Start Date: When the vesting period begins. Vesting End Date: When the vesting period ends. USDC Payment Information: Transaction details related to the USDC payment. USDC Payment Handling:

Accept USDC as the payment method for purchasing BTB. Transfer USDC payments to the designated project treasury or multisig wallet. Update the user’s data account with the investment amount upon receiving USDC. Security Considerations:

Ensure the smart contract follows best practices for security. Implement measures to prevent unauthorized access or manipulation of vesting data. Implement reentrancy guard. Log important events.