> 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/flare-fassets-or-mainnet-audit-comp/46218-sc-insight-documentation-implementation-discrepancy-in-agent-vault-access-control.md).

# #46218 \[SC-Insight] Documentation-Implementation Discrepancy in Agent Vault Access Control

**Submitted on May 26th 2025 at 20:30:49 UTC by @Victor\_TheOracle for** [**Audit Comp | Flare | FAssets**](https://immunefi.com/audit-competition/audit-comp-flare-fassets)

* **Report ID:** #46218
* **Report Type:** Smart Contract
* **Report severity:** Insight
* **Target:** <https://github.com/flare-foundation/fassets/blob/main/contracts/assetManager/implementation/AgentVault.sol>
* **Impacts:**

## Description

## Brief/Intro

The `depositCollateral` and `updateCollateral` functions in the Agent Vault contract are documented to be callable by anyone but are implemented with `onlyOwner` modifiers, restricting access to vault owners only. This prevents third-party funding mechanisms and flexible collateral management as described in the documentation.

## Vulnerability Details

The documentation explicitly states that both `depositCollateral` and `updateCollateral` should be callable by anybody:

**Documentation Claims:**

* `depositCollateral`: "NOTE: anybody can call this method, to allow the owner to deposit from any wallet."
* `updateCollateral`: "NOTE: anybody can call this method, to allow the owner to deposit from any source."

**Actual Implementation:**

```solidity
function depositCollateral(IERC20 _token, uint256 _amount)
    external override
    onlyOwner  //@audit Contradicts documentation
{
    _token.safeTransferFrom(msg.sender, address(this), _amount);
    assetManager.updateCollateral(address(this), _token);
    _tokenUsed(_token, TOKEN_DEPOSIT);
}

function updateCollateral(IERC20 _token)
    external override
    onlyOwner  //@audit Contradicts documentation
{
    assetManager.updateCollateral(address(this), _token);
    _tokenUsed(_token, TOKEN_DEPOSIT);
}
```

This implementation shows that it has deviated from what was documented.

## Impact Details

The primary consequence of this access control discrepancy is **loss of flexibility** as third parties cannot assist with collateral management despite this functionality being explicitly documented.

## References

1. AgentVault documentation for the `depositCollateral`, and `updateCollateral` functions: <https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/docs/IAgentVault.md?plain=1#L1-L5>
2. AgentVault implementation: <https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/contracts/assetManager/implementation/AgentVault.sol#L93-L109>

## Proof of Concept

1. The documentation clearly states that anybody can call the `depositCollateral` and `updateCollateral` methods, to allow the owner to deposit from any wallet or source.

<https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/docs/IAgentVault.md?plain=1#L1-L5>

```
**depositCollateral** - Deposit vault collateral. Parameter `_token` is explicit to allow depositing before collateral switch.
NOTE: owner must call `token.approve(vault, amount)` before calling this method. NOTE: anybody can call this method, to allow the owner to deposit from any wallet.

**updateCollateral** - Update collateral after `transfer(vault, some amount)` was called (alternative to depositCollateral). Parameter `_token` is explicit to allow depositing before collateral switch.
NOTE: anybody can call this method, to allow the owner to deposit from any source.
```

2. Owner tries to deposit or update collateral from another wallet, but the transaction fails with the "Ownable: caller is not the owner" error.
3. This does not align with the documentation and it should be corrected.


---

# 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/flare-fassets-or-mainnet-audit-comp/46218-sc-insight-documentation-implementation-discrepancy-in-agent-vault-access-control.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.
