Share
Buy $MOVE
Scotty Beam (SCOTTY)

0x0003...6f6c

Overall Score

0/100

We can't be 100% sure, but this token is likely a honeypot! Exercise extra caution - you might not be able to withdraw funds or sell your tokens.

1// Beginning of TransparentUpgradeableProxy.sol
2// SPDX-License-Identifier: MIT
3
4pragma solidity =0.8.4;
5
6/**
7 * @dev This is the interface that {BeaconProxy} expects of its beacon.
8 */
9interface IBeacon {
10 /**
11 * @dev Must return an address that can be used as a delegate call target.
12 *
13 * {BeaconProxy} will check that this address is a contract.
14 */
15 function implementation() external view returns (address);
16}
17
18/**
19 * @dev Library for reading and writing primitive types to specific storage slots.
20 *
21 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
22 * This library helps with reading and writing to such slots without the need for inline assembly.
23 *
24 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
25 *
26 * Example usage to set ERC1967 implementation slot:
27 * ```
28 * contract ERC1967 {
29 * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
30 *
31 * function _getImplementation() internal view returns (address) {
32 * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
33 * }
34 *
35 * function _setImplementation(address newImplementation) internal {
36 * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
37 * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
38 * }
39 * }
40 * ```
41 *
42 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
43 */
44library StorageSlot {
45 struct AddressSlot {
46 address value;
47 }
48
49 struct BooleanSlot {
50 bool value;
51 }
52
53 struct Bytes32Slot {
54 bytes32 value;
55 }
56
57 struct Uint256Slot {
58 uint256 value;
59 }
60
61 /**
62 * @dev Returns an `AddressSlot` with member `value` located at `slot`.
63 */
64 function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
65 assembly {
66 r.slot := slot
67 }
68 }
69
70 /**
71 * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
72 */
73 function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
74 assembly {
75 r.slot := slot
76 }
77 }
78
79 /**
80 * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
81 */
82 function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
83 assembly {
84 r.slot := slot
85 }
86 }
87
88 /**
89 * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
90 */
91 function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
92 assembly {
93 r.slot := slot
94 }
95 }
96}
97
98/**
99 * @dev Collection of functions related to the address type
100 */
101library Address {
102 /**
103 * @dev Returns true if `account` is a contract.
104 *
105 * [IMPORTANT]
106 * ====
107 * It is unsafe to assume that an address for which this function returns
108 * false is an externally-owned account (EOA) and not a contract.
109 *
110 * Among others, `isContract` will return false for the following
111 * types of addresses:
112 *
113 * - an externally-owned account
114 * - a contract in construction
115 * - an address where a contract will be created
116 * - an address where a contract lived, but was destroyed
117 * ====
118 */
119 function isContract(address account) internal view returns (bool) {
120 // This method relies on extcodesize, which returns 0 for contracts in
121 // construction, since the code is only stored at the end of the
122 // constructor execution.
123
124 uint256 size;
125 assembly {
126 size := extcodesize(account)
127 }
128 return size > 0;
129 }
130
131 /**
132 * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
133 * `recipient`, forwarding all available gas and reverting on errors.
134 *
135 * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
136 * of certain opcodes, possibly making contracts go over the 2300 gas limit
137 * imposed by `transfer`, making them unable to receive funds via
138 * `transfer`. {sendValue} removes this limitation.
139 *
140 * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
141 *
142 * IMPORTANT: because control is transferred to `recipient`, care must be
143 * taken to not create reentrancy vulnerabilities. Consider using
144 * {ReentrancyGuard} or the
145 * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
146 */
147 function sendValue(address payable recipient, uint256 amount) internal {
148 require(address(this).balance >= amount, "Address: insufficient balance");
149
150 (bool success, ) = recipient.call{value: amount}("");
151 require(success, "Address: unable to send value, recipient may have reverted");
152 }
153
154 /**
155 * @dev Performs a Solidity function call using a low level `call`. A
156 * plain `call` is an unsafe replacement for a function call: use this
157 * function instead.
158 *
159 * If `target` reverts with a revert reason, it is bubbled up by this
160 * function (like regular Solidity function calls).
161 *
162 * Returns the raw returned data. To convert to the expected return value,
163 * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
164 *
165 * Requirements:
166 *
167 * - `target` must be a contract.
168 * - calling `target` with `data` must not revert.
169 *
170 * _Available since v3.1._
171 */
172 function functionCall(address target, bytes memory data) internal returns (bytes memory) {
173 return functionCall(target, data, "Address: low-level call failed");
174 }
175
176 /**
177 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
178 * `errorMessage` as a fallback revert reason when `target` reverts.
179 *
180 * _Available since v3.1._
181 */
182 function functionCall(
183 address target,
184 bytes memory data,
185 string memory errorMessage
186 ) internal returns (bytes memory) {
187 return functionCallWithValue(target, data, 0, errorMessage);
188 }
189
190 /**
191 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
192 * but also transferring `value` wei to `target`.
193 *
194 * Requirements:
195 *
196 * - the calling contract must have an ETH balance of at least `value`.
197 * - the called Solidity function must be `payable`.
198 *
199 * _Available since v3.1._
200 */
201 function functionCallWithValue(
202 address target,
203 bytes memory data,
204 uint256 value
205 ) internal returns (bytes memory) {
206 return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
207 }
208
209 /**
210 * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
211 * with `errorMessage` as a fallback revert reason when `target` reverts.
212 *
213 * _Available since v3.1._
214 */
215 function functionCallWithValue(
216 address target,
217 bytes memory data,
218 uint256 value,
219 string memory errorMessage
220 ) internal returns (bytes memory) {
221 require(address(this).balance >= value, "Address: insufficient balance for call");
222 require(isContract(target), "Address: call to non-contract");
223
224 (bool success, bytes memory returndata) = target.call{value: value}(data);
225 return verifyCallResult(success, returndata, errorMessage);
226 }
227
228 /**
229 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
230 * but performing a static call.
231 *
232 * _Available since v3.3._
233 */
234 function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
235 return functionStaticCall(target, data, "Address: low-level static call failed");
236 }
237
238 /**
239 * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
240 * but performing a static call.
241 *
242 * _Available since v3.3._
243 */
244 function functionStaticCall(
245 address target,
246 bytes memory data,
247 string memory errorMessage
248 ) internal view returns (bytes memory) {
249 require(isContract(target), "Address: static call to non-contract");
250
251 (bool success, bytes memory returndata) = target.staticcall(data);
252 return verifyCallResult(success, returndata, errorMessage);
253 }
254
255 /**
256 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
257 * but performing a delegate call.
258 *
259 * _Available since v3.4._
260 */
261 function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
262 return functionDelegateCall(target, data, "Address: low-level delegate call failed");
263 }
264
265 /**
266 * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
267 * but performing a delegate call.
268 *
269 * _Available since v3.4._
270 */
271 function functionDelegateCall(
272 address target,
273 bytes memory data,
274 string memory errorMessage
275 ) internal returns (bytes memory) {
276 require(isContract(target), "Address: delegate call to non-contract");
277
278 (bool success, bytes memory returndata) = target.delegatecall(data);
279 return verifyCallResult(success, returndata, errorMessage);
280 }
281
282 /**
283 * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
284 * revert reason using the provided one.
285 *
286 * _Available since v4.3._
287 */
288 function verifyCallResult(
289 bool success,
290 bytes memory returndata,
291 string memory errorMessage
292 ) internal pure returns (bytes memory) {
293 if (success) {
294 return returndata;
295 } else {
296 // Look for revert reason and bubble it up if present
297 if (returndata.length > 0) {
298 // The easiest way to bubble the revert reason is using memory via assembly
299
300 assembly {
301 let returndata_size := mload(returndata)
302 revert(add(32, returndata), returndata_size)
303 }
304 } else {
305 revert(errorMessage);
306 }
307 }
308 }
309}
310
311/**
312 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
313 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
314 * be specified by overriding the virtual {_implementation} function.
315 *
316 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
317 * different contract through the {_delegate} function.
318 *
319 * The success and return data of the delegated call will be returned back to the caller of the proxy.
320 */
321abstract contract Proxy {
322 /**
323 * @dev Delegates the current call to `implementation`.
324 *
325 * This function does not return to its internall call site, it will return directly to the external caller.
326 */
327 function _delegate(address implementation) internal virtual {
328 assembly {
329 // Copy msg.data. We take full control of memory in this inline assembly
330 // block because it will not return to Solidity code. We overwrite the
331 // Solidity scratch pad at memory position 0.
332 calldatacopy(0, 0, calldatasize())
333
334 // Call the implementation.
335 // out and outsize are 0 because we don't know the size yet.
336 let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
337
338 // Copy the returned data.
339 returndatacopy(0, 0, returndatasize())
340
341 switch result
342 // delegatecall returns 0 on error.
343 case 0 {
344 revert(0, returndatasize())
345 }
346 default {
347 return(0, returndatasize())
348 }
349 }
350 }
351
352 /**
353 * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
354 * and {_fallback} should delegate.
355 */
356 function _implementation() internal view virtual returns (address);
357
358 /**
359 * @dev Delegates the current call to the address returned by `_implementation()`.
360 *
361 * This function does not return to its internall call site, it will return directly to the external caller.
362 */
363 function _fallback() internal virtual {
364 _beforeFallback();
365 _delegate(_implementation());
366 }
367
368 /**
369 * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
370 * function in the contract matches the call data.
371 */
372 fallback() external payable virtual {
373 _fallback();
374 }
375
376 /**
377 * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
378 * is empty.
379 */
380 receive() external payable virtual {
381 _fallback();
382 }
383
384 /**
385 * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
386 * call, or as part of the Solidity `fallback` or `receive` functions.
387 *
388 * If overriden should call `super._beforeFallback()`.
389 */
390 function _beforeFallback() internal virtual {}
391}
392
393/**
394 * @dev This abstract contract provides getters and event emitting update functions for
395 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
396 *
397 * _Available since v4.1._
398 *
399 * @custom:oz-upgrades-unsafe-allow delegatecall
400 */
401abstract contract ERC1967Upgrade {
402 // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
403 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
404
405 /**
406 * @dev Storage slot with the address of the current implementation.
407 * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
408 * validated in the constructor.
409 */
410 bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
411
412 /**
413 * @dev Emitted when the implementation is upgraded.
414 */
415 event Upgraded(address indexed implementation);
416
417 /**
418 * @dev Returns the current implementation address.
419 */
420 function _getImplementation() internal view returns (address) {
421 return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
422 }
423
424 /**
425 * @dev Stores a new address in the EIP1967 implementation slot.
426 */
427 function _setImplementation(address newImplementation) private {
428 require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
429 StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
430 }
431
432 /**
433 * @dev Perform implementation upgrade
434 *
435 * Emits an {Upgraded} event.
436 */
437 function _upgradeTo(address newImplementation) internal {
438 _setImplementation(newImplementation);
439 emit Upgraded(newImplementation);
440 }
441
442 /**
443 * @dev Perform implementation upgrade with additional setup call.
444 *
445 * Emits an {Upgraded} event.
446 */
447 function _upgradeToAndCall(
448 address newImplementation,
449 bytes memory data,
450 bool forceCall
451 ) internal {
452 _upgradeTo(newImplementation);
453 if (data.length > 0 || forceCall) {
454 Address.functionDelegateCall(newImplementation, data);
455 }
456 }
457
458 /**
459 * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
460 *
461 * Emits an {Upgraded} event.
462 */
463 function _upgradeToAndCallSecure(
464 address newImplementation,
465 bytes memory data,
466 bool forceCall
467 ) internal {
468 address oldImplementation = _getImplementation();
469
470 // Initial upgrade and setup call
471 _setImplementation(newImplementation);
472 if (data.length > 0 || forceCall) {
473 Address.functionDelegateCall(newImplementation, data);
474 }
475
476 // Perform rollback test if not already in progress
477 StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);
478 if (!rollbackTesting.value) {
479 // Trigger rollback using upgradeTo from the new implementation
480 rollbackTesting.value = true;
481 Address.functionDelegateCall(
482 newImplementation,
483 abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
484 );
485 rollbackTesting.value = false;
486 // Check rollback was effective
487 require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
488 // Finally reset to the new implementation and log the upgrade
489 _upgradeTo(newImplementation);
490 }
491 }
492
493 /**
494 * @dev Storage slot with the admin of the contract.
495 * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
496 * validated in the constructor.
497 */
498 bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
499
500 /**
501 * @dev Emitted when the admin account has changed.
502 */
503 event AdminChanged(address previousAdmin, address newAdmin);
504
505 /**
506 * @dev Returns the current admin.
507 */
508 function _getAdmin() internal view returns (address) {
509 return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
510 }
511
512 /**
513 * @dev Stores a new address in the EIP1967 admin slot.
514 */
515 function _setAdmin(address newAdmin) private {
516 require(newAdmin != address(0), "ERC1967: new admin is the zero address");
517 StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
518 }
519
520 /**
521 * @dev Changes the admin of the proxy.
522 *
523 * Emits an {AdminChanged} event.
524 */
525 function _changeAdmin(address newAdmin) internal {
526 emit AdminChanged(_getAdmin(), newAdmin);
527 _setAdmin(newAdmin);
528 }
529
530 /**
531 * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
532 * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
533 */
534 bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
535
536 /**
537 * @dev Emitted when the beacon is upgraded.
538 */
539 event BeaconUpgraded(address indexed beacon);
540
541 /**
542 * @dev Returns the current beacon.
543 */
544 function _getBeacon() internal view returns (address) {
545 return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
546 }
547
548 /**
549 * @dev Stores a new beacon in the EIP1967 beacon slot.
550 */
551 function _setBeacon(address newBeacon) private {
552 require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
553 require(
554 Address.isContract(IBeacon(newBeacon).implementation()),
555 "ERC1967: beacon implementation is not a contract"
556 );
557 StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
558 }
559
560 /**
561 * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
562 * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
563 *
564 * Emits a {BeaconUpgraded} event.
565 */
566 function _upgradeBeaconToAndCall(
567 address newBeacon,
568 bytes memory data,
569 bool forceCall
570 ) internal {
571 _setBeacon(newBeacon);
572 emit BeaconUpgraded(newBeacon);
573 if (data.length > 0 || forceCall) {
574 Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
575 }
576 }
577}
578
579/**
580 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
581 * implementation address that can be changed. This address is stored in storage in the location specified by
582 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
583 * implementation behind the proxy.
584 */
585contract ERC1967Proxy is Proxy, ERC1967Upgrade {
586 /**
587 * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
588 *
589 * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
590 * function call, and allows initializating the storage of the proxy like a Solidity constructor.
591 */
592 constructor(address _logic, bytes memory _data) payable {
593 assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
594 _upgradeToAndCall(_logic, _data, false);
595 }
596
597 /**
598 * @dev Returns the current implementation address.
599 */
600 function _implementation() internal view virtual override returns (address impl) {
601 return ERC1967Upgrade._getImplementation();
602 }
603}
604
605/**
606 * @dev This contract implements a proxy that is upgradeable by an admin.
607 *
608 * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
609 * clashing], which can potentially be used in an attack, this contract uses the
610 * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
611 * things that go hand in hand:
612 *
613 * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
614 * that call matches one of the admin functions exposed by the proxy itself.
615 * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
616 * implementation. If the admin tries to call a function on the implementation it will fail with an error that says
617 * "admin cannot fallback to proxy target".
618 *
619 * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
620 * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
621 * to sudden errors when trying to call a function from the proxy implementation.
622 *
623 * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
624 * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
625 */
626contract TransparentUpgradeableProxy is ERC1967Proxy {
627 /**
628 * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
629 * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.
630 */
631 constructor(
632 address _logic,
633 address admin_,
634 bytes memory _data
635 ) payable ERC1967Proxy(_logic, _data) {
636 assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
637 _changeAdmin(admin_);
638 }
639
640 /**
641 * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
642 */
643 modifier ifAdmin() {
644 if (msg.sender == _getAdmin()) {
645 _;
646 } else {
647 _fallback();
648 }
649 }
650
651 /**
652 * @dev Returns the current admin.
653 *
654 * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
655 *
656 * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
657 * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
658 * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
659 */
660 function admin() external ifAdmin returns (address admin_) {
661 admin_ = _getAdmin();
662 }
663
664 /**
665 * @dev Returns the current implementation.
666 *
667 * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
668 *
669 * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
670 * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
671 * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
672 */
673 function implementation() external ifAdmin returns (address implementation_) {
674 implementation_ = _implementation();
675 }
676
677 /**
678 * @dev Changes the admin of the proxy.
679 *
680 * Emits an {AdminChanged} event.
681 *
682 * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
683 */
684 function changeAdmin(address newAdmin) external virtual ifAdmin {
685 _changeAdmin(newAdmin);
686 }
687
688 /**
689 * @dev Upgrade the implementation of the proxy.
690 *
691 * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
692 */
693 function upgradeTo(address newImplementation) external ifAdmin {
694 _upgradeToAndCall(newImplementation, bytes(""), false);
695 }
696
697 /**
698 * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
699 * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
700 * proxied contract.
701 *
702 * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
703 */
704 function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
705 _upgradeToAndCall(newImplementation, data, true);
706 }
707
708 /**
709 * @dev Returns the current admin.
710 */
711 function _admin() internal view virtual returns (address) {
712 return _getAdmin();
713 }
714
715 /**
716 * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
717 */
718 function _beforeFallback() internal virtual override {
719 require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
720 super._beforeFallback();
721 }
722}
723// End of TransparentUpgradeableProxy.sol
724