> For the complete documentation index, see [llms.txt](https://docs.stakeup.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stakeup.finance/technical-docs/smart-contracts/stakeupstaking.md).

# 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.
