Build on Solana
Task II
Contract Creation Task
Create a new contract using anchor which will extend the functions we have up to this point. Only change needs to be made to the increment and decrement functions.
- increment: A function to increase the counter value, with an optional parameter data that specifies how much to increment (default value is 1).
- decrement: A function to decrease the counter value, with an optional parameter data that specifies how much to decrement (default value is 1).
In the decrement function:
Check if the data parameter is passed. If not, set data to 1 (default value).
Before decrementing the counter, check if the result would be less than 0. If so, throw an error to prevent negative values.
Frontend Integration Task
Create a basic frontend interface using the react template available from the frontend integration video. Remember to interact with all of the functions in the contract.