Skip to content

Commit 3b5f0ad

Browse files
authored
prettier (#179)
* prettier * fix test * always enable ffi
1 parent 23b57e6 commit 3b5f0ad

File tree

9 files changed

+23
-30
lines changed

9 files changed

+23
-30
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ jobs:
3333
version: nightly
3434
- name: Run tests
3535
run: |
36-
forge test --no-match-contract SignatureDrop
37-
forge test --match-contract SignatureDrop --ffi
36+
forge test

contracts/drop/DropERC1155.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ contract DropERC1155 is
288288
// Verify claim validity. If not valid, revert.
289289
// when there's allowlist present --> verifyClaimMerkleProof will verify the _proofMaxQuantityPerTransaction value with hashed leaf in the allowlist
290290
// when there's no allowlist, this check is true --> verifyClaim will check for _quantity being less/equal than the limit
291-
bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 || claimCondition[_tokenId].phases[activeConditionId].merkleRoot == bytes32(0);
291+
bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 ||
292+
claimCondition[_tokenId].phases[activeConditionId].merkleRoot == bytes32(0);
292293
verifyClaim(
293294
activeConditionId,
294295
_msgSender(),

contracts/drop/DropERC20.sol

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ contract DropERC20 is
207207
// Verify claim validity. If not valid, revert.
208208
// when there's allowlist present --> verifyClaimMerkleProof will verify the _proofMaxQuantityPerTransaction value with hashed leaf in the allowlist
209209
// when there's no allowlist, this check is true --> verifyClaim will check for _quantity being less/equal than the limit
210-
bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 || claimCondition.phases[activeConditionId].merkleRoot == bytes32(0);
210+
bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 ||
211+
claimCondition.phases[activeConditionId].merkleRoot == bytes32(0);
211212
verifyClaim(
212213
activeConditionId,
213214
_msgSender(),
@@ -320,12 +321,7 @@ contract DropERC20 is
320321
}
321322

322323
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), platformFeeRecipient, platformFees);
323-
CurrencyTransferLib.transferCurrency(
324-
_currency,
325-
_msgSender(),
326-
primarySaleRecipient,
327-
totalPrice - platformFees
328-
);
324+
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), primarySaleRecipient, totalPrice - platformFees);
329325
}
330326

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

contracts/drop/DropERC721.sol

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ contract DropERC721 is
351351
// Verify claim validity. If not valid, revert.
352352
// when there's allowlist present --> verifyClaimMerkleProof will verify the _proofMaxQuantityPerTransaction value with hashed leaf in the allowlist
353353
// when there's no allowlist, this check is true --> verifyClaim will check for _quantity being less/equal than the limit
354-
bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 || claimCondition.phases[activeConditionId].merkleRoot == bytes32(0);
354+
bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 ||
355+
claimCondition.phases[activeConditionId].merkleRoot == bytes32(0);
355356
verifyClaim(
356357
activeConditionId,
357358
_msgSender(),
@@ -460,12 +461,7 @@ contract DropERC721 is
460461
}
461462

462463
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), platformFeeRecipient, platformFees);
463-
CurrencyTransferLib.transferCurrency(
464-
_currency,
465-
_msgSender(),
466-
primarySaleRecipient,
467-
totalPrice - platformFees
468-
);
464+
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), primarySaleRecipient, totalPrice - platformFees);
469465
}
470466

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

foundry.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ src = 'contracts'
2323
test = 'src/test'
2424
verbosity = 0
2525
#ignored_error_codes = []
26-
fuzz_runs = 100
27-
#ffi = false
26+
#fuzz_runs = 100
27+
ffi = true
2828
#sender = '0x00a329c0648769a73afac7f9381e08fb43dbea72'
2929
#tx_origin = '0x00a329c0648769a73afac7f9381e08fb43dbea72'
3030
#initial_balance = '0xffffffffffffffffffffffff'

src/test/drop/DropERC721.t.sol

Lines changed: 7 additions & 6 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+
1314
// using Strings for uint256;
1415

1516
constructor(address _drop) {
@@ -267,15 +268,15 @@ contract DropERC721Test is BaseTest {
267268
inputs[0] = "node";
268269
inputs[1] = "src/test/scripts/generateRoot.ts";
269270
inputs[2] = Strings.toString(x);
270-
271+
271272
bytes memory result = vm.ffi(inputs);
272273
// revert();
273274
bytes32 root = abi.decode(result, (bytes32));
274-
275+
275276
inputs[1] = "src/test/scripts/getProof.ts";
276277
result = vm.ffi(inputs);
277278
bytes32[] memory proofs = abi.decode(result, (bytes32[]));
278-
279+
279280
vm.warp(1);
280281

281282
address receiver = address(0x92Bb439374a091c7507bE100183d8D1Ed2c9dAD3);
@@ -310,15 +311,15 @@ contract DropERC721Test is BaseTest {
310311
inputs[0] = "node";
311312
inputs[1] = "src/test/scripts/generateRoot.ts";
312313
inputs[2] = Strings.toString(x);
313-
314+
314315
bytes memory result = vm.ffi(inputs);
315316
// revert();
316317
bytes32 root = abi.decode(result, (bytes32));
317-
318+
318319
inputs[1] = "src/test/scripts/getProof.ts";
319320
result = vm.ffi(inputs);
320321
bytes32[] memory proofs = abi.decode(result, (bytes32[]));
321-
322+
322323
vm.warp(1);
323324

324325
address receiver = address(0x92Bb439374a091c7507bE100183d8D1Ed2c9dAD3);

src/test/scripts/generateRoot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { MerkleTree } = require("merkletreejs");
22
const keccak256 = require("keccak256");
33
const { ethers } = require("ethers");
44

5-
const process = require('process');
5+
const process = require("process");
66

77
const members = [
88
"0x92Bb439374a091c7507bE100183d8D1Ed2c9dAD3",

src/test/scripts/getProof.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { MerkleTree } = require("merkletreejs");
22
const keccak256 = require("keccak256");
33
const { ethers } = require("ethers");
44

5-
const process = require('process');
5+
const process = require("process");
66

77
const members = [
88
"0x92Bb439374a091c7507bE100183d8D1Ed2c9dAD3",

src/test/utils/BaseTest.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ abstract contract BaseTest is DSTest, Test {
8080
TWFactory(factory).addImplementation(address(new TokenERC20(fee)));
8181
TWFactory(factory).addImplementation(address(new TokenERC721(fee)));
8282
TWFactory(factory).addImplementation(address(new TokenERC1155(fee)));
83-
TWFactory(factory).addImplementation(address(new DropERC20(fee)));
83+
TWFactory(factory).addImplementation(address(new DropERC20()));
8484
TWFactory(factory).addImplementation(address(new MockContract(bytes32("DropERC721"), 1)));
85-
TWFactory(factory).addImplementation(address(new DropERC721(fee)));
85+
TWFactory(factory).addImplementation(address(new DropERC721()));
8686
TWFactory(factory).addImplementation(address(new MockContract(bytes32("DropERC1155"), 1)));
87-
TWFactory(factory).addImplementation(address(new DropERC1155(fee)));
87+
TWFactory(factory).addImplementation(address(new DropERC1155()));
8888
TWFactory(factory).addImplementation(address(new MockContract(bytes32("SignatureDrop"), 1)));
8989
TWFactory(factory).addImplementation(address(new SignatureDrop()));
9090
TWFactory(factory).addImplementation(address(new MockContract(bytes32("Marketplace"), 1)));

0 commit comments

Comments
 (0)