---
# System prepended metadata

title: DropManager API

---

### Address DEV - 0x5B02caBBF2a291E4F08ebF7D29FeF242B1495554
### Address PROD - 0xbf2b79Ca4Cb9bE4d7976580709c95da3b6a7b7a5

### Public DropManager Methods:

#### Write methods

 * createEmptyDrop()
 * attachNftToDropEvent()
 * attachNftArrToDropEvent()
 * detachNftFromDropEventByIndex()
 * detachNftFromDropEventById()
 * editDrop()
 * createDropWithAttachedNfts()
 * initialBuy()
 * reserveNftInDrop()
 * nftPaySell()
 * updateReservationTime()
 * updateNftContract()
 * updateTransferManager()
 * getAvailableNft()
 * getNftIds()
 * getDropReservations()
 * getDropData()
 * getDropReservationByNftId()
 * updateReservationTime()
 * updateReservations()
 


---

### createEmptyDrop()

```
createEmptyDrop(EmptyDropDTO DropDTO)  external onlyRole(OPERATOR_ROLE) dropNotExists(DropDTO.dropId)
```

> Could be called only by ***OPERATOR***.

Function that creates "empty" *Drop* object. *Drop* without assosiated NFT's token.

#### Parameters
> Drop with *dropId* should not exist.


```
EmptyDropDTO = {
        uint256 dropId;
        uint256 releaseStartDate;
        uint256 releaseEndDate;
        uint256 nftAmountAllowedToBuy;
}
```
**dropId** - int value that identifies *Drop* on the Blockchain.
**releaseStartDate** - timestamp in seconds for start selling period.
**releaseEndDate** - timestamp in seconds for end selling period.
**nftAmountAllowedToBuy** - max number of NFT's that could be sold to one wallet.



---

### attachNftToDropEvent()

```
attachNftToDropEvent(uint256 dropId, uint256 _nftId) external onlyRole(OPERATOR_ROLE) dropExists(dropId)
```
> Could be called only by ***OPERATOR***.

Function that attaches NFT to specific *dropId*. Throw an error if NFT has been already attached.

#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.
**nftId** - int value that identifies NFT on the Blockchain.


---

### attachNftArrToDropEvent()

```
attachNftArrToDropEvent(uint256 dropId, uint256[] calldata nftIdArr) external onlyRole(OPERATOR_ROLE) dropExists(dropId) nftsNotAttached(nftIdArr)
```
> Could be called only by ***OPERATOR***.

Function that attaches NFT array to specific *dropId*. Throw an error if any NFT has been already attached.

#### Parameters

> Drop with *dropId* should exist.
> NFT's should not be attached.

**dropId** - int value that identifies *Drop* on the Blockchain.
**nftIdArr** - int array that contains of NFT id's from the Blockchain.


---

### detachNftFromDropEventByIndex()

```
detachNftFromDropEventByIndex(uint256 dropId, uint256 index) external onlyRole(OPERATOR_ROLE) dropExists(dropId)
```

> Could be called only by ***OPERATOR***.

Function that detaches NFT from the Drop by *index* value of the Drop's internal *nftIdList* array.

#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.
**index** - int value of the internal array index.

#### Emitted events

```
detachedNft = {
    uint256 dropId,
    uint256 detachedNft
}
```

**dropId** - int value that identifies *Drop* on the Blockchain.
**detachedNft** - int value that identifies NFT on the Blockchain.


---

### detachNftFromDropEventById()
```
detachNftFromDropEventById(uint256 dropId, uint256 _nftId) external onlyRole(OPERATOR_ROLE) dropExists(dropId)
```

> Could be called only by ***OPERATOR***.

Function that detaches NFT from the Drop by *_nftId* value.

#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.
**nftId** - int value that identifies NFT on the Blockchain.

#### Emitted events

```
detachedNft = {
    uint256 dropId,
    uint256 detachedNft
}
```

**dropId** - int value that identifies *Drop* on the Blockchain.
**detachedNft** - int value that identifies NFT on the Blockchain.


---
### editDrop()
```
editDrop(EmptyDropDTO calldata DropDTO) external onlyRole(OPERATOR_ROLE) dropExists(DropDTO.dropId)
```

> Could be called only by ***OPERATOR***.

Function that updates *Drop* object. Updates **releaseStartDate**, **releaseEndDate**, **nftAmountAllowedToBuy** parameters of the *Drop*.

#### Parameters

> Drop with *dropId* should exist.


```
EmptyDropDTO = {
        uint256 dropId;
        uint256 releaseStartDate;
        uint256 releaseEndDate;
        uint256 nftAmountAllowedToBuy;
}
```
**dropId** - int value that identifies *Drop* on the Blockchain.
**releaseStartDate** - timestamp in seconds for start selling period.
**releaseEndDate** - timestamp in seconds for end selling period.
**nftAmountAllowedToBuy** - max number of NFT's that could be sold to one wallet.


---

### createDropWithAttachedNfts()
```
createDropWithAttachedNfts(EmptyDropDTO calldata DropDTO, uint256[] calldata nftIds) external onlyRole(OPERATOR_ROLE) dropNotExists(DropDTO.dropId)
```

> Could be called only by ***OPERATOR***.

Function that creates and attach NFT's array to the Drop in one Transaction. Combine together "**createEmptyDrop**" and "**attachNftArrToDropEvent**" methods.

#### Parameters

> Drop with *dropId* should exist.


```
EmptyDropDTO = {
        uint256 dropId;
        uint256 releaseStartDate;
        uint256 releaseEndDate;
        uint256 nftAmountAllowedToBuy;
}
```
**dropId** - int value that identifies *Drop* on the Blockchain.
**releaseStartDate** - timestamp in seconds for start selling period.
**releaseEndDate** - timestamp in seconds for end selling period.
**nftAmountAllowedToBuy** - max number of NFT's that could be sold to one wallet.
**nftIds** - NFT Id's array that will be attached to the drop.

#### Emitted events

```
DropEventCreated = {
    uint256 dropId,
    uint256[] nftIds
}
```

**dropId** - int value that identifies *Drop* on the Blockchain.
**nftIds** - NFT Id's array that will be attached to the drop.

---

### initialBuy()

```
initialBuy(uint256 dropId, address buyer) external onlyRole(OPERATOR_ROLE) dropExists(dropId)
```

> Could be called only by ***OPERATOR***.
> Updates reservations before executing.

Function that sell nft from specific *Drop* to *buyer*.

#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.
**buyer** - address of the buyer's wallet.


#### Emitted events

```
InitialBuyEvent = {
    address buyer,
    uint256 nftId,
    uint256 nftOwnerCap
}
```

**buyer** - address of the buyer's wallet.
**nftId** - int value that identifies NFT on the Blockchain.
**nftOwnerCap**  - number of buy's from this Drop.


---

### reserveNftInDrop()

```
reserveNftInDrop(uint256 dropId, address holder) external onlyRole(OPERATOR_ROLE) returns(uint256 nftId)
```

> Could be called only by ***OPERATOR***.
> Updates reservations before executing.


Function that puts nft into reservation for 15 mins for specific *holder*.

#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.

#### Emitted events

```
nftReserved = {
    uint256 reservedNftId,
    address holder,
    uint256 reservationDeadline
}
```

**reservedNftId** - int value that identifies NFT on the Blockchain.
**holder** - address of the holders's wallet.
**reservationDeadline**  - timestamp when reservation ends.

#### Return value

**nftId** - int value that identifies NFT on the Blockchain.


---

### nftPaySell()
```
nftPaySell(uint256 dropId, uint256 nftId) external onlyRole(OPERATOR_ROLE) returns(bool)
```

> Could be called only by ***OPERATOR***.
> Updates reservations before executing.


Function that transfer nft from reservation to *holder* who is setted in reservation.

#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.
**nftId** - int value that identifies NFT on the Blockchain.

#### Return value

**result** - bool value that identifies if nft transfer was successful.

---

### updateReservationTime()

```
updateReservationTime(uint256 _reservationTime) external onlyRole(OPERATOR_ROLE)
```

> Could be called only by ***OPERATOR***.


Function that changes reservation duration. A new time window is set for the next reservations.

#### Parameters

**_reservationTime** - int value for the new reservation duration(in seconds).

---

### updateReservations()
```
updateReservations(uint256 dropId) external onlyRole(OPERATOR_ROLE) returns(bool)
```

> Could be called only by ***OPERATOR***.
> Updates reservations before executing.


Function that checks every reservation in *Drop*. Cancels reservations for NFT that are in reserve state longer than reservation Duration.

#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.

#### Return value

**result** - bool value that identifies if at least one reservation was canceled.


---

### updateNftContract()
```
updateNftContract(address _nftContract) external onlyRole(OPERATOR_ROLE)
```

> Could be called only by ***OPERATOR***.

Function that updates NFT contract address which is used by the DropManager.

#### Parameters

**nftContract** - address value of the NFT contract.


---

### updateTransferManager()
```
updateTransferManager(address _transferManager) external onlyRole(OPERATOR_ROLE)
```

> Could be called only by ***OPERATOR***.

Function that updates TransferManager contract address which is used by the DropManager.

#### Parameters

**_transferManager** - address value of the TransferManager contract.


---

### getAvailableNft()
```
getAvailableNft(uint256 dropId) external view returns(uint availableNft)
```

> Updates reservations before executing.


Function that returns a number of NFTs left in *Drop*.

#### Parameters

**dropId** - int value that identifies *Drop* on the Blockchain.

#### Return value

**availableNft** - amount of NFTs left in *Drop*.

#### Emitted events

```
getAvailableNftEvent = {uint256 nftId}
```

---

### getNftIds()
```
getNftIds(uint256 dropId) external view dropExists(dropId) returns(uint256[] memory nftIds)
```

Function that returns NFTs id array.

> Updates reservations before executing.


#### Parameters

**dropId** - int value that identifies *Drop* on the Blockchain.

#### Return value

**nftIds** - array of NFTs id left in *Drop*.


#### Emitted events

```
getNftIdsEvent = {uint256[]  nftIds}
```


---

### getDropData()
```
getDropData(uint256 dropId) external view dropExists(dropId) returns(uint256 _releaseStartDate,
                                                                                uint256 _releaseEndDate,
                                                                                uint256[] memory _nftIdList,
                                                                                Reservation[] memory _reservedNfts,
                                                                                uint256 _nftAmountAllowedToBuy)
```

Function that returns info about the Drop.

> Updates reservations before executing.


#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.

#### Return value

**releaseStartDate** - timestamp means starting sell period.
**releaseEndDate** - timestamp means ending sell period.
**nftIdListIds** - array of NFTs id left in *Drop*.
**reservedNfts** - array of NFTs id reserved in Drop.
**nftAmountAllowedToBuy** - max amount of NFTs that can be sold to one wallet.

#### Emitted events

```
getDropDataEvent {uint256 _releaseStartDate,
                            uint256 _releaseEndDate,
                            uint256[]  _nftIdList,
                            Reservation[]  _reservedNfts,
                            uint256 _nftAmountAllowedToBuy}
```

---
### getDropReservations()
```
getDropReservations(uint256 dropId) external view dropExists(dropId) returns(Reservation[] memory _reservedNfts)
```

Function that return array of NFTs id reserved in Drop.

> Updates reservations before executing.


#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.

#### Return value

**reservedNfts** - array of NFTs id reserved in Drop.

#### Emitted events

```
getDropReservationsEvent = {Reservation[]  _reservedNfts}
```

---
### getDropReservationByNftId()
```
getDropReservationByNftId(uint256 dropId, uint256 nftId) external dropExists(dropId) returns(Reservation memory _reservedNft)
```

Function that returns Reservation object by NFT id and Drop id.

> Updates reservations before executing.

#### Parameters

> Drop with *dropId* should exist.

**dropId** - int value that identifies *Drop* on the Blockchain.
**nftId** - int value that identifies NFT on the Blockchain.

#### Return value

```
Reservation = {
        uint256 nftId;
        address holder;
        uint256 reservationDeadline;
    }
```

**nftId** - int value that identifies NFT on the Blockchain.
**holder** - address of the holders's wallet.
**reservationDeadline** - timestamp means end of reservation.

#### Emitted events

```
getDropReservationByNftIdEvent = {Reservation  _reservedNft}
```