# Relationship

## Follow

### FollowRegister

1. Deploy a follow contract

```solidity
  function deployFollowContract(address owner) external returns (uint256);
```

Deploy a user's follow and record it to the FollowRegister contract.

Parameters:

* owner: The address receiving a Follow contract

Return value:

* tokenId: The tokenID for a Follow contract in the FollowRegister contract.

2. Lookup the Follow contract addresses belonging to an address

```solidity
  function ownedFollowContract(address owner) external view returns (address);
```

Lookup the Follow contract addresses belonging to an address

Parameters:

* owner: The address owning a Follow contract

Return value:

* contractAddress: the address(es) of Follow contract(s).

### Follow

1. Follow

```solidity
function follow() external returns (uint256);
```

To follow the owner of the current contract

Return value:

* tokenId: The tokenId for this following in the contract.

2. Unfollow

```solidity
  function unfollow() external;
```

To unfollow the owner of the current contract

## Dao

### DaoRegister

1. Deploy a DAO contract

```solidity
  function deployDaoContract(address owner,string memory name) external returns (uint256);
```

Deploy a Dao contract and record it on the DaoRegister contract. The creator will be the owner of the contract.

Parameters:

* owner: The intended owner of this Dao contract.
* name: The name of this Dao contract.

Return value:

* tokenId: The tokenId for this Dao contract in the DaoRegister contract.

2. Lookup the information on a DAO

```solidity
  function daoOf(uint256 tokenId) external view returns(address owner,address contractAddress);
```

Use tokenId to lookup the owner and address that a DAO contract is linked to.

Parameters:

* tokenId

Return value:

* owner: The creator of the DAO contract
* contractAddress: The address of the DAO contract.

### DAO

1. Set the URI for a dao

```solidity
function setDaoURI(string memory daoURI) external;
```

Set the URI for a dao. Pass the transaction hash related to the dao on Arweave.

Parameters:

* daoURI: A resource address pointing to the data of a dao's information. It is a transaction hash on Arweave.

The content uploaded to Arweave is structured as follows:

```json
{
  "avatar": "${The avatar of DAO}",
  "description": "${The description of DAO}"
}
```

2. The URI for a dao

```solidity
function daoURI() external view returns (string memory _daoURI);
```

Query the URI for a dao. Return the transaction hash related to the dao on Arweave.

Parameters:

* daoURI: A resource address pointing to the data of a dao's information. It is a transaction hash on Arweave.

3. Is this an open dao?

```solidity
function isFreeJoin() external view returns (bool);
```

Check if this dao is open to the public without an admin's invitation.

Return value:

* isFreeJoin: true--free to join;false--closed to the public

4. Add the specified address to the dao.

```solidity
function addMember(address[] memory addr) external;
```

Add the specified address to dao in batches, only executed by the creator of dao.

Parameters:

* addr: The specified address.

5. Join a dao.

```solidity
  function join() external returns (uint256 tokenId);
```

When user joins a dao:

Return value:

* tokenId: The tokenId for this member in the dao.

6. Removed from a dao

```solidity
  function remove(address addr) external;
```

Remove a certain member from a dao.

Parameters:

* addr: The address of the member to be removed.

7. Is a member of the dao?

```solidity
  function isMember(address addr) external view returns(bool);
```

Query whether an address is a member of a dao

Parameters:

* addr: The address of member

Return value:

* isMember: true--is a member of the dao;false--not a member of the dao

8. The owner of a dao

```solidity
  function ownerOfDao() external view returns(address owner);
```

Query the owner for a dao.

Return value:

* owner: The owner of a dao
