31Third

QuantstampFiles named in the report

Quantstamp reviewed 31Third on 1 Mar 2023: 15 findings, 0 critical; 9 marked fixed, 4 acknowledged, 2 open.

No open critical findings
Open the reportOpen 31Third’s security record

Report hosted on certificate.quantstamp.com.

Trustblock does not review code.

Findings15

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical000
High001
Medium002
Low246
LowDeflationary Tokens Are Not SupportedAcknowledged

Some tokens can implement hooks or fee systems that get executed when transferred. That means that the amount pulled by the smart contract (calling `transferFrom()`) and the actual amount increased to the balance are not the same. Handling the accounting of these tokens can be complex and can lead to unexpected behavior. <br><br> 31Third is not compatible with these tokens. This is a usual approach in many major DeFi protocols by design and not a security issue. <br><br> In `_claimAndApproveFromToken()` the following condition is checked following the transfer of funds from the caller: ``` if (fromBalanceAfter < fromBalanceBefore + _trade.fromAmount) { revert NotEnoughClaimed(_trade, _trade.fromAmount, fromBalanceAfter - fromBalanceBefore); } ``` If a token was being used that takes a fee on transfer, the trade would always revert.

LowNo Lower Bound for `maxFeeBasisPoints`Acknowledged

The `reduceMaxBasisPoints()` allows the maximum fee to be set to a lower value. It is important to note that once the maximum fee limit is reduced, it cannot be raised again. If for some reason, the maximum fee was set to zero, it would be impossible to charge fees for trades.

LowPrivileged Roles and OwnershipAcknowledged

Smart contracts will often have `owner` variables to designate the person with special privileges to make modifications to the smart contract. <br><br> In the case where a malicious actor obtains control of the owner's wallet, privileged functionality can be exploited in a way that harms future users. Specifically, a malicious actor could call `ExchangeAdapterRegistry.editAdapter()` to change the adapter address to a malicious contract for a previously established exchange. After the exchange adapter is updated, users that call `BatchTrade.batchTrade()` using the now compromised exchange adapter are subject to having their funds stolen by the malicious adapter contract. The following are all other cases of owner privileges: - `BatchTrade.activate()` and `BatchTrade.deactivate()` allows the owner to start/stop trading. - `BatchTrade.addFeelessWallet()`, `BatchTrade.addFeelessWallets()`, `BatchTrade.removeFeelessWallet()`, and `BatchTrade.removeFeelessWallets()` allows the owner to add or remove wallets that can trade without paying fees. - `BatchTrade.updateFeeRecipient()`, `BatchTrade.updateBasisPoints()`, and `BatchTrade.reduceMaxBasisPoints()` allows the owner to update the trade fee and the fee recipient.

LowUnchecked Return Data Received From ExchangeAcknowledged

The `BatchTrade.batchTrade()` function allows a user to pass in arbitrary call data to be executed on an exchange contract. The function invoked on the exchange contract may return data which is collected as shown below: ``` (bool targetSuccess, bytes memory result) = _target.call{value: _value}( _data ); ``` However, no validation is done on the `result` data obtained. The only action taken is to log the data in an event upon trade failure: `emit TradeFailedReason(**msg.sender**, _trade.from, _trade.to, result);`. Depending on the data returned from the exchange, it may be worth performing validation checks upon the return data. This validation would be specific to the exchange, and so would likely belong on the appropriate adapter contract.

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (5)

  • contracts/trading/ExchangeAdapterRegistry.sol
  • contracts/trading/IExchangeAdapter.sol
  • contracts/trading/adapter/WETHAdapter.sol
  • contracts/trading/BatchTrade.sol
  • contracts/trading/adapter/ZeroExExchangeAdapter.sol

Part of 31Third’s security record

31Third
Audits2 audits by 1 firmLast audit Apr 2024, by Quantstamp.
Critical findingsNo open critical findingsAcross 2 reports.
Open 31Third’s security record

Security firm

Quantstamp

236 projects reviewed · 332 reports · latest Oct 2026

See Quantstamp’s audits

Something wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.

Tell us