Assessment reports>Astroport Pair XYK Sale Tax>Threat Model>Message: ExecuteMsg::ProvideLiquidity

Message: ExecuteMsg::ProvideLiquidity

This message can be sent by anyone and is used to add liquidity to the AMM in return for LP tokens.

The parameters that a user can control are:

  • assets — This is the list of the two input assets (denom and amount). These must be the same as the assets in the pool. The amounts as checked in assert_coins_properly_sent, must be the same as the amounts sent in the message.

  • receiver — This is the address of the receiver of the LP tokens. If not set, the LP tokens are sent to the sender of the message.

  • auto_stake — This determines whether the LP tokens are automatically staked. If set, the minted liquidity tokens are instead staked in the Generator contract on behalf of the receiver.

  • slippage_tolerance — This is an optional parameter that determines the maximum slippage that the user is willing to accept. The transaction will fail if the pool price moves more than the slippage tolerance.

The handler for this message computes the amount of LP tokens to mint and sends them to the receiver. It choses the minimum of the two amounts of LP tokens that would be minted from the two assets. The input assets are checked for normalization to prevent duplicates.

Appropriate messages are generated to mint the LP tokens and to transfer the input assets to the contract. If configured, the asset balances are updated and tracked. The cumulative prices are then updated in the config and the response including the messages and attributes is returned.

Zellic © 2024Back to top ↑