Assessment reports>Wasabi>Threat Models>writeOptionTo

Function: writeOptionTo(WasabiStructs.PoolAsk _request, bytes calldata _signature, address _receiver)

This writes an option from the pool to the respective receiver. The option request must be within the pool's configuration. The signature must be signed by either the admin or the owner of the pool. The signature must not be replayed. The option is issued to the receiver.

Inputs

  • _request

    • Control: User has full control over this input.

    • Constraints: The request's corresponding strike price, expiration, and option type is valid.

    • Impact: Only legitimate requests can be written to the pool.

  • _signature

    • Control: User has full control over this input.

    • Constraints: The signer of the signature is either the admin or the owner. Cannot be replayed because of the idOrCancelled mapping.

    • Impact: Signature of the request is validated.

  • _receiver

    • Control: User has full control over this input.

    • Constraints: No constraints. Can be any address.

    • Impact: The option is issued to the receiver.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

  • writeOptionTo -> validate(_request, _signature)

  • What is controllable? The request and the signature.

    • If return value controllable, how is it used and how can it go wrong? No return value.

    • What happens if it reverts, reenters, or does other unusual control flow? Option not written from the pool, and option is not issued to the receiver.

  • writeOptionTo -> factory.issueOption(_receiver)

  • What is controllable? The receiver address.

    • If return value controllable, how is it used and how can it go wrong? Return value is used to denote the optionId and could go wrong if an existing optionId is the chosen value. However, that does not appear the case.

    • What happens if it reverts, reenters, or does other unusual control flow? Option not written from the pool, and option is not issued to the receiver.

  • writeOptionTo -> optionIds.add(optionId))

    • What is controllable? Nothing, optionId is chosen by the protocol.

    • If return value controllable, how is it used and how can it go wrong? No return value; function simply adds optionId to an enumerable set.

    • What happens if it reverts, reenters, or does other unusual control flow? Option not written from the pool, and option is not issued to the receiver.

Zellic © 2024Back to top ↑