diff --git a/packages/splits-v2/script/Base.s.sol b/packages/splits-v2/script/Base.s.sol index d4dd4cc..1939b19 100644 --- a/packages/splits-v2/script/Base.s.sol +++ b/packages/splits-v2/script/Base.s.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { ICreateX } from "./ICreateX.sol"; diff --git a/packages/splits-v2/script/SplitFactoryV2.s.sol b/packages/splits-v2/script/SplitFactoryV2.s.sol index 092eedc..4500eb5 100644 --- a/packages/splits-v2/script/SplitFactoryV2.s.sol +++ b/packages/splits-v2/script/SplitFactoryV2.s.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { SplitFactoryV2 } from "../src/splitters/SplitFactoryV2.sol"; diff --git a/packages/splits-v2/script/SplitsWarehouse.s.sol b/packages/splits-v2/script/SplitsWarehouse.s.sol index 135ea21..e05609f 100644 --- a/packages/splits-v2/script/SplitsWarehouse.s.sol +++ b/packages/splits-v2/script/SplitsWarehouse.s.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { SplitsWarehouse } from "../src/SplitsWarehouse.sol"; diff --git a/packages/splits-v2/src/SplitsWarehouse.sol b/packages/splits-v2/src/SplitsWarehouse.sol index 6b832d1..0c132f3 100644 --- a/packages/splits-v2/src/SplitsWarehouse.sol +++ b/packages/splits-v2/src/SplitsWarehouse.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: UNLICENSED +// SPDX-License-Identifier: GPL-3.0-or-later // license? pragma solidity ^0.8.18; diff --git a/packages/splits-v2/src/interfaces/IERC165.sol b/packages/splits-v2/src/interfaces/IERC165.sol index 0353f2d..46c35a2 100644 --- a/packages/splits-v2/src/interfaces/IERC165.sol +++ b/packages/splits-v2/src/interfaces/IERC165.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; interface IERC165 { diff --git a/packages/splits-v2/src/interfaces/IERC6909.sol b/packages/splits-v2/src/interfaces/IERC6909.sol index 984b91d..2b6d276 100644 --- a/packages/splits-v2/src/interfaces/IERC6909.sol +++ b/packages/splits-v2/src/interfaces/IERC6909.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { IERC165 } from "./IERC165.sol"; diff --git a/packages/splits-v2/src/interfaces/IERC6909X.sol b/packages/splits-v2/src/interfaces/IERC6909X.sol index 8d60256..18d16ab 100644 --- a/packages/splits-v2/src/interfaces/IERC6909X.sol +++ b/packages/splits-v2/src/interfaces/IERC6909X.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { IERC5267 } from "@openzeppelin/contracts/interfaces/IERC5267.sol"; diff --git a/packages/splits-v2/src/interfaces/IERC6909XCallback.sol b/packages/splits-v2/src/interfaces/IERC6909XCallback.sol index 8a76d60..bdab42f 100644 --- a/packages/splits-v2/src/interfaces/IERC6909XCallback.sol +++ b/packages/splits-v2/src/interfaces/IERC6909XCallback.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; interface IERC6909XCallback { diff --git a/packages/splits-v2/src/interfaces/ISplitsWarehouse.sol b/packages/splits-v2/src/interfaces/ISplitsWarehouse.sol index b6f0053..969d068 100644 --- a/packages/splits-v2/src/interfaces/ISplitsWarehouse.sol +++ b/packages/splits-v2/src/interfaces/ISplitsWarehouse.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: UNLICENSED +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { IERC6909 } from "./IERC6909.sol"; diff --git a/packages/splits-v2/src/interfaces/IWETH9.sol b/packages/splits-v2/src/interfaces/IWETH9.sol index 34d94bd..c469cc9 100644 --- a/packages/splits-v2/src/interfaces/IWETH9.sol +++ b/packages/splits-v2/src/interfaces/IWETH9.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; interface IWETH9 { diff --git a/packages/splits-v2/src/libraries/Cast.sol b/packages/splits-v2/src/libraries/Cast.sol index 1489d78..d356055 100644 --- a/packages/splits-v2/src/libraries/Cast.sol +++ b/packages/splits-v2/src/libraries/Cast.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; library Cast { diff --git a/packages/splits-v2/src/libraries/Math.sol b/packages/splits-v2/src/libraries/Math.sol index 0400e8d..52cb4f9 100644 --- a/packages/splits-v2/src/libraries/Math.sol +++ b/packages/splits-v2/src/libraries/Math.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; library Math { diff --git a/packages/splits-v2/src/libraries/SplitV2.sol b/packages/splits-v2/src/libraries/SplitV2.sol index e2fed4e..961a30c 100644 --- a/packages/splits-v2/src/libraries/SplitV2.sol +++ b/packages/splits-v2/src/libraries/SplitV2.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; library SplitV2Lib { diff --git a/packages/splits-v2/src/tokens/ERC6909.sol b/packages/splits-v2/src/tokens/ERC6909.sol index cead58f..bdc3df7 100644 --- a/packages/splits-v2/src/tokens/ERC6909.sol +++ b/packages/splits-v2/src/tokens/ERC6909.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { IERC165 } from "../interfaces/IERC165.sol"; diff --git a/packages/splits-v2/src/tokens/ERC6909X.sol b/packages/splits-v2/src/tokens/ERC6909X.sol index bbaf568..b9af549 100644 --- a/packages/splits-v2/src/tokens/ERC6909X.sol +++ b/packages/splits-v2/src/tokens/ERC6909X.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { IERC6909X } from "../interfaces/IERC6909X.sol"; diff --git a/packages/splits-v2/src/utils/Nonces.sol b/packages/splits-v2/src/utils/Nonces.sol index 0931a5e..0235435 100644 --- a/packages/splits-v2/src/utils/Nonces.sol +++ b/packages/splits-v2/src/utils/Nonces.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; /** diff --git a/packages/splits-v2/test/Base.t.sol b/packages/splits-v2/test/Base.t.sol index 8cf5515..9e6ff3e 100644 --- a/packages/splits-v2/test/Base.t.sol +++ b/packages/splits-v2/test/Base.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { SplitsWarehouse } from "../src/SplitsWarehouse.sol"; diff --git a/packages/splits-v2/test/erc6909/ERC6909.t.sol b/packages/splits-v2/test/erc6909/ERC6909.t.sol index 5b22830..3f12fd7 100644 --- a/packages/splits-v2/test/erc6909/ERC6909.t.sol +++ b/packages/splits-v2/test/erc6909/ERC6909.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { BaseTest } from "../Base.t.sol"; diff --git a/packages/splits-v2/test/erc6909/ERC6909Test.sol b/packages/splits-v2/test/erc6909/ERC6909Test.sol index abcae9d..c3125b6 100644 --- a/packages/splits-v2/test/erc6909/ERC6909Test.sol +++ b/packages/splits-v2/test/erc6909/ERC6909Test.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { Cast } from "../../src/libraries/Cast.sol"; diff --git a/packages/splits-v2/test/splitters/SplitFactoryV2.t.sol b/packages/splits-v2/test/splitters/SplitFactoryV2.t.sol index 18c700e..648b21a 100644 --- a/packages/splits-v2/test/splitters/SplitFactoryV2.t.sol +++ b/packages/splits-v2/test/splitters/SplitFactoryV2.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { SplitV2Lib } from "../../src/libraries/SplitV2.sol"; diff --git a/packages/splits-v2/test/splitters/SplitWalletV2.t.sol b/packages/splits-v2/test/splitters/SplitWalletV2.t.sol index 587d405..40f7711 100644 --- a/packages/splits-v2/test/splitters/SplitWalletV2.t.sol +++ b/packages/splits-v2/test/splitters/SplitWalletV2.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { Clone } from "../../src/libraries/Clone.sol"; @@ -229,6 +229,7 @@ contract SplitWalletV2Test is BaseTest { vm.startPrank(ALICE.addr); wallet.setPaused(true); + if (split.totalAllocation == 0 && split.recipients.length > 0) vm.expectRevert(); wallet.distribute(split, token, ALICE.addr); vm.stopPrank(); @@ -256,6 +257,7 @@ contract SplitWalletV2Test is BaseTest { wallet.distribute(split, token, ALICE.addr); + if (split.totalAllocation == 0 && split.recipients.length > 0) vm.expectRevert(); assertDistribute(split, token, _warehouseAmount, _splitAmount, ALICE.addr); } @@ -278,6 +280,7 @@ contract SplitWalletV2Test is BaseTest { dealSplit(address(wallet), native, splitAmount, _warehouseAmount); + if (split.totalAllocation == 0 && split.recipients.length > 0) vm.expectRevert(); wallet.distribute(split, native, ALICE.addr); assertDistribute(split, native, _warehouseAmount, splitAmount, ALICE.addr); } diff --git a/packages/splits-v2/test/utils/Address.sol b/packages/splits-v2/test/utils/Address.sol index 14312a5..5a9aae7 100644 --- a/packages/splits-v2/test/utils/Address.sol +++ b/packages/splits-v2/test/utils/Address.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/packages/splits-v2/test/utils/ERC20.sol b/packages/splits-v2/test/utils/ERC20.sol index 429e2b1..f15f8ae 100644 --- a/packages/splits-v2/test/utils/ERC20.sol +++ b/packages/splits-v2/test/utils/ERC20.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { ERC20 as AbstractERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/packages/splits-v2/test/utils/ERC6909XUtils.sol b/packages/splits-v2/test/utils/ERC6909XUtils.sol index 9d7154b..3373762 100644 --- a/packages/splits-v2/test/utils/ERC6909XUtils.sol +++ b/packages/splits-v2/test/utils/ERC6909XUtils.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { MessageHashUtils } from "./MessageHashUtils.sol"; diff --git a/packages/splits-v2/test/utils/Fuzzer.sol b/packages/splits-v2/test/utils/Fuzzer.sol index bac5256..e160e10 100644 --- a/packages/splits-v2/test/utils/Fuzzer.sol +++ b/packages/splits-v2/test/utils/Fuzzer.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; contract Fuzzer { diff --git a/packages/splits-v2/test/utils/MessageHashUtils.sol b/packages/splits-v2/test/utils/MessageHashUtils.sol index a48e827..427407c 100644 --- a/packages/splits-v2/test/utils/MessageHashUtils.sol +++ b/packages/splits-v2/test/utils/MessageHashUtils.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; diff --git a/packages/splits-v2/test/utils/Ownable.t.sol b/packages/splits-v2/test/utils/Ownable.t.sol index 79dbfc6..a05c0eb 100644 --- a/packages/splits-v2/test/utils/Ownable.t.sol +++ b/packages/splits-v2/test/utils/Ownable.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { Ownable } from "../../src/utils/Ownable.sol"; diff --git a/packages/splits-v2/test/utils/Pausable.t.sol b/packages/splits-v2/test/utils/Pausable.t.sol index 5c516fc..b40ff9c 100644 --- a/packages/splits-v2/test/utils/Pausable.t.sol +++ b/packages/splits-v2/test/utils/Pausable.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { Pausable } from "../../src/utils/Pausable.sol"; diff --git a/packages/splits-v2/test/utils/ReentrantReceiver.sol b/packages/splits-v2/test/utils/ReentrantReceiver.sol index 07779a2..3b46be2 100644 --- a/packages/splits-v2/test/utils/ReentrantReceiver.sol +++ b/packages/splits-v2/test/utils/ReentrantReceiver.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { SplitsWarehouse } from "../../src/SplitsWarehouse.sol"; diff --git a/packages/splits-v2/test/utils/Wallet.t.sol b/packages/splits-v2/test/utils/Wallet.t.sol index 1d71918..387748f 100644 --- a/packages/splits-v2/test/utils/Wallet.t.sol +++ b/packages/splits-v2/test/utils/Wallet.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { Ownable } from "../../src/utils/Ownable.sol"; diff --git a/packages/splits-v2/test/warehouse/SplitsWarehouse.t.sol b/packages/splits-v2/test/warehouse/SplitsWarehouse.t.sol index 011c3e4..ae83fba 100644 --- a/packages/splits-v2/test/warehouse/SplitsWarehouse.t.sol +++ b/packages/splits-v2/test/warehouse/SplitsWarehouse.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { SplitsWarehouse } from "../../src/SplitsWarehouse.sol"; diff --git a/packages/splits-v2/test/warehouse/SplitsWarehouseHandler.sol b/packages/splits-v2/test/warehouse/SplitsWarehouseHandler.sol index 29c24ce..c0a1d09 100644 --- a/packages/splits-v2/test/warehouse/SplitsWarehouseHandler.sol +++ b/packages/splits-v2/test/warehouse/SplitsWarehouseHandler.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { SplitsWarehouse } from "../../src/SplitsWarehouse.sol"; @@ -100,6 +100,33 @@ contract SplitsWarehouseHandler is CommonBase, StdCheats, StdUtils { warehouseBalance[token] -= balance - 1; } + function withdraw(uint256 _user, uint256[2] memory _amounts, uint256 _withdrawer) public { + _user = bound(_user, 0, users.length - 1); + address user = users[_user]; + + _withdrawer = bound(_withdrawer, 0, users.length - 1); + address withdrawer = users[_withdrawer]; + + address[] memory _tokens = new address[](2); + uint256[] memory amounts = new uint256[](2); + + for (uint256 i = 0; i < 2; i++) { + _tokens[i] = tokens[i]; + amounts[i] = bound(_amounts[i], 0, warehouse.balanceOf(user, _tokens[i].toUint256())); + } + + (, bool paused) = warehouse.withdrawConfig(user); + + vm.prank(withdrawer); + if (user == badActor || paused) { + return; + } + warehouse.withdraw(user, _tokens, amounts, withdrawer); + + warehouseBalance[tokens[0]] -= amounts[0]; + warehouseBalance[tokens[1]] -= amounts[1]; + } + function transfer(uint256 _sender, uint256 _receiver, uint256 _token, uint256 _amount) public mockUser(_sender) { _sender = bound(_sender, 0, users.length - 1); _receiver = bound(_receiver, 0, users.length - 1); @@ -192,6 +219,42 @@ contract SplitsWarehouseHandler is CommonBase, StdCheats, StdUtils { warehouse.batchTransfer(receiverAddresses, token, amounts); } + function batchDeposit( + uint256 _sender, + uint256[5] memory _receivers, + uint256[5] memory _amounts, + uint256 _token + ) + public + mockUser(_sender) + { + address[] memory receiverAddresses = new address[](5); + uint256[] memory amounts = new uint256[](5); + _sender = bound(_sender, 0, users.length - 1); + _token = bound(_token, 0, tokens.length - 1); + address token = tokens[_token]; + + uint256 balance = token == native ? address(this).balance : IERC20(tokens[_token]).balanceOf(address(this)); + uint256 amount = 0; + for (uint256 i = 0; i < 5; i++) { + _receivers[i] = bound(_receivers[i], 0, users.length - 1); + receiverAddresses[i] = users[_receivers[i]]; + + amounts[i] = bound(_amounts[i], 0, balance); + balance -= amounts[i]; + amount += amounts[i]; + } + + if (token == native) { + warehouse.batchDeposit{ value: amount }(receiverAddresses, token, amounts); + } else { + IERC20(token).approve(address(warehouse), amount); + warehouse.batchDeposit(receiverAddresses, token, amounts); + } + + warehouseBalance[token] += amount; + } + function filter( address[5] memory owners, uint96[5] memory amounts diff --git a/packages/splits-v2/test/warehouse/SplitsWarehouseInvariant.t.sol b/packages/splits-v2/test/warehouse/SplitsWarehouseInvariant.t.sol index b0ca0bd..2d926a4 100644 --- a/packages/splits-v2/test/warehouse/SplitsWarehouseInvariant.t.sol +++ b/packages/splits-v2/test/warehouse/SplitsWarehouseInvariant.t.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.18; import { Cast } from "../../src/libraries/Cast.sol";