BCDV-4028_Advanced_Smart_Contracts

LAB 1: Array Manipulation using SafeMath Library

Step 1: Deploying the library on Remix IDE Screenshot 2023-09-24 at 10 21 48 PM


Step 2: Deploying the smart contract by giving a user defined Data Array on Remix IDE Screenshot 2023-09-24 at 10 22 37 PM
Step 3: Calling the getArray function to check our input Screenshot 2023-09-24 at 10 23 33 PM
Step 4: Calling the sortArray function to sort our input Screenshot 2023-09-24 at 10 24 58 PM
Step 5: Calling the removeDuplicatesFromArray function to remove the duplicates Screenshot 2023-09-24 at 10 25 16 PM
BONUS Step: Fetching elements from the dataArray based on their indexes. Screenshot 2023-09-24 at 10 25 43 PM




LAB 2: Delegate Call to update state variables

Step 1: Deploying the Receiver Contract on Remix IDE Screenshot 2023-09-25 at 12 02 20 AM


Step 2: Deploying the Caller smart contract by giving the receiver contract address as the input Screenshot 2023-09-25 at 12 02 45 AM
Step 3: Calling the stateVariable function to get the value of the variable on the Receiver contract. Screenshot 2023-09-25 at 12 03 11 AM
Step 4: Updating the value of the stateVariable using the updateState on the Receiver contract. Screenshot 2023-09-25 at 12 03 58 AM
Step 5: Calling the receiver address function on the Caller Contract to verify the address of the receiver contract Screenshot 2023-09-25 at 12 07 46 AM
Step 6: Calling the updateState function on the Caller Contract and checking the address of the receiver contract which has been updated because of the delegate call. Screenshot 2023-09-25 at 12 10 15 AM




LAB 3: Lending Contract, Unit Tests and Simulation Test

Image 1: All three unit tests passed. Screenshot 2023-09-30 at 10 29 29 PM

Image 2: Simulation test passed. Screenshot 2023-09-30 at 10 43 41 PM




LAB 5: Generating random number using ChainLink VRF

Step 1: Deploying the contract with the correct subscription ID. Screenshot 2023-10-01 at 10 01 02 PM

Step 2: Adding the address of the deployed contract into the trusted consumer list. Screenshot 2023-10-01 at 10 09 58 PM

Step 3: Check the Last Request ID, and copy it. Screenshot 2023-10-01 at 10 12 11 PM

Step 4: Paste the requestID in the getRequestState tab and getRequestState. You will see a bool: fulfilled true indicating the fulfilled request. You will also see the 2 random numbers generated. Screenshot 2023-10-01 at 10 12 36 PM

Step 5: Request again for random numbers. Check history to note the pending transaction. Screenshot 2023-10-01 at 10 16 21 PM

Step 6: Repeat the process and see the output again! Screenshot 2023-10-01 at 10 17 22 PM