Issue with allocation
function allocateFunds(address recipient, uint256 amount) {
_allocations[msg.sender][recipient] = amount;
}
function withdraw(address token, uint256 amount, address recipient) {
if (_balances[token] < amount) revert InsufficientBalance();
// No check against allocations
}
// Example:
allocateFunds(recipient1, 1000); // Allocator A
allocateFunds(recipient2, 1000); // Allocator B
// Total allocated: 2000
// Actual balance might be: 500
// System allows overallocation
Example:
// Treasury has 1000 USDC
_balances[USDC] = 1000
// No allocations yet
_allocations[allocatorA][recipient1] = 0
_allocations[allocatorB][recipient2] = 0
// Allocator A promises 800 USDC to recipient1
allocateFunds(recipient1, 800);
_allocations[allocatorA][recipient1] = 800
// Problem #1: Function doesn't specify which token is being allocated
// Problem #2: No check if Treasury has 800 of any token available
// Allocator B promises 500 USDC to recipient2
allocateFunds(recipient2, 500);
_allocations[allocatorB][recipient2] = 500
// Total allocated: 800 + 500 = 1300
// Actual balance: 1000 USDC
// Problem #3: System allowed allocations exceeding available funds
// Recipient1 tries to withdraw their 800 allocation
withdraw(USDC, 800, recipient1);
// Only checks balance, not allocations
if (_balances[USDC] = totalAllocated + amount, "Insufficient funds");
_allocations[msg.sender][recipient] = amount;
}
// Current withdraw function
function withdraw(address token, uint256 amount, address recipient) {
if (_balances[token] = amount, "Exceeds allocation");
_allocations[msg.sender][recipient] -= amount;
}
Multiple allocators can exceed available funds. Allocations don't specify token type. No validation against available token balances.
Foundry
This has been expressed above
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.