Assessment reports>Fee Flow>Threat Model>buy

Function: buy(address[] assets, address assetsReceiver, uint256 deadline, uint256 maxPaymentTokenAmount)

Allows a user to buy assets by transferring payment tokens and receiving the assets.

Inputs

  • assets

    • Control: Full.

    • Constraints: Must be a nonempty array of addresses of contracts with a callable transfer(address,uint256) function.

    • Impact: The addresses of the assets to be bought.

  • assetsReceiver

    • Control: Full.

    • Constraints: None.

    • Impact: The address that will receive the bought assets.

  • deadline

    • Control: Full.

    • Constraints: Must be a future timestamp.

    • Impact: The deadline timestamp for the purchase.

  • maxPaymentTokenAmount

    • Control: Full.

    • Constraints: Must be greater than or equal to the payment amount.

    • Impact: The maximum amount of payment tokens the user is willing to spend.

Branches and code coverage

Intended branches

  • Successfully executes purchase of fee tokens and calculates new price, capping at ABS_MAX_INIT_PRICE.

Negative behavior

  • assets is empty.

  • deadline passed.

  • paymentAmount exceeds maxPaymentTokenAmount.

  • Function cannot reenter.

Zellic © 2024Back to top ↑