<!-- canonical: https://0xsimao.com/findings/nftperp-i-contracts-inherit-their-interfaces -->

# Contracts should inherit their interfaces

Low/Info · Three Sigma · NFT perpetuals · 2nd January, 2024

Finding 3S-NFTPerp-N05 of the Nftperp Exchange security review.

- Report: /reports/nftperp-i
- Source: https://cdn.sanity.io/files/qoqld077/production/c19530de75e234ad15694b4563edb1fc9d2a3fd8.pdf

---

### Description

To avoid differences between the function declarations in the contracts and their
interfaces, it is a good practice for contracts to inherit their interfaces. At the moment the
[AMM](https://github.com/nftperp/NFTPerp-V2-Contracts/blob/1c16f2010a851ac23aec73822d55388901bbe5e7/src/AMM.sol) contract doesn't inherit the [IAMM](https://github.com/nftperp/NFTPerp-V2-Contracts/blob/1c16f2010a851ac23aec73822d55388901bbe5e7/src/interfaces/IAMM.sol) interface and this leads to problems of functions
existing in the interface but not the contract. For instance, functions
getInitializationPrice(), getLiquidationParams() and
getReservesAndTotalLiquidity(). In the future a user might try to interact with the
protocol using the interface, but the call would certainly revert due to this issue.

### Status

Acknowledged

---

Related findings:

- [Some contracts don't implement their entire interface](https://0xsimao.com/findings/m-0-don-implement-entire-interface): M^0 Minter Gateway
