Assessment reports>Wasabi>Threat Models>createPool

Function: createPool(address _nftAddress, uint256[] _initialTokenIds, WasabiStructs.PoolConfiguration _poolConfiguration, WasabiStructs.OptionType[] _types, address _admin)

Creates a new ETH-based pool with the given pool configuration, supported option types, and admin.

Inputs

  • _nftAddress

    • Control: User has full control over this input.

    • Constraints: User owns the respective intialTokenIds of the NFT.

    • Impact: Any NFT address can be used, given the user owns the respective initialTokenIds of the collection.

  • _initialTokenIds

    • Control: User has full control over this input.

    • Constraints: User owns the respective intialTokenIds of the NFT.

    • Impact: User can add any NFTs to the pool, given the user owns the respective initialTokenIds of the collection.

  • _poolConfiguration

    • Control: User has full control over this input.

    • Constraints: Configuration passes WasabiValidation.validate.

    • Impact: Configuration is within bounds of strike price and duration.

  • _types

    • Control: User has full control over this input.

    • Constraints: Must be at least one option type, call or put.

    • Impact: User can select which option types are supported by the pool.

  • _admin

    • Control: User has full control over this input.

    • Constraints: No constraints.

    • Impact: Admin can be any address.

Branches and code coverage (including function calls)

Intended branches

Negative behavior

Function call analysis

  • createPool -> WasabiValidation.validate(_poolConfiguration)

  • What is controllable? The pool configuration.

    • 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? Pool is not created under revert condition. Reentrancy is not possible. Unusual control flow is not present.

  • createPool -> ETHWasabiPool(payable(Clones.clone(address(templatePool))))

  • What is controllable? Nothing is controllable.

    • If return value controllable, how is it used and how can it go wrong? Return value corresponds to the address of the new pool. No foreseeable issues unless clone overwrites existing contract.

    • What happens if it reverts, reenters, or does other unusual control flow? Pool is not created under revert condition. Reentrancy is not possible. Unusual control flow is not present.

  • createPool -> pool.initialize(this, nft, options, _msgSender(), _poolConfiguration, _types, _admin)

  • What is controllable? The NFT, pool configuration, option types, and admin.

    • 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? Pool is not created under revert condition. Reentrancy is not possible. Unusual control flow is not present.

  • createPool -> _poolAddress.transfer(msg.value)

  • What is controllable? msg.value.

    • 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? Pool is not created under revert condition. Reentrancy is not possible because the receiver is the pool address. Unusual control flow is not present since the receive function is not overridden.

  • createPool -> nft.safeTransferFrom(_msgSender(), _poolAddress, _initialTokenIds[i])

    • What is controllable? The initialTokenIds

    • 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? Pool is not created under revert condition, which can happen if the msg.sender does not approve or own the NFT. Reentrancy is not possible because the receiver is the pool address, which has no abnormal logic in the onERC721Received function.

Zellic © 2024Back to top ↑