@mapprotocol/common-contracts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -0
- package/artifacts/contracts/AuthorityManager.sol/AuthorityManager.json +1237 -0
- package/artifacts/contracts/base/BaseImplemention.sol/BaseImplementation.json +298 -0
- package/contracts/AuthorityManager.sol +60 -0
- package/contracts/base/BaseImplemention.sol +38 -0
- package/package.json +73 -0
- package/typechain-types/@openzeppelin/contracts/access/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/access/manager/AccessManager.ts +1109 -0
- package/typechain-types/@openzeppelin/contracts/access/manager/IAccessManaged.ts +148 -0
- package/typechain-types/@openzeppelin/contracts/access/manager/IAccessManager.ts +1073 -0
- package/typechain-types/@openzeppelin/contracts/access/manager/IAuthority.ts +96 -0
- package/typechain-types/@openzeppelin/contracts/access/manager/index.ts +7 -0
- package/typechain-types/@openzeppelin/contracts/index.ts +11 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/IERC1967.ts +168 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.ts +90 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/index.ts +4 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/index.ts +6 -0
- package/typechain-types/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/proxy/ERC1967/index.ts +4 -0
- package/typechain-types/@openzeppelin/contracts/proxy/beacon/IBeacon.ts +90 -0
- package/typechain-types/@openzeppelin/contracts/proxy/beacon/index.ts +4 -0
- package/typechain-types/@openzeppelin/contracts/proxy/index.ts +7 -0
- package/typechain-types/@openzeppelin/contracts/utils/Address.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/Multicall.ts +87 -0
- package/typechain-types/@openzeppelin/contracts/utils/index.ts +8 -0
- package/typechain-types/@openzeppelin/contracts/utils/math/SafeCast.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/math/index.ts +4 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/access/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.ts +185 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/access/manager/index.ts +4 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/index.ts +9 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/proxy/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.ts +105 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.ts +196 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/proxy/utils/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.ts +105 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.ts +183 -0
- package/typechain-types/@openzeppelin/contracts-upgradeable/utils/index.ts +5 -0
- package/typechain-types/@openzeppelin/index.ts +7 -0
- package/typechain-types/common.ts +131 -0
- package/typechain-types/contracts/AuthorityManager.ts +1163 -0
- package/typechain-types/contracts/base/BaseImplemention.sol/BaseImplementation.ts +363 -0
- package/typechain-types/contracts/base/BaseImplemention.sol/index.ts +4 -0
- package/typechain-types/contracts/base/index.ts +5 -0
- package/typechain-types/contracts/index.ts +6 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/manager/AccessManager__factory.ts +1240 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/manager/IAccessManaged__factory.ts +115 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/manager/IAccessManager__factory.ts +1085 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/manager/IAuthority__factory.ts +51 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/manager/index.ts +7 -0
- package/typechain-types/factories/@openzeppelin/contracts/index.ts +7 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1967__factory.ts +67 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable__factory.ts +38 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils__factory.ts +105 -0
- package/typechain-types/factories/@openzeppelin/contracts/proxy/ERC1967/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/proxy/beacon/IBeacon__factory.ts +35 -0
- package/typechain-types/factories/@openzeppelin/contracts/proxy/beacon/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/proxy/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/Address__factory.ts +75 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/Errors__factory.ts +101 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/Multicall__factory.ts +57 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/index.ts +7 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.ts +118 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/math/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/access/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable__factory.ts +142 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/access/manager/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/index.ts +6 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/proxy/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable__factory.ts +48 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable__factory.ts +153 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/proxy/utils/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable__factory.ts +48 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable__factory.ts +101 -0
- package/typechain-types/factories/@openzeppelin/contracts-upgradeable/utils/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/index.ts +5 -0
- package/typechain-types/factories/contracts/AuthorityManager__factory.ts +1302 -0
- package/typechain-types/factories/contracts/base/BaseImplemention.sol/BaseImplementation__factory.ts +312 -0
- package/typechain-types/factories/contracts/base/BaseImplemention.sol/index.ts +4 -0
- package/typechain-types/factories/contracts/base/index.ts +4 -0
- package/typechain-types/factories/contracts/index.ts +5 -0
- package/typechain-types/factories/index.ts +5 -0
- package/typechain-types/hardhat.d.ts +387 -0
- package/typechain-types/index.ts +46 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "BaseImplementation",
|
|
4
|
+
"sourceName": "contracts/base/BaseImplemention.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [
|
|
8
|
+
{
|
|
9
|
+
"internalType": "address",
|
|
10
|
+
"name": "authority",
|
|
11
|
+
"type": "address"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"name": "AccessManagedInvalidAuthority",
|
|
15
|
+
"type": "error"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"inputs": [
|
|
19
|
+
{
|
|
20
|
+
"internalType": "address",
|
|
21
|
+
"name": "caller",
|
|
22
|
+
"type": "address"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"internalType": "uint32",
|
|
26
|
+
"name": "delay",
|
|
27
|
+
"type": "uint32"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"name": "AccessManagedRequiredDelay",
|
|
31
|
+
"type": "error"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"inputs": [
|
|
35
|
+
{
|
|
36
|
+
"internalType": "address",
|
|
37
|
+
"name": "caller",
|
|
38
|
+
"type": "address"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"name": "AccessManagedUnauthorized",
|
|
42
|
+
"type": "error"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"inputs": [
|
|
46
|
+
{
|
|
47
|
+
"internalType": "address",
|
|
48
|
+
"name": "target",
|
|
49
|
+
"type": "address"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"name": "AddressEmptyCode",
|
|
53
|
+
"type": "error"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"inputs": [
|
|
57
|
+
{
|
|
58
|
+
"internalType": "address",
|
|
59
|
+
"name": "implementation",
|
|
60
|
+
"type": "address"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"name": "ERC1967InvalidImplementation",
|
|
64
|
+
"type": "error"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"inputs": [],
|
|
68
|
+
"name": "ERC1967NonPayable",
|
|
69
|
+
"type": "error"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"inputs": [],
|
|
73
|
+
"name": "EnforcedPause",
|
|
74
|
+
"type": "error"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"inputs": [],
|
|
78
|
+
"name": "ExpectedPause",
|
|
79
|
+
"type": "error"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"inputs": [],
|
|
83
|
+
"name": "FailedCall",
|
|
84
|
+
"type": "error"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"inputs": [],
|
|
88
|
+
"name": "InvalidInitialization",
|
|
89
|
+
"type": "error"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"inputs": [],
|
|
93
|
+
"name": "NotInitializing",
|
|
94
|
+
"type": "error"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"inputs": [],
|
|
98
|
+
"name": "UUPSUnauthorizedCallContext",
|
|
99
|
+
"type": "error"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"inputs": [
|
|
103
|
+
{
|
|
104
|
+
"internalType": "bytes32",
|
|
105
|
+
"name": "slot",
|
|
106
|
+
"type": "bytes32"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"name": "UUPSUnsupportedProxiableUUID",
|
|
110
|
+
"type": "error"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"anonymous": false,
|
|
114
|
+
"inputs": [
|
|
115
|
+
{
|
|
116
|
+
"indexed": false,
|
|
117
|
+
"internalType": "address",
|
|
118
|
+
"name": "authority",
|
|
119
|
+
"type": "address"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"name": "AuthorityUpdated",
|
|
123
|
+
"type": "event"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"anonymous": false,
|
|
127
|
+
"inputs": [
|
|
128
|
+
{
|
|
129
|
+
"indexed": false,
|
|
130
|
+
"internalType": "uint64",
|
|
131
|
+
"name": "version",
|
|
132
|
+
"type": "uint64"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"name": "Initialized",
|
|
136
|
+
"type": "event"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"anonymous": false,
|
|
140
|
+
"inputs": [
|
|
141
|
+
{
|
|
142
|
+
"indexed": false,
|
|
143
|
+
"internalType": "address",
|
|
144
|
+
"name": "account",
|
|
145
|
+
"type": "address"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"name": "Paused",
|
|
149
|
+
"type": "event"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"anonymous": false,
|
|
153
|
+
"inputs": [
|
|
154
|
+
{
|
|
155
|
+
"indexed": false,
|
|
156
|
+
"internalType": "address",
|
|
157
|
+
"name": "account",
|
|
158
|
+
"type": "address"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"name": "Unpaused",
|
|
162
|
+
"type": "event"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"anonymous": false,
|
|
166
|
+
"inputs": [
|
|
167
|
+
{
|
|
168
|
+
"indexed": true,
|
|
169
|
+
"internalType": "address",
|
|
170
|
+
"name": "implementation",
|
|
171
|
+
"type": "address"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"name": "Upgraded",
|
|
175
|
+
"type": "event"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"inputs": [],
|
|
179
|
+
"name": "UPGRADE_INTERFACE_VERSION",
|
|
180
|
+
"outputs": [
|
|
181
|
+
{
|
|
182
|
+
"internalType": "string",
|
|
183
|
+
"name": "",
|
|
184
|
+
"type": "string"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"stateMutability": "view",
|
|
188
|
+
"type": "function"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"inputs": [],
|
|
192
|
+
"name": "authority",
|
|
193
|
+
"outputs": [
|
|
194
|
+
{
|
|
195
|
+
"internalType": "address",
|
|
196
|
+
"name": "",
|
|
197
|
+
"type": "address"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"stateMutability": "view",
|
|
201
|
+
"type": "function"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"inputs": [],
|
|
205
|
+
"name": "getImplementation",
|
|
206
|
+
"outputs": [
|
|
207
|
+
{
|
|
208
|
+
"internalType": "address",
|
|
209
|
+
"name": "",
|
|
210
|
+
"type": "address"
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"stateMutability": "view",
|
|
214
|
+
"type": "function"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"inputs": [],
|
|
218
|
+
"name": "isConsumingScheduledOp",
|
|
219
|
+
"outputs": [
|
|
220
|
+
{
|
|
221
|
+
"internalType": "bytes4",
|
|
222
|
+
"name": "",
|
|
223
|
+
"type": "bytes4"
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
"stateMutability": "view",
|
|
227
|
+
"type": "function"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"inputs": [],
|
|
231
|
+
"name": "paused",
|
|
232
|
+
"outputs": [
|
|
233
|
+
{
|
|
234
|
+
"internalType": "bool",
|
|
235
|
+
"name": "",
|
|
236
|
+
"type": "bool"
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
"stateMutability": "view",
|
|
240
|
+
"type": "function"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"inputs": [],
|
|
244
|
+
"name": "proxiableUUID",
|
|
245
|
+
"outputs": [
|
|
246
|
+
{
|
|
247
|
+
"internalType": "bytes32",
|
|
248
|
+
"name": "",
|
|
249
|
+
"type": "bytes32"
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
"stateMutability": "view",
|
|
253
|
+
"type": "function"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"inputs": [
|
|
257
|
+
{
|
|
258
|
+
"internalType": "address",
|
|
259
|
+
"name": "newAuthority",
|
|
260
|
+
"type": "address"
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
"name": "setAuthority",
|
|
264
|
+
"outputs": [],
|
|
265
|
+
"stateMutability": "nonpayable",
|
|
266
|
+
"type": "function"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"inputs": [],
|
|
270
|
+
"name": "trigger",
|
|
271
|
+
"outputs": [],
|
|
272
|
+
"stateMutability": "nonpayable",
|
|
273
|
+
"type": "function"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"inputs": [
|
|
277
|
+
{
|
|
278
|
+
"internalType": "address",
|
|
279
|
+
"name": "newImplementation",
|
|
280
|
+
"type": "address"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"internalType": "bytes",
|
|
284
|
+
"name": "data",
|
|
285
|
+
"type": "bytes"
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
"name": "upgradeToAndCall",
|
|
289
|
+
"outputs": [],
|
|
290
|
+
"stateMutability": "payable",
|
|
291
|
+
"type": "function"
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
"bytecode": "0x",
|
|
295
|
+
"deployedBytecode": "0x",
|
|
296
|
+
"linkReferences": {},
|
|
297
|
+
"deployedLinkReferences": {}
|
|
298
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.24;
|
|
3
|
+
|
|
4
|
+
import { AccessManager } from "@openzeppelin/contracts/access/manager/AccessManager.sol";
|
|
5
|
+
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
6
|
+
|
|
7
|
+
contract AuthorityManager is AccessManager {
|
|
8
|
+
using EnumerableSet for EnumerableSet.AddressSet;
|
|
9
|
+
|
|
10
|
+
mapping(uint64 role => EnumerableSet.AddressSet) private _roleMembers;
|
|
11
|
+
|
|
12
|
+
constructor(address default_admin) AccessManager(default_admin) {
|
|
13
|
+
_roleMembers[ADMIN_ROLE].add(default_admin);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getRoleMember(uint64 role, uint256 index) public view virtual returns (address) {
|
|
17
|
+
return _roleMembers[role].at(index);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getRoleMemberCount(uint64 role) public view virtual returns (uint256) {
|
|
21
|
+
return _roleMembers[role].length();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getRoleMembers(uint64 role) public view virtual returns (address[] memory) {
|
|
25
|
+
return _roleMembers[role].values();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function grantRole(
|
|
29
|
+
uint64 roleId,
|
|
30
|
+
address account,
|
|
31
|
+
uint32 executionDelay
|
|
32
|
+
)
|
|
33
|
+
public
|
|
34
|
+
override
|
|
35
|
+
onlyAuthorized
|
|
36
|
+
{
|
|
37
|
+
bool granted = _grantRole(roleId, account, getRoleGrantDelay(roleId), executionDelay);
|
|
38
|
+
if (granted) {
|
|
39
|
+
_roleMembers[roleId].add(account);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function revokeRole(uint64 roleId, address account) public override onlyAuthorized {
|
|
44
|
+
bool revoked = _revokeRole(roleId, account);
|
|
45
|
+
if (revoked) {
|
|
46
|
+
_roleMembers[roleId].remove(account);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function renounceRole(uint64 roleId, address callerConfirmation) public override {
|
|
51
|
+
if (callerConfirmation != _msgSender()) {
|
|
52
|
+
revert AccessManagerBadConfirmation();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
bool revoked = _revokeRole(roleId, callerConfirmation);
|
|
56
|
+
if (revoked) {
|
|
57
|
+
_roleMembers[roleId].remove(callerConfirmation);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import { ERC1967Utils } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
|
|
5
|
+
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
6
|
+
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
|
|
7
|
+
import { AccessManagedUpgradeable } from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
|
8
|
+
|
|
9
|
+
abstract contract BaseImplementation is
|
|
10
|
+
UUPSUpgradeable,
|
|
11
|
+
PausableUpgradeable,
|
|
12
|
+
AccessManagedUpgradeable
|
|
13
|
+
{
|
|
14
|
+
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
15
|
+
constructor() {
|
|
16
|
+
_disableInitializers();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function __BaseImplementation_init(address _defaultAdmin) internal onlyInitializing {
|
|
20
|
+
__Pausable_init();
|
|
21
|
+
__AccessManaged_init(_defaultAdmin);
|
|
22
|
+
__UUPSUpgradeable_init();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function __BaseImplementation_init_unchained(address _defaultAdmin) internal onlyInitializing {
|
|
26
|
+
// Reserved for future use
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function trigger() external restricted {
|
|
30
|
+
paused() ? _unpause() : _pause();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _authorizeUpgrade(address newImplementation) internal virtual override restricted { }
|
|
34
|
+
|
|
35
|
+
function getImplementation() external view returns (address) {
|
|
36
|
+
return ERC1967Utils.getImplementation();
|
|
37
|
+
}
|
|
38
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mapprotocol/common-contracts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Common contracts for MAP Protocol",
|
|
5
|
+
"main": "typechain-types/index.js",
|
|
6
|
+
"types": "typechain-types/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"contracts/**/*.sol",
|
|
9
|
+
"artifacts/contracts/**/*.json",
|
|
10
|
+
"!artifacts/contracts/**/*.dbg.json",
|
|
11
|
+
"typechain-types/**/*",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/mapprotocol/mapo-contracts-v2.git",
|
|
17
|
+
"directory": "common"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/mapprotocol/mapo-contracts-v2/tree/main/common",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/mapprotocol/mapo-contracts-v2/issues"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"registry": "https://registry.npmjs.org/"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "forge build",
|
|
29
|
+
"build:hardhat": "hardhat compile",
|
|
30
|
+
"test": "forge test",
|
|
31
|
+
"test:hardhat": "hardhat test",
|
|
32
|
+
"format": "forge fmt",
|
|
33
|
+
"clean": "forge clean && hardhat clean && rm -rf typechain-types",
|
|
34
|
+
"compile": "hardhat compile",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"gas-report": "forge test --gas-report",
|
|
37
|
+
"coverage": "forge coverage",
|
|
38
|
+
"prepublishOnly": "npm run clean && npm run build:hardhat && npm run typecheck"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"solidity",
|
|
42
|
+
"ethereum",
|
|
43
|
+
"smart-contracts",
|
|
44
|
+
"map-protocol"
|
|
45
|
+
],
|
|
46
|
+
"author": "MAP Protocol",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@openzeppelin/contracts": "^5.4.0",
|
|
50
|
+
"@openzeppelin/contracts-upgradeable": "^5.4.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
|
|
54
|
+
"@nomicfoundation/hardhat-ethers": "^3.0.0",
|
|
55
|
+
"@nomicfoundation/hardhat-foundry": "^1.1.1",
|
|
56
|
+
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
|
|
57
|
+
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
|
|
58
|
+
"@nomicfoundation/hardhat-verify": "^2.0.0",
|
|
59
|
+
"@typechain/ethers-v6": "^0.5.0",
|
|
60
|
+
"@typechain/hardhat": "^9.0.0",
|
|
61
|
+
"@types/chai": "^4.2.0",
|
|
62
|
+
"@types/mocha": ">=9.1.0",
|
|
63
|
+
"@types/node": ">=18.0.0",
|
|
64
|
+
"chai": "^4.2.0",
|
|
65
|
+
"ethers": "^6.4.0",
|
|
66
|
+
"hardhat": "^2.19.0",
|
|
67
|
+
"hardhat-gas-reporter": "^1.0.8",
|
|
68
|
+
"solidity-coverage": "^0.8.0",
|
|
69
|
+
"ts-node": ">=8.0.0",
|
|
70
|
+
"typechain": "^8.3.0",
|
|
71
|
+
"typescript": ">=4.5.0"
|
|
72
|
+
}
|
|
73
|
+
}
|