Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Invalid

Missing a check against `address(0)` in `GMXTrove`'s constructor

Summary

The constructor of GMXTrove needs to have a check against address(0) to avoid possible errors.

Vulnerability Details

When GMXTrove is deployed an address _vault is passed to its constructor. The current codebase does not check whether the passed _vault can be an address(0) or not.

constructor (address _vault) {
@> vault = IGMXVault(_vault);
GMXTypes.Store memory _store = vault.store();
// Set token approvals for this trove's vault contract
_store.tokenA.approve(address(vault), type(uint256).max);
_store.tokenB.approve(address(vault), type(uint256).max);
}

Impact

Funds could be permanently lost if sent to address(0) because lack of checking.

Tools Used

Manual Review

Recommendations

Add a check to make sure the value provided cannot be address(0).

constructor (address _vault) {
+ if (_vault == address(0)) revert Errors.ZeroAddressNotAllowed();
vault = IGMXVault(_vault);
GMXTypes.Store memory _store = vault.store();
// Set token approvals for this trove's vault contract
_store.tokenA.approve(address(vault), type(uint256).max);
_store.tokenB.approve(address(vault), type(uint256).max);
}
Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.