> For the complete documentation index, see [llms.txt](https://reports.immunefi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://reports.immunefi.com/yeet/41766-sc-insight-in-yeet.sol-storage-slots-only-set-in-constructor-should-be-declared-immutable-..md).

# #41766 \[SC-Insight] In \`Yeet.sol\`, storage slots only set in constructor should be declared \`immutable\`.

**Submitted on Mar 18th 2025 at 08:10:37 UTC by @Victor\_TheOracle for** [**Audit Comp | Yeet**](https://immunefi.com/audit-competition/audit-comp-yeet)

* **Report ID:** #41766
* **Report Type:** Smart Contract
* **Report severity:** Insight
* **Target:** <https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/Yeet.sol>
* **Impacts:**

## Description

## Brief/Intro

In `Yeet.sol`, several state variables that are only set in the constructor are not declared as `immutable`. This oversight leads to unnecessary storage usage and higher gas costs during contract interactions.

## Vulnerability Details

The Solidity compiler offers the `immutable` keyword for variables that are assigned only once during construction. By marking these variables as `immutable`, their values are embedded directly in the bytecode rather than stored in a storage slot, leading to significant gas optimizations. In `Yeet.sol`, the following variables are set exclusively in the constructor but are not marked as immutable:

```solidity
/// @notice yeetTokenAddress is the address of the YeetToken contract
//@audit (info) -----> Should be immutable
address public yeetTokenAddress;
/// @notice rewardsContract is the Reward contract
//@audit (info) -----> Should be immutable
Reward public rewardsContract;
/// @notice gameSettings is the YeetGameSettings contract
//@audit (info) -----> Should be immutable
YeetGameSettings public gameSettings;
/// @notice yeetback is the Yeetback contract
//@audit (info) -----> Should be immutable
Yeetback public yeetback;
```

## Impact Details

The primary impact of this issue is increased gas consumption during contract execution.

## References

Links to relevant lines:

1. <https://github.com/immunefi-team/audit-comp-yeet/blob/da15231cdefd8f385fcdb85c27258b5f0d0cc270/src/Yeet.sol#L111>
2. <https://github.com/immunefi-team/audit-comp-yeet/blob/da15231cdefd8f385fcdb85c27258b5f0d0cc270/src/Yeet.sol#L113>
3. <https://github.com/immunefi-team/audit-comp-yeet/blob/da15231cdefd8f385fcdb85c27258b5f0d0cc270/src/Yeet.sol#L117>
4. <https://github.com/immunefi-team/audit-comp-yeet/blob/da15231cdefd8f385fcdb85c27258b5f0d0cc270/src/Yeet.sol#L121>

## Proof of Concept

## Proof of Concept


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://reports.immunefi.com/yeet/41766-sc-insight-in-yeet.sol-storage-slots-only-set-in-constructor-should-be-declared-immutable-..md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
