The incorrect order of the Diva and Aave addresses in the constructor of the AaveDIVAWrapperCore results in the addresses being assigned incorrectly within the contract.
Contract AaveDIVAWrapper inherits from the abstract contract AaveDIVAWrapperCore where the addresses of the external protocols, i.e., Aave and DIVA are initialized. In the constructor of AaveDIVAWrapper we have the following order of arguments:
address _aaveV3Pool
address _diva
address _owner
These are then passed to the constructor of AaveDIVAWrapperCore, as shown in the following code:
The problem is that the constructor of the AaveDIVAWrapperCore contract takes the arguments in the following order:
address diva_
address aaveV3Pool_
address owner_
This means that the diva_ address and the aaveV3Pool_ address have been swapped, causing none of the functions to work and rendering the wrapper unusable.
The following code shows the assignment of the two addresses and the constructor of the AaveDIVAWrapperCore
Furthermore, in the deployment script deployAaveDIVAWrapper.ts, we can also see that the order is
AaveV3Pool
DIVA
Owner
One would imagine that the tests would catch this mistake but if we look at the test file AaveDIVAWrapper.test.ts we see that in the moment of the deployment at L99 the order of the constructor arguments has been changed to
divaAddress
AaveAddress
ownerAddress
HIGH -> The wrapper will be deployed, but the addresses of the DIVA protocol and Aave will be swapped, meaning that any function relying on these external protocol will not work
Change the order of the arguments when deploying AaveDIVAWrapper in AaveDIVAWrapper.test.ts and every test will fail:
Manual Review
Change the argument order in the constructor of AaveDIVAWrapperCore to be the same as in the AaveDIVAWrapper, i.e.,
aaveV3Pool_
diva_
owner_
Also, adapt the test file to ensure the order remains correct after the change.
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.