Skip to content

Commit 3072ded

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
update multiwrap design doc
1 parent 13e1c8a commit 3072ded

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

contracts/multiwrap/multiwrap.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,19 @@ The document is written for technical and non-technical readers. To ask further
1010

1111
The thirdweb Multiwrap contract lets you wrap arbitrary ERC20, ERC721 and ERC1155 tokens you own into a single wrapped token / NFT.
1212

13-
The `Multiwrap` contract is meant to be used for bundling up multiple assets (ERC20 / ERC721 / ERC1155) into a single wrapped token, which can then
14-
be unwrapped in exchange for the underlying tokens.
13+
The `Multiwrap` contract is meant to be used for bundling up multiple assets (ERC20 / ERC721 / ERC1155) into a single wrapped token, which can then be unwrapped in exchange for the underlying tokens.
1514

16-
The single wrapped token received on bundling up multiple assets, as mentioned above, is an ERC721 NFT. It can be transferred, sold on any NFT Marketplace, and
17-
generate royalties just like any other NFTs.
15+
The single wrapped token received on bundling up multiple assets, as mentioned above, is an ERC721 NFT. It can be transferred, sold on any NFT Marketplace, and generate royalties just like any other NFTs.
1816

1917
### Why we’re building `Multiwrap`
2018

21-
We're building `Multiwrap` for cases where an application wishes to bundle up / distribute / transact over *n* independent tokens all at once, as a single asset. This opens
22-
up several novel NFT use cases.
19+
We're building `Multiwrap` for cases where an application wishes to bundle up / distribute / transact over *n* independent tokens all at once, as a single asset. This opens up several novel NFT use cases.
2320

24-
For example, consider a lending service where people can take out a loan while putting up an NFT as a collateral. Using `Multiwrap`, a borrower can wrap their NFT with
25-
some ether, and put up the resultant wrapped ERC721 NFT as collateral on the lending service. Now, the bowwoer's NFT, as collateral, has a floor value.
21+
For example, consider a lending service where people can take out a loan while putting up an NFT as a collateral. Using `Multiwrap`, a borrower can wrap their NFT with some ether, and put up the resultant wrapped ERC721 NFT as collateral on the lending service. Now, the borrower's NFT, as collateral, has a floor value.
2622

2723
## Technical Details
2824

29-
The `Multiwrap` contract itself is an ERC721 contract. It lets you wrap arbitrary ERC20, ERC721 and ERC1155 tokens you own into a single wrapped token / NFT. This means
30-
escrowing the relevant ERC20, ERC721 and ERC1155 tokens into the `Multiwrap` contract, and receiving the wrapped NFT in exchange. This wrapped NFT can later be 'unwrapped'
31-
i.e. burned in exchange for the underlying tokens.
25+
The `Multiwrap` contract itself is an ERC721 contract. It lets you wrap arbitrary ERC20, ERC721 and ERC1155 tokens you own into a single wrapped token / NFT. This means escrowing the relevant ERC20, ERC721 and ERC1155 tokens into the `Multiwrap` contract, and receiving the wrapped NFT in exchange. This wrapped NFT can later be 'unwrapped' i.e. burned in exchange for the underlying tokens.
3226

3327
### Wrapping tokens
3428

@@ -42,7 +36,7 @@ struct Token {
4236
address assetContract;
4337
TokenType tokenType;
4438
uint256 tokenId;
45-
uint256 amount;
39+
uint256 totalAmount;
4640
}
4741
```
4842

@@ -51,23 +45,23 @@ struct Token {
5145
| assetContract | address | The contract address of the asset to wrap. |
5246
| tokenType | TokenType | The token type (ERC20 / ERC721 / ERC1155) of the asset to wrap. |
5347
| tokenId | uint256 | The token Id of the asset to wrap, if the asset is an ERC721 / ERC1155 NFT. |
54-
| amount | uint256 | The amount of the asset to wrap, if the asset is an ERC20 / ERC1155 fungible token. |
48+
| totalAmount | uint256 | The amount of the asset to wrap, if the asset is an ERC20 / ERC1155 fungible token. |
5549

56-
Each token in the bundle of tokens to be wrapped as a single wrapped NFT must be specified to the `Multiwrap` contract in the form of the `Token` struct. The contract handles the respective token based on the value of `tokenType` provided. Any incorrect values passed (e.g. the `amount` specified to be wrapped exceeds the token owner's token balance) will cause the wrapping transaction to revert.
50+
Each token in the bundle of tokens to be wrapped as a single wrapped NFT must be specified to the `Multiwrap` contract in the form of the `Token` struct. The contract handles the respective token based on the value of `tokenType` provided. Any incorrect values passed (e.g. the `totalAmount` specified to be wrapped exceeds the token owner's token balance) will cause the wrapping transaction to revert.
5751

5852
Multiple tokens can be wrapped as a single wrapped NFT by calling the following function:
5953

6054
```solidity
6155
function wrap(
62-
Token[] memory wrappedContents,
56+
Token[] memory tokensToWrap,
6357
string calldata uriForWrappedToken,
6458
address recipient
6559
) external payable returns (uint256 tokenId);
6660
```
6761

6862
| Parameters | Type | Description |
6963
| --- | --- | --- |
70-
| wrappedContents | Token[] | The tokens to wrap. |
64+
| tokensToWrap | Token[] | The tokens to wrap. |
7165
| uriForWrappedToken | string | The metadata URI for the wrapped NFT. |
7266
| recipient | address | The recipient of the wrapped NFT. |
7367

@@ -86,8 +80,8 @@ function unwrap(
8680

8781
| Parameters | Type | Description |
8882
| --- | --- | --- |
89-
| tokenId | Token[] | The token Id of the wrapped NFT to unwrap.. |
90-
| recipient | address | The recipient of the underlying ERC1155, ERC721, ERC20 tokens of the wrapped NFT. |
83+
| tokenId | Token[] | The token Id of the wrapped NFT to unwrap. |
84+
| recipient | address | The recipient of the underlying ERC20, ERC721 or ERC1155 tokens of the wrapped NFT. |
9185

9286
When unwrapping the single wrapped NFT, the wrapped NFT is burned.
9387

0 commit comments

Comments
 (0)