Skip to content

Conversation

@omarinuwa
Copy link

Implements comprehensive property tests for ERC1155 multi-token contracts following EIP-1155. Addresses GitHub issue #57.

Adds 30 properties across 6 files:

  • ERC1155BasicProperties (14 properties): Balance tracking, single/batch transfers, operator approvals, and safe transfer receiver checks
  • ERC1155BurnableProperties (6 properties): Single and batch burn operations with proper authorization checks
  • ERC1155MintableProperties (8 properties): Single and batch mint operations with safe receiver validation

Each property includes:

  • Full NatSpec documentation with title, notice, dev notes, and invariants
  • Unique property IDs (ERC1155-BALANCE-001, ERC1155-TRANSFER-001, etc.)
  • Testing mode indicators (INTERNAL/EXTERNAL)
  • Organized sections with descriptive headers

Property Categories:

  • Balance Properties: Zero address balance, batch consistency
  • Transfer Properties: Zero address protection, balance updates, self-transfers, batch operations, array validation
  • Approval Properties: Operator approval management, authorization checks
  • Safety Properties: Receiver interface validation for safe transfers
  • Burn Properties: Balance reduction, approval requirements, batch operations
  • Mint Properties: Balance increases, zero address protection, receiver checks

Both INTERNAL and EXTERNAL testing approaches supported:

  • Internal (3 files): Test harness inherits from token implementation
  • External (3 files): Tests interact through public interface only

Base contracts and utilities:

  • ERC1155TestBase: Base for internal testing with MockReceiver1155
  • ERC1155ExternalTestBase: Base for external testing
  • MockReceiver1155: Test contract for safe transfer callbacks
  • IERC1155Internal: Interface for external testing

Implements comprehensive property tests for ERC1155 multi-token contracts
following EIP-1155. Addresses GitHub issue crytic#57.

Adds 30 properties across 6 files:
- ERC1155BasicProperties (14 properties): Balance tracking, single/batch
  transfers, operator approvals, and safe transfer receiver checks
- ERC1155BurnableProperties (6 properties): Single and batch burn operations
  with proper authorization checks
- ERC1155MintableProperties (8 properties): Single and batch mint operations
  with safe receiver validation

Each property includes:
- Full NatSpec documentation with title, notice, dev notes, and invariants
- Unique property IDs (ERC1155-BALANCE-001, ERC1155-TRANSFER-001, etc.)
- Testing mode indicators (INTERNAL/EXTERNAL)
- Organized sections with descriptive headers

Property Categories:
- Balance Properties: Zero address balance, batch consistency
- Transfer Properties: Zero address protection, balance updates, self-transfers,
  batch operations, array validation
- Approval Properties: Operator approval management, authorization checks
- Safety Properties: Receiver interface validation for safe transfers
- Burn Properties: Balance reduction, approval requirements, batch operations
- Mint Properties: Balance increases, zero address protection, receiver checks

Both INTERNAL and EXTERNAL testing approaches supported:
- Internal (3 files): Test harness inherits from token implementation
- External (3 files): Tests interact through public interface only

Base contracts and utilities:
- ERC1155TestBase: Base for internal testing with MockReceiver1155
- ERC1155ExternalTestBase: Base for external testing
- MockReceiver1155: Test contract for safe transfer callbacks
- IERC1155Internal: Interface for external testing

Directory structure follows existing patterns:
contracts/ERC1155/
├── internal/
│   ├── properties/ (BasicProperties, BurnableProperties, MintableProperties)
│   └── util/ (ERC1155TestBase, MockReceiver1155)
├── external/
│   ├── properties/ (External variants of above)
│   └── util/ (ERC1155ExternalTestBase)
└── util/ (IERC1155Internal interface)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Omar Inuwa seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants