The comment says, the mapping is like vaultNumber => chainId => allocation
But in the implementation it is done like chainId => vaultNumber => allocation
Vulnerability Detail
Refer the summary section
Impact
If mapping is based on vaultNumber => chainId => allocation , all the implementation which are using the allocation would end with incorrect working behavior.
ak1
medium
Game.sol#L31 : mapping(uint256 => mapping(uint256 => int256)) allocations; is not implemented as how the comment says. Not clear.
Summary
The basket has one of the parameter for allocation.
The comment says, the mapping is like
vaultNumber => chainId => allocation
But in the implementation it is done like
chainId => vaultNumber => allocation
Vulnerability Detail
Refer the summary section
Impact
If mapping is based on
vaultNumber => chainId => allocation
, all the implementation which are using theallocation
would end with incorrect working behavior.Code Snippet
https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Game.sol#L215-L221
Tool used
Manual Review
Recommendation
Not sure whether it is type error. If not, correct the code and update in other places.