Address Contract Partially Verified
Address
0xDB910943e97b27E0C0a46f5CEfcf613b17813838
Balance
0 ETH
Nonce
1
Code Size
5209 bytes
Creator
0x492f3783...217E at tx 0xd530c980...68c8b8
Indexed Transactions
0
Contract Bytecode
5209 bytes
0x608060405234801561000f575f5ffd5b506004361061011f575f3560e01c80635c975abb116100ab578063c125c8611161006f578063c125c861146102f3578063d53b245b1461030f578063d547741f1461032b578063d7ad21ac14610347578063e63ab1e9146103775761011f565b80635c975abb1461025f57806375b238fc1461027d5780638456cb591461029b57806391d14854146102a5578063a217fddf146102d55761011f565b80632f2ff15d116100f25780632f2ff15d146101e3578063364706c8146101ff57806336568abe1461021d5780633f4ba83a1461023957806344ed753a146102435761011f565b806301ffc9a71461012357806316c2be6b1461015357806323bbcdb014610183578063248a9ca3146101b3575b5f5ffd5b61013d60048036038101906101389190610e9e565b610395565b60405161014a9190610ee3565b60405180910390f35b61016d60048036038101906101689190610f56565b61040e565b60405161017a9190610ee3565b60405180910390f35b61019d60048036038101906101989190610f56565b61042b565b6040516101aa9190610f99565b60405180910390f35b6101cd60048036038101906101c89190610fe5565b610440565b6040516101da919061101f565b60405180910390f35b6101fd60048036038101906101f89190611038565b61045c565b005b61020761047e565b6040516102149190610f99565b60405180910390f35b61023760048036038101906102329190611038565b610484565b005b6102416104ff565b005b61025d600480360381019061025891906110a0565b610534565b005b610267610638565b6040516102749190610ee3565b60405180910390f35b61028561064d565b604051610292919061101f565b60405180910390f35b6102a3610671565b005b6102bf60048036038101906102ba9190611038565b6106a6565b6040516102cc9190610ee3565b60405180910390f35b6102dd610709565b6040516102ea919061101f565b60405180910390f35b61030d60048036038101906103089190611108565b61070f565b005b61032960048036038101906103249190611146565b6107e0565b005b61034560048036038101906103409190611038565b6108a8565b005b610361600480360381019061035c9190611171565b6108ca565b60405161036e9190610f99565b60405180910390f35b61037f610a25565b60405161038c919061101f565b60405180910390f35b5f7f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610407575061040682610a49565b5b9050919050565b6004602052805f5260405f205f915054906101000a900460ff1681565b6003602052805f5260405f205f915090505481565b5f5f5f8381526020019081526020015f20600101549050919050565b61046582610440565b61046e81610ab2565b6104788383610ac6565b50505050565b60025481565b61048c610baf565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146104f0576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104fa8282610bb6565b505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61052981610ab2565b610531610c9f565b50565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561055e81610ab2565b6127108211156105a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059a9061121b565b60405180910390fd5b8160035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff167fb7902185ac0a79231c8be85f0ee0d94806d95d785d216824a078279f5d5bfbae8360405161062b9190610f99565b60405180910390a2505050565b5f60015f9054906101000a900460ff16905090565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61069b81610ab2565b6106a3610d00565b50565b5f5f5f8481526020019081526020015f205f015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b5f5f1b81565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561073981610ab2565b8160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff167f8af110e2cdec2af97569417a7ea26d5f5965e7cd29aee2f497eeb460cbefa303836040516107d39190610ee3565b60405180910390a2505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561080a81610ab2565b61271082111561084f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108469061121b565b60405180910390fd5b816002819055505f73ffffffffffffffffffffffffffffffffffffffff167fb7902185ac0a79231c8be85f0ee0d94806d95d785d216824a078279f5d5bfbae8360405161089c9190610f99565b60405180910390a25050565b6108b182610440565b6108ba81610ab2565b6108c48383610bb6565b50505050565b5f60045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1680610966575060045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b15610973575f9050610a1e565b5f5f60035f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054116109c0576002546109ff565b60035f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20545b90506127108184610a109190611266565b610a1a91906112d4565b9150505b9392505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b610ac381610abe610baf565b610d61565b50565b5f610ad183836106a6565b610ba55760015f5f8581526020019081526020015f205f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550610b42610baf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019050610ba9565b5f90505b92915050565b5f33905090565b5f610bc183836106a6565b15610c95575f5f5f8581526020019081526020015f205f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550610c32610baf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a460019050610c99565b5f90505b92915050565b610ca7610db2565b5f60015f6101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610ce9610baf565b604051610cf69190611313565b60405180910390a1565b610d08610dfb565b6001805f6101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d4a610baf565b604051610d579190611313565b60405180910390a1565b610d6b82826106a6565b610dae5780826040517fe2517d3f000000000000000000000000000000000000000000000000000000008152600401610da592919061132c565b60405180910390fd5b5050565b610dba610638565b610df9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df09061139d565b60405180910390fd5b565b610e03610638565b15610e43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3a90611405565b60405180910390fd5b565b5f5ffd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610e7d81610e49565b8114610e87575f5ffd5b50565b5f81359050610e9881610e74565b92915050565b5f60208284031215610eb357610eb2610e45565b5b5f610ec084828501610e8a565b91505092915050565b5f8115159050919050565b610edd81610ec9565b82525050565b5f602082019050610ef65f830184610ed4565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610f2582610efc565b9050919050565b610f3581610f1b565b8114610f3f575f5ffd5b50565b5f81359050610f5081610f2c565b92915050565b5f60208284031215610f6b57610f6a610e45565b5b5f610f7884828501610f42565b91505092915050565b5f819050919050565b610f9381610f81565b82525050565b5f602082019050610fac5f830184610f8a565b92915050565b5f819050919050565b610fc481610fb2565b8114610fce575f5ffd5b50565b5f81359050610fdf81610fbb565b92915050565b5f60208284031215610ffa57610ff9610e45565b5b5f61100784828501610fd1565b91505092915050565b61101981610fb2565b82525050565b5f6020820190506110325f830184611010565b92915050565b5f5f6040838503121561104e5761104d610e45565b5b5f61105b85828601610fd1565b925050602061106c85828601610f42565b9150509250929050565b61107f81610f81565b8114611089575f5ffd5b50565b5f8135905061109a81611076565b92915050565b5f5f604083850312156110b6576110b5610e45565b5b5f6110c385828601610f42565b92505060206110d48582860161108c565b9150509250929050565b6110e781610ec9565b81146110f1575f5ffd5b50565b5f81359050611102816110de565b92915050565b5f5f6040838503121561111e5761111d610e45565b5b5f61112b85828601610f42565b925050602061113c858286016110f4565b9150509250929050565b5f6020828403121561115b5761115a610e45565b5b5f6111688482850161108c565b91505092915050565b5f5f5f6060848603121561118857611187610e45565b5b5f61119586828701610f42565b93505060206111a686828701610f42565b92505060406111b78682870161108c565b9150509250925092565b5f82825260208201905092915050565b7f5461782072617465206d757374206265203c3d203130302500000000000000005f82015250565b5f6112056018836111c1565b9150611210826111d1565b602082019050919050565b5f6020820190508181035f830152611232816111f9565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61127082610f81565b915061127b83610f81565b925082820261128981610f81565b915082820484148315176112a05761129f611239565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6112de82610f81565b91506112e983610f81565b9250826112f9576112f86112a7565b5b828204905092915050565b61130d81610f1b565b82525050565b5f6020820190506113265f830184611304565b92915050565b5f60408201905061133f5f830185611304565b61134c6020830184611010565b9392505050565b7f5061757361626c653a206e6f74207061757365640000000000000000000000005f82015250565b5f6113876014836111c1565b915061139282611353565b602082019050919050565b5f6020820190508181035f8301526113b48161137b565b9050919050565b7f5061757361626c653a20706175736564000000000000000000000000000000005f82015250565b5f6113ef6010836111c1565b91506113fa826113bb565b602082019050919050565b5f6020820190508181035f83015261141c816113e3565b905091905056fea2646970667358221220e4375dbebc28246c80841b2622bf42fb7b33d70ddd509b1c2c8ac2c08d9dfc0464736f6c634300081c0033
Verified Source Code Partial Match
Compiler: v0.8.28+commit.7893614a
EVM: cancun
Optimization: No
TaxHandler.sol 566 lines
// File: @openzeppelin/contracts/access/IAccessControl.sol
// OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC-165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
* Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File: @openzeppelin/contracts/access/AccessControl.sol
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}
// File: @openzeppelin/contracts/security/Pausable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
// File: contracts/TaxHandler.sol
pragma solidity ^0.8.28;
contract TaxHandler is AccessControl, Pausable {
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
uint256 public defaultTaxRate;
mapping(address => uint256) public customTaxRates;
mapping(address => bool) public isTaxExempt;
event TaxRateUpdated(address indexed account, uint256 newRate);
event TaxExemptStatusUpdated(address indexed account, bool isExempt);
constructor(uint256 _defaultTaxRate) {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROLE, msg.sender);
defaultTaxRate = _defaultTaxRate;
}
function setDefaultTaxRate(uint256 _newRate) external onlyRole(ADMIN_ROLE) {
require(_newRate <= 10000, "Tax rate must be <= 100%");
defaultTaxRate = _newRate;
emit TaxRateUpdated(address(0), _newRate);
}
function setCustomTaxRate(address _account, uint256 _newRate) external onlyRole(ADMIN_ROLE) {
require(_newRate <= 10000, "Tax rate must be <= 100%");
customTaxRates[_account] = _newRate;
emit TaxRateUpdated(_account, _newRate);
}
function setTaxExemptStatus(address _account, bool _isExempt) external onlyRole(ADMIN_ROLE) {
isTaxExempt[_account] = _isExempt;
emit TaxExemptStatusUpdated(_account, _isExempt);
}
function getTax(address _from, address _to, uint256 _amount) public view returns (uint256) {
if (isTaxExempt[_from] || isTaxExempt[_to]) {
return 0;
}
uint256 taxRate = customTaxRates[_from] > 0 ? customTaxRates[_from] : defaultTaxRate;
return (_amount * taxRate) / 10000;
}
function pause() public onlyRole(PAUSER_ROLE) {
_pause();
}
function unpause() public onlyRole(PAUSER_ROLE) {
_unpause();
}
}
Read Contract
ADMIN_ROLE 0x75b238fc → bytes32
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
PAUSER_ROLE 0xe63ab1e9 → bytes32
customTaxRates 0x23bbcdb0 → uint256
defaultTaxRate 0x364706c8 → uint256
getRoleAdmin 0x248a9ca3 → bytes32
getTax 0xd7ad21ac → uint256
hasRole 0x91d14854 → bool
isTaxExempt 0x16c2be6b → bool
paused 0x5c975abb → bool
supportsInterface 0x01ffc9a7 → bool
Write Contract 8 functions
These functions modify contract state and require a wallet transaction to execute.
grantRole 0x2f2ff15d
bytes32 role
address account
pause 0x8456cb59
No parameters
renounceRole 0x36568abe
bytes32 role
address callerConfirmation
revokeRole 0xd547741f
bytes32 role
address account
setCustomTaxRate 0x44ed753a
address _account
uint256 _newRate
setDefaultTaxRate 0xd53b245b
uint256 _newRate
setTaxExemptStatus 0xc125c861
address _account
bool _isExempt
unpause 0x3f4ba83a
No parameters
Recent Transactions
No transactions found for this address