# Smart Contracts Overview

The VLR staking contract and all unique E-VLR staking contracts have over 90% of common code in common. The only differences in function headers enable a distribution of a rewards basket in exchanged for staked VLR, as opposed to a single token used for both inputs and outputs of all E-VLR staking contracts.&#x20;

#### Code

{% tabs %}
{% tab title="VLR Staking" %}
[VlrStaker.sol](https://github.com/valerstudios/VLR-Staking-Contracts/blob/main/contracts/VlrStaker.sol)
{% endtab %}

{% tab title="E-VLR Staking" %}
[EvlrStaker.sol](https://github.com/valerstudios/VLR-Staking-Contracts/blob/main/contracts/EvlrStaker.sol)
{% endtab %}
{% endtabs %}

#### Address

`VlrStaker` is will be deployed on the Binance Smart Chain network.&#x20;

The list of E-VLR contract deployment addresses is found in [Business Incubation](https://admin-vlr.gitbook.io/valerstudios/the-vlr-staking-system/business-incubation#incubator-participants).

### Events

{% tabs %}
{% tab title="VLR Staking" %}

#### RewardsDistributed

> event RewardsDistributed(uint256\[] indexed totalDistributed, address\[] indexed addressesOfDistributedTokens, uint256 indexed timeOfDistribution );

At the time of rewards distribution, we log the basket of tokens distributed and the respective quantity of tokens distributed.
{% endtab %}

{% tab title="E-VLR Staking" %}

#### RewardsDistributed

> event RewardsDistributed(uint256 indexed totalDistributed, uint256 indexed timeOfDistribution );

At the time of rewards distribution, we log the quantity of rewards distributed to stakers.
{% endtab %}
{% endtabs %}

### Read Only Functions

#### getCharityAddress

> function getCharityAddress() external view returns (address \_charityBagAddress);

This function returns the address of the wallet collecting charity fees.&#x20;

### State-Changing Functions

{% tabs %}
{% tab title="VLR Staking" %}

#### stake

> function stake(uint256 \_stakedVlrAmount)&#x20;
>
> &#x20;       external&#x20;
>
> &#x20;       returns (
>
> &#x20;               uint256 mtcFeePaid,&#x20;
>
> &#x20;               uint256 charityFeePaid,&#x20;
>
> &#x20;               uint256 burnFeePaid,&#x20;
>
> &#x20;               uint256 stakingFeePaid,&#x20;
>
> &#x20;               uint256 svlrMinted
>
> &#x20;       );

Contributes `_stakedVlrAmount` to the contract, creating `svlrMinted` equal to that amount less `mtcFeePaid`, `charityFeePaid`, `burnFeePaid`, and `stakingFeePaid`.

&#x20;

#### unstake

> function unstake(uint256 \_unstakedAmount)
>
> &#x20;       external&#x20;
>
> &#x20;       returns (
>
> &#x20;               uint256 mtcFeePaid,&#x20;
>
> &#x20;               uint256 charityFeePaid,&#x20;
>
> &#x20;               uint256 burnFeePaid,&#x20;
>
> &#x20;               uint256 stakingFeePaid,&#x20;
>
> &#x20;               uint256 vlrReturned,
>
> &#x20;               uint256 vlrRewardsReturned
>
> &#x20;       );

Removes `_unstakedAmount` and returns `vlrReturned` equal to that amount less `mtcFeePaid`, `charityFeePaid`, `burnFeePaid`, and `stakingFeePaid` plus staking rewards equal to `vlrRewardsReturned`.&#x20;
{% endtab %}

{% tab title="E-VLR Staking" %}

#### stake

> function stake(uint256 \_stakedVlrAmount)&#x20;
>
> &#x20;       external&#x20;
>
> &#x20;       returns (
>
> &#x20;               uint256 charityFeePaid,&#x20;
>
> &#x20;               uint256 burnFeePaid,&#x20;
>
> &#x20;               uint256 stakingFeePaid,&#x20;
>
> &#x20;               uint256 svlrMinted
>
> &#x20;       );

Contributes `_stakedVlrAmount` to the contract, creating `svlrMinted` equal to that amount less `charityFeePaid`, `burnFeePaid`, and `stakingFeePaid`.

&#x20;

#### unstake

> function unstake(uint256 \_unstakedAmount)
>
> &#x20;       external&#x20;
>
> &#x20;       returns (
>
> &#x20;               uint256 charityFeePaid,&#x20;
>
> &#x20;               uint256 burnFeePaid,&#x20;
>
> &#x20;               uint256 stakingFeePaid,&#x20;
>
> &#x20;               uint256 vlrReturned,
>
> &#x20;               uint256 vlrRewardsReturned
>
> &#x20;       );

Removes `_unstakedAmount` and returns `vlrReturned` equal to that amount less `charityFeePaid`, `burnFeePaid`, and `stakingFeePaid` plus staking rewards equal to `vlrRewardsReturned`.
{% endtab %}
{% endtabs %}


---

# 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://admin-vlr.gitbook.io/valerstudios/reference/smart-contracts-overview.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.
