Skip to content
Audit finding Beginner

Missing Event Emission in AgentVault and CollateralPoolToken Factory Contracts

The AgentVaultFactory and CollateralPoolTokenFactory contracts create new proxy instances without emitting any event. This reduces on-chain transparency and makes it harder for off-chain systems to track deployments, but no direct security impact is claimed.

blackgrease Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#47094 [SC-Insight] Missing Event Emission in `AgentVault` and `CollateralPoolToken` Factory Contracts

Submitted on Jun 8th 2025 at 22:27:50 UTC by @blackgrease for Audit Comp | Flare | FAssets

Description

Note: Due to the issue being prevalent in two contracts but maintaining the same fix - and considering this is an Insight report - the two occurrences have been merged into one report.

Severity > Insight: Code Enhancements and Optimization and/or Best Practice

Summary

The two factory contracts, CollateralPoolTokenFactory and AgentVaultFactory, do not emit events upon successful creation of new contract instances. This omission reduces on-chain transparency and makes it difficult for off-chain systems to track deployed contracts. It further breaks the best practive of events being emitted on important state changes.

Description

Both CollateralPoolTokenFactory and AgentVaultFactory are responsible for deploying new proxy contract instances (CollateralPoolToken and AgentVault, respectively) using the ERC1967Proxy pattern.

However, neither factory contract emits an event upon creation of a new contract. This breaks a smart contract development best practice where a contract should emit an event on important state changes; such as a new contract being created, important state variable change and such. This helps to notify off-chain infrastructure (e.g indexers, explorers, front-ends) about new deployments.

Affected Areas

  • CollateralPoolTokenFactory
Solidity

function create(IICollateralPool _pool, string memory _systemSuffix, string memory _agentSuffix)
        external override
        returns (address)
    {
        string memory tokenName = string.concat(TOKEN_NAME_PREFIX, _systemSuffix, "-", _agentSuffix);
        string memory tokenSymbol = string.concat(TOKEN_SYMBOL_PREFIX, _systemSuffix, "-", _agentSuffix);
        ERC1967Proxy proxy = new ERC1967Proxy(implementation, new bytes(0));
        CollateralPoolToken poolToken = CollateralPoolToken(address(proxy));
        poolToken.initialize(address(_pool), tokenName, tokenSymbol);
        return address(poolToken); //@audit-insight: no event emission
    }
  • AgentVaultFactory
Solidity

   function create(IIAssetManager _assetManager) external returns (IIAgentVault) {
        ERC1967Proxy proxy = new ERC1967Proxy(implementation, new bytes(0));
        AgentVault agentVault = AgentVault(payable(address(proxy)));
        agentVault.initialize(_assetManager);
        return agentVault; //@audit-insight: no event emission
    }

Impact

This issue is an Insight under Code Optimizations and Enhancements and Best Practices. The results of the missing event emission are:

  1. Reduced Transparency: Users, auditors, and developers are unable to verify contract deployments easily.
  2. Poor Developer and User Experience: Front-ends cannot reliably fetch and display newly created contract instances for users without resorting to inefficient on-chain scans.
  3. Security Concerns: The absence of event logs makes it harder to audit and detect malicious or accidental deployments.

Mitigation

The recommend mitigation is to include event emission each time a new instance of either AgentVault or CollateralPoolToken factory is created.

In CollateralPoolTokenFactory

Solidity

//Event Declaration
event CollateralPoolTokenCreated(address indexed poolToken, string tokenName, string tokenSymbol);


function create(IICollateralPool _pool, string memory _systemSuffix, string memory _agentSuffix)
    external override
    returns (address)
{
    string memory tokenName = string.concat(TOKEN_NAME_PREFIX, _systemSuffix, "-", _agentSuffix);
    string memory tokenSymbol = string.concat(TOKEN_SYMBOL_PREFIX, _systemSuffix, "-", _agentSuffix);
    ERC1967Proxy proxy = new ERC1967Proxy(implementation, new bytes(0));
    CollateralPoolToken poolToken = CollateralPoolToken(address(proxy));
    poolToken.initialize(address(_pool), tokenName, tokenSymbol);
    emit CollateralPoolTokenCreated(address(poolToken), tokenName, tokenSymbol); //Event implemented
    return address(poolToken);
}

In AgentVaultFactory

Solidity

//Event Declaration
event AgentVaultCreated(address indexed vault, address indexed assetManager);

function create(IIAssetManager _assetManager) external returns (IIAgentVault) {
    ERC1967Proxy proxy = new ERC1967Proxy(implementation, new bytes(0));
    AgentVault agentVault = AgentVault(payable(address(proxy)));
    agentVault.initialize(_assetManager);
    emit AgentVaultCreated(address(agentVault), address(_assetManager)); //Event implemented
    return agentVault;
}

Proof of Concept

Proof-of-concept

CollateralPoolTokenFactory

  1. The function create is called on deployed instance of CollateralPoolFactory
  2. The contract CollateralPoolToken is created.
  3. The caller gets returned a address value but no event is emitted.
  4. No external indexers, observers or off-chain systems are aware that a new CollateralPoolToken has been created.
  5. Additional step: Caller has to manually make this information public for the system to be aware.

AgentVaultFactory

  1. The function create is called on deployed instance of AgentVaultFactory
  2. The contract AgentVault is created
  3. The caller gets returned a address value but no event is emitted
  4. No external indexers, observers or off-chain systems are aware that a new AgentVault has been created
  5. Additional step: Caller has to manually make this information public aware.

The original report as published on Immunefi, by blackgrease. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the factory functions were written without an event declaration or emit statement after deploying the new proxy contract.

Impact

The missing events reduce transparency and make it harder for off-chain systems to detect new deployments, but the report does not claim any direct exploit or loss of funds.

What the attacker needed

None

The fix

The factories should emit an event each time a new AgentVault or CollateralPoolToken is created.

How it was found

  1. Call the create function on the CollateralPoolTokenFactory contract.
  2. A new CollateralPoolToken contract is created.
  3. The caller receives the address but no event is emitted.
  4. Call the create function on the AgentVaultFactory contract.
  5. A new AgentVault contract is created.
  6. The caller receives the address but no event is emitted.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a smart contract creates something new, like another contract, it can write a note to the blockchain called an event. Other programs watch these notes to know what happened. Here, the factories create new contracts but do not write any note, so it is harder to notice and track new contracts.

More by blackgrease

View all

25 more disclosed reports, best first.

More from Flare | FAssets

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.