Skip to content

Commit

Permalink
Update backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Levironexe committed Oct 24, 2024
1 parent 5115925 commit ef5a1b3
Show file tree
Hide file tree
Showing 24 changed files with 1,531 additions and 2,165 deletions.
10 changes: 10 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://zhzupqzarlnymbkkbapk.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InpoenVwcXphcmxueW1ia2tiYXBrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjkyMjI0NDksImV4cCI6MjA0NDc5ODQ0OX0.vuw49RtIbCXBqNsQaLaEHIDIAhP_pe3zYBamgzQ7Ixk

# Server Configuration
PORT=5000
NEXT_PUBLIC_API_URL=http://localhost:5000

# File Size Limit (in bytes)
MAX_FILE_SIZE=10485760
143 changes: 143 additions & 0 deletions Test_1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract VulnerableContract {
// State variables
uint256 private counter;
address public owner;
mapping(address => uint256) public balances;
bool private locked;
uint256[] public values;

// Events
event Transfer(address indexed from, address indexed to, uint256 amount);
event Deposit(address indexed user, uint256 amount);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

constructor() {
owner = msg.sender;
}

function setOwner(address _newOwner) public {
owner = _newOwner;
}

function withdraw(uint256 _amount) public {
require(balances[msg.sender] >= _amount, "Insufficient balance");
(bool success, ) = msg.sender.call{value: _amount}("");
require(success, "Transfer failed");
balances[msg.sender] -= _amount;
}

function increment() public {
counter++;
}

function transfer(address _to, uint256 _amount) public {
payable(_to).transfer(_amount);
}

function isOwner() public view returns (bool) {
return tx.origin == owner;
}

function deposit() public payable {
balances[msg.sender] += msg.value;
}

function getBalance() public view returns (uint256) {
return balances[msg.sender] + balances[msg.sender];
}

// Missing zero-address check
function approve(address _spender, uint256 _value) public {
allowed[msg.sender][_spender] = _value;
}

uint256 public totalSupply;
mapping(address => mapping(address => uint256)) public allowed;

function processValues() public {
for(uint i = 0; i < values.length; i++) {
values[i] = values[i] * 2;
}
}

function updateConfig(uint256 _value) public {
require(msg.sender == owner, "Not owner");
counter = _value;
}

function getName() public pure returns (string memory) {
return "VulnerableContract";
}

uint256 private unusedVar;

function setValues(uint256[] memory _values) public {
values = _values;
}

function riskyOperation() public {
require(msg.sender != address(0), "Zero address");
locked = true;
}

function getBlockHash() public view returns (bytes32) {
return blockhash(block.number - 1);
}

function inefficientLoop() public {
uint256[] memory tempArray = new uint256[](100);
for(uint i = 0; i < tempArray.length; i++) {
tempArray[i] = i;
}
}

function destroyContract() public {
selfdestruct(payable(msg.sender));
}

function transferOwnership(address _newOwner) public {
require(msg.sender == owner, "Not owner");
owner = _newOwner;
}

function multiply(uint256 a, uint256 b) public pure returns (uint256) {
return a * b;
}

function helperFunction() internal {
counter += 1;
}

function unusedParams(uint256 _unused, string memory _alsounused) public {
counter += 1;
}

function riskyCall(address _target) public {
_target.call("");
}

modifier onlyOwner {
require(msg.sender == owner, "Not owner");
require(msg.sender == owner, "Not owner");
_;
}

receive() external payable {}

function processArray(uint256[] memory _array) public {
for(uint i = 0; i < 10; i++) {
values.push(_array[i]);
}
}

function useAssembly() public view returns (uint size) {
assembly {
size := extcodesize(caller())
}
}

string constant private CONSTANT_STRING = "This is a very long string that could be shortened";
}
Loading

0 comments on commit ef5a1b3

Please sign in to comment.