## Summary
The contract currently has several functions marked as `public` that are not used internally. In Solidity, functions that are not used internally should be marked as `external` rather than `public`. This change can help save gas during external calls, as `external` functions are optimized for this purpose. Making these changes will optimize the contract and ensure adherence to best practices.
## Vulnerability Details
In Solidity, functions marked as `public` can be called both externally and internally, while `external` functions can only be called externally. When a function is not needed for internal calls, marking it as `external` can reduce gas consumption slightly due to the compiler's ability to optimize `external` calls more efficiently. There are multiple instances in the contract where functions are marked as `public` but could be marked as `external` because they are not used internally.
### 11 Found Instances:
1. function setBoxPrice(uint256 _price) public {
2. function addReward(string memory _name, uint256 _value) public {
3. function buyBox() public payable {
4. function openBox() public {
5. function withdrawFunds() public {
6. function transferReward(address _to, uint256 _index) public {
7. function claimAllRewards() public {
8. function claimSingleReward(uint256 _index) public {
9. function getRewards() public view returns (Reward[] memory) {
10. function getRewardPool() public view returns (Reward[] memory) {
11. function changeOwner(address _newOwner) public {
## Impact
Marking functions as external instead of public when they are not used internally can save gas on external calls. Since the functions are only accessed externally, there is no need for them to be callable internally, and marking them as external will make the contract slightly more efficient.
• Gas Optimization: Solidity can optimize external function calls better than public ones. By changing the visibility to external, the gas usage will be reduced when these functions are called from outside the contract.
• Code Readability: Using external instead of public also makes the code cleaner by making it clear that the function is not meant to be called internally, improving readability and maintainability.
## Tools Used
Aderyn
## Recommendations
All the above emntiuoned functions' visibility can be changed from `public` to `external` to mitigate this issue.