Skip to content

Commit fe7bc85

Browse files
nkrishangKrishang Nadgaudakumaryash90Krishang Nadgauda
authored
0xMacro audit Jun '22: DropERC1155 (#182)
* (Q-1) Unused variable * fix claim quantity limit fix claim quantity limit * cleanup * remove thirdwebfee remove thirdwebfee Co-authored-by: Krishang Nadgauda <[email protected]> Co-authored-by: yash <[email protected]> Co-authored-by: Krishang Nadgauda <[email protected]>
1 parent 763f685 commit fe7bc85

File tree

7 files changed

+79
-0
lines changed

7 files changed

+79
-0
lines changed

contracts/drop/DropERC1155.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,12 @@ contract DropERC1155 is
597597
emit PrimarySaleRecipientUpdated(_saleRecipient);
598598
}
599599

600+
/// @dev Lets a contract admin set the recipient for all primary sales.
601+
function setSaleRecipientForToken(uint256 _tokenId, address _saleRecipient) external onlyRole(DEFAULT_ADMIN_ROLE) {
602+
saleRecipient[_tokenId] = _saleRecipient;
603+
emit SaleRecipientForTokenUpdated(_tokenId, _saleRecipient);
604+
}
605+
600606
/// @dev Lets a contract admin update the default royalty recipient and bps.
601607
function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps)
602608
external

contracts/drop/DropERC20.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,16 @@ contract DropERC20 is
321321
}
322322

323323
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), platformFeeRecipient, platformFees);
324+
<<<<<<< HEAD
324325
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), primarySaleRecipient, totalPrice - platformFees);
326+
=======
327+
CurrencyTransferLib.transferCurrency(
328+
_currency,
329+
_msgSender(),
330+
primarySaleRecipient,
331+
totalPrice - platformFees
332+
);
333+
>>>>>>> b00169bb4f25ccd10ebe36429d714cc5f919af63
325334
}
326335

327336
/// @dev Transfers the tokens being claimed.

contracts/drop/DropERC721.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,16 @@ contract DropERC721 is
461461
}
462462

463463
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), platformFeeRecipient, platformFees);
464+
<<<<<<< HEAD
464465
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), primarySaleRecipient, totalPrice - platformFees);
466+
=======
467+
CurrencyTransferLib.transferCurrency(
468+
_currency,
469+
_msgSender(),
470+
primarySaleRecipient,
471+
totalPrice - platformFees
472+
);
473+
>>>>>>> b00169bb4f25ccd10ebe36429d714cc5f919af63
465474
}
466475

467476
/// @dev Transfers the NFTs being claimed.

contracts/interfaces/drop/IDropERC1155.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ interface IDropERC1155 is IERC1155Upgradeable, IDropClaimCondition {
4646
/// @dev Emitted when the max wallet claim count for a given tokenId is updated.
4747
event MaxWalletClaimCountUpdated(uint256 tokenId, uint256 count);
4848

49+
/// @dev Emitted when the sale recipient for a particular tokenId is updated.
50+
event SaleRecipientForTokenUpdated(uint256 indexed tokenId, address saleRecipient);
51+
4952
/**
5053
* @notice Lets an account with `MINTER_ROLE` lazy mint 'n' NFTs.
5154
* The URIs for each token is the provided `_baseURIForTokens` + `{tokenId}`.

docs/DropERC1155.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,23 @@ function setRoyaltyInfoForToken(uint256 _tokenId, address _recipient, uint256 _b
951951
| _recipient | address | undefined
952952
| _bps | uint256 | undefined
953953

954+
### setSaleRecipientForToken
955+
956+
```solidity
957+
function setSaleRecipientForToken(uint256 _tokenId, address _saleRecipient) external nonpayable
958+
```
959+
960+
961+
962+
*Lets a contract admin set the recipient for all primary sales.*
963+
964+
#### Parameters
965+
966+
| Name | Type | Description |
967+
|---|---|---|
968+
| _tokenId | uint256 | undefined
969+
| _saleRecipient | address | undefined
970+
954971
### setWalletClaimCount
955972

956973
```solidity
@@ -1337,6 +1354,23 @@ event RoyaltyForToken(uint256 indexed tokenId, address royaltyRecipient, uint256
13371354
| royaltyRecipient | address | undefined |
13381355
| royaltyBps | uint256 | undefined |
13391356

1357+
### SaleRecipientForTokenUpdated
1358+
1359+
```solidity
1360+
event SaleRecipientForTokenUpdated(uint256 indexed tokenId, address saleRecipient)
1361+
```
1362+
1363+
1364+
1365+
1366+
1367+
#### Parameters
1368+
1369+
| Name | Type | Description |
1370+
|---|---|---|
1371+
| tokenId `indexed` | uint256 | undefined |
1372+
| saleRecipient | address | undefined |
1373+
13401374
### TokensClaimed
13411375

13421376
```solidity

docs/IDropERC1155.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,23 @@ event MaxWalletClaimCountUpdated(uint256 tokenId, uint256 count)
288288
| tokenId | uint256 | undefined |
289289
| count | uint256 | undefined |
290290

291+
### SaleRecipientForTokenUpdated
292+
293+
```solidity
294+
event SaleRecipientForTokenUpdated(uint256 indexed tokenId, address saleRecipient)
295+
```
296+
297+
298+
299+
*Emitted when the sale recipient for a particular tokenId is updated.*
300+
301+
#### Parameters
302+
303+
| Name | Type | Description |
304+
|---|---|---|
305+
| tokenId `indexed` | uint256 | undefined |
306+
| saleRecipient | address | undefined |
307+
291308
### TokensClaimed
292309

293310
```solidity

src/test/drop/DropERC721.t.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import "../utils/BaseTest.sol";
1010
contract SubExploitContract is ERC721Holder, ERC1155Holder {
1111
DropERC721 internal drop;
1212
address payable internal master;
13+
// using Strings for uint256;
1314

1415
// using Strings for uint256;
1516

0 commit comments

Comments
 (0)