-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: drop
UniversalTokenLib
in AdminV2
- Loading branch information
1 parent
87723a5
commit 1b797f6
Showing
2 changed files
with
16 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
Check warning Code scanning / Slither Different pragma directives are used Warning
3 different versions of Solidity are used:
- Version constraint ^0.8.20 is used by: -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 -^0.8.20 - Version constraint 0.8.24 is used by: -0.8.24 -0.8.24 - Version constraint ^0.8.4 is used by: -^0.8.4 -^0.8.4 -^0.8.4 -^0.8.4 -^0.8.4 -^0.8.4 -^0.8.4 -^0.8.4 -^0.8.4 -^0.8.4 Check warning Code scanning / Slither Incorrect versions of Solidity Warning
Version constraint ^0.8.20 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)
- VerbatimInvalidDeduplication - FullInlinerNonExpressionSplitArgumentEvaluationOrder - MissingSideEffectsOnSelectorAccess. It is used by: - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 - ^0.8.20 |
||
|
||
import {AccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol"; | ||
|
||
import {UniversalTokenLib} from "./libs/UniversalToken.sol"; | ||
import {IAdminV2} from "./interfaces/IAdminV2.sol"; | ||
import {IAdminV2Errors} from "./interfaces/IAdminV2Errors.sol"; | ||
|
||
import {AccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol"; | ||
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; | ||
import {Address} from "@openzeppelin/contracts/utils/Address.sol"; | ||
|
||
contract AdminV2 is AccessControlEnumerable, IAdminV2, IAdminV2Errors { | ||
using UniversalTokenLib for address; | ||
using SafeERC20 for IERC20; | ||
|
||
/// @notice Address reserved for native gas token (ETH on Ethereum and most L2s, AVAX on Avalanche, etc) | ||
address public constant NATIVE_GAS_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; | ||
|
||
bytes32 public constant RELAYER_ROLE = keccak256("RELAYER_ROLE"); | ||
bytes32 public constant CANCELER_ROLE = keccak256("CANCELER_ROLE"); | ||
|
@@ -54,7 +58,11 @@ contract AdminV2 is AccessControlEnumerable, IAdminV2, IAdminV2Errors { | |
if (feeAmount == 0) return; // skip if no accumulated fees | ||
|
||
protocolFees[token] = 0; | ||
token.universalTransfer(recipient, feeAmount); | ||
if (token == NATIVE_GAS_TOKEN) { | ||
Address.sendValue(payable(recipient), feeAmount); | ||
} else { | ||
IERC20(token).safeTransfer(recipient, feeAmount); | ||
} | ||
emit FeesSwept(token, recipient, feeAmount); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters