# Methods

#### Deposit principal <a href="#deposit-principal" id="deposit-principal"></a>

```
function depositPrincipal(uint256 _tokenAmount) external returns (uint256);
```

This function will be called whenever a user stakes via the Flashstake Protocol. The Time Vault owner can choose to implement a fee but the resulting “locked” principal the user should expect after the stake has ended must be returned.

{% hint style="warning" %}
This function should be protected such that only the Flashstake Protocol can execute this. This is to ensure users do not accidentally call this function and lose their funds.
{% endhint %}

#### Withdraw principal

```
function withdrawPrincipal(uint256 _tokenAmount) external;
```

This function should withdraw principal from the underlying strategy (eg AAVE).

{% hint style="info" %}
This function should be protected such that only the Flash Protocol can execute this. Keeping this unprotected would of course mean anyone would withdraw principal tokens from your strategy.
{% endhint %}

#### Burn TBT

```
function burnFToken(
    uint256 _tokenAmount,
    uint256 _minimumReturned,
    address _yieldTo
) external returns (uint256);
```

This is the function the user will be calling when performing a [FlashBurn](/time-based-tokens-tbts/burning-tbts-flashburn.md). It is responsible for burning the fToken supplied by the user and returning yield to the user.

#### Get principal balance

```
function getPrincipalBalance() external view returns (uint256);
```

This must return the current total of all principal accepted by the contract.

#### Get yield balance

```
function getYieldBalance() external view returns (uint256);
```

This function must report the total yield balance.

#### Get principal address

```
function getPrincipalAddress() external view returns (address);
```

This must return the principal token address (eg DAI).

#### Quote mint fToken

```
function quoteMintFToken(uint256 _tokenAmount, uint256 duration) external view returns (uint256);
```

This function will be called by the Flash Protocol (and frontends) to determine how many fTokens should be minted for a given \_tokenAmount and \_duration (in seconds).

#### Quote burn fToken

```
function quoteBurnFToken(uint256 _tokenAmount) external view returns (uint256);
```

This function must return the yield a user should expect when burning \_tokenAmount fTokens.

#### Set fToken address

```
function setFTokenAddress(address _fTokenAddress) external;
```

The function to set the fERC20 address within the strategy.

Note

This function should be protected such that only the Flash Protocol can execute this.

#### Get max stake duration

```
function getMaxStakeDuration() external view returns (uint256);
```

This function must report the maximum duration a user can stake for. This can either be hardcoded or be a function of on-chain metrics.


---

# 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.flashstake.io/smart-contracts/time-vault-strategy/methods.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.
