ClayStack

QuantstampFiles named in the report

Quantstamp reviewed ClayStack on 26 Sep 2022: 12 findings, 0 critical; 6 marked fixed, 6 acknowledged.

No open critical findings
Open the reportOpen ClayStack’s security record

Report hosted on certificate.quantstamp.com.

Trustblock does not review code.

Findings12

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

SeverityOpenAcknowledgedFixed
Critical000
High000
Medium000
Low066
LowMissing InitializersFixed

`ClayManager` is missing a call to `__UUPSUpgradeable_init()` in the `initialize()` function. Though the function may be empty, it is important to call the initializer in case this changes in future version upgrades.

LowMissing Input ValidationFixed

Some functions do not validate their inputs, which can result in unexpected behavior by the contracts. A non-exhaustive list includes: * `ClayManager.initialize()`: Validate that `_csToken` is a non-zero address. * `ClayManager._claim()`: Validate that `claimVault` is a non-zero address. * `ClayManager.earlyClaim()`: * Validate that order exists. * Validate that `claimVault` is a non-zero address. * Validate that the order cannot be claimed through ordinary means.

LowPrivileged Roles and OwnershipFixed

Certain contracts have state variables, e.g. `TIMELOCK_UPGRADES_ROLE`, which provide certain addresses with privileged roles. Such roles may pose a risk to end-users. The `ClayManager` contract contains the following privileged roles: * `onlyProxy` modifier-guarded functions * `initialize()` -- initialize the contract's variables post-deployment. * `upgradeTo()` -- upgrade the implementation of the proxy to a new contract. * `onlyRole(CS_SERVICE_ROLE)` modifier-guarded functions * `setBridgeFee()` -- set the fee to manually trigger the bridge by user in matic * `setBridgeRequirements()` -- set the days and amounts required for bridge transfers * `setMinClaimDays()` -- set the minimum number of days to claim tokens when netted locally * `pause()` -- pause the contract * `unpause()` -- unpause the contract * `onlyRole(TIMELOCK_UPGRADES_ROLE)` modifier-guarded functions * `setTreasury()` -- set the treasury wallet * `setClaimVault()` -- set the vault to which MATIC tokens will be sent * `upgradeTo()` -- upgrade the implementation of the proxy * `_authorizeUpgrade()` -- require a certain sender to be used (when upgrading the implementation) The `CsToken` contract contains the following privileged roles: * `onlyClayMain` modifier-guarded functions * `mint()` -- mints tokens to an address, increasing the total supply * `burn()` -- burn an amount of tokens from an address, reducing the total supply The `UserProxy` contract contains the following privileged roles: * `onlyProxy` modifier-guarded functions * `initialize()` -- initialize the contract's variables post-deployment. * `upgradeTo()` -- upgrade the implementation of the proxy to a new contract. * `onlyRole(TIMELOCK_ROLE)` modifier-guarded functions * `processInsurance()` -- process insurance towards ClayMatic donation and fees * `onlyRole(TIMELOCK_UPGRADES_ROLE)` modifier-guarded functions * `setClaimVault()` -- sets the vault to which matic tokens will be sent * `setTreasury()` -- set the treasury wallet * `upgradeTo()` -- upgrade the implementation of the proxy * `_authorizeUpgrade()` -- require a certain sender to be used (when upgrading the implementation) * `onlyRole(CS_SERVICE_ROLE)` modifier-guarded functions * `pause()` -- pause the contract * `unpause()` -- unpause the contract The `ClaimVault` contract contains the following privileged roles: * `claimFunds()` requires the sender to be `clayManager`.

LowReliance on `fxRootTunnel` to Be Working as ExpectedFixed

The `ClayManager` contract is responsible for completing the process of a batch order that is specified by `batchID` in polygon, using `ClayManager._processMessageFromRoot()`. This function is designed and expected to be called only once. However, these functions have no protection against replay attacks. Though `_processMessageFromRoot()` prevents the same `_stateId` from being used twice, it does not prevent the same `_batchId` from being passed into `_registerClaimProceeded()`. `_registerClaimProceeded()` being executed more than once for a `_batchId` is an unexpected condition and could cause negative consequences to the platform.

LowUnchecked Return ValueFixed

Most functions will return a `true` or `false` value upon success. It is important to ensure that every necessary function is checked. `UserProxy.deposit()` does not check the return value of its call to `clayMatic.deposit(amount)`.

LowUnlocked PragmaFixed

Every Solidity file specifies in the header a version number of the format `pragma solidity (^)0.8.*`. The caret (`^`) before the version number implies an unlocked pragma, meaning that the compiler will use the specified version _and above_, hence the term "unlocked".

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 (25)

  • src/lib/Merkle.sol
  • src/interfaces/IDepositManager.sol
  • src/lib/ExitPayloadReader.sol
  • src/TimeLock.sol
  • src/interfaces/IClayBase.sol
  • src/RoleManager.sol
  • src/tunnel/FxBaseRootTunnel.sol
  • src/tunnel/FxBaseChildTunnel.sol
  • src/lib/RLPReader.sol
  • src/interfaces/IRoleManager.sol
  • src/interfaces/IClaimVault.sol
  • src/interfaces/IChildToken.sol
  • src/interfaces/IERC20Predicate.sol
  • src/interfaces/IClayMain.sol
  • src/interfaces/IRootChainManager.sol
  • src/UserProxy.sol
  • src/interfaces/IClayTunnel.sol
  • src/ClaimVault.sol
  • src/interfaces/IClayManager.sol
  • src/CsToken.sol
  • src/interfaces/IWETH9.sol
  • src/lib/MerklePatriciaProof.sol
  • src/interfaces/ICSToken.sol
  • src/interfaces/IFxRoot.sol
  • src/ClayManager.sol

Part of ClayStack’s security record

ClayStack
Audits4 audits by 3 firmsLast audit Jan 2024, by Nethermind Security.
Critical findingsNo open critical findingsAcross the 4 reports, 1 critical finding was reported. It is marked fixed by the firm that reported it.
Open ClayStack’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