ERC-721 Composition Extension

The reference implementation and its tests are now public: GitHub - antferr/erc721-composition: Reference implementation and tests for a proposed ERC-721 extension: tokens that hold assets in a container locked until the burn · GitHub

It follows the rules in the opening post plus the three from my reply to @Zealynx, and every specification test runs on two container types: an ERC-6551 account from the canonical registry, and a minimal container of its own. A few results that bear on the discussion so far:

  • Any declared container is refused as a recipient, by transfer or by mint. Random sequences of mints, transfers, burns and deposits check after every step that a token inside another token’s container is always older than that token, so no cycle can close within the collection (invariant_InsideImpliesOlder).
  • Why the implementation must not be upgradeable: an account behind an upgradeable proxy keeps its address, its code and its declared data, and after an upgrade the holder empties it while the token exists (test_Reader_RejectsUpgradeableProxyAccount). The example reader turns it away because it recognises the implementation itself.
  • Thirteen defects are kept in the repository, each caught by the same check that passes on the reference implementation. One of them is an account that locks isValidSigner but still accepts the holder’s ERC-1271 signatures.

@SergeevDmitry, the invariants follow your point in the “Contracts can’t read events” thread: functions and events are compared with a model built from the operations, not only with each other. One of the defects writes the same wrong container to the function and to the event; the two agree, and only the model catches it (test_Defect_X5_SeenByInvariant).

The code has not been audited. Review of the code is as welcome as review of the rules.