@@ -4,7 +4,7 @@ pragma solidity 0.8.23;
44import {Address} from "@openzeppelin/contracts/utils/Address.sol " ;
55
66library PoseidonUnit1L {
7- function poseidon (uint256 [1 ] calldata ) public pure returns (uint256 ) {}
7+ function poseidon (bytes32 [1 ] calldata ) public pure returns (bytes32 ) {}
88}
99
1010/**
@@ -26,7 +26,7 @@ contract Depositor {
2626 /**
2727 * @notice Represents the minimum time (in seconds) that a deposit must be locked in the contract. Set to one hour.
2828 */
29- uint256 public constant HOUR = 60 * 60 ;
29+ uint256 public constant MIN_LOCK_TIME = 1 hours ;
3030
3131 /**
3232 * @notice Struct to store details of each deposit.
@@ -84,9 +84,8 @@ contract Depositor {
8484
8585 /**
8686 * @notice Error thrown when a deposit is attempted with an amount of 0 ETH.
87- * @param sentAmount The amount of ETH attempted to be deposited, expected to be greater than 0.
8887 */
89- error InsufficientDepositAmount ( uint256 sentAmount );
88+ error ZeroDepositAmount ( );
9089
9190 /**
9291 * @notice Error thrown when a deposit with the given secret hash already exists.
@@ -134,9 +133,9 @@ contract Depositor {
134133 * @param lockTime_ The duration (in seconds) for which the deposit is locked and cannot be withdrawn.
135134 */
136135 function deposit (address recipient_ , bytes32 secretHash_ , uint256 lockTime_ ) external payable {
137- if (msg .value == 0 ) revert InsufficientDepositAmount ( msg . value );
136+ if (msg .value == 0 ) revert ZeroDepositAmount ( );
138137 if (deposits[secretHash_].amount != 0 ) revert DepositAlreadyExists (secretHash_);
139- if (lockTime_ < HOUR ) revert LockTimeTooShort (lockTime_, HOUR );
138+ if (lockTime_ < MIN_LOCK_TIME ) revert LockTimeTooShort (lockTime_, MIN_LOCK_TIME );
140139 if (recipient_ == address (0 )) revert ZeroAddressNotAllowed ();
141140
142141 deposits[secretHash_] = Deposit ({
@@ -157,7 +156,7 @@ contract Depositor {
157156 * @param secret_ The prototype of the `secretHash` used in the deposit function.
158157 */
159158 function withdraw (bytes32 secret_ ) external {
160- bytes32 secretHash_ = bytes32 ( PoseidonUnit1L.poseidon ([uint256 ( secret_)]) );
159+ bytes32 secretHash_ = PoseidonUnit1L.poseidon ([secret_] );
161160
162161 Deposit storage userDeposit = deposits[secretHash_];
163162
0 commit comments