# BBProfiles

{% embed url="<https://github.com/backedby/v1-contracts/blob/main/contracts/BBProfiles.sol>" %}

## Functions

### createProfile

```solidity
function createProfile(
    address owner, 
    address receiver, 
    string calldata cid
) external returns (uint256 profileId)
```

Creates a profile and sets its owner, receiver and CID

#### Parameters

| Name     | Type    | Description                     |
| -------- | ------- | ------------------------------- |
| owner    | address | Owner of the created profile    |
| receiver | address | Receiver of the created profile |
| cid      | string  | CID of the created profile      |

#### Return Values

| Name      | Type    | Description               |
| --------- | ------- | ------------------------- |
| profileId | uint256 | ID of the created profile |

### editProfile

```solidity
function editProfile(
    uint256 profileId, 
    address owner, 
    address receiver, 
    string calldata cid
) external
```

Sets the owner, receiver and CID of an existing profile

#### Parameters

| Name      | Type    | Description                 |
| --------- | ------- | --------------------------- |
| profileId | uint256 | ID of the profile to edit   |
| owner     | address | New owner of the profile    |
| receiver  | address | New receiver of the profile |
| cid       | string  | New CID of the profile      |

### totalProfiles

```solidity
function totalProfiles(
) external view returns (uint256 total)
```

Returns the total number of profiles

#### Return Values

| Name  | Type    | Description              |
| ----- | ------- | ------------------------ |
| total | uint256 | Number of total profiles |

### getProfile

```solidity
function getProfile(
    uint256 profileId
) external view returns (address owner, address receiver, string memory cid)
```

Returns an existing profiles owner, receiver and CID

#### Parameters

| Name      | Type    | Description                 |
| --------- | ------- | --------------------------- |
| profileId | uint256 | ID of the profile to return |

#### Return Values

| Name     | Type    | Description                |
| -------- | ------- | -------------------------- |
| owner    | address | Returned profiles owner    |
| receiver | address | Returned profiles receiver |
| cid      | string  | Returned profiles CID      |

### getOwnersProfiles

```solidity
function getOwnersProfiles(
    address account
) external view returns (uint256[] memory profileIds)
```

Returns all profile ID's an address is the owner of

#### Parameters

| Name    | Type    | Description                              |
| ------- | ------- | ---------------------------------------- |
| account | address | Address of owners profile ID's to return |

#### Return Values

| Name       | Type       | Description                          |
| ---------- | ---------- | ------------------------------------ |
| profileIds | uint256\[] | All profile ID's owned by an address |

### ownersTotalProfiles

```solidity
function ownersTotalProfiles(
    address owner
) external view returns (uint256 total)
```

Returns the total number of profiles an address is the owner of

#### Parameters

| Name  | Type    | Description                                |
| ----- | ------- | ------------------------------------------ |
| owner | address | Address of owners total profiles to return |

#### Return Values

| Name  | Type    | Description                                  |
| ----- | ------- | -------------------------------------------- |
| total | uint256 | Number of total profiles owned by an address |


---

# 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://docs.backed.by/docs/developers/smart-contracts/core/bbprofiles.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.
