Assessment reports>Anzen and protocol-v2>Threat Model>Function: createOffer(uint256 tokenId, uint256 amount, uint256 askPrice)

Function: createOffer(uint256 tokenId, uint256 amount, uint256 askPrice)

The function allows a user to create a new offer by locking ERC-1155 tokens in the contract and setting an ask price.

Inputs

  • tokenId

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: The parameter specifies the identifier of the ERC-1155 token to be locked in the offer.

  • amount

    • Control: Arbitrary.

    • Constraints: Must be greater than or equal to minimumOfferAmount.

    • Impact: The parameter specifies the amount of tokens to lock in the offer.

  • askPrice

    • Control: Arbitrary.

    • Constraints: Must be greater than zero and less than or equal to 1e6.

    • Impact: The parameter specifies the asking price for the offer in USDC equivalent.

Branches and code coverage

Intended branches

  • A new offer structure is created, offerIdCounter is incremented, and the data is added to offers.

  • The tokens are transferred from the creator to the contract, and offerId is recorded in the userOffers mapping.

Negative behavior

  • Revert if amount is below minimumOfferAmount.

  • Revert if askPrice is not within an acceptable range.

Zellic © 2025Back to top ↑