> 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/spectra-finance/43402-sc-insight-function-getptunderlyingunit-could-be-marked-external.md).

# #43402 \[SC-Insight] Function \`getPTUnderlyingUnit\` could be marked external

**Submitted on Apr 5th 2025 at 15:48:56 UTC by @PotEater for** [**Audit Comp | Spectra Finance**](https://immunefi.com/audit-competition/audit-comp-spectra-finance)

* **Report ID:** #43402
* **Report Type:** Smart Contract
* **Report severity:** Insight
* **Target:** <https://github.com/immunefi-team/Spectra-Audit-Competition/blob/main/src/router/util/RouterUtil.sol>
* **Impacts:**

## Description

## Brief/Intro

The function `getPTUnderlyingUnit` is marked as public, however it is not used internally anywhere, so it could be marked external to save gas.

## Vulnerability details

Public functions can be called internally and externally at the same time. In such case, marking a function public would make sense. However, the mentioned functions are not used internally within the contract.

This means the functions can be marked external to save gas.

## Impact Details

Functions marked `public` cost more gas than external functions. This is gas/code optimization.

Changing this function to external will save gas.

## References

<https://github.com/immunefi-team/Spectra-Audit-Competition/blob/1cebdc67a9276fd87105d13f302fd77d000d0c0b/src/router/util/RouterUtil.sol#L831>

## Proof of Concept

## Proof of Concept

```solidity
    function getPTUnderlyingUnit(address _pt) public view returns (uint256) { // @audit-issue function could be marked external
        return getUnit(IPrincipalToken(_pt).underlying());
    }
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://reports.immunefi.com/spectra-finance/43402-sc-insight-function-getptunderlyingunit-could-be-marked-external.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
