Skip to content

Commit 4a5e0a4

Browse files
authored
[gms-1166] threat model for 1155 (#148)
1 parent b523208 commit 4a5e0a4

File tree

5 files changed

+43
-532
lines changed

5 files changed

+43
-532
lines changed

audits/202309-threat-model-preset-erc721.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Contract Factory Threat Model
2-
31
## Introduction
42
This document is a thread model for two preset erc721 token contracts built by Immutable.
53

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Introduction
2+
This document is a thread model for the preset erc1155 token contracts built by Immutable.
3+
4+
This document encompasses information for all contracts under the [token](../contracts/token/erc1155) directory
5+
6+
## Context
7+
8+
The ERC1155 presets built by immutable were done with the requirements of supply tracking and permits
9+
10+
- Clients should be able to track how many tokens of a specific token id in a collection is in circulation
11+
12+
- Clients should be able to create permits for unapproved wallets to operate on their behalf
13+
14+
- Minting should be restricted to addresses that were granted the `minter` role.
15+
16+
- Only allow operators should be able to modify and assign roles to addresses for administering the collection on chain.
17+
18+
- Contracts should not be upgradeable to prevent external developers from getting around royalty requirements.
19+
20+
21+
## Design and Implementation
22+
23+
### ImmutableERC1155
24+
The ImmutableERC1155 extends OZ's `ERC1155Burnable` contract inheriting the public burn methods to be used by the client.
25+
Permit is added to allow for Gasless transactions from the token owners.
26+
27+
#### Modifications From Base Implementation
28+
29+
- Added total supply tracking for each token id. This will be managed via the pre-transfer hook called by mint, burn and transfer methods
30+
- Added Permits to allow unapproved wallets to become approved without the owner spending gas.
31+
- Override `uri` to return `baseURI` field to keep in standard with ImmutableERC721
32+
- Added `baseURI` to replace `uri` to encourage the usage of `baseURI`
33+
34+
35+
## Attack Surfaces
36+
37+
ERC1155 only has `setApproveForAll` as it's approval method. Meaning any flow that requires a 3rd party to operator on a set of tokens owned by another wallet will grant the third party access to all of that specific wallet's tokens. The third party needs to be entirely trustworthy. The owner needs to be diligent on revoking unrestricted access when not needed.
38+
39+
We can consider implementing a more complicated approval schema if needed. i.e by token id or by token id and amount.
40+
41+
## Tests
42+
`forge test` will run all the related tests.

0 commit comments

Comments
 (0)