Assessment reports>Bera Contracts>Threat Model>Function: createBatchStream(uint256[] calldata tokenIds, address onBehalfOfOwner)

Function: createBatchStream(uint256[] calldata tokenIds, address onBehalfOfOwner)

The function create a stream for each token in tokenIds. An aggregate allocation is transferred to the owner of the NFT, and a fee is transferred to the caller if they are not the NFT's owner.

Inputs

  • tokenIds

    • Validation: The current block number is checked to be greater than vestingStartBlock. The tokenId is checked to be a valid credentialNFT by the ownerOf function.

    • Impact: It prevents the creation of a stream twice or the creation of a stream for a non-existing NFT.

  • onBehalfOfOwner

    • Validation: Each stream is checked to be owned by the onBehalfOfOwner address and to have not being already created.

    • Impact: It prevents the creation of a stream for a token not owned by onBehalfOfOwner.

Branches and code coverage (including function calls)

Intended branches

  • A stream is created by the owner of the NFT from a token array. The instant amount is properly transferred.

  • A stream is created by another user. The instant amount and the fees are properly transferred.

Negative behavior

  • A stream created for the second time reverts.

  • A stream created before the vesting starts reverts.

  • A stream created for an array containing an invalid identifier reverts.

  • A transfer failure during a stream creation reverts.

Function call analysis

  • transfer(onbehalfOf, instantAmountAccum)

    • External/Internal? Internal.

    • Argument control? No.

    • Impact: Transfers the fees.

  • transfer(tx.origin, payMasterFeeAccum)

    • External/Internal? Internal.

    • Argument control? No.

    • Impact: Transfers the amount of the stream creation.

Zellic © 2025Back to top ↑