Skip to content

Commit dd89e1c

Browse files
feat: add TransientLockUnsafeMock contract and enhance TransientLock tests for improved locking functionality
1 parent fffc457 commit dd89e1c

3 files changed

Lines changed: 241 additions & 218 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.30;
3+
4+
import "../../libraries/TransientLockUnsafe.sol";
5+
6+
contract TransientLockUnsafeMock {
7+
using TransientLockUnsafeLib for TransientLock;
8+
9+
TransientLock private _lock;
10+
11+
function lock() external {
12+
_lock.lock();
13+
}
14+
15+
function unlock() external {
16+
_lock.unlock();
17+
}
18+
19+
function isLocked() external view returns (bool) {
20+
return _lock.isLocked();
21+
}
22+
23+
function lockAndCheck() external returns (bool) {
24+
_lock.lock();
25+
return _lock.isLocked();
26+
}
27+
28+
function lockUnlockAndCheck() external returns (bool) {
29+
_lock.lock();
30+
_lock.unlock();
31+
return _lock.isLocked();
32+
}
33+
34+
function doubleLock() external {
35+
_lock.lock();
36+
_lock.lock();
37+
}
38+
39+
function unlockWithoutLock() external {
40+
_lock.unlock();
41+
}
42+
}

0 commit comments

Comments
 (0)