Winners array seems not checked if theres duplication inside the array inside.So the rewards being send as percentage so there would be mistakenly send more rewards to duplicated address..
Loss of funds caused by user/organizer/owner error .According to protocol developer's these are trusted individuals yet they'r not error prone to begin with .
function createDataWithDuplicatedWinner()public view returns (bytes memory data){
address[] memory tokens_ = new address[](1);
tokens_[0] = jpycv2Address;
address[] memory winners = new address[](2);
winners[0]=(user1);
winners[1]=(user1);
uint256[] memory percentages_ = new uint256[](2);
percentages_[0]=(5000);
percentages_[1]=(4500);
data = abi.encodeWithSelector(Distributor.distribute.selector, jpycv2Address, winners, percentages_, "");
}
function testSucceedsEvenIfTheWinnerIsDuplicated() public setUpContestForJasonAndSentJpycv2Token(organizer) {
assertEq(MockERC20(jpycv2Address).balanceOf(user1), 0 ether);
assertEq(MockERC20(jpycv2Address).balanceOf(stadiumAddress), 0 ether);
bytes32 randomId_ = keccak256(abi.encode("Jason", "001"));
bytes memory data = createDataWithDuplicatedWinner();
vm.warp(16 days);
vm.startPrank(factoryAdmin);
proxyFactory.deployProxyAndDistributeByOwner(organizer, randomId_, address(distributor), data);
vm.stopPrank();
assertEq(MockERC20(jpycv2Address).balanceOf(user1), 9500 ether);
assertEq(MockERC20(jpycv2Address).balanceOf(stadiumAddress), 500 ether);
}
This code block may used if there's duplication exist and take appropriate action according to protocol developer's intentions