Open hats-bug-reporter[bot] opened 2 months ago
Github username: @coreggon11 Twitter username: krikoeth Submission hash (on-chain): 0x66b206cbd9a06db535ff0cd9a130935be56ab7a786e7ac1939650f1bf3cb7b7b Severity: low
Description:
The function get_amounts_for_liquidity_mint accepts &mut self as the argument. However, this funciton does not change the contract's state, therefore the self parameter should not be mutable.
get_amounts_for_liquidity_mint
&mut self
Consider changing the function parameter:
#[ink(message)] fn get_amounts_for_liquidity_mint( - &mut self, + &self, liquidity: u128, ) -> Result<Vec<u128>, StablePoolError> { Ok(math::compute_amounts_given_lp( liquidity, &self.reserves(), self.psp22.total_supply(), )?) }
The suggested change should also be done in the StablePool trait.
StablePool
Invalid submission: it does not change the intended behavior of the contract
Github username: @coreggon11 Twitter username: krikoeth Submission hash (on-chain): 0x66b206cbd9a06db535ff0cd9a130935be56ab7a786e7ac1939650f1bf3cb7b7b Severity: low
Description:
Description
The function
get_amounts_for_liquidity_mint
accepts&mut self
as the argument. However, this funciton does not change the contract's state, therefore the self parameter should not be mutable.Recommendation
Consider changing the function parameter:
The suggested change should also be done in the
StablePool
trait.