-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathMockNttManager.sol
92 lines (79 loc) · 2.56 KB
/
MockNttManager.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// SPDX-License-Identifier: Apache 2
pragma solidity >=0.8.8 <0.9.0;
import "../../src/NttManager/NttManager.sol";
contract MockNttManagerContract is NttManager {
constructor(
address token,
Mode mode,
uint16 chainId,
uint64 rateLimitDuration,
bool skipRateLimiting
) NttManager(token, mode, chainId, rateLimitDuration, skipRateLimiting) {}
/// We create a dummy storage variable here with standard solidity slot assignment.
/// Then we check that its assigned slot is 0, i.e. that the super contract doesn't
/// define any storage variables (and instead uses deterministic slots).
/// See `test_noAutomaticSlot` below.
uint256 my_slot;
function lastSlot() public pure returns (bytes32 result) {
assembly ("memory-safe") {
result := my_slot.slot
}
}
}
contract MockNttManagerMigrateBasic is NttManager {
// Call the parents constructor
constructor(
address token,
Mode mode,
uint16 chainId,
uint64 rateLimitDuration,
bool skipRateLimiting
) NttManager(token, mode, chainId, rateLimitDuration, skipRateLimiting) {}
function _migrate() internal view override {
_checkThresholdInvariants();
_checkTransceiversInvariants();
revert("Proper migrate called");
}
}
contract MockNttManagerImmutableCheck is NttManager {
// Call the parents constructor
constructor(
address token,
Mode mode,
uint16 chainId,
uint64 rateLimitDuration,
bool skipRateLimiting
) NttManager(token, mode, chainId, rateLimitDuration, skipRateLimiting) {}
}
contract MockNttManagerImmutableRemoveCheck is NttManager {
// Call the parents constructor
constructor(
address token,
Mode mode,
uint16 chainId,
uint64 rateLimitDuration,
bool skipRateLimiting
) NttManager(token, mode, chainId, rateLimitDuration, skipRateLimiting) {}
// Turns on the capability to EDIT the immutables
function _migrate() internal override {
_setMigratesImmutables(true);
}
}
contract MockNttManagerStorageLayoutChange is NttManager {
address a;
address b;
address c;
// Call the parents constructor
constructor(
address token,
Mode mode,
uint16 chainId,
uint64 rateLimitDuration,
bool skipRateLimiting
) NttManager(token, mode, chainId, rateLimitDuration, skipRateLimiting) {}
function setData() public {
a = address(0x1);
b = address(0x2);
c = address(0x3);
}
}