Skip to content

Commit eb2b0f1

Browse files
committed
prettier format
1 parent 16d79bd commit eb2b0f1

22 files changed

+406
-191
lines changed

contracts/lazy_mint/ERC1155/LazyMintERC1155.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ contract LazyMintERC1155 is
380380
bytes32[] calldata _proofs,
381381
uint256 _conditionIndex
382382
) public view {
383-
384383
ClaimCondition memory _mintCondition = claimConditions[_tokenId].claimConditionAtIndex[_conditionIndex];
385384

386385
require(_quantity > 0 && _quantity <= _mintCondition.quantityLimitPerTransaction, "invalid quantity claimed.");

contracts/lazy_mint/ERC20/ILazyMintERC20.sol

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pragma solidity ^0.8.0;
1010
*/
1111

1212
interface ILazyMintERC20 {
13-
1413
/**
1514
* @notice The claim conditions for a given tokenId x time window.
1615
*
@@ -98,7 +97,11 @@ interface ILazyMintERC20 {
9897
* @param proofs The proof required to prove the account's inclusion in the merkle root whitelist
9998
* of the mint conditions that apply.
10099
*/
101-
function claim(address receiver, uint256 quantity, bytes32[] calldata proofs) external payable;
100+
function claim(
101+
address receiver,
102+
uint256 quantity,
103+
bytes32[] calldata proofs
104+
) external payable;
102105

103106
/**
104107
* @notice Lets a module admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.

contracts/lazy_mint/ERC20/LazyMintERC20.sol

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { IWETH } from "../../interfaces/IWETH.sol";
1818
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
1919

2020
contract LazyMintERC20 is ILazyMintERC20, Coin, ReentrancyGuard {
21-
2221
/// @dev Version of the contract.
2322
uint256 public constant VERSION = 1;
2423

@@ -53,16 +52,8 @@ contract LazyMintERC20 is ILazyMintERC20, Coin, ReentrancyGuard {
5352
address _saleRecipient,
5453
uint128 _royaltyBps,
5554
uint128 _feeBps
56-
)
57-
Coin(
58-
_controlCenter,
59-
_name,
60-
_symbol,
61-
_trustedForwarder,
62-
_contractURI
63-
)
64-
{
65-
// Set the protocol control center
55+
) Coin(_controlCenter, _name, _symbol, _trustedForwarder, _contractURI) {
56+
// Set the protocol control center
6657
nativeTokenWrapper = _nativeTokenWrapper;
6758
defaultSaleRecipient = _saleRecipient;
6859
royaltyBps = uint64(_royaltyBps);
@@ -89,8 +80,11 @@ contract LazyMintERC20 is ILazyMintERC20, Coin, ReentrancyGuard {
8980
// ===== External functions =====
9081

9182
/// @dev Lets an account claim a given quantity of tokens, of a single tokenId.
92-
function claim(address _receiver, uint256 _quantity, bytes32[] calldata _proofs) external payable nonReentrant {
93-
83+
function claim(
84+
address _receiver,
85+
uint256 _quantity,
86+
bytes32[] calldata _proofs
87+
) external payable nonReentrant {
9488
// Get the claim conditions.
9589
uint256 activeConditionIndex = getIndexOfActiveCondition();
9690
ClaimCondition memory condition = claimConditions.claimConditionAtIndex[activeConditionIndex];
@@ -225,7 +219,6 @@ contract LazyMintERC20 is ILazyMintERC20, Coin, ReentrancyGuard {
225219
bytes32[] calldata _proofs,
226220
uint256 _conditionIndex
227221
) public view {
228-
229222
ClaimCondition memory _claimCondition = claimConditions.claimConditionAtIndex[_conditionIndex];
230223

231224
require(
@@ -265,7 +258,11 @@ contract LazyMintERC20 is ILazyMintERC20, Coin, ReentrancyGuard {
265258
}
266259

267260
/// @dev Transfers the tokens being claimed.
268-
function transferClaimedTokens(address _to, uint256 _claimConditionIndex, uint256 _quantityBeingClaimed) internal {
261+
function transferClaimedTokens(
262+
address _to,
263+
uint256 _claimConditionIndex,
264+
uint256 _quantityBeingClaimed
265+
) internal {
269266
// Update the supply minted under mint condition.
270267
claimConditions.claimConditionAtIndex[_claimConditionIndex].supplyClaimed += _quantityBeingClaimed;
271268
// Update the claimer's next valid timestamp to mint. If next mint timestamp overflows, cap it to max uint256.
@@ -333,11 +330,11 @@ contract LazyMintERC20 is ILazyMintERC20, Coin, ReentrancyGuard {
333330
if (_from == _to) {
334331
return;
335332
}
336-
333+
337334
uint256 balBefore = IERC20(_currency).balanceOf(_to);
338335
bool success = IERC20(_currency).transferFrom(_from, _to, _amount);
339336
uint256 balAfter = IERC20(_currency).balanceOf(_to);
340337

341338
require(success && balAfter == balBefore + _amount, "failed to transfer currency.");
342339
}
343-
}
340+
}

contracts/lazy_mint/ERC721/ILazyMintERC721.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ interface ILazyMintERC721 {
118118
* @param _proofs The proof required to prove the account's inclusion in the merkle root whitelist
119119
* of the mint conditions that apply.
120120
*/
121-
function claim(address receiver, uint256 _quantity, bytes32[] calldata _proofs) external payable;
121+
function claim(
122+
address receiver,
123+
uint256 _quantity,
124+
bytes32[] calldata _proofs
125+
) external payable;
122126

123127
/**
124128
* @notice Lets a module admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.

contracts/marketplace/IMarketplace.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ interface IMarketplace {
211211
* (2) the lister does not own or has removed Markeplace's
212212
* approval to transfer the tokens listed for sale.
213213
*/
214-
function buy(uint256 _listingId, uint256 _quantity, address _currency, uint256 _totalPrice) external payable;
214+
function buy(
215+
uint256 _listingId,
216+
uint256 _quantity,
217+
address _currency,
218+
uint256 _totalPrice
219+
) external payable;
215220

216221
/**
217222
* @notice Lets someone make an offer to a direct listing, or bid in an auction.

contracts/marketplace/Marketplace.sol

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ contract Marketplace is
3636
ERC2771Context,
3737
Multicall
3838
{
39-
4039
/// @dev Version of the contract.
4140
uint256 public constant VERSION = 1;
4241

@@ -244,12 +243,7 @@ contract Marketplace is
244243
uint256 _quantityToBuy,
245244
address _currency,
246245
uint256 _totalPrice
247-
)
248-
external
249-
payable
250-
override
251-
nonReentrant
252-
{
246+
) external payable override nonReentrant {
253247
Listing memory targetListing = listings[_listingId];
254248
address buyer = _msgSender();
255249

contracts/signature_mint/ERC1155/ISignatureMint1155.sol

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ interface ISignatureMint1155 {
8181
* @param uri The URI to assign to the NFT.
8282
*
8383
*/
84-
function mintTo(address to, string calldata uri, uint256 amount) external;
84+
function mintTo(
85+
address to,
86+
string calldata uri,
87+
uint256 amount
88+
) external;
8589

8690
/**
8791
* @notice Mints an NFT according to the provided mint request.
@@ -90,4 +94,4 @@ interface ISignatureMint1155 {
9094
* @param signature he signature produced by an account signing the mint request.
9195
*/
9296
function mintWithSignature(MintRequest calldata req, bytes calldata signature) external payable;
93-
}
97+
}

contracts/signature_mint/ERC1155/SignatureMint1155.sol

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,11 @@ contract SignatureMint1155 is
161161
}
162162

163163
/// @dev Lets an account with MINTER_ROLE mint an NFT.
164-
function mintTo(address _to, string calldata _uri, uint256 _amount) external onlyMinter {
165-
164+
function mintTo(
165+
address _to,
166+
string calldata _uri,
167+
uint256 _amount
168+
) external onlyMinter {
166169
uint256 tokenIdToMint = nextTokenIdToMint;
167170
nextTokenIdToMint += 1;
168171

@@ -173,16 +176,12 @@ contract SignatureMint1155 is
173176
/// ===== External functions =====
174177

175178
/// @dev Mints an NFT according to the provided mint request.
176-
function mintWithSignature(MintRequest calldata _req, bytes calldata _signature)
177-
external
178-
payable
179-
nonReentrant
180-
{
179+
function mintWithSignature(MintRequest calldata _req, bytes calldata _signature) external payable nonReentrant {
181180
address signer = verifyRequest(_req, _signature);
182181
address receiver = _req.to == address(0) ? _msgSender() : _req.to;
183182

184183
uint256 tokenIdToMint;
185-
if(_req.tokenId == type(uint).max) {
184+
if (_req.tokenId == type(uint256).max) {
186185
tokenIdToMint = nextTokenIdToMint;
187186
nextTokenIdToMint += 1;
188187
} else {
@@ -265,9 +264,13 @@ contract SignatureMint1155 is
265264
/// ===== Internal functions =====
266265

267266
/// @dev Mints an NFT to `to`
268-
function _mintTo(address _to, string calldata _uri, uint256 _tokenId, uint256 _amount) internal {
269-
270-
if(bytes(_tokenURI[_tokenId]).length == 0) {
267+
function _mintTo(
268+
address _to,
269+
string calldata _uri,
270+
uint256 _tokenId,
271+
uint256 _amount
272+
) internal {
273+
if (bytes(_tokenURI[_tokenId]).length == 0) {
271274
require(bytes(_uri).length > 0, "empty uri.");
272275
_tokenURI[_tokenId] = _uri;
273276
}
@@ -455,7 +458,10 @@ contract SignatureMint1155 is
455458
override(AccessControlEnumerable, ERC1155, IERC165)
456459
returns (bool)
457460
{
458-
return super.supportsInterface(interfaceId) || interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC2981).interfaceId;
461+
return
462+
super.supportsInterface(interfaceId) ||
463+
interfaceId == type(IERC1155).interfaceId ||
464+
interfaceId == type(IERC2981).interfaceId;
459465
}
460466

461467
function _msgSender() internal view virtual override(Context, ERC2771Context) returns (address sender) {

test/LazyMint/ERC1155/claim/withERC20Token.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,25 @@ describe("Test: claim lazy minted tokens with erc20 tokens", function () {
120120
describe("Revert cases", function () {
121121
it("Should revert if quantity wanted is zero", async () => {
122122
const invalidQty: BigNumber = BigNumber.from(0);
123-
await expect(lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, invalidQty, proof)).to.be.revertedWith(
124-
"invalid quantity claimed.",
125-
);
123+
await expect(
124+
lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, invalidQty, proof),
125+
).to.be.revertedWith("invalid quantity claimed.");
126126
});
127127

128128
it("Should revert if quantity wanted is greater than limit per transaction", async () => {
129129
const invalidQty: BigNumber = (mintConditions[0].quantityLimitPerTransaction as BigNumber).add(1);
130130

131-
await expect(lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, invalidQty, proof)).to.be.revertedWith(
132-
"invalid quantity claimed.",
133-
);
131+
await expect(
132+
lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, invalidQty, proof),
133+
).to.be.revertedWith("invalid quantity claimed.");
134134
});
135135

136136
it("Should revert if tokenId provided is unminted", async () => {
137137
const invalidTokenId: BigNumber = amountToLazyMint.add(1);
138138

139-
await expect(lazyMintERC1155.connect(claimer).claim(claimer.address, invalidTokenId, quantityToClaim, proof)).to.be.revertedWith(
140-
"no public mint condition.",
141-
);
139+
await expect(
140+
lazyMintERC1155.connect(claimer).claim(claimer.address, invalidTokenId, quantityToClaim, proof),
141+
).to.be.revertedWith("no public mint condition.");
142142
});
143143

144144
it("Should revert if quantity wanted + current mint supply exceeds max mint supply", async () => {
@@ -149,9 +149,9 @@ describe("Test: claim lazy minted tokens with erc20 tokens", function () {
149149

150150
while (supplyClaimed.lt(maxClaimableSupply)) {
151151
if (supplyClaimed.add(quantityToClaim).gt(maxClaimableSupply)) {
152-
await expect(lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, quantityToClaim, proof)).to.be.revertedWith(
153-
"exceed max mint supply.",
154-
);
152+
await expect(
153+
lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, quantityToClaim, proof),
154+
).to.be.revertedWith("exceed max mint supply.");
155155
}
156156

157157
await lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, quantityToClaim, proof);
@@ -169,15 +169,15 @@ describe("Test: claim lazy minted tokens with erc20 tokens", function () {
169169
it("Should revert if claimer claims before valid timestamp for transaction", async () => {
170170
await lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, quantityToClaim, proof);
171171

172-
await expect(lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, quantityToClaim, proof)).to.be.revertedWith(
173-
"cannot claim yet.",
174-
);
172+
await expect(
173+
lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, quantityToClaim, proof),
174+
).to.be.revertedWith("cannot claim yet.");
175175
});
176176

177177
it("Should revert if claimer is not in the whitelist", async () => {
178-
await expect(lazyMintERC1155.connect(protocolAdmin).claim(protocolAdmin.address, tokenId, quantityToClaim, proof)).to.be.revertedWith(
179-
"not in whitelist.",
180-
);
178+
await expect(
179+
lazyMintERC1155.connect(protocolAdmin).claim(protocolAdmin.address, tokenId, quantityToClaim, proof),
180+
).to.be.revertedWith("not in whitelist.");
181181
});
182182

183183
it("Should revert if caller has not approved lazy mint to transfer currency", async () => {
@@ -186,9 +186,9 @@ describe("Test: claim lazy minted tokens with erc20 tokens", function () {
186186
.connect(claimer)
187187
.decreaseAllowance(lazyMintERC1155.address, await erc20Token.balanceOf(claimer.address));
188188

189-
await expect(lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, quantityToClaim, proof)).to.be.revertedWith(
190-
"insufficient currency balance or allowance.",
191-
);
189+
await expect(
190+
lazyMintERC1155.connect(claimer).claim(claimer.address, tokenId, quantityToClaim, proof),
191+
).to.be.revertedWith("insufficient currency balance or allowance.");
192192
});
193193
});
194194

0 commit comments

Comments
 (0)