> For the complete documentation index, see [llms.txt](https://admin-vlr.gitbook.io/valerstudios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://admin-vlr.gitbook.io/valerstudios/reference/smart-contracts-overview.md).

# 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](/valerstudios/the-vlr-staking-system/business-incubation.md#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 %}
