<!-- canonical: https://0xsimao.com/findings/nftperp-ii-set-pools-validation -->

# setPools() could use more validation

Low/Info · Three Sigma · NFT perpetuals · 29th January, 2024

Finding 3S-NFTPerp-N08 of the Nftperp Matching Engine security review.

- Report: /reports/nftperp-ii
- Source: https://cdn.sanity.io/files/qoqld077/production/87f617e82d5468500e950a669f30607376b37c32.pdf

---

### Description

AmmRouter:setPools() is an admin function but could still benefit from input validaiton to
prevent mistakes. For example, specifying a pool id that already [exists](https://github.com/nftperp/NFTPerp-V2-Contracts/blob/8ea05fc0ecf299ca8374b571486846652c8725f8/src/AMMRouter.sol#L183) will overwrite the
current amm, which could be dangerous. Additionally, it should be checked that the bounds
of the pools increase with the index, which is currently not enforced but the logic depends
on it.

### Status

Acknowledged
