@@ -4,7 +4,6 @@ pragma solidity 0.8.24;
44import { IPriceCalculator } from "./IPriceCalculator.sol " ;
55import { IERC20 } from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol " ;
66import { SafeERC20 } from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol " ;
7- import { ERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol " ;
87import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol " ;
98
109// The rate limit is outside the expected limits
@@ -209,63 +208,6 @@ abstract contract MembershipUpgradeable is Initializable {
209208 IERC20 (token).safeTransferFrom (_sender, address (this ), depositAmount);
210209 }
211210
212- /// @dev acquire a membership and transfer the deposit to the contract
213- /// Uses the RC20 Permit extension allowing approvals to be made via signatures, as defined in
214- /// [EIP-2612](https://eips.ethereum.org/EIPS/eip-2612).
215- /// @param _owner The address of the token owner who is giving permission and will own the membership.
216- /// @param _deadline The timestamp until when the permit is valid.
217- /// @param _v The recovery byte of the signature.
218- /// @param _r Half of the ECDSA signature pair.
219- /// @param _s Half of the ECDSA signature pair.
220- /// @param _idCommitment the idCommitment of the new membership
221- /// @param _rateLimit the membership rate limit
222- /// @return index the index of the new membership in the membership set
223- /// @return indexReused true if the index was reused, false otherwise
224- function _acquireMembershipWithPermit (
225- address _owner ,
226- uint256 _deadline ,
227- uint8 _v ,
228- bytes32 _r ,
229- bytes32 _s ,
230- uint256 _idCommitment ,
231- uint32 _rateLimit
232- )
233- internal
234- returns (uint32 index , bool indexReused )
235- {
236- // Check if the rate limit is valid
237- if (! isValidMembershipRateLimit (_rateLimit)) {
238- revert InvalidMembershipRateLimit ();
239- }
240-
241- currentTotalRateLimit += _rateLimit;
242-
243- // Determine if we exceed the total rate limit
244- if (currentTotalRateLimit > maxTotalRateLimit) {
245- revert CannotExceedMaxTotalRateLimit ();
246- }
247-
248- (address token , uint256 depositAmount ) = priceCalculator.calculate (_rateLimit);
249-
250- ERC20Permit (token).permit (_owner, address (this ), depositAmount, _deadline, _v, _r, _s);
251-
252- // Possibly reuse an index of an erased membership
253- (index, indexReused) = _getFreeIndex ();
254-
255- memberships[_idCommitment] = MembershipInfo ({
256- holder: _owner,
257- activeDuration: activeDurationForNewMemberships,
258- gracePeriodStartTimestamp: block .timestamp + uint256 (activeDurationForNewMemberships),
259- gracePeriodDuration: gracePeriodDurationForNewMemberships,
260- token: token,
261- depositAmount: depositAmount,
262- rateLimit: _rateLimit,
263- index: index
264- });
265-
266- IERC20 (token).safeTransferFrom (_owner, address (this ), depositAmount);
267- }
268-
269211 /// @notice Checks if a rate limit is within the allowed bounds
270212 /// @param rateLimit The rate limit
271213 /// @return true if the rate limit is within the allowed bounds, false otherwise
0 commit comments