---
description: >-
  In order to be able to using our Dividend Hub, you must implement some
  function into your smart contract following our standards.
---

# Dividend Hub Installation

{% hint style="info" %}
This Documentation is only for developers, so if you are not developer, you dont have to follow this documentation. And this is a documentation for you if you are going to register on our dividend hub by using DoKEN Dividend Hub Interface

Visit our tg for more information : [https://t.me/dokentokensupport](https://t.me/dokentokensupport)


{% endhint %}

What you need to do is quite simple, you only need to add few functions below into your smart contract which later will be used by our frontend to communicate.

For full example of implementation, feel free to observe DoKEN Smart Contract as an example at&#x20;

[https://bscscan.com/address/0xf9a2d40589271be17612a3f57a9028a568f56e3d](https://bscscan.com/address/0xf9a2d40589271be17612a3f57a9028a568f56e3d)

### DoKENRewardAddress

DoKENRewardAddress function expect returns the reward address token. for example if your token has offering cake token, then it should return the cake token address.

```
function DoKENRewardAddress() external view returns (address) {
    // return rewardTokenAddress;
}
```

### DoKENDividendTrackerAddress

DoKENDividendTrackerAddress function expect returns the dividend tracker address of your project

```
function DoKENDividendTrackerAddress() external view returns (address) {
    // return dividendTrackerAddress;
}

```

### DoKENRewardOnPool

DoKENRewardOnPool function expect returns the value of total reward that is not been distributed yet. In other words, is the balance of your reward pool ( dividendTracker ) in form of rewardToken. The return value must be in **uint256,** and do not divide the value by corresponding token decimals, just leave it as it is

```
function DoKENRewardOnPool() external view returns (uint256) {
    // return IERC20(rewardToken).balanceOf(address(dividendTracker));
}
```

### DoKENTokenFees

DoKENTokenFees expect returns a multiple uint256 values, and it must be a number that represent the percentage of fees.&#x20;

These numbers must be **presented** in these order :&#x20;

**totalFee,rewardFee,liquidityFee,marketingFee,developerFee,additionalSellingFee**

{% hint style="info" %}
if you are not implementing one of these fee, just return 0 on it
{% endhint %}

```
function DoKENTokenFees() external view 
returns ( uint256,uint256,uint256,uint256,uint256,uint256)
  {
    // .. in this example, the project doesnt have "additionalSellingFee"
    // return (getTotalFees(),rewardsFee,liquidityFee,marketingFee,devFee,0);
  }
```

### DoKENRewardDistributed

DoKENRewardDistributed expect returns the amount of distributed reward in **uint256** values, do not divide the amount with the corresponding token decimal. just leave it as it is

```
function DoKENRewardDistributed() external view returns (uint256) {
    // return dividendTracker.getTotalDividendsDistributed();
}
```

### DoKENGetAccountDividendsInfo

DoKENGetAccountDividendsInfo Expect returns a dividend information by address, the return values should in these order

* **address** account,
* **int256** index
* **int256** iterationsUntilProcessed
* **uint256** withdrawableDividends
* **uint256** withdrawnDividends
* **uint256** totalDividends
* **uint256** lastClaimTime
* **uint256** nextClaimTime
* **uint256** secondsUntilAutoClaimAvailable

{% hint style="info" %}
Most of this field already available if you are implementing roger wu dividend token interface, the only thing you need to add is the "withdrawnDividends"
{% endhint %}

```
function DoKENGetAccountDividendsInfo(address account)
    public
    view
    returns (
      address,
      int256,
      int256,
      uint256,
      uint256,
      uint256,
      uint256,
      uint256,
      uint256
    )
  {
    // return dividendTracker.getAccount(account);
  }
```

### DoKENRewardPaid

DoKENRewardPaid expect return a **uint256** value of the paid reward for the corresponding holder address

```
function DoKENRewardPaid(address holder) external view returns (uint256) {
   // (, , , , uint256 paidAmount, , , , ) = DoKENGetAccountDividendsInfo(holder);
   // return paidAmount;
}
```

### DoKENRewardUnPaid

DoKENRewardUnPaid expect return a uint256 value of the unpaid reward for the corresponding holder address

```
function DoKENRewardUnPaid(address holder) external view returns (uint256) {
   // (, , , uint256 unpaidAmount, , , , , ) = DoKENGetAccountDividendsInfo(
   //   holder
   // );
   
   // return unpaidAmount;
}
```

### DoKENRewardClaim

DoKENRewardClaim will be use to communicate with your project claim function

```
function DoKENRewardClaim() external {
    // dividendTracker.processAccount(payable(msg.sender), false);
}
```

### DoKENNumberOfDividendTokenHolders

DoKENNumberOfDividendTokenHolders Expect to returns the total holders of the dividend

```
function DoKENNumberOfDividendTokenHolders() external view returns (uint256) {
    // return dividendTracker.getNumberOfTokenHolders();
}
```

## Old Contract Integration

Lets say you already have a deployed contract, and not implementing DoKENDividendHub Interface, but want to be able to register on our DividendHub.

Changing contract code is impossible ( assumed you're not using upgradable contract ) , so the alternative would be you have to create a new contract as the middle man of our dapps to your real contract, and we call it "DoKENHubProxy"

How can you make one ? Lets follow our next documentation
