Automatic smart contract auditing and code refactoring using GPT4
The problem Solidity Copilot solves
Smart Contract Auditing: audits the smart contract, identifies security issues, and refactors the code based on the issues found in one click
Code Refactoring: opens up a new window on vscode so that the developer can compare the code (highlights which parts are removed or added for clear visibility and provides comments for each change to enhance code review and comprehension). This is a helpful feature that saves developers time and effort in manually making the necessary changes.
Test Code Generation: automatically generates test codes for the smart contract so that a developer doesn't have to go through the hassle of checking everything each time a function is written (if a test code file doesn't exist, our tool creates a test folder and places the new test code in that folder, ensuring an organized structure)
Gas Fee Checking: checks gas fees in one click by utilizing the hardhat gas reporter based on the test code that is generated by our tool so that the process of checking the smart contract's gas consumption is streamlined. This helps optimize gas usage and efficiency in smart contracts.
Challenges I ran into
the api key for GPT4 is very slow to test our code for code refactoring and smart contract auditing. We had to change between different GPT models (GPT3.5 & GPT4): used GPT3.5 to test the code quickly and find any bugs, and used GPT4 to enhance the output quality
showing the differences between the original code versus the newly refactored code was difficult. We wanted to find a way to best present the differences in one vscode window, so we decided that splitting up the windows and highlighting the differences as red and green (red: removed, green: added code) would be the easiest way to understand how the code changed.
Tracks Applied (2)
Web3.0 dApp
Security and Reliability: By providing automatic smart contract auditing, our tool enhances the security and reliability...Read More
Impact Application
Security and Reliability: By providing automatic smart contract auditing, our tool enhances the security and reliability...Read More