Skip to content

Commit 5eb1cb1

Browse files
committed
Merge branch 'main' into shipyard-droperc721-audit-fixes
2 parents 5462745 + 8d3d775 commit 5eb1cb1

21 files changed

+624
-436
lines changed

contracts/drop/DropERC20.sol

Lines changed: 245 additions & 211 deletions
Large diffs are not rendered by default.

contracts/interfaces/IThirdwebPlatformFee.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8.11;
33

44
interface IThirdwebPlatformFee {
55
/// @dev Returns the platform fee bps and recipient.
6-
function getPlatformFeeInfo() external view returns (address platformFeeRecipient, uint16 platformFeeBps);
6+
function getPlatformFeeInfo() external view returns (address, uint16);
77

88
/// @dev Lets a module admin update the fees on primary sales.
99
function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external;

contracts/interfaces/drop/IDropERC20.sol

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import "../IThirdwebPrimarySale.sol";
88
import "./IDropClaimCondition.sol";
99

1010
/**
11-
* `LazyMintERC20` is an ERC 20 contract.
11+
* Thirdweb's 'Drop' contracts are distribution mechanisms for tokens. The
12+
* `DropERC20` contract is a distribution mechanism for ERC20 tokens.
1213
*
13-
* The module admin can create claim conditions with non-overlapping time windows,
14-
* and accounts can claim the tokens, in a given time window, according to restrictions
15-
* defined in that time window's claim conditions.
14+
* A contract admin (i.e. holder of `DEFAULT_ADMIN_ROLE`) can create claim conditions
15+
* with non-overlapping time windows, and accounts can claim the tokens according to
16+
* restrictions defined in the claim condition that is active at the time of the transaction.
1617
*/
1718

1819
interface IDropERC20 is
@@ -33,46 +34,50 @@ interface IDropERC20 is
3334
/// @dev Emitted when new claim conditions are set.
3435
event ClaimConditionsUpdated(ClaimCondition[] claimConditions);
3536

36-
/// @dev Emitted when a new sale recipient is set.
37+
/// @dev Emitted when a new primary sale recipient is set.
3738
event PrimarySaleRecipientUpdated(address indexed recipient);
3839

39-
/// @dev Emitted when fee on primary sales is updated.
40+
/// @dev Emitted when fee platform fee recipient or bps is updated.
4041
event PlatformFeeInfoUpdated(address platformFeeRecipient, uint256 platformFeeBps);
4142

42-
/// @dev Emitted when a max total supply is set for a token.
43+
/// @dev Emitted when the global max supply of tokens is updated.
4344
event MaxTotalSupplyUpdated(uint256 maxTotalSupply);
4445

45-
/// @dev Emitted when a wallet claim count is updated.
46+
/// @dev Emitted when the wallet claim count for an address is updated.
4647
event WalletClaimCountUpdated(address indexed wallet, uint256 count);
4748

48-
/// @dev Emitted when the max wallet claim count is updated.
49+
/// @dev Emitted when the global max wallet claim count is updated.
4950
event MaxWalletClaimCountUpdated(uint256 count);
5051

5152
/**
5253
* @notice Lets an account claim a given quantity of tokens.
5354
*
54-
* @param _receiver The receiver of the NFTs to claim.
55-
* @param _quantity The quantity of tokens to claim.
56-
* @param _currency The currency in which to pay for the claim.
57-
* @param _pricePerToken The price per token to pay for the claim.
58-
* @param _proofs The proof required to prove the account's inclusion in the merkle root whitelist
59-
* of the mint conditions that apply.
60-
* @param _proofMaxQuantityPerTransaction The maximum claim quantity per transactions that included in the merkle proof.
55+
* @param receiver The receiver of the tokens to claim.
56+
* @param quantity The quantity of tokens to claim.
57+
* @param currency The currency in which to pay for the claim.
58+
* @param pricePerToken The price per token (i.e. price per 1 ether unit of the token)
59+
* to pay for the claim.
60+
* @param proofs The proof of the claimer's inclusion in the merkle root allowlist
61+
* of the claim conditions that apply.
62+
* @param proofMaxQuantityPerTransaction (Optional) The maximum number of tokens an address included in an
63+
* allowlist can claim.
6164
*/
6265
function claim(
63-
address _receiver,
64-
uint256 _quantity,
65-
address _currency,
66-
uint256 _pricePerToken,
67-
bytes32[] calldata _proofs,
68-
uint256 _proofMaxQuantityPerTransaction
66+
address receiver,
67+
uint256 quantity,
68+
address currency,
69+
uint256 pricePerToken,
70+
bytes32[] calldata proofs,
71+
uint256 proofMaxQuantityPerTransaction
6972
) external payable;
7073

7174
/**
72-
* @notice Lets a module admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.
75+
* @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.
7376
*
74-
* @param _phases Mint conditions in ascending order by `startTimestamp`.
75-
* @param _resetLimitRestriction To reset claim phases limit restriction.
77+
* @param phases Claim conditions in ascending order by `startTimestamp`.
78+
* @param resetClaimEligibility Whether to reset `limitLastClaimTimestamp` and
79+
* `limitMerkleProofClaim` values when setting new
80+
* claim conditions.
7681
*/
77-
function setClaimConditions(ClaimCondition[] calldata _phases, bool _resetLimitRestriction) external;
82+
function setClaimConditions(ClaimCondition[] calldata phases, bool resetClaimEligibility) external;
7883
}

contracts/interfaces/marketplace/IMarketplace.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ interface IMarketplace is IThirdwebContract, IThirdwebPlatformFee {
3434
* This is the entire listing quantity if the listing is an auction.
3535
* @param currency The currency in which the offer is made.
3636
* @param pricePerToken The price per token offered to the lister.
37+
* @param expirationTimestamp The timestamp after which a seller cannot accept this offer.
3738
*/
3839
struct Offer {
3940
uint256 listingId;
4041
address offeror;
4142
uint256 quantityWanted;
4243
address currency;
4344
uint256 pricePerToken;
45+
uint256 expirationTimestamp;
4446
}
4547

4648
/**
@@ -297,12 +299,16 @@ interface IMarketplace is IThirdwebContract, IThirdwebPlatformFee {
297299
*
298300
* @param _pricePerToken For direct listings: offered price per token. For auction listings: the bid
299301
* amount per token. The total offer/bid amount is `_quantityWanted * _pricePerToken`.
302+
*
303+
* @param _expirationTimestamp For aution listings: inapplicable. For direct listings: The timestamp after which
304+
* the seller can no longer accept the offer.
300305
*/
301306
function offer(
302307
uint256 _listingId,
303308
uint256 _quantityWanted,
304309
address _currency,
305-
uint256 _pricePerToken
310+
uint256 _pricePerToken,
311+
uint256 _expirationTimestamp
306312
) external payable;
307313

308314
/**

contracts/lib/CurrencyTransferLib.sol

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ library CurrencyTransferLib {
3131
}
3232

3333
/// @dev Transfers a given amount of currency. (With native token wrapping)
34-
function transferCurrencyWithWrapperAndBalanceCheck(
34+
function transferCurrencyWithWrapper(
3535
address _currency,
3636
address _from,
3737
address _to,
@@ -55,7 +55,7 @@ library CurrencyTransferLib {
5555
safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
5656
}
5757
} else {
58-
safeTransferERC20WithBalanceCheck(_currency, _from, _to, _amount);
58+
safeTransferERC20(_currency, _from, _to, _amount);
5959
}
6060
}
6161

@@ -77,30 +77,6 @@ library CurrencyTransferLib {
7777
}
7878
}
7979

80-
/// @dev Transfer `amount` of ERC20 token from `from` to `to`.
81-
function safeTransferERC20WithBalanceCheck(
82-
address _currency,
83-
address _from,
84-
address _to,
85-
uint256 _amount
86-
) internal {
87-
if (_from == _to) {
88-
return;
89-
}
90-
91-
uint256 balBefore = IERC20Upgradeable(_currency).balanceOf(_to);
92-
93-
if (_from == address(this)) {
94-
IERC20Upgradeable(_currency).safeTransfer(_to, _amount);
95-
} else {
96-
IERC20Upgradeable(_currency).safeTransferFrom(_from, _to, _amount);
97-
}
98-
99-
uint256 balAfter = IERC20Upgradeable(_currency).balanceOf(_to);
100-
101-
require(balAfter == balBefore + _amount, "currency transfer failed.");
102-
}
103-
10480
/// @dev Transfers `amount` of native token to `to`.
10581
function safeTransferNativeToken(address to, uint256 value) internal {
10682
// solhint-disable avoid-low-level-calls

0 commit comments

Comments
 (0)