# Purchase Contract

Level 1 S-NFT can be purchased at our official website,  authorized third party sellers, or the Market.&#x20;

```
function buy(uint256[] calldata _hnIds) external nonReentrant {
        address[] memory _sellers = new address[](_hnIds.length);
        uint256[] memory prices = new uint256[](_hnIds.length);
        bool[] memory isInPools = new bool[](_hnIds.length);

     for (uint256 i = 0; i < _hnIds.length; i++) {
        require(hnIds.contains(_hnIds[i]), "This HN does not exist");
        prices[i] = hnPrice[_hnIds[i]];
        uint256 feeAmount = (prices[i] * feeRatio) / 1e4;
        uint256 sellAmount = prices[i] - feeAmount;

        _sellers[i] = hnSeller[_hnIds[i]];
        isInPools[i] = hnIsInPool[_hnIds[i]];

        hnIds.remove(_hnIds[i]);
        sellerHnIds[_sellers[i]].remove(_hnIds[i]);

        busd.transferFrom(msg.sender, _sellers[i], sellAmount);
        busd.transferFrom(msg.sender, receivingAddress, feeAmount);
        if (isInPools[i]) {
            hnPool.hnMarketWithdraw(msg.sender, _sellers[i], _hnIds[i]);
        } else {
            hn.safeTransferFrom(address(this), msg.sender, _hnIds[i]);
        }

        sellerTotalSellAmount[_sellers[i]] += sellAmount;
        sellerTotalSellCount[_sellers[i]]++;

        buyerTotalBuyAmount[msg.sender] += sellAmount;
        buyerTotalBuyCount[msg.sender]++;

        totalSellAmount += sellAmount;
        totalFeeAmount += feeAmount;
        totalSellCount++;
    }
    buyers.add(msg.sender);

    emit Buy(msg.sender, _sellers, _hnIds, prices, isInPools);
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://land-hash.gitbook.io/hashland/white-paper/hashland-application/purchase-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
