Skip to content

skaunov/solana-solquad-excercise

 
 

Repository files navigation

Introduction to the Solquad Project Testing Exercise

Welcome to the Solquad Project Testing Exercise! This unique and hands-on exercise is designed to help you test your skills. The Solquad Project presents a series of tests and challenges centered around a hypothetical blockchain application built on the Solana network. This exercise is particularly focused on the Anchor framework, which you have learned about in the previous modules. Your task involves reviewing and improving the given Solquad smart contract code.

Code Overview

This code includes various functionalities such as initializing escrow and pool accounts, creating and managing projects, and handling voting and reward distribution mechanisms. The exercise is designed to test your understanding of Solana's programming model, smart contract logic, and the particularities of handling transactions and accounts on a blockchain.

Challenges

  1. Prevent Double Addition of Projects in Pool: In Test 2, the same project is added twice to the pool, allowing for potential double funding. Modify the program logic to prevent a project from being added more than once.

Hint: Consider adding a boolean field to the project account that flags whether it's already in a pool.

  1. Restrict Projects to a Single Pool: In Test 3, a project is added to multiple pools, which shouldn't be possible. Implement a check in the program to ensure a project can only be associated with one pool.

Hint: This might involve seed checks on the project account.

  1. Safe Arithmetic in Escrow Distribution: In the distribute_escrow_amount instruction, current arithmetic operations are unchecked, risking overflow errors. Introduce safe arithmetic practices to handle potential overflows.

  2. Analysis of Weighted Reward Distribution: Test 4 reveals that a project receives double the intended amount. Investigate and address this issue, considering whether resolving the first challenge also fixes this or if additional modifications are needed.

By tackling these challenges, you will not only improve the Solquad project but also deepen your understanding of smart contract security and efficiency.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 50.0%
  • Rust 50.0%