Function: adminFillOffer(uint256 offerId, uint256 usdzAmount)
The function allows a user with the POOL_MANAGER_ROLE to fill an offer, involving complex interactions with external contracts for redemption and repayment.
Inputs
offerIdControl: Arbitrary.
Constraints: Must correspond to an existing offer.
Impact: The parameter identifies the specific offer to fill.
usdzAmountControl: Arbitrary.
Constraints: Must be a positive value and should not exceed the remaining amount in the offer.
Impact: The parameter determines how much USDz is to be transacted.
Branches and code coverage
Intended branches
Deduct
usdzAmountfrom the offer's amount, calculaterequiredUSDC, and interact with external contracts for token swaps and transfers.If the offer amount becomes zero after the transaction, decrement
pendingOffersCountand delete the offer.
Negative behavior
Revert if the offer has already been filled.
Revert if the
usdzAmountis not greater than zero.