Missing _mytSharesDeposited Decrements in _forceRepay/_doLiquidation Leads to Smart Contract Unable to Operate Due to Lack of Token Funds
The contract's internal accounting variable tracking deposited MYT shares is not reduced when tokens are sent out during forced repayments and liquidations. This causes the reported total value locked to be overstated, which could eventually make the contract unable to operate because it believes it holds more tokens than it actually does.
- Disclosed after under an hour
58369 sc high missing mytsharesdeposited decrements in forcerepay doliquidation leads to smart contract unable to operate due to lack of token funds
Submitted on Nov 1st 2025 at 17:27:23 UTC by @gor97 for Audit Comp | Alchemix V3
- Report ID: #58369
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi\\_audit/src/AlchemistV3.sol
- Impacts:
- Smart contract unable to operate due to lack of token funds
Description
Brief/Intro
The AlchemistV3 protocol contains a critical accounting vulnerability where the internal _mytSharesDeposited variable fails to be decremented when MYT tokens are transferred out during forced repayments (_forceRepay()) and liquidations (_doLiquidation()). This accounting mismatch causes the _getTotalUnderlyingValue() function to return progressively overstated Total Value Locked (TVL) calculations, which compound with each liquidation event. As the discrepancy between reported and actual token balances grows, the smart contract becomes unable to operate properly due to insufficient token funds relative to what the protocol believes it holds, ultimately leading to operational failure and potential system-wide dysfunction.
Vulnerability Details
The vulnerability stems from incomplete accounting maintenance in two critical functions within the AlchemistV3 contract. The contract uses an internal variable _mytSharesDeposited (line 134) to track the total MYT shares deposited:
uint256 private _mytSharesDeposited;
This variable is used by the _getTotalUnderlyingValue() function (line 1238-1241) to calculate the protocol's TVL:
function _getTotalUnderlyingValue() internal view returns (uint256 totalUnderlyingValue) {
uint256 yieldTokenTVLInUnderlying = convertYieldTokensToUnderlying(_mytSharesDeposited);
totalUnderlyingValue = yieldTokenTVLInUnderlying;
}
The contract correctly maintains this accounting variable in most operations:
- Incremented during
deposit()at line 383:_mytSharesDeposited += amount; - Decremented during
withdraw()at line 410:_mytSharesDeposited -= amount; - Decremented for protocol fees in multiple locations
However, two critical functions transfer MYT tokens out without updating the accounting:
Location 1: _forceRepay() Function (Line 779)
function _forceRepay(uint256 accountId, uint256 amount) internal returns (uint256) {
// ... calculation logic ...
TokenUtils.safeTransfer(myt, address(transmuter), creditToYield); // Transfers MYT out
// Missing: _mytSharesDeposited -= creditToYield;
return creditToYield;
}
Location 2: _doLiquidation() Function (Lines 875, 879)
function _doLiquidation(uint256 accountId, uint256 collateralInUnderlying, uint256 repaidAmountInYield)
internal returns (uint256 amountLiquidated, uint256 feeInYield, uint256 feeInUnderlying)
{
// ... calculation logic ...
TokenUtils.safeTransfer(myt, transmuter, amountLiquidated - feeInYield); // Line 875
if (feeInYield > 0 && account.collateralBalance >= feeInYield) {
TokenUtils.safeTransfer(myt, msg.sender, feeInYield); // Line 879
}
// Missing: _mytSharesDeposited -= amountLiquidated;
}
Technical Impact Chain
- Accounting Discrepancy: Each liquidation/forced repayment creates a growing gap between
_mytSharesDepositedand actual MYT token balance - TVL Overstatement:
_getTotalUnderlyingValue()returns inflated values based on the incorrect_mytSharesDeposited - Dependent Function Failures: Functions like
totalValue()(line 1073) and collateralization calculations rely on accurate TVL data - Operational Breakdown: As the discrepancy grows, operations requiring actual token transfers fail when the contract believes it has more tokens than it actually possesses
Vulnerability Reproduction Path
- User deposits 50,000 MYT shares →
_mytSharesDeposited = 50,000 - User borrows against collateral and creates transmuter redemption
- Liquidation occurs →
_forceRepay()transfers 50 MYT shares to Transmuter - Actual MYT balance: 49,950 shares (correctly decreased)
_mytSharesDeposited: 50,000 shares (incorrectly unchanged)- TVL calculation overstated by 50 shares
- Process repeats with each liquidation, compounding the discrepancy
Impact Details
The vulnerability manifests as progressive operational degradation with compounding effects:
Primary Impact: Smart Contract Operational Failure
- Token Fund Shortage: The contract believes it holds more MYT tokens than it actually possesses
- Operation Failures: Functions requiring token transfers fail when attempting to move non-existent tokens
- Progressive Deterioration: Each liquidation/forced repayment event worsens the discrepancy
Financial Quantification
- Per-Event Impact: Each liquidation creates a permanent accounting gap equivalent to the liquidated amount
- Cumulative Effect: The discrepancy compounds with protocol usage - active protocols with frequent liquidations will accumulate larger discrepancies faster
- System-Wide Risk: Affects all users as the core TVL calculation becomes increasingly unreliable
Operational Consequences
- Withdrawal Failures: Users may be unable to withdraw funds when the contract's perceived balance exceeds actual balance
- Liquidation System Breakdown: Incorrect TVL calculations affect liquidation triggers and calculations
- Risk Management Failure: Collateralization ratios become unreliable, preventing proper risk assessment
- Protocol Dysfunction: Core protocol operations that depend on accurate token accounting begin to fail
Severity Factors
- Likelihood: HIGH - Occurs during normal protocol operations (liquidations and forced repayments)
- Impact Scope: ALL protocol users affected as TVL is a global calculation
- Persistence: Bug effects are permanent and accumulate over time
- Recovery Difficulty: Requires protocol-level intervention to correct accumulated discrepancies
Code Locations
- Primary Contract:
/src/AlchemistV3.sol - Vulnerable Functions:
_forceRepay()- Line 779_doLiquidation()- Lines 875, 879
- Affected Calculations:
_getTotalUnderlyingValue()- Line 1238-1241totalValue()- Line 1073 (depends on accurate TVL)
Recommended Fixes
- For
_forceRepay(): Add_mytSharesDeposited -= creditToYield;after the token transfer - For
_doLiquidation(): Add_mytSharesDeposited -= amountLiquidated;after both token transfers - Additional Safeguards: Implement assertion checks to verify
_mytSharesDeposited == IERC20(myt).balanceOf(address(this))in critical functions
Proof of Concept
Proof of Concept
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
import "forge-std/Script.sol";
import "forge-std/console.sol";
import {AlchemistV3} from "../src/AlchemistV3.sol";
import {IAlchemistV3, AlchemistInitializationParams} from "../src/interfaces/IAlchemistV3.sol";
import {AlchemistV3Position} from "../src/AlchemistV3Position.sol";
import {Transmuter} from "../src/Transmuter.sol";
import {ITransmuter} from "../src/interfaces/ITransmuter.sol";
import {VaultV2} from "vault-v2/VaultV2.sol";
import {IVaultV2} from "vault-v2/interfaces/IVaultV2.sol";
import {AlchemicTokenV3} from "../src/test/mocks/AlchemicTokenV3.sol";
import {TestERC20} from "./TestERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
contract PoC_Bug_TVL_Mismatch is Script {
AlchemistV3 alchemist;
AlchemistV3Position positionNFT;
Transmuter transmuter;
AlchemicTokenV3 debtToken;
VaultV2 myt;
TestERC20 underlying;
address protocolFeeReceiver = address(0x10);
address proxyOwner = address(0x99);
address deployer;
function run() external {
console.log("PoC: TVL Mismatch Bug");
console.log("========================================");
vm.startBroadcast();
deployer = msg.sender;
// Deploy underlying token and MYT vault
underlying = new TestERC20(1_000_000e18, 18);
myt = new VaultV2(deployer, address(underlying));
myt.setName("MYT");
myt.setSymbol("MYT");
IERC20(address(underlying)).approve(address(myt), type(uint256).max);
uint256 assets = 100_000e18;
myt.deposit(assets, deployer);
// Deploy debt token and transmuter
debtToken = new AlchemicTokenV3("alUSD", "alUSD", 0);
ITransmuter.TransmuterInitializationParams memory tparams = ITransmuter.TransmuterInitializationParams({
syntheticToken: address(debtToken),
feeReceiver: protocolFeeReceiver,
timeToTransmute: 100,
transmutationFee: 0,
exitFee: 0,
graphSize: 1000
});
transmuter = new Transmuter(tparams);
// Deploy AlchemistV3 with proxy
AlchemistV3 alchemistLogic = new AlchemistV3();
AlchemistInitializationParams memory params = AlchemistInitializationParams({
admin: deployer,
debtToken: address(debtToken),
underlyingToken: address(underlying),
depositCap: type(uint256).max,
minimumCollateralization: 2e18,
globalMinimumCollateralization: 2e18,
collateralizationLowerBound: 2e18,
transmuter: address(transmuter),
protocolFee: 0,
protocolFeeReceiver: protocolFeeReceiver,
liquidatorFee: 0,
repaymentFee: 0,
myt: address(myt)
});
bytes memory alchemParams = abi.encodeWithSelector(AlchemistV3.initialize.selector, params);
TransparentUpgradeableProxy proxyAlchemist = new TransparentUpgradeableProxy(address(alchemistLogic), proxyOwner, alchemParams);
alchemist = AlchemistV3(address(proxyAlchemist));
// Setup position NFT and whitelist
positionNFT = new AlchemistV3Position(address(alchemist));
alchemist.setAlchemistPositionNFT(address(positionNFT));
debtToken.setWhitelist(address(alchemist), true);
// Create position and deposit
IERC20(address(myt)).approve(address(alchemist), type(uint256).max);
uint256 sharesToDeposit = IERC20(address(myt)).balanceOf(deployer) / 2;
alchemist.deposit(sharesToDeposit, deployer, 0);
uint256 tokenId = 1;
// Mint debt to maximum capacity
uint256 capacity = alchemist.getMaxBorrowable(tokenId);
alchemist.mint(tokenId, capacity, deployer);
// Create transmuter redemption
IERC20(address(debtToken)).approve(address(transmuter), capacity);
transmuter.setAlchemist(address(alchemist));
transmuter.setDepositCap(uint256(type(int256).max));
uint256 redemptionAmount = capacity / 10;
transmuter.createRedemption(redemptionAmount);
vm.roll(block.number + 2);
// Measure TVL before liquidation
console.log("BEFORE LIQUIDATION:");
uint256 alchemistSharesBefore = IERC20(address(myt)).balanceOf(address(alchemist));
uint256 actualUnderlyingBefore = IVaultV2(address(myt)).convertToAssets(alchemistSharesBefore);
uint256 tvlBefore = alchemist.getTotalUnderlyingValue();
console.log(" Alchemist MYT shares:", alchemistSharesBefore);
console.log(" Actual underlying:", actualUnderlyingBefore);
console.log(" TVL reported:", tvlBefore);
console.log(" Match?", actualUnderlyingBefore == tvlBefore ? "YES" : "NO");
// Trigger liquidation
console.log("TRIGGERING LIQUIDATION...");
alchemist.liquidate(tokenId);
// Measure TVL after liquidation
console.log("AFTER LIQUIDATION:");
uint256 alchemistSharesAfter = IERC20(address(myt)).balanceOf(address(alchemist));
uint256 actualUnderlyingAfter = IVaultV2(address(myt)).convertToAssets(alchemistSharesAfter);
uint256 tvlAfter = alchemist.getTotalUnderlyingValue();
console.log(" Alchemist MYT shares:", alchemistSharesAfter);
console.log(" Actual underlying:", actualUnderlyingAfter);
console.log(" TVL reported:", tvlAfter);
console.log(" Match?", actualUnderlyingAfter == tvlAfter ? "YES" : "NO");
// Demonstrate the bug
console.log("BUG RESULT:");
if (tvlAfter > actualUnderlyingAfter) {
uint256 discrepancy = tvlAfter - actualUnderlyingAfter;
console.log(" TVL OVERSTATED by:", discrepancy);
console.log(" Percentage (bps):", (discrepancy * 10000) / actualUnderlyingAfter);
console.log(" Root cause: _mytSharesDeposited not decremented in liquidation");
} else {
console.log(" No discrepancy found");
}
console.log("========================================");
vm.stopBroadcast();
}
}
Context
AlchemistV3 is the core contract of the Alchemix V3 protocol. It holds MYT shares on behalf of depositors, lets users mint a synthetic debt token against that collateral, and interacts with a Transmuter contract that handles redemptions. Internally it keeps a private counter, _mytSharesDeposited, declared at line 134:
uint256 private _mytSharesDeposited;
That counter is the protocol's own record of how many MYT shares it is holding. It is the only input to the TVL calculation, _getTotalUnderlyingValue() at lines 1238-1241:
function _getTotalUnderlyingValue() internal view returns (uint256 totalUnderlyingValue) {
uint256 yieldTokenTVLInUnderlying = convertYieldTokensToUnderlying(_mytSharesDeposited);
totalUnderlyingValue = yieldTokenTVLInUnderlying;
}
The reported impact category is "Smart contract unable to operate due to lack of token funds". The report was submitted on 1 November 2025 under the Alchemix V3 audit competition on Immunefi and rated High.
Setup
The proof of concept is a Foundry script (forge-std/Script.sol, forge-std/console.sol) compiled with Solidity 0.8.28. It deploys the whole stack from scratch rather than forking a live network:
TestERC20as the underlying token, with a supply of1_000_000e18and 18 decimals.VaultV2as the MYT vault, named "MYT" with symbol "MYT".AlchemicTokenV3as the debt token ("alUSD").Transmuter, initialised withtimeToTransmute: 100, zero transmutation fee, zero exit fee andgraphSize: 1000.AlchemistV3behind aTransparentUpgradeableProxy, withminimumCollateralization,globalMinimumCollateralizationandcollateralizationLowerBoundall set to2e18, andprotocolFee,liquidatorFeeandrepaymentFeeall zero.AlchemistV3Positionas the position NFT, registered withsetAlchemistPositionNFT.
The deployer address is the broadcast sender, the protocol fee receiver is address(0x10) and the proxy owner is address(0x99). The debt token whitelists the Alchemist contract with debtToken.setWhitelist(address(alchemist), true).
Finding it
The researcher compared every place where MYT leaves the contract against every place where _mytSharesDeposited is updated. Most operations are consistent:
deposit()increments it at line 383:_mytSharesDeposited += amount;withdraw()decrements it at line 410:_mytSharesDeposited -= amount;- protocol fee handling decrements it in several locations.
Two functions move MYT out without touching the counter. The first is _forceRepay() at line 779:
function _forceRepay(uint256 accountId, uint256 amount) internal returns (uint256) {
// ... calculation logic ...
TokenUtils.safeTransfer(myt, address(transmuter), creditToYield); // Transfers MYT out
// Missing: _mytSharesDeposited -= creditToYield;
return creditToYield;
}
The second is _doLiquidation() at lines 875 and 879:
function _doLiquidation(uint256 accountId, uint256 collateralInUnderlying, uint256 repaidAmountInYield)
internal returns (uint256 amountLiquidated, uint256 feeInYield, uint256 feeInUnderlying)
{
// ... calculation logic ...
TokenUtils.safeTransfer(myt, transmuter, amountLiquidated - feeInYield); // Line 875
if (feeInYield > 0 && account.collateralBalance >= feeInYield) {
TokenUtils.safeTransfer(myt, msg.sender, feeInYield); // Line 879
}
// Missing: _mytSharesDeposited -= amountLiquidated;
}
In both cases the real MYT balance of the contract falls while the counter stays where it was. Because _getTotalUnderlyingValue() reads only the counter, the reported TVL drifts above the truth, and the gap grows with every liquidation or forced repayment.
The report lays out the chain as four steps: the accounting discrepancy accumulates; _getTotalUnderlyingValue() returns inflated values; dependent functions such as totalValue() at line 1073 and the collateralization calculations consume that inflated figure; and eventually operations that need real token transfers fail because the contract believes it holds more than it does.
Exploitation
Step 1: deploy the tokens and the MYT vault
underlying = new TestERC20(1_000_000e18, 18);
myt = new VaultV2(deployer, address(underlying));
myt.setName("MYT");
myt.setSymbol("MYT");
IERC20(address(underlying)).approve(address(myt), type(uint256).max);
uint256 assets = 100_000e18;
myt.deposit(assets, deployer);
The deployer seeds the vault with 100,000 underlying and receives the corresponding MYT shares.
Step 2: deploy the debt token, the Transmuter and the Alchemist
debtToken = new AlchemicTokenV3("alUSD", "alUSD", 0);
ITransmuter.TransmuterInitializationParams memory tparams = ITransmuter.TransmuterInitializationParams({
syntheticToken: address(debtToken),
feeReceiver: protocolFeeReceiver,
timeToTransmute: 100,
transmutationFee: 0,
exitFee: 0,
graphSize: 1000
});
transmuter = new Transmuter(tparams);
AlchemistV3 alchemistLogic = new AlchemistV3();
AlchemistInitializationParams memory params = AlchemistInitializationParams({
admin: deployer,
debtToken: address(debtToken),
underlyingToken: address(underlying),
depositCap: type(uint256).max,
minimumCollateralization: 2e18,
globalMinimumCollateralization: 2e18,
collateralizationLowerBound: 2e18,
transmuter: address(transmuter),
protocolFee: 0,
protocolFeeReceiver: protocolFeeReceiver,
liquidatorFee: 0,
repaymentFee: 0,
myt: address(myt)
});
bytes memory alchemParams = abi.encodeWithSelector(AlchemistV3.initialize.selector, params);
TransparentUpgradeableProxy proxyAlchemist = new TransparentUpgradeableProxy(address(alchemistLogic), proxyOwner, alchemParams);
alchemist = AlchemistV3(address(proxyAlchemist));
The Alchemist is initialised with a 2:1 minimum collateralization and no fees.
Step 3: register the position NFT and open a position
positionNFT = new AlchemistV3Position(address(alchemist));
alchemist.setAlchemistPositionNFT(address(positionNFT));
debtToken.setWhitelist(address(alchemist), true);
IERC20(address(myt)).approve(address(alchemist), type(uint256).max);
uint256 sharesToDeposit = IERC20(address(myt)).balanceOf(deployer) / 2;
alchemist.deposit(sharesToDeposit, deployer, 0);
uint256 tokenId = 1;
Half of the deployer's MYT shares are deposited into the Alchemist under token ID 1. This is the deposit that increments _mytSharesDeposited.
Step 4: borrow to capacity and create a redemption
uint256 capacity = alchemist.getMaxBorrowable(tokenId);
alchemist.mint(tokenId, capacity, deployer);
IERC20(address(debtToken)).approve(address(transmuter), capacity);
transmuter.setAlchemist(address(alchemist));
transmuter.setDepositCap(uint256(type(int256).max));
uint256 redemptionAmount = capacity / 10;
transmuter.createRedemption(redemptionAmount);
vm.roll(block.number + 2);
The position is minted to its maximum borrowable amount. A tenth of the borrowed debt is then committed to a Transmuter redemption, and the block number is advanced by two.
Step 5: measure TVL before the liquidation
console.log("BEFORE LIQUIDATION:");
uint256 alchemistSharesBefore = IERC20(address(myt)).balanceOf(address(alchemist));
uint256 actualUnderlyingBefore = IVaultV2(address(myt)).convertToAssets(alchemistSharesBefore);
uint256 tvlBefore = alchemist.getTotalUnderlyingValue();
console.log(" Alchemist MYT shares:", alchemistSharesBefore);
console.log(" Actual underlying:", actualUnderlyingBefore);
console.log(" TVL reported:", tvlBefore);
console.log(" Match?", actualUnderlyingBefore == tvlBefore ? "YES" : "NO");
The script takes two independent readings: the contract's real MYT share balance converted to underlying, and the TVL the contract reports. The script prints whether the two agree before any liquidation.
Step 6: trigger the liquidation
alchemist.liquidate(tokenId);
This drives _doLiquidation(), which transfers MYT to the Transmuter and, if a fee applies, to the caller. With liquidatorFee set to zero in this deployment the fee branch is not exercised, but the main transfer at line 875 is.
Step 7: measure TVL after the liquidation and print the discrepancy
console.log("AFTER LIQUIDATION:");
uint256 alchemistSharesAfter = IERC20(address(myt)).balanceOf(address(alchemist));
uint256 actualUnderlyingAfter = IVaultV2(address(myt)).convertToAssets(alchemistSharesAfter);
uint256 tvlAfter = alchemist.getTotalUnderlyingValue();
console.log(" Alchemist MYT shares:", alchemistSharesAfter);
console.log(" Actual underlying:", actualUnderlyingAfter);
console.log(" TVL reported:", tvlAfter);
console.log(" Match?", actualUnderlyingAfter == tvlAfter ? "YES" : "NO");
console.log("BUG RESULT:");
if (tvlAfter > actualUnderlyingAfter) {
uint256 discrepancy = tvlAfter - actualUnderlyingAfter;
console.log(" TVL OVERSTATED by:", discrepancy);
console.log(" Percentage (bps):", (discrepancy * 10000) / actualUnderlyingAfter);
console.log(" Root cause: _mytSharesDeposited not decremented in liquidation");
} else {
console.log(" No discrepancy found");
}
The script prints the real balance, the reported TVL and, if the reported figure is higher, the absolute and basis-point size of the gap. The report does not include the console output of this run.
The report also gives a plain arithmetic walkthrough of the same effect:
- A user deposits 50,000 MYT shares, so
_mytSharesDeposited = 50,000. - The user borrows against the collateral and creates a Transmuter redemption.
- A liquidation occurs and
_forceRepay()transfers 50 MYT shares to the Transmuter. - The actual MYT balance is now 49,950 shares, correctly decreased.
_mytSharesDepositedis still 50,000 shares, incorrectly unchanged.- The TVL calculation is overstated by 50 shares.
- The process repeats with each liquidation, compounding the discrepancy.
Root cause
The contract maintains a cached counter of MYT shares held instead of reading the token balance when it needs TVL. Every path that moves MYT out has to update that cache, and two paths do not: _forceRepay() and _doLiquidation(). The counter is not updated, so the error only shows up later in the derived TVL figure. The report recommends adding a cross-check against IERC20(myt).balanceOf(address(this)) as a safeguard. The report does not describe any other defence that would have prevented it.
Impact
The report frames the impact as progressive operational degradation:
- Token fund shortage. The contract believes it holds more MYT than it does, so functions that need to move tokens can fail when the tokens are not there.
- Withdrawal failures. Users may be unable to withdraw when the perceived balance exceeds the real one.
- Liquidation system breakdown. Incorrect TVL feeds liquidation triggers and calculations.
- Risk management failure. Collateralization ratios become unreliable, preventing proper risk assessment.
- Protocol dysfunction. Core operations that depend on accurate token accounting begin to fail.
On quantification, the report states that each liquidation creates a permanent accounting gap equal to the liquidated amount, that the gap compounds with protocol usage (active protocols with frequent liquidations accumulate it faster), and that the effect is system-wide because TVL is a global calculation. It rates likelihood as high because the trigger is normal protocol operation, notes that the effects are permanent and accumulate, and says recovery requires protocol-level intervention. The report does not give a concrete loss figure or a worked example beyond the 50,000/50-share illustration above.
Fix
The report recommends three changes:
- In
_forceRepay(), add_mytSharesDeposited -= creditToYield;after the token transfer. - In
_doLiquidation(), add_mytSharesDeposited -= amountLiquidated;after both token transfers. - As an additional safeguard, add assertion checks verifying
_mytSharesDeposited == IERC20(myt).balanceOf(address(this))in critical functions.
Variants to test
- Other cached-balance counters. Look for any private variable that mirrors a token balance (deposits, shares, debt) and grep every transfer of that token out of the contract. A positive result is a transfer path with no matching decrement, and a derived value (TVL, exchange rate, cap) that reads only the counter.
- Fee branches. The PoC runs with
liquidatorFeeandprotocolFeeat zero. Re-run with non-zero fees to check whether the fee transfer at line 879 and the protocol fee paths keep the counter consistent; a positive result is a gap that grows by the fee amount as well as the liquidated amount. - Forced repayment path. Exercise
_forceRepay()directly rather than through liquidation, since the report names it as the second affected function. A positive result is the same divergence betweengetTotalUnderlyingValue()and the real balance after a forced repayment. - Repeated events. Loop liquidations and compare the reported TVL against the real balance after each one. A positive result is a monotonically widening gap rather than a one-off difference.
- Downstream consumers. Check
totalValue()and the collateralization maths for behaviour once TVL is overstated: caps, borrow limits and liquidation thresholds computed from the inflated figure. A positive result is a limit that lets a position borrow or survive beyond what the real balance supports.
Hunting notes
This class of bug hides in accounting caches: a contract that stores its own copy of a balance for gas or simplicity, then updates it in the common paths (deposit, withdraw, fee collection) and forgets the rarer ones (forced repayment, liquidation, emergency exits). During review, list every safeTransfer of the tracked token out of the contract and match each one against an update to the counter; the mismatch is usually a one-line omission in a function that is hard to reach in normal testing.
The signal in recon is a private variable that feeds a public view such as TVL or an exchange rate, combined with several transfer sites. If the view is used for caps, collateralization or liquidation thresholds, the omission becomes an impact rather than a rounding error.
The PoC builds a self-contained Foundry deployment, drives the protocol through deposit, mint to capacity, redemption and liquidation, and prints the real balance next to the reported TVL before and after the event, with the difference expressed in basis points. That side-by-side comparison, plus the explicit line references for the missing decrements, is what turns a code-reading observation into a reproducible High-severity finding.
What happened, in plain words
Alchemix V3 is a set of programs (smart contracts) that run on a blockchain. People put tokens into it, and the program keeps a running tally of how much it is holding. That tally is used to answer a simple question: "how much is this program worth right now?" The answer is called TVL, short for Total Value Locked.
The problem in this report is that the tally is not always updated. When the program sends some of its tokens out during two specific events (a forced repayment and a liquidation), it forgets to reduce the tally. The tokens really leave, but the tally still counts them. So the program starts to believe it holds more than it does. Every time one of those events happens, the gap gets bigger. Eventually the program may try to send tokens it no longer has, and operations may fail.
The researcher who found this wrote a small test program that sets up the whole system from scratch, triggers a liquidation, and prints the real balance next to the reported value. The report was submitted on 1 November 2025 in the Alchemix V3 audit competition on Immunefi and rated High severity, under the impact category "Smart contract unable to operate due to lack of token funds".
A few words before we go further, because the rest of the article uses them constantly:
- A smart contract is a program that lives on a blockchain. It runs automatically and anyone can call it. Think of a vending machine: it holds money and goods, and it follows fixed rules when you press a button.
- A token is a digital unit tracked by a contract. It is like a shop loyalty stamp: the contract keeps a list of who owns how many.
- A balance is simply how many tokens an address holds.
- A variable is a named storage slot inside a program.
_mytSharesDepositedis one such slot, and it is the heart of this story.
Context
AlchemistV3 is the main contract of the Alchemix V3 protocol. It does three jobs:
- It holds MYT shares on behalf of people who deposit them. MYT is itself a kind of receipt token: you give the protocol an underlying token, and you get MYT shares that represent your slice of the pool.
- It lets users mint a synthetic debt token against that collateral. "Synthetic" means the debt token is created by the protocol rather than borrowed from a bank; "collateral" means the deposit the protocol can take if you do not repay.
- It talks to a second contract called the Transmuter, which handles redemptions (swapping the debt token back for value over time).
Inside AlchemistV3 there is a private counter declared at line 134:
uint256 private _mytSharesDeposited;
Line by line: uint256 means an unsigned whole number (no negatives, no decimals). private means only code inside this contract can read or write it. _mytSharesDeposited is the name. The semicolon ends the statement. In plain terms: this is the contract's own notebook entry saying "I am holding this many MYT shares".
That notebook entry is the only input to the TVL calculation, a function called _getTotalUnderlyingValue() at lines 1238 to 1241:
function _getTotalUnderlyingValue() internal view returns (uint256 totalUnderlyingValue) {
uint256 yieldTokenTVLInUnderlying = convertYieldTokensToUnderlying(_mytSharesDeposited);
totalUnderlyingValue = yieldTokenTVLInUnderlying;
}
Line by line: function starts a function definition. _getTotalUnderlyingValue is its name. internal means only this contract and contracts derived from it can call it. view means it only reads data and does not change anything. returns (uint256 totalUnderlyingValue) declares that it hands back one number, named totalUnderlyingValue. Inside, the first line takes the notebook entry _mytSharesDeposited, passes it to a helper called convertYieldTokensToUnderlying (which turns shares into the value of the underlying token), and stores the result in yieldTokenTVLInUnderlying. The second line copies that into the return value. So the whole function is: "read the notebook, convert it, report it". It never looks at the real token balance.
That is the design decision that makes the bug possible. If the notebook is wrong, the reported TVL is wrong, and nothing in this function can notice.
Setup
The proof of concept is a Foundry script. Foundry is a toolkit for writing and running tests against smart contracts on your own machine, without touching a real blockchain. The script imports forge-std/Script.sol and forge-std/console.sol (helpers for running scripts and printing to the terminal) and is compiled with Solidity 0.8.28, the version of the programming language used.
Rather than connecting to a live network, the script builds the entire system from zero. That is a common and useful habit: a self-contained test is reproducible by anyone, and it removes any doubt about outside factors. The pieces it deploys are:
TestERC20as the underlying token, with a supply of1_000_000e18and 18 decimals. Thee18notation means "times ten to the power eighteen", the standard way tokens express fractions.VaultV2as the MYT vault, named "MYT" with symbol "MYT". A vault here is a contract that accepts deposits and issues shares.AlchemicTokenV3as the debt token, named "alUSD".Transmuter, set up withtimeToTransmute: 100, zero transmutation fee, zero exit fee andgraphSize: 1000.AlchemistV3behind aTransparentUpgradeableProxy. A proxy is a contract that forwards calls to another contract; it lets the team replace the logic later without changing the address users interact with. The collateral settingsminimumCollateralization,globalMinimumCollateralizationandcollateralizationLowerBoundare all2e18, andprotocolFee,liquidatorFeeandrepaymentFeeare all zero.AlchemistV3Positionas the position NFT, registered withsetAlchemistPositionNFT. An NFT here is just a unique identifier that proves who owns a particular borrowing position.
The deployer address is whoever runs the script, the protocol fee receiver is address(0x10) and the proxy owner is address(0x99). The debt token is told to trust the Alchemist contract with debtToken.setWhitelist(address(alchemist), true).
Finding it
The researcher did something very simple and very effective: they listed every place where MYT leaves the contract, and compared that list against every place where the notebook entry _mytSharesDeposited is updated. Most of the time the two lists line up:
deposit()increases the counter at line 383:_mytSharesDeposited += amount;withdraw()decreases it at line 410:_mytSharesDeposited -= amount;- protocol fee handling decreases it in several locations.
Two functions move MYT out without touching the counter. The first is _forceRepay() at line 779:
function _forceRepay(uint256 accountId, uint256 amount) internal returns (uint256) {
// ... calculation logic ...
TokenUtils.safeTransfer(myt, address(transmuter), creditToYield); // Transfers MYT out
// Missing: _mytSharesDeposited -= creditToYield;
return creditToYield;
}
Line by line: the function takes an accountId (which position) and an amount, is internal (only callable from inside), and returns a number. The comment marks where the real calculation lives, omitted for brevity. TokenUtils.safeTransfer(myt, address(transmuter), creditToYield) sends creditToYield units of the MYT token from this contract to the Transmuter. The next line is a comment showing what should have been there but is not: a subtraction from the notebook entry. Then the function returns creditToYield. The transfer is real; the notebook is untouched.
The second is _doLiquidation() at lines 875 and 879:
function _doLiquidation(uint256 accountId, uint256 collateralInUnderlying, uint256 repaidAmountInYield)
internal returns (uint256 amountLiquidated, uint256 feeInYield, uint256 feeInUnderlying)
{
// ... calculation logic ...
TokenUtils.safeTransfer(myt, transmuter, amountLiquidated - feeInYield); // Line 875
if (feeInYield > 0 && account.collateralBalance >= feeInYield) {
TokenUtils.safeTransfer(myt, msg.sender, feeInYield); // Line 879
}
// Missing: _mytSharesDeposited -= amountLiquidated;
}
Line by line: the function takes three inputs and returns three numbers (how much was liquidated, the fee in yield tokens, the fee in underlying tokens). The first transfer sends amountLiquidated - feeInYield MYT to the Transmuter. Then an if checks two conditions: the fee is greater than zero, and the account's collateral balance is at least the fee. If both hold, a second transfer sends feeInYield MYT to msg.sender, the address that called the function (the liquidator). The final comment shows the missing subtraction. Again, tokens leave, notebook stays.
In both cases the contract's real MYT balance falls while the counter stays where it was. Because _getTotalUnderlyingValue() reads only the counter, the reported TVL drifts above the truth, and the gap grows with every liquidation or forced repayment.
The report lays the chain out in four steps:
- The accounting discrepancy accumulates.
_getTotalUnderlyingValue()returns inflated values.- Dependent functions such as
totalValue()at line 1073 and the collateralization calculations consume that inflated figure. - Eventually operations that need real token transfers fail, because the contract believes it holds more than it does.
Exploitation
Step 1: deploy the tokens and the MYT vault
underlying = new TestERC20(1_000_000e18, 18);
myt = new VaultV2(deployer, address(underlying));
myt.setName("MYT");
myt.setSymbol("MYT");
IERC20(address(underlying)).approve(address(myt), type(uint256).max);
uint256 assets = 100_000e18;
myt.deposit(assets, deployer);
Line by line: the first line creates the underlying test token with one million units and 18 decimals. The second creates the MYT vault, owned by the deployer and backed by that underlying token. The next two lines give the vault a human-readable name and symbol. The approve line lets the vault move the deployer's underlying tokens without asking each time; type(uint256).max means "no limit". assets is set to 100,000 underlying. The last line deposits those 100,000 into the vault on behalf of the deployer, who receives the matching MYT shares.
Why this step: every later step needs tokens to exist and a vault to hold them. This is the foundation of the whole scenario.
Step 2: deploy the debt token, the Transmuter and the Alchemist
debtToken = new AlchemicTokenV3("alUSD", "alUSD", 0);
ITransmuter.TransmuterInitializationParams memory tparams = ITransmuter.TransmuterInitializationParams({
syntheticToken: address(debtToken),
feeReceiver: protocolFeeReceiver,
timeToTransmute: 100,
transmutationFee: 0,
exitFee: 0,
graphSize: 1000
});
transmuter = new Transmuter(tparams);
AlchemistV3 alchemistLogic = new AlchemistV3();
AlchemistInitializationParams memory params = AlchemistInitializationParams({
admin: deployer,
debtToken: address(debtToken),
underlyingToken: address(underlying),
depositCap: type(uint256).max,
minimumCollateralization: 2e18,
globalMinimumCollateralization: 2e18,
collateralizationLowerBound: 2e18,
transmuter: address(transmuter),
protocolFee: 0,
protocolFeeReceiver: protocolFeeReceiver,
liquidatorFee: 0,
repaymentFee: 0,
myt: address(myt)
});
bytes memory alchemParams = abi.encodeWithSelector(AlchemistV3.initialize.selector, params);
TransparentUpgradeableProxy proxyAlchemist = new TransparentUpgradeableProxy(address(alchemistLogic), proxyOwner, alchemParams);
alchemist = AlchemistV3(address(proxyAlchemist));
Line by line: the first line creates the debt token with the name and symbol "alUSD". The next block builds a settings object for the Transmuter: which token it deals in, where fees go, how long a redemption takes (timeToTransmute: 100), zero fees, and a graph size of 1000 (an internal parameter for how redemptions are matched). The Transmuter is then created with those settings.
Then the Alchemist logic contract is created. A settings object is filled in: the admin is the deployer, the debt token and underlying token are the ones just made, the deposit cap is unlimited, the three collateralization settings are all 2e18 (meaning a position must be backed at least two to one), all three fees are zero, and the MYT vault is the one from step 1. abi.encodeWithSelector packs the function name initialize and those settings into a byte string, which is the format a proxy expects. The proxy is created with the logic address, the proxy owner, and that packed call. Finally the alchemist variable is pointed at the proxy address.
Why this step: the Alchemist is the contract under test, and it needs a debt token, a Transmuter and a vault to function.
Step 3: register the position NFT and open a position
positionNFT = new AlchemistV3Position(address(alchemist));
alchemist.setAlchemistPositionNFT(address(positionNFT));
debtToken.setWhitelist(address(alchemist), true);
IERC20(address(myt)).approve(address(alchemist), type(uint256).max);
uint256 sharesToDeposit = IERC20(address(myt)).balanceOf(deployer) / 2;
alchemist.deposit(sharesToDeposit, deployer, 0);
uint256 tokenId = 1;
Line by line: the position NFT contract is created and registered with the Alchemist, so each borrowing position gets a unique identifier. The debt token is told to trust the Alchemist. The deployer approves the Alchemist to move their MYT shares without limit. sharesToDeposit is set to half of the deployer's MYT balance. The deposit call puts those shares into the Alchemist on the deployer's behalf. tokenId = 1 is the identifier of the position that was just created.
Why this step: this deposit is the event that increases _mytSharesDeposited. Without a deposit there is nothing for the notebook to be wrong about.
Step 4: borrow to capacity and create a redemption
uint256 capacity = alchemist.getMaxBorrowable(tokenId);
alchemist.mint(tokenId, capacity, deployer);
IERC20(address(debtToken)).approve(address(transmuter), capacity);
transmuter.setAlchemist(address(alchemist));
transmuter.setDepositCap(uint256(type(int256).max));
uint256 redemptionAmount = capacity / 10;
transmuter.createRedemption(redemptionAmount);
vm.roll(block.number + 2);
Line by line: getMaxBorrowable asks the Alchemist how much debt this position can take on. mint creates exactly that much debt token for the deployer, which pushes the position right to its collateralization limit. The deployer then approves the Transmuter to move that debt token. The Transmuter is pointed at the Alchemist and given a very large deposit cap. redemptionAmount is one tenth of the borrowed amount, and createRedemption commits that tenth to a redemption. Finally vm.roll(block.number + 2) advances the simulated blockchain by two blocks.
Why this step: minting to the maximum borrowable amount is part of the scenario. The redemption gives the Transmuter a reason to be involved. The block roll is part of setting up the scenario.
Step 5: measure TVL before the liquidation
console.log("BEFORE LIQUIDATION:");
uint256 alchemistSharesBefore = IERC20(address(myt)).balanceOf(address(alchemist));
uint256 actualUnderlyingBefore = IVaultV2(address(myt)).convertToAssets(alchemistSharesBefore);
uint256 tvlBefore = alchemist.getTotalUnderlyingValue();
console.log(" Alchemist MYT shares:", alchemistSharesBefore);
console.log(" Actual underlying:", actualUnderlyingBefore);
console.log(" TVL reported:", tvlBefore);
console.log(" Match?", actualUnderlyingBefore == tvlBefore ? "YES" : "NO");
Line by line: the first line prints a heading. The second reads the contract's real MYT share balance straight from the token contract. The third converts that share count into the value of the underlying token. The fourth asks the Alchemist for its own reported TVL. The next three lines print all three numbers. The last line compares the real value with the reported value and prints YES or NO.
Why this step: this is the control measurement, taken before any liquidation. Taking a baseline is what makes the later difference meaningful; without it you cannot say whether a gap existed all along or was created by the event.
Step 6: trigger the liquidation
console.log("TRIGGERING LIQUIDATION...");
alchemist.liquidate(tokenId);
Line by line: the first line prints a message so the output is readable. The second calls liquidate on the position, which runs _doLiquidation() inside the contract.
Why this step: this is the event that moves MYT out of the contract. Inside _doLiquidation(), MYT goes to the Transmuter and, if a fee applies, to the caller. In this deployment liquidatorFee is zero, so the fee branch is not exercised, but the main transfer at line 875 is.
Step 7: measure TVL after the liquidation and print the discrepancy
console.log("AFTER LIQUIDATION:");
uint256 alchemistSharesAfter = IERC20(address(myt)).balanceOf(address(alchemist));
uint256 actualUnderlyingAfter = IVaultV2(address(myt)).convertToAssets(alchemistSharesAfter);
uint256 tvlAfter = alchemist.getTotalUnderlyingValue();
console.log(" Alchemist MYT shares:", alchemistSharesAfter);
console.log(" Actual underlying:", actualUnderlyingAfter);
console.log(" TVL reported:", tvlAfter);
console.log(" Match?", actualUnderlyingAfter == tvlAfter ? "YES" : "NO");
console.log("BUG RESULT:");
if (tvlAfter > actualUnderlyingAfter) {
uint256 discrepancy = tvlAfter - actualUnderlyingAfter;
console.log(" TVL OVERSTATED by:", discrepancy);
console.log(" Percentage (bps):", (discrepancy * 10000) / actualUnderlyingAfter);
console.log(" Root cause: _mytSharesDeposited not decremented in liquidation");
} else {
console.log(" No discrepancy found");
}
Line by line: the first block repeats the same three readings as step 5, now after the liquidation, and prints them with the same YES/NO comparison. The second block checks whether the reported TVL is now greater than the real value. If it is, it computes the difference, prints it, converts it to basis points (a basis point is one hundredth of a percent, so 10000 basis points make 100 percent) by multiplying by 10000 and dividing by the real value, and prints the root cause. If not, it prints that no discrepancy was found.
Why this step: this is the proof. The same two measurements, taken before and after one event, show whether the event broke the accounting. Expressing the gap in basis points makes it comparable across different sizes of position.
The report does not include the console output of this run.
The report also gives a plain arithmetic walkthrough of the same effect:
- A user deposits 50,000 MYT shares, so
_mytSharesDeposited = 50,000. - The user borrows against the collateral and creates a Transmuter redemption.
- A liquidation occurs and
_forceRepay()transfers 50 MYT shares to the Transmuter. - The actual MYT balance is now 49,950 shares, correctly decreased.
_mytSharesDepositedis still 50,000 shares, incorrectly unchanged.- The TVL calculation is overstated by 50 shares.
- The process repeats with each liquidation, compounding the discrepancy.
Root cause
The contract keeps a cached counter of MYT shares held instead of reading the token balance when it needs TVL. "Cached" means a stored copy kept for convenience, like writing your bank balance on a sticky note instead of checking the app each time. Every path that moves MYT out has to update that cache, and two paths do not: _forceRepay() and _doLiquidation().
The counter is not updated, so the mistake only shows up later in the derived TVL figure. The mistake is silent and only shows up later in the derived TVL figure. The report recommends adding a cross-check against IERC20(myt).balanceOf(address(this)) as a safeguard. A cross-check is simply asking the token contract "how much do you say I have?" and comparing it with the notebook. The report does not describe any other defence that would have prevented it.
Impact
The report frames the impact as progressive operational degradation, meaning the system gets worse over time rather than breaking all at once:
- Token fund shortage. The contract believes it holds more MYT than it does, so functions that need to move tokens can fail when the tokens are not there.
- Withdrawal failures. Users may be unable to withdraw when the perceived balance exceeds the real one.
- Liquidation system breakdown. Incorrect TVL feeds liquidation triggers and calculations.
- Risk management failure. Collateralization ratios become unreliable, preventing proper risk assessment.
- Protocol dysfunction. Core operations that depend on accurate token accounting begin to fail.
On quantification, the report states that each liquidation creates a permanent accounting gap equal to the liquidated amount, that the gap compounds with protocol usage (active protocols with frequent liquidations accumulate it faster), and that the effect is system-wide because TVL is a global calculation. It rates likelihood as high because the trigger is normal protocol operation, notes that the effects are permanent and accumulate, and says recovery requires protocol-level intervention. The report does not give a concrete loss figure or a worked example beyond the 50,000/50-share illustration above.
Fix
The report recommends three changes:
- In
_forceRepay(), add_mytSharesDeposited -= creditToYield;after the token transfer. - In
_doLiquidation(), add_mytSharesDeposited -= amountLiquidated;after both token transfers. - As an additional safeguard, add assertion checks verifying
_mytSharesDeposited == IERC20(myt).balanceOf(address(this))in critical functions. An assertion is a check that stops the program if something that should always be true is not.
Variants to test
These are directions for anyone hunting for similar bugs elsewhere. Each one describes what to look for and what a positive result would look like.
- Other cached-balance counters. Look for any private variable that mirrors a token balance (deposits, shares, debt) and search every transfer of that token out of the contract. A positive result is a transfer path with no matching decrement, and a derived value (TVL, exchange rate, cap) that reads only the counter.
- Fee branches. The PoC runs with
liquidatorFeeandprotocolFeeat zero. Re-run with non-zero fees to check whether the fee transfer at line 879 and the protocol fee paths keep the counter consistent; a positive result is a gap that grows by the fee amount as well as the liquidated amount. - Forced repayment path. Exercise
_forceRepay()directly rather than through liquidation, since the report names it as the second affected function. A positive result is the same divergence betweengetTotalUnderlyingValue()and the real balance after a forced repayment. - Repeated events. Loop liquidations and compare the reported TVL against the real balance after each one. A positive result is a monotonically widening gap rather than a one-off difference.
- Downstream consumers. Check
totalValue()and the collateralization maths for behaviour once TVL is overstated: caps, borrow limits and liquidation thresholds computed from the inflated figure. A positive result is a limit that lets a position borrow or survive beyond what the real balance supports.
Hunting notes
This class of bug hides in accounting caches: a contract that stores its own copy of a balance for gas or simplicity, then updates it in the common paths (deposit, withdraw, fee collection) and forgets the rarer ones (forced repayment, liquidation, emergency exits). During review, list every safeTransfer of the tracked token out of the contract and match each one against an update to the counter; the mismatch is usually a one-line omission in a function that is hard to reach in normal testing.
The signal in recon is a private variable that feeds a public view such as TVL or an exchange rate, combined with several transfer sites. If the view is used for caps, collateralization or liquidation thresholds, the omission becomes an impact rather than a rounding error.
The PoC builds a self-contained Foundry deployment, drives the protocol through deposit, mint to capacity, redemption and liquidation, and prints the real balance next to the reported TVL before and after the event, with the difference expressed in basis points. That side-by-side comparison, plus the explicit line references for the missing decrements, is what turns a code-reading observation into a reproducible High-severity finding.
Glossary
- Smart contract: a program stored and run on a blockchain that executes fixed rules automatically.
- Blockchain: a shared, append-only record of transactions maintained by many computers.
- Token: a digital unit tracked by a smart contract, with a balance per address.
- Balance: the number of tokens a particular address holds.
- Variable: a named storage slot inside a program that holds a value.
- uint256: an unsigned whole number in Solidity, with no negatives and no decimals.
- Private: a visibility keyword meaning only code inside the same contract can access the item.
- Internal: a visibility keyword meaning only the contract and contracts derived from it can call the function.
- View: a function modifier meaning the function only reads state and changes nothing.
- Function: a named block of code that takes inputs and may return outputs.
- TVL (Total Value Locked): the total value of assets a protocol is holding, usually expressed in the underlying token.
- MYT: the vault share token in this protocol, representing a slice of a pool of underlying tokens.
- Underlying token: the base token that a vault accepts and that shares are measured against.
- Vault: a contract that accepts deposits and issues shares representing ownership of the pool.
- Synthetic debt token: a token created by the protocol to represent debt, rather than borrowed from an external lender.
- Collateral: assets deposited to back a loan, which the protocol can seize if the loan is not repaid.
- Collateralization ratio: how much collateral backs a given amount of debt, for example two to one.
- Liquidation: the process of closing a position that has fallen below the required collateral ratio.
- Transmuter: the contract in this protocol that handles redemptions of the debt token.
- Redemption: exchanging the debt token for value over a period of time.
- Proxy (TransparentUpgradeableProxy): a contract that forwards calls to a separate logic contract, allowing the logic to be replaced without changing the address.
- NFT (position NFT): a unique token that identifies ownership of a specific position.
- Whitelist: a list of addresses that a contract is allowed to interact with.
- Approve: a token operation granting another address permission to move your tokens.
- Mint: creating new tokens.
- Deposit: placing tokens into a contract in exchange for shares or credit.
- Withdraw: taking tokens back out of a contract.
- Forced repayment (
_forceRepay): a repayment path that moves MYT out of the contract without the normal withdrawal flow. - Liquidation function (
_doLiquidation): the internal function that carries out a liquidation and transfers MYT out. - safeTransfer: a token helper that moves tokens and checks the call succeeded.
- msg.sender: the address that called the current function.
- Revert: cancelling a transaction and undoing its changes, usually because a check failed.
- Assertion: a check that stops execution if a condition that should always hold does not.
- Cache / cached counter: a stored copy of a value kept for convenience instead of recomputing it each time.
- Accounting discrepancy: a difference between what a contract records and what it actually holds.
- Basis point (bps): one hundredth of a percent; 10000 basis points equal 100 percent.
- Foundry: a toolkit for writing and running smart contract tests and scripts locally.
- Solidity: the programming language used to write the contracts in this report.
- forge-std: a library of helpers for Foundry scripts and tests.
- console.log: a Foundry helper that prints values to the terminal during a script run.
- e18 notation: shorthand for multiplying by ten to the power eighteen, used to express token amounts with 18 decimals.
- Block: a bundle of transactions added to the blockchain at once;
vm.rolladvances the simulated block number. - Proof of concept (PoC): a small program that demonstrates a bug actually happens.
- Severity: the rating given to a finding, here High, reflecting how serious the impact is.
- Immunefi: the bug bounty platform where this report was submitted.
- Audit competition: a time-limited event where researchers review a project's code and submit findings for review.