# StakeUpStaking

## Overview

`StakeUpStaking` is a smart contract that allows users to stake `SUP` tokens in order to receive fees generated from `stUsdc`.

## Contract API

### `stake`

```solidity
function stake(uint256 stakeupAmount) external;
```

Stake `SUP` tokens in the staking contract to earn `stUsdc` rewards.

### `unstake`

```solidity
function unstake(uint256 stakeupAmount, bool harvestRewards) external;
```

Unstake `SUP` tokens from the staking contract.

### `harvest`

```solidity
function harvest() external;
```

Claim all `stUsdc` rewards accrued by the `msg.sender`

### `getStakeUpToken`

```solidity
function stakupToken() external view returns (IStakeUpToken);
```

Returns the SUP token instance.

### `getStUsdc`

```solidity
function stUsdc() external view returns (IStUsdc);
```

Returns the `stUsdc` token instance.

### `claimableRewards`

```solidity
function claimableRewards(address account) external view returns (uint256);
```

Returns the amount of claimable rewards available for an `account` in terms of `stUsdc`.

### `totalStakeUpStaked`

```solidity
function totalStakeUpStaked() external view returns (uint256);
```

Returns the total amount of `SUP` staked within the staking contract.

### `getRewardData`

```solidity
function rewardData() external view returns (RewardData memory);
```

Returns the global `RewardData` struct for the staking contract.

```solidity
/**
* @notice Data structure containing information pertaining to a reward period
* @dev All rewards are denominated in stTBY shares due to the token's rebasing nature
* @param index The last index that the rewards were updated
* @param lastShares The last shares balance of rewards available in the contract
*/
struct RewardData {
   uint128 index;
   uint128 lastShares;
}
```

### `getUserStakingData`

```solidity
function userStakingData(address account) external view returns (StakingData memory);
```

Returns `StakingData` for a specific `account`.

```solidity
/**
* @notice Data structure containing information pertaining to a user's stake
* @dev All rewards are denominated in stTBY shares due to the token's rebasing nature
* @param amountStaked The amount of STAKEUP tokens currently staked
* @param index The last index that the users rewards were updated
* @param rewardsAccrued The amount of stTBY rewards that have accrued to the stake
*/
struct StakingData {
   uint256 amountStaked;
   uint128 index;
   uint128 rewardsAccrued;
}
```

### `getLastRewardBlock`

```solidity
function lastRewardBlock() external view returns (uint256);
```

Returns the last block of the global reward data.


---

# 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.stakeup.finance/technical-docs/smart-contracts/stakeupstaking.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.
