generated from PaulRBerg/foundry-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathWCT.sol
More file actions
117 lines (105 loc) · 5.16 KB
/
WCT.sol
File metadata and controls
117 lines (105 loc) · 5.16 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import { ERC20VotesUpgradeable } from
"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";
import { ERC20PermitUpgradeable } from
"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol";
import { NoncesUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/NoncesUpgradeable.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import { ERC20BurnableUpgradeable } from
"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
import { NttTokenUpgradeable } from "src/NttTokenUpgradeable.sol";
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/// @title WCT Token
/// @notice This contract implements the ERC20 representation of WCT token with burn, permit, and voting functionality.
/// It is designed to work with Wormhole's NTT bridge and is to be deployed on any non-superchain EVM chain.
/// @author WalletConnect
contract WCT is NttTokenUpgradeable, ERC20VotesUpgradeable, ERC20PermitUpgradeable, AccessControlUpgradeable {
/// @notice The timestamp after which transfer restrictions are disabled
/// @custom:deprecated This storage variable is no longer used but preserved for storage layout compatibility
/// @custom:oz-renamed-from transferRestrictionsDisabledAfter
uint256 public deprecatedTransferRestrictionsDisabledAfter;
/// @notice Mapping of addresses that are allowed to transfer tokens to any address
/// @custom:deprecated This storage variable is no longer used but preserved for storage layout compatibility
/// @custom:oz-renamed-from allowedFrom
mapping(address account => bool isAllowed) public deprecatedAllowedFrom;
/// @notice Mapping of addresses that are allowed to receive tokens from any address
/// @custom:deprecated This storage variable is no longer used but preserved for storage layout compatibility
/// @custom:oz-renamed-from allowedTo
mapping(address account => bool isAllowed) public deprecatedAllowedTo;
/// @notice Address of the corresponding version of this token on the remote chain
/// @custom:deprecated This storage variable is no longer used but preserved for storage layout compatibility
/// @custom:oz-renamed-from REMOTE_TOKEN
address public DEPRECATED_REMOTE_TOKEN;
/// @notice Address of the StandardBridge on this network
/// @custom:deprecated This storage variable is no longer used but preserved for storage layout compatibility
/// @custom:oz-renamed-from BRIDGE
address public DEPRECATED_BRIDGE;
/// @notice Initialization data for the contract
struct Init {
/// @dev The address that will be the initial admin of the contract
address initialAdmin;
}
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/// @notice Initializes the WCT token
/// @param init The initialization data for the contract
function initialize(Init calldata init) public initializer {
__NttToken_init(address(0), "WalletConnect", "WCT");
__ERC20Permit_init("WalletConnect");
__ERC20Votes_init();
__ERC20Burnable_init();
__AccessControl_init();
_grantRole(DEFAULT_ADMIN_ROLE, init.initialAdmin);
}
/// @notice A function to set the new minter for the tokens.
/// @param newMinter The address to add as both a minter and burner.
function setMinter(address newMinter) external override onlyRole(DEFAULT_ADMIN_ROLE) {
_setMinter(newMinter);
}
/// @notice Returns the current timestamp as a uint48
/// @return The current block timestamp
function clock() public view override returns (uint48) {
return uint48(block.timestamp);
}
/// @notice Returns the clock mode
/// @return A string indicating the clock mode
// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() public pure override returns (string memory) {
return "mode=timestamp";
}
/// @notice ERC165 interface check function
/// @param interfaceId Interface ID to check
/// @return Whether or not the interface is supported by this contract
function supportsInterface(bytes4 interfaceId)
public
view
override(AccessControlUpgradeable, NttTokenUpgradeable)
returns (bool)
{
return NttTokenUpgradeable.supportsInterface(interfaceId)
|| AccessControlUpgradeable.supportsInterface(interfaceId);
}
// The following functions are overrides required by Solidity.
function _update(
address from,
address to,
uint256 value
)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._update(from, to, value);
}
function nonces(address nonceOwner)
public
view
override(ERC20PermitUpgradeable, NoncesUpgradeable)
returns (uint256)
{
return super.nonces(nonceOwner);
}
}