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
assetsControl: 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.
assetsReceiverControl: Full.
Constraints: None.
Impact: The address that will receive the bought assets.
deadlineControl: Full.
Constraints: Must be a future timestamp.
Impact: The deadline timestamp for the purchase.
maxPaymentTokenAmountControl: 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
assetsis empty.deadlinepassed.paymentAmountexceedsmaxPaymentTokenAmount.Function cannot reenter.