Phoenix-Protocol-Group / phoenix-contracts

Source code of the smart contracts of the Phoenix DeFi hub DEX protocol
GNU General Public License v3.0
10 stars 7 forks source link

[V-PHX-VUL-026] Deployer redundancies #185

Closed gangov closed 9 months ago

gangov commented 9 months ago

The function performs a check on deployer that will always be false:

Redundant deployer check; the if statement will never be taken.

let deployer = e.current_contract_address();

if deployer != e.current_contract_address() {
    deployer.require_auth();
}

This could be simplified by removing the creation of the deployer value and instead running the following:

Reduced stake contract deployment.

e.deployer()
  .with_current_address(salt)
  .deploy(stake_wasm_hash)

Impact

The current implementation is more verbose and leads to dead code.

Recommendation

Simplify the logic in the function.