# CIAN Yield Layer Tech Docs

**Base URL:**

```
GET https://yieldlayer.cian.app/{chain_name}/pool
```

Supported `{chain_name}` values:

* ethereum
* arbitrum
* bsc
* sei

**Overview**

Each vault is an ERC4626 vault. The underlying asset can be retrieved using the `asset()` function.

**1. Chain Vaults List**

**Endpoint**:

```
/home/vaults
```

**Description**:

Retrieve the list of all vaults on the specified chain.

**Example:**

**Response Fields**:

* **`pool_name`**: The name displayed on frontend. Might be changed.
* **`pool_address`**: Yield layer contract address.
* **`public`**: If the yield layer is listed on the landing page.
* **`tvl_usd`**: The TVL in USD after leverage.
* **`net_tvl_usd`**: The TVL in USD users deposited.
* **`apy_7`**: 7-day average APY, divided into:
  * **apy\_instant\_7**: Reflected in receipt token prices.
  * **apy\_esti\_by\_points\_7**: Estimated APY from points earned.
  * **apy\_eco\_earn\_7**: Ecosystem-specific APY (e.g., stETH Yield Layer).
  * ***CIAN POINTS ARE NOT INCLUDED***.

**Return:**

```
{
    "code": "ok",
    "status": 0,
    "msg": "server response ok",
    "data": [
        {
            "chain_id": 1,
            "public": true,
            "pool_name": "stETH Yield Layer",
            "pool_address": "0xB13aa2d0345b0439b064f26B82D8dCf3f508775d",
            "pool_type": "yield-layer",
            "display_index": 35,
            "apy": "0.9012",
            "apy_7": "0.9012",
            "apy_instant_7": "0.9012",
            "apy_esti_by_points_7": "0",
            "apy_eco_earn_7": "0",
            "apy_eco_earn_upto_7": "0",
            "apy_vault_upto_7": "-50",
            "tvl_usd": "568363147.47",
            "net_tvl_usd": "59267528.93"
        },
        ...
    ]
}
```

**2. Vault Config**

**Endpoint**:

```
/home/vault/:vault_address
```

**Description**:

Retrieve configuration details for a specific vault.

**Example**:

**Response Fields**:

* **`deposit_capacity`**: The capacity to control deposition on frontend. Depositing directly through contract is not affected.
* **`fee_info.exit`**: Initial exit fee, 0.02 for 0.02%
* **`fee_info.exit_override`**: The actual exit fee applied by the contract, 0.02 for 0.02%
* **`fee_info.management`**: Anual management fee.
* **`fee_info.performance`**: Performance fee, 8 for 8%
* **`conf.min_deposit` & `conf.min_withdraw`**: Minimum deposit/withdrawal limits (applicable only on Cian's frontend).
* **`current_holders_count` & `history_holders_count`**: Holders counted by history evnets.

```
{
    "code": "ok",
    "status": 0,
    "msg": "server response ok",
    "data": {
        "chain_id": 1,
        "public": true,
        "pool_name": "stETH Yield Layer",
        "pool_address": "0xB13aa2d0345b0439b064f26B82D8dCf3f508775d",
        "pool_type": "yield-layer",
        "created_at": "2024-06-12T15:00:21Z",
        "deposit_capacity": "159000",
        "apy_7": "0.9012",
        "apy_instant_7": "0.9012",
        "apy_esti_by_points_7": "0",
        "apy_eco_earn_7": "0",
        "apy_eco_earn_upto_7": "0",
        "apy_vault_upto_7": "-50",
        "apy": "0.9012",
        "net_apy": "0.8291",
        "tvl": "126754.17",
        "tvlUsd": "568363147.47",
        "fee_info": {
            "exit": "0.02",
            "exit_override": "0",
            "performance": "8",
            "management": "0",
            "reserve_fund": "0"
        },
        "conf": {
            "gas_limit": "300000",
            "min_deposit": "0.05",
            "min_withdraw": "0.05",
            "safety_level": "4"
        },
        "tags": [
            {
                "type": "general",
                "name": "Audited"
            },
            {
                "type": "general",
                "name": "Airdrop"
            },
            {
                "type": "institution",
                "name": "Institution Trusted"
            },
            {
                "type": "eco_earn",
                "name": "Eco. Earn"
            },
            {
                "type": "general",
                "name": "The Most Holders"
            }
        ],
        "current_holders_count": 65,
        "history_holders_count": 221,
        "blockscan_link": "https://etherscan.io/address/0xB13aa2d0345b0439b064f26B82D8dCf3f508775d"
    }
}
•
```

**3. Vault Tvls Info**

**Endpoint**:

```
/home/vault/tvl/:vault_address
```

**Description**:

Retrieve TVL and related statistics for a specific vault.

**Example**:

**Response Fields**:

* **`tvl_base`**: Vault's asset (ERC4626 `asset()`, e.g., WETH for stETH Yield Layer; FBTC for FBTC Yield Layer) TVL after leverage.
* **`points_accumulated`**: The points earned by this vault.

For some protocols, points will be distributed directly to the users and we do not receive the points.

```
{
    "code": "ok",
    "status": 0,
    "msg": "server response ok",
    "data": {
        "id": 21179,
        "vault_address": "0xB13aa2d0345b0439b064f26B82D8dCf3f508775d",
        "time": "2024-10-11T08:01:31Z",
        "tvl_usd": "95920581.860476976",
        "tvl_base": "39807.664984646",
        "tvl_eth": "39807.664984646",
        "net_tvl_usd": "11433655.689450938",
        "net_tvl_base": "4745.041433313",
        "net_tvl_eth": "4745.041433313",
        "points_accumulated": {
            "cian": {
                "vault_history_earned": "287800",
                "vault_balance": "287800",
                "transferred_to_user": "0",
                "difference": "0"
            },
            "mellow": {
                "vault_history_earned": "39464.873",
                "vault_balance": "39464.873",
                "transferred_to_user": "0",
                "difference": "21.777"
            },
            "symbiotic": {
                "vault_history_earned": "39464.8733641944",
                "vault_balance": "39464.8733641944",
                "transferred_to_user": "0",
                "difference": "21.7769288103"
            }
        }
    }
}
```

**4. User Info**

**Endpoint**:

```
/home/vault/user/:vault_address
```

**Params**:

| param         | type   | required |
| ------------- | ------ | -------- |
| user\_address | string | Yes      |

**Description**:

Retrieve user-specific information for a vault.

**Example**:

**Response Fields**:

* **`principal`**: User’s deposited amount.
* **`assets`**: Current assets owned by the user.
* **`earnings`**: User’s earnings in the vault.
* **`points`**: Points earned by the user.
* **`received_airdrops`**: For some yield layers like USD1 Yield Layer and slisBNB Yield Layer, we record the airdrop distribution tx.

```
{
    "code": "ok",
    "status": 0,
    "msg": "server response ok",
    "data": {
        "total_supply": "12434.507077853446564375",
        "vault_net_assets": "13216.679813844968967722059920643662634375",
        "user_shares": "6849.96954784468962534",
        "user_weight": "0.550883883450826",
        "principal": {
            "asset": "7209.16074496",
            "usd": "14222296.62703569",
            "eth": "7209.16074496"
        },
        "assets": {
            "asset": "7280.85590218",
            "usd": "32894397.30612279",
            "eth": "7280.85590218"
        },
        "earnings": {
            "asset": "71.69515722",
            "usd": "18672100.6790871",
            "eth": "71.69515722"
        },
        "unrealized": null,
        "received_airdrops": null,
        "points": {
            "cian": {
                "balance": "8113583.24862"
            },
            "mellow": {
                "balance": "29392.480357"
            },
            "symbiotic": {
                "balance": "152197.847186"
            }
        }
    }
}
```

**5. Vault History**

**Endpoint**:

```
/home/vault/history/:vault_address
```

**Params**:

| param | type | required | Default |
| ----- | ---- | -------- | ------- |
| limit | int  | No       | 100     |

**Description**:

Retrieve the historical data of a vault, including TVL, APY, and holders list in hour basis.

**Example**:

**Response Fields**:

Return the vault history for every hour, including tvl, apy and all holders list.

* **`holders[i].amount`**: The receipt token user holds.
* **`holders[i].weight`**: The ratio user takes in the whole vault.

```
{
    "code": "ok",
    "status": 0,
    "msg": "server response ok",
    "data": [
        {
            "vault_address": "0xB13aa2d0345b0439b064f26B82D8dCf3f508775d",
            "timestamp": 1733119200,
            "tvl_usd": "411559654.94007585",
            "tvl_base": "111906.500224345",
            "net_tvl_usd": "70622027.170377447",
            "net_tvl_base": "19202.717770128",
            "apy": "14.626845842",
            "apy_theoretic": "14.280446129",
            "total_supply": "19753.615235941726521928",
            "holders": [
                {
                    "address": "0xD126DD36d66F02C738395d94F5e10467c29A4c66",
                    "amount": "0.277487519480792635",
                    "weight": "0.0000140474296055"
                },
                {
                    "address": "0x83b27107441800E511dAA32DcF4ad11D95C95298",
                    "amount": "1.830340935482094906",
                    "weight": "0.0000926585292677"
                },
                ...
            ]
        },
        ...
    ]
}
```

**6. Apy breakdown**

**Endpoint:**

```
/home/vault/breakdown/:vault_address
```

**Description:**

Retrieve apy && allocation details for a specific vault.

**Example:**

**Response Fields:**

* **`strategies.id`**: The ID to identify the strategy.
* **`strategies.weight`**: Allocation percentage.

```
​
{
    "code": "ok",
    "status": 0,
    "msg": "server response ok",
    "data": {
        "apy_instant_7": "3.865",
        "apy_esti_by_points_7": "0",
        "apy_eco_earn_7": "0",
        "apy_eco_earn_upto_7": "0",
        "apy_vault_upto_7": "-2",
        "apy_7": "3.865",
        "net_apy_7": "3.5558",
        "point_protocols": [
            {
                "protocol": "Cian",
                "point_weighted_bonus": "1",
                "directly_to_user": false
            }
        ],
        "strategies": [
            {
                "id": 103,
                "name": "Aave V3 Lido Market ezETH Recursive Staking",
                "weight": "0.997249247",
                "apy": "3.8694",
                "lending_leverage": "13",
                "protocols": [
                    "Aave V3 Lido",
                    "Eigenlayer",
                    "Lido",
                    "Renzo"
                ],
                "rewards": [
                    {
                        "source": "Aave V3 Lido Borrow wstETH Cost",
                        "protocol": "Aave V3 Lido",
                        "instant": true,
                        "apy_7": "-4.7928",
                        "apy_instant_7": "-4.7928",
                        "apy_esti_by_points_7": "0",
                        "point_weighted_bonus": "0"
                    },
                    {
                        "source": "stETH Rebase Cost",
                        "protocol": "Lido",
                        "instant": true,
                        "apy_7": "-23.5603",
                        "apy_instant_7": "-23.5603",
                        "apy_esti_by_points_7": "0",
                        "point_weighted_bonus": "0"
                    },
                    {
                        "source": "ezETH Restake Yield",
                        "protocol": "Renzo",
                        "instant": true,
                        "apy_7": "32.2225",
                        "apy_instant_7": "32.2225",
                        "apy_esti_by_points_7": "0",
                        "point_weighted_bonus": "0"
                    }
                ],
                "unrealized": null
            },
            {
                "id": 100,
                "name": "Hold",
                "weight": "0.002750752",
                "apy": "2.2539",
                "lending_leverage": "1",
                "protocols": [
                    "Lido"
                ],
                "rewards": [
                    {
                        "source": "stETH Rebase Yield",
                        "protocol": "Lido",
                        "instant": true,
                        "apy_7": "2.2539",
                        "apy_instant_7": "2.2539",
                        "apy_esti_by_points_7": "0",
                        "point_weighted_bonus": "0"
                    }
                ],
                "unrealized": null
            },
            ......
        ]
    }
}
•
```

**7. Pending withdraw**

**Endpoint:**

```
/home/vault/withdraw/pending/:vault_address
```

**Description:**

Get pending withdraw list for a specific vault.

**Example:**

**Response Fields:**

```
​
{
    "code": "ok",
    "status": 0,
    "msg": "server response ok",
    "data": [
        {
            "chain_id": 56,
            "user_address": "0x00cea1A93E13634f85d23546d970fb3c7c1a0B4E",
            "time": 1762039523,
            "hash": "0xaf4d0a379787f6de30e34e5b93ff6d7e94bc77afe1cb420a4d624c69ffe8315a",
            "link": "https://bscscan.com/tx/0xaf4d0a379787f6de30e34e5b93ff6d7e94bc77afe1cb420a4d624c69ffe8315a",
            "shares": "2.633494758263618293",
            "assets": "2.602414710520771121"
        }
        ....
    ]
}
•
```

**8. Confirmed withdraw**

**Endpoint:**

```
/home/vault/user_confirm_withdrawal/:vault_address?user_address=:user_address
```

**Description:**

Get confirmed withdraw list for a specific user on a vault which ORDER BY \[block] DESC.

**Example:**

**Response Fields:**

```
​{
  "code": "ok",
  "status": 0,
  "msg": "server response ok",
  "data": [
    {
      "pool_name": "wrsETH Yield Layer",
      "pool_address": "0x9551a413Dd54A8BF992E980bd71201Eb48b7a852",
      "block": 7032583,
      "confirm_redeem_hash": "0x56e0fcc5a9e7949ef0840d210706c1d4195beffe41fcf2a85f226c8a85b803c1",
      "request_redeem_hash": "0xbef54c98f6ac025f799761084437aefc8a3dfb3c33c2bc3b51bc55cbfc367c6c",
      "user_address": "0x3ccD0fB49F0c3b16E8743344F351762f659fA6c9",
      "token_address": "0xe561FE05C39075312Aa9Bc6af79DdaE981461359",
      "token_symbol": "wrsETH",
      "token_amount": "0.5332"
    },
    ...
}

```

**Cian Yield Layer ABI**

**Deposit**

`optionalDeposit(address _token, uint256 _assets, address _receiver, address _referral) returns (uint256 _shares)`

Before calling this function, user should approve the contract to spend the token (token can be WBTC / FBTC / pumpBTC).

**Example:**

optionalDeposit(WBTC, 1e8, UserAddress, ReferralAddress) Means UserAddress deposits 1 WBTC to the vault, and ReferralAddress gets the referral fee.

**Return:**

`_shares`: The amount of shares user gets.

Also emits event: `OptionalDeposit(msg.sender, _token, _assets, _receiver, _referral)`

**Withdraw**

`requestRedeem(uint256 _shares)`

Will transfer the assets from the user's address to redeemer address, and request to redeem the shares to tokens.

**Example:**

requestRedeem(1e8) Means user wants to redeem 1 shares.
