# Curve yUSD

Curve Resolver fetch position of user, Buy, Deposit and Withdraw details. You can view details like source code, ABIs on [Etherscan](https://etherscan.io/address/0xaf122FB1C70b913AF467a9D924890f92c109bfc3#code).

## Get Position

Fetch the Curve position details of an address

```
dsa.curve_y.getPosition(address);
```

| Parameter | Type           | Description        |
| --------- | -------------- | ------------------ |
| address   | address/string | The owner address. |

**Returns:** `Object` with all the Position details.Copy

```
{
  "curveBalance": 0,
  "totalSupply": 0,
  "virtualPrice": "1.0088886123601257",
  "userShare": 0,
  "daiPoolBalance": 0,
  "usdcPoolBalance": 0,
  "usdtPoolBalance": 0,
  "tusdPoolBalance": 0,
  "stakedCurveBalance": 0,
  "rewardsEarned:" 0,
  "yfiTokenBalance": 0

}
```

| Return Parameter   | Type          | Description                                                  |
| ------------------ | ------------- | ------------------------------------------------------------ |
| curveBalance       | number        | User's curve token balance.                                  |
| totalSupply        | number        | Total supply of the curve token                              |
| virtualPrice       | number/string | Virtual price of the curve token on yUSD pool.               |
| userShare          | number        | The users share in % eg - 1 = 1% share                       |
| daiPoolBalance     | number        | Balance of Dai in the pool.                                  |
| usdcPoolBalance    | number        | Balance of USDC in the pool.                                 |
| usdtPoolBalance    | number        | Balance of USDT in the pool.                                 |
| tusdPoolBalance    | number        | Balance of TUSD in the pool.                                 |
| stakedCurveBalance | number        | The amount of curve tokens staked in synthetix staking pool. |
| rewardsEarned      | number        | SNX tokens earned from synthetix staking pool.               |
| yfiTokenBalance    | number        | FYI token balance.                                           |

## Get Buy Amount

Fetch amount of tokens to buy of a user with just a single call.Copy

```
dsa.curve_y.getBuyAmount(buyToken, sellToken, sellAmt, slippage)
```

| Parameter | Type   | Description                                                                              |
| --------- | ------ | ---------------------------------------------------------------------------------------- |
| buyToken  | string | The buy token symbol.                                                                    |
| sellToken | string | The sell token address.                                                                  |
| sellAmt   | number | The amount of tokens to sell. Amount to be written in normal form eg - 1.1 ETH, 100 DAI. |
| slippage  | number | The slippage in percent eg - 1 means 1%, 10 means 10%, etc.                              |

**Returns:** `Object` of buy token details

```
{
  buyAmt: "2208.0499999999997",
  buyAmtRaw: "2208050000000000000000",
  unitAmt: "216388900000000000000",
  virtualPrice: "1.0088886123601257"
}
```

| Return Parameter | Type          | Description                                                                                                                                                                                 |
| ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| buyAmt           | number/string | Expected buy token amount.                                                                                                                                                                  |
| buyAmtRaw        | number/string | Expected buy token amount in decimal form.                                                                                                                                                  |
| unitAmt          | number/string | The unit amount is the minimum amount of curve token amount expected per token amount. It is calculated with the help of slippage. The parameter is passed directly in the curve connector. |
| virtualPrice     | number/string | Virtual price of the curve token on yUSD pool.                                                                                                                                              |

## Get Deposit Amount

Fetch amount of tokens to deposit of a user with just a single call

```
dsa.curve_y.getDepositAmount(token, amount, slippage)
```

| Parameter | Type   | Description                                                            |
| --------- | ------ | ---------------------------------------------------------------------- |
| token     | string | The deposit token symbol.                                              |
| amount    | number | The amount of tokens to deposit. This should be a decimal value.       |
| slippage  | number | The slippage to deposit in percent eg - 1 means 1%, 10 means 10%, etc. |

**Returns:** `Object` of buy token details.Copy

```
{
  curveAmt: "2208.0499999999997",
  curveAmtRaw: "2208050000000000000000",
  unitAmt: "216388900000000000000",
  virtualPrice: "1.0088886123601257"
}
```

| Return Parameter | Type          | Description                                                                                                                                                                   |
| ---------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| curveAmt         | number/string | Expected deposit token amount.                                                                                                                                                |
| curveAmtRaw      | number/string | Expected deposit token amount in decimal form.                                                                                                                                |
| unitAmt          | number/string | The unit amount is the minimum amount of curve token expected per token. It is calculated with the help of slippage. The parameter is passed directly in the curve connector. |
| virtualPrice     | number/string | Virtual price of the curve token on yUSD pool.                                                                                                                                |

## Get Withdraw Amount

Fetch amount of Curve token to redeem of a user with just a single call.Copy

```
dsa.curve_y.getWithdrawAmount(token, amount, slippage)
```

| Parameter | Type   | Description                                                             |
| --------- | ------ | ----------------------------------------------------------------------- |
| token     | string | The withdraw token symbol.                                              |
| amount    | number | The amount of tokens to withdraw. This should be a decimal value.       |
| slippage  | number | The slippage to withdraw in percent eg - 1 means 1%, 10 means 10%, etc. |

**Returns:** `Object` of withdraw token details.Copy

```
{
  curveAmt: "2208.0499999999997",
  curveAmtRaw: "2208050000000000000000",
  unitAmt: "216388900000000000000",
  virtualPrice: "1.0088886123601257"
}
```

| Return Parameter | Type          | Description                                                                                                                                                                   |
| ---------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| curveAmt         | number/string | Expected Curve token amount to redeem.                                                                                                                                        |
| curveAmtRaw      | number/string | Expected Curve token amount to redeem in decimal form.                                                                                                                        |
| unitAmt          | number/string | The unit amount is the minimum amount of curve token expected per token. It is calculated with the help of slippage. The parameter is passed directly in the curve connector. |
| virtualPrice     | number/string | Virtual price of the curve token on yUSD pool.                                                                                                                                |

## Get Withdraw Raw Amount

Returns token amount and unit amount with just a single call.Copy

```
dsa.curve_y.getWithdrawTokenAmount(token, amt, slippage)
```

| Parameter | Type   | Description                                                             |
| --------- | ------ | ----------------------------------------------------------------------- |
| token     | string | The withdraw token symbol.                                              |
| amount    | number | The amount of Curve tokens to redeem. This should be a decimal value.   |
| slippage  | number | The slippage to withdraw in percent eg - 1 means 1%, 10 means 10%, etc. |

**Returns:** `Object` of withdraw token details.Copy

```
{
  amt: "2208.0499999999997",
  amtRaw: "2208050000000000000000",
  unitAmt: "216388900000000000000",
  virtualPrice: "1.0088886123601257"
}
```

| Return Parameter | Type          | Description                                                                                                                                                                   |
| ---------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amt              | number/string | Expected withdraw token amount.                                                                                                                                               |
| amtRaw           | number/string | Expected withdraw token amount in decimal form.                                                                                                                               |
| unitAmt          | number/string | The unit amount is the minimum amount of curve token expected per token. It is calculated with the help of slippage. The parameter is passed directly in the curve connector. |
| virtualPrice     | number/string | Virtual price of the curve token on yUSD pool.                                                                                                                                |
