Security Audit
November 11th, 2025
Version 1.0.0
Presented by 0xMacro
This document includes the results of the security audit for Superstate's smart contract code as found in the section titled ‘Source Code’. The security audit was performed by the Macro security team from October 28th to October 31st, 2025.
The purpose of this audit is to review the source code of certain Superstate Solidity contracts, and provide feedback on the design, architecture, and quality of the source code with an emphasis on validating the correctness and security of the software in its entirety.
Disclaimer: While Macro’s review is comprehensive and has surfaced some changes that should be made to the source code, this audit should not solely be relied upon for security, as no single audit is guaranteed to catch all possible bugs.
The following is an aggregation of issues found by the Macro Audit team:
| Severity | Count | Acknowledged | Won't Do | Addressed |
|---|---|---|---|---|
| Low | 3 | 2 | - | 1 |
| Code Quality | 4 | - | - | 4 |
| Informational | 2 | - | - | - |
Superstate was quick to respond to these issues.
Our understanding of the specification was based on the following sources:
The following source code was reviewed during the audit:
c6b0158256f85f3e6fb845e27235af58cb7f1c78
a41fc6ff8def3cdd44e33b8cb54812ca43308fe0
Specifically, we audited the following contracts:
| Source Code | SHA256 |
|---|---|
| evm/protocol/dip/src/Dip.sol |
|
| evm/protocol/token/src/Dippable.sol |
|
| evm/protocol/token/src/EquityToken.sol |
|
Note: This document contains an audit solely of the Solidity contracts listed above. Specifically, the audit pertains only to the contracts themselves, and does not pertain to any other programs or scripts, including deployment scripts.
Click on an issue to jump to it, or scroll down to see them all.
We quantify issues in three parts:
This third part – the severity level – is a summary of how much consideration the client should give to fixing the issue. We assign severity according to the table of guidelines below:
| Severity | Description |
|---|---|
|
(C-x) Critical |
We recommend the client must fix the issue, no matter what, because not fixing would mean significant funds/assets WILL be lost. |
|
(H-x) High |
We recommend the client must address the issue, no matter what, because not fixing would be very bad, or some funds/assets will be lost, or the code’s behavior is against the provided spec. |
|
(M-x) Medium |
We recommend the client to seriously consider fixing the issue, as the implications of not fixing the issue are severe enough to impact the project significantly, albiet not in an existential manner. |
|
(L-x) Low |
The risk is small, unlikely, or may not relevant to the project in a meaningful way. Whether or not the project wants to develop a fix is up to the goals and needs of the project. |
|
(Q-x) Code Quality |
The issue identified does not pose any obvious risk, but fixing could improve overall code quality, on-chain composability, developer ergonomics, or even certain aspects of protocol design. |
|
(I-x) Informational |
Warnings and things to keep in mind when operating the protocol. No immediate action required. |
|
(G-x) Gas Optimizations |
The presented optimization suggestion would save an amount of gas significant enough, in our opinion, to be worth the development cost of implementing it. |
In the Dip.sol contract, important state changes through config update performed by the admin, may change or break core invariants of the corresponding market in Active state. For example, by changing unexpectedly discount rate buyers may receive less than the anticipated assets in return. Also by changing totalPaymentTarget to be less than the totalPaymentReceived no additional purchases will be possible through the buyTheDip() function, but market will remain in Active state.
Remediations to consider
Expected behavior, acknowledged. Changes will be announced ahead of time, and validation/scheduling will be decided and set off-chain
In the Dip.sol, oracle latency tolerance is configured through the uint8 config variable oracleLatencyToleranceInSeconds, which defines latency tolerance in seconds resulting in a valid range of 1-255 seconds (max ~4 minutes).
This range is potentially too restrictive operationally for some of the price feeds and this may cause unnecessary reverts. Consider using uint32 or uint64 instead.
Non-issue, validation and proper config will be decided and set off-chain.
In the Dip.sol contract, in specific situation when payment token decimals value is smaller than the value of the constant PAYMENT_TOKEN_DECIMALS set during contract deployment, contract functionality may malfunction. This will cause instrument tokens to be minted in exchange for 0 payment amount due to the loss of precision error in calculations.
In the Dip.sol contract, _calculateOutput() is responsible for performing the most important calculations related to the issuance of instrument assets under discounted rates.
uint8 instrumentDecimals = uint8(IERC20Metadata(address(market.instrument)).decimals());
instrumentAmount = _calculateInstrumentAmount(
normPaymentAmount, PAYMENT_TOKEN_DECIMALS, discountedPrice, priceDecimals, instrumentDecimals
);
actualPaymentAmount = changeDecimals(normPaymentAmount, PAYMENT_TOKEN_DECIMALS, paymentDecimals);
In the case, when payment token decimals is smaller than the PAYMENT_TOKEN_DECIMALS normalizedPaymentAmount will get truncated during conversion from PAYMENT_TOKEN_DECIMALS to the actual payment token decimals. This will cause actualPaymentAmount to have smaller value than expected and in specific cases to be 0.
Since in the Dippable.sol, return value of actualPaymentAmount is used to determine how much to charge buyer for the issued amount of instrument, it will result in underpayment in this scenario.
function buyTheDip(bytes32 marketId, uint256 paymentAmount, uint256 minOutAmount, IERC20 paymentToken)
external
virtual
{
...
// Call DIP contract with buyer address and payment token
// DIP validates market state, pricing, and returns actual amounts
(uint256 actualPaymentAmount, uint256 instrumentAmount, address paymentRecipient) =
IDip(dip).buyTheDip(marketId, msg.sender, paymentAmount, paymentToken);
// Validate slippage protection
if (instrumentAmount < minOutAmount) revert InsufficientOutput(instrumentAmount, minOutAmount);
// Transfer payment from buyer to recipient
paymentToken.safeTransferFrom(msg.sender, paymentRecipient, actualPaymentAmount);
// Mint instrument tokens to buyer
_mint(msg.sender, instrumentAmount);
// Note: DIP contract emits the Purchase event for tracking
}
Remediations to consider
PAYMENT_TOKEN_DECIMALS value, ornormalizedPaymentAmount is not divisible by the scaling factor.Within the project scope multiple versions of OpenZeppelin are used. In the case of Dip.sol contract 2 versions of OpenZeppelin are used within the same contract. (both v5.0.2 and v5.1.0).
In EquityToken.sol contract, OZ’s v4 SafeERC20 library is used, while in in Dippable.sol OZ’s v5 is used.
Consider updating implementation across the project in scope to use a single OZ library version.
In the Dip.sol following public methods are present which are not feature in the IDip.sol interface.
// setters
setPriceOracle(address)
initialize(address)
// Public getters (auto-generated)
priceOracle()
markets(bytes32)
// public constants
BASIS_POINTS()
PRICE_CLAMP_DECIMALS()
PAYMENT_TOKEN_DECIMALS()
Consider adding them to the IDip.sol.
In the EquityToken.sol
The following import seems unused and can be removed
import {IERC20 as IERC20V5} from "openzeppelin-contracts-v5.0.2/contracts/token/ERC20/IERC20.sol";
In the Dip.sol
DiscountedPriceZero error is unreachable. Given price > 0 and discountRate < 10000, both factors price and BASIS_POINTS - discountRate are non zero, as a result mulDivUp() won’t yield zero.
uint256 price = uint256(int256(pythPrice.price)); // Safe: already validated price > 0
...
discountedPrice = FixedPointMathLib.mulDivUp(price, BASIS_POINTS - market.discountRate, BASIS_POINTS);
if (discountedPrice == 0) revert DiscountedPriceZero();
Consider removing this unnecessary code.
In the Dip.sol
createMarket() docs claim oracle address validation, but implementation doesn’t ensure a non-zero priceOracle
oraclePriceFeedId is checked and priceOracle is global (could be zero unless set via setPriceOracle).priceOracle != address(0) in createMarket or update NatSpec to clarify requirement to set it beforehand.Integration doc in header omits the buyer parameter Dip.sol Lines 33-41
// Call buyTheDip(marketId, paymentAmount, paymentToken) - only callable by active market's instrument
function buyTheDip(bytes32 marketId, address buyer, uint256 paymentAmount, IERC20 paymentToken)
Update docs to include buyer.
Comment about clearing currentMarketForInstrument, lists only Paused/Cancelled, but code also clears on Closed
* Leaving Active State:
* - Clears currentMarketForInstrument[instrument] = bytes32(0)
* - Allows other markets for same instrument to become active
* - Applies to: Active → Paused, Active → Cancelled <=== here
*
* Entering Active State:
* - Validates no other market is currently active (AlreadyCurrentMarket)
* - Sets currentMarketForInstrument[instrument] = marketId
* - Applies to: Initialized → Active, Paused → Active
Docs should include Active → Closed.
calculateOutput() natspec refers to non existing _calculateOutputNormalized() function.
natspec for markets variable incorrectly refers to 12 fields of Market struct, while it actually has 14 fields
/// @dev Auto-generates getter that returns all 12 fields as tuple
In the Dippable.sol
In the natspec for buyTheDip() function, consider clarifying that payment transfer is performed by the instrument, not DIP.
/**
* @notice Purchases tokens through a DIP market with oracle-based discounted pricing
* @dev Validates inputs, processes payment through DIP contract, and mints tokens to buyer
* @param marketId The DIP market identifier
* @param paymentAmount The amount of payment token to spend
* @param minOutAmount The minimum amount of tokens to receive (slippage protection)
* @param paymentToken The token to use for payment (must match market's payment token)
*/
The must expression in the following statement is misleading
3. _requireNotAccountingPaused() must be implemented by the inheriting contract
Since, this function has a default empty body, inheritors are not forced to override it. In EquityToken it is overridden correctly, but other inheritors could omit it and bypass the pause check. Consider updating must to should, or remove empty function body to require inheritors to implement it.
In the EquityToken.sol
adminBurn().Admin can mint() / bulkMint() / burn() tokens
Contract owner may mint() / bulkMint() / burn() any tokens and circumvent buyTheDip() execution flow.
Admin can hot-swap DIP contract
Dippable.setDipContract() is owner-only but has no delay/guard. This is an admin risk; consider using a timelock.
The contracts in the project’s scope do not support fee-on-transfer payment tokens.
Macro makes no warranties, either express, implied, statutory, or otherwise, with respect to the services or deliverables provided in this report, and Macro specifically disclaims all implied warranties of merchantability, fitness for a particular purpose, noninfringement and those arising from a course of dealing, usage or trade with respect thereto, and all such warranties are hereby excluded to the fullest extent permitted by law.
Macro will not be liable for any lost profits, business, contracts, revenue, goodwill, production, anticipated savings, loss of data, or costs of procurement of substitute goods or services or for any claim or demand by any other party. In no event will Macro be liable for consequential, incidental, special, indirect, or exemplary damages arising out of this agreement or any work statement, however caused and (to the fullest extent permitted by law) under any theory of liability (including negligence), even if Macro has been advised of the possibility of such damages.
The scope of this report and review is limited to a review of only the code presented by the Superstate team and only the source code Macro notes as being within the scope of Macro’s review within this report. This report does not include an audit of the deployment scripts used to deploy the Solidity contracts in the repository corresponding to this audit. Specifically, for the avoidance of doubt, this report does not constitute investment advice, is not intended to be relied upon as investment advice, is not an endorsement of this project or team, and it is not a guarantee as to the absolute security of the project. In this report you may through hypertext or other computer links, gain access to websites operated by persons other than Macro. Such hyperlinks are provided for your reference and convenience only, and are the exclusive responsibility of such websites’ owners. You agree that Macro is not responsible for the content or operation of such websites, and that Macro shall have no liability to your or any other person or entity for the use of third party websites. Macro assumes no responsibility for the use of third party software and shall have no liability whatsoever to any person or entity for the accuracy or completeness of any outcome generated by such software.