@@ -46,19 +46,22 @@ contract Escrow is Owned, IEscrow {
4646 uint public batchCount;
4747 uint public protocolFeeBps;
4848 address public feeRecipient;
49+ uint public batchDepositLimit;
4950
5051 constructor (
5152 address _owner ,
5253 address _signer ,
5354 address [] memory _initialWhitelistedTokens ,
54- uint _initialFeeBps
55+ uint _initialFeeBps ,
56+ uint _initialBatchDepositLimit
5557 ) Owned (_owner) {
5658 require (_initialFeeBps <= MAX_FEE_BPS, Errors.INVALID_FEE);
5759 feeRecipient = _owner;
5860 protocolFeeBps = _initialFeeBps;
5961 CLAIM_INITIAL_CHAIN_ID = block .chainid ;
6062 CLAIM_INITIAL_DOMAIN_SEPARATOR = _computeClaimDomainSeparator ();
6163 signer = _signer;
64+ batchDepositLimit = _initialBatchDepositLimit;
6265
6366 for (uint256 i = 0 ; i < _initialWhitelistedTokens.length ; i++ ) {
6467 _whitelistedTokens.add (_initialWhitelistedTokens[i]);
@@ -129,6 +132,7 @@ contract Escrow is Owned, IEscrow {
129132 external
130133 returns (uint [] memory depositIds )
131134 {
135+ require (params.length <= batchDepositLimit, Errors.BATCH_DEPOSIT_LIMIT_EXCEEDED);
132136 depositIds = new uint [](params.length );
133137
134138 for (uint256 i = 0 ; i < params.length ; i++ ) {
@@ -274,7 +278,7 @@ contract Escrow is Owned, IEscrow {
274278 }
275279
276280 /*//////////////////////////////////////////////////////////////
277- WHITELIST
281+ OWNER OPERATIONS
278282 //////////////////////////////////////////////////////////////*/
279283 function addWhitelistedToken (address token ) external onlyOwner {
280284 require (token != address (0 ), Errors.INVALID_ADDRESS);
@@ -291,31 +295,6 @@ contract Escrow is Owned, IEscrow {
291295 return _whitelistedTokens.contains (token);
292296 }
293297
294- function getWhitelistedTokens () external view returns (address [] memory ) {
295- uint256 length = _whitelistedTokens.length ();
296- address [] memory tokens = new address [](length);
297-
298- for (uint256 i = 0 ; i < length; i++ ) {
299- tokens[i] = _whitelistedTokens.at (i);
300- }
301-
302- return tokens;
303- }
304-
305- /*//////////////////////////////////////////////////////////////
306- GETTERS
307- //////////////////////////////////////////////////////////////*/
308- function getDepositsBySender (address sender ) external view returns (uint [] memory ) {
309- return senderDeposits[sender];
310- }
311-
312- function getDepositsByRecipient (address recipient ) external view returns (uint [] memory ) {
313- return recipientDeposits[recipient];
314- }
315-
316- /*//////////////////////////////////////////////////////////////
317- FEE MANAGEMENT (Owner Only)
318- //////////////////////////////////////////////////////////////*/
319298 function setProtocolFeeBps (uint _newFeeBps ) external onlyOwner {
320299 require (_newFeeBps <= MAX_FEE_BPS, Errors.INVALID_FEE);
321300 protocolFeeBps = _newFeeBps;
@@ -328,12 +307,37 @@ contract Escrow is Owned, IEscrow {
328307 emit FeeRecipientSet (_newFeeRecipient);
329308 }
330309
331- /*//////////////////////////////////////////////////////////////
332- SIGNER MANAGEMENT (Owner Only)
333- //////////////////////////////////////////////////////////////*/
334310 function setSigner (address _newSigner ) external onlyOwner {
335311 require (_newSigner != address (0 ), Errors.INVALID_ADDRESS);
336312 signer = _newSigner;
337313 emit SignerSet (_newSigner);
338314 }
315+
316+ function setBatchDepositLimit (uint _newLimit ) external onlyOwner {
317+ require (_newLimit > 0 , Errors.INVALID_BATCH_DEPOSIT_LIMIT);
318+ batchDepositLimit = _newLimit;
319+ emit BatchDepositLimitSet (_newLimit);
320+ }
321+
322+ /*//////////////////////////////////////////////////////////////
323+ GETTERS
324+ //////////////////////////////////////////////////////////////*/
325+ function getDepositsBySender (address sender ) external view returns (uint [] memory ) {
326+ return senderDeposits[sender];
327+ }
328+
329+ function getDepositsByRecipient (address recipient ) external view returns (uint [] memory ) {
330+ return recipientDeposits[recipient];
331+ }
332+
333+ function getWhitelistedTokens () external view returns (address [] memory ) {
334+ uint256 length = _whitelistedTokens.length ();
335+ address [] memory tokens = new address [](length);
336+
337+ for (uint256 i = 0 ; i < length; i++ ) {
338+ tokens[i] = _whitelistedTokens.at (i);
339+ }
340+
341+ return tokens;
342+ }
339343}
0 commit comments