// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
/**
* @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;
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import "../interfaces/utils/IAccessHandler.sol";
import "./BaseInitializer.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
/**
* @title Access Handler
* @author BetBase Dev Team
* @notice An access control contract. It restricts access to otherwise public
* methods, by checking for assigned roles. its meant to be extended
* and holds all the predefined role type for the derrived contracts.
* @notice This is a util contract for the BookieMain app.
*/
abstract contract AccessHandler is IAccessHandler, BaseInitializer, AccessControl, Pausable {
/**
* @notice Simple constructor, just sets the admin.
* Allows for AccessHandler to be inherited by non-upgradeable contracts
* that are normally deployed, with a contructor call.
*/
constructor() {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(OPERATION_ADMIN_ROLE, msg.sender);
_grantRole(PAUSER_ROLE, msg.sender);
}
/**
* @notice Adds another admin.
* @param newAdmin is the addresse of the new admin.
*/
function addAdmin(address newAdmin) external override onlyRole(DEFAULT_ADMIN_ROLE) {
_grantRole(DEFAULT_ADMIN_ROLE, newAdmin);
}
/**
* @notice Removes an admin.
* @param inAdmin is the addresse of the admin to remove.
*/
function removeAdmin(address inAdmin) external override onlyRole(DEFAULT_ADMIN_ROLE) {
// We want at least 1 admin, so admins cannot renounce their own role.
if (inAdmin != _msgSender())
_revokeRole(DEFAULT_ADMIN_ROLE, inAdmin);
}
/**
* @notice Puts the contract in pause state, for emergency control.
*/
function pause() external override onlyRole(PAUSER_ROLE) {
_pause();
}
/**
* @notice Puts the contract in operational state, after being paused.
*/
function unpause() external override onlyRole(PAUSER_ROLE) {
_unpause();
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
abstract contract BaseInitializer is Initializable {
/**
* Error for call to a contract that is not yet initialized.
*/
error NotInitialized();
/**
* Error for call to a contract that is already initialized.
*/
error AlreadyInitialized();
/**
* @notice Throws if this contract has not been initialized.
*/
modifier isInitialized() {
if (!getInitialized()) {
revert NotInitialized();
}
_;
}
/**
* @notice Initialize and remember this state to avoid repeating.
*/
function initialize() internal virtual initializer {}
/**
* @notice Get the state of initialization.
* @return bool true if initialized.
*/
function getInitialized() internal view returns (bool) {
return _getInitializedVersion() != 0 && !_isInitializing();
}
/**
* @notice Get the state of initialization.
* @return bool true if initialized.
*/
function getInitializedVersion() external view returns (uint64) {
return _getInitializedVersion();
}
}
// SPDX-License-Identifier: MIT
// 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;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 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;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 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, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
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;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
bytes32 constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 constant BURNER_ROLE = keccak256("BURNER_ROLE");
bytes32 constant TRANSFER_ROLE = keccak256("TRANSFER_ROLE");
bytes32 constant BETTER_ROLE = keccak256("BETTER_ROLE");
bytes32 constant CANCEL_ROLE = keccak256("CANCEL_ROLE");
bytes32 constant LOCKBOX_ROLE = keccak256("LOCKBOX_ROLE");
bytes32 constant REPORTER_ROLE = keccak256("REPORTER_ROLE");
bytes32 constant ADD_ROLE = keccak256("ADD_ROLE");
bytes32 constant REWARDER_ROLE = keccak256("REWARDER_ROLE");
bytes32 constant REWARD_ADMIN_ROLE = keccak256("REWARD_ADMIN_ROLE");
bytes32 constant OPERATION_ADMIN_ROLE = keccak256("OPERATION_ADMIN_ROLE");
bytes32 constant SIGNER_ROLE = keccak256("SIGNER_ROLE");
bytes32 constant TOKEN_ROLE = keccak256("TOKEN_ROLE");
bytes32 constant BONUS_REPORTER_ROLE = keccak256("BONUS_REPORTER_ROLE");
bytes32 constant BONUS_CONTROLLER_ROLE = keccak256("BONUS_CONTROLLER_ROLE");
bytes32 constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 constant VETO_ROLE = keccak256("VETO_ROLE");
interface IAccessHandler {
function addAdmin(address) external;
function removeAdmin(address) external;
function pause() external;
function unpause() external;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IDistToken is IERC20 {
function token() external view returns (IERC20);
function tokenAdd() external view returns (address);
function addHandler(address) external;
function removeHandler(address) external;
function mint(address, uint256) external;
function burn(uint256) external;
function burnFrom(address, uint256) external;
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* 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[EIP 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);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
interface ILockBox {
/**
* Event that fires when tokens are locked.
* @param owner is the address got the tokens locked.
* @param token is the token contract address
* @param lockedAmount is the amount locked.
*/
event TokensLocked(address indexed owner, address indexed token, uint256 lockedAmount);
/**
* Event that fires when tokens are unlocked.
* @param owner is the address got the tokens unlocked.
* @param token is the token contract address
* @param unlockedAmount is the amount unlocked.
*/
event TokensUnlocked(address indexed owner, address indexed token, uint256 unlockedAmount);
/**
* Error for token unlock failure,
* although balance should always be available.
* Needed `required` but only `available` available.
* @param owner is the address that want to unlock tokens.
* @param token is the token contract address.
* @param available balance available.
* @param required requested amount to unlock.
*/
error InsufficientLockedTokens(
address owner,
address token,
uint256 available,
uint256 required
);
function lockAmount(address, address, uint256) external;
function unlockAmount(address, address, uint256) external;
function unlockAmountTo(address, address, address, uint256) external;
function getLockedAmount(address, address) external view returns (uint256);
function hasLockedAmount(address, address, uint256) external view returns (bool);
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import "../tokens/IDistToken.sol";
interface ITokenValidator {
/**
* Error for using a zero address token.
*/
error BadTokenZero();
/**
* Error for using a address that is not a token (not a contract).
* @param tokenAdd is the address of the token.
*/
error InvalidToken(address tokenAdd);
/**
* Error for using a not allowed token.
* @param tokenAdd is the address of the token.
*/
error TokenNotAllowed(address tokenAdd);
function addDistToken(IDistToken) external;
function addSingleToken(address) external;
function addTokenPair(address, address) external;
function removeDistToken(IDistToken) external;
function removeToken(address) external;
function enableValidation() external;
function disableValidation() external;
function isAllowedDistToken(address) external view returns (bool);
function isAllowedValueToken(address) external view returns (bool);
function isAllowedToken(address) external view returns (bool);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import "../interfaces/utils/ILockBox.sol";
import "./TokenValidator.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Lock Box
* @author BetBase Dev Team
* @notice Simple contract for storing tokens in a locked state.
* @notice This is a sub contract for the BookieMain app.
* @notice Its keeps a list of locked tokens and can own the locked tokens.
* @notice TokenValidator is Accesshandler, Accesshandler is Initializable.
*/
contract LockBox is ILockBox, TokenValidator {
// owner => token => amount
mapping(address => mapping(address => uint256)) private lockedTokens;
/**
* @notice Default constructor.
*/
constructor() {}
/**
* @notice Init function to call if this is deployed instead of extended.
*/
function initBox() external onlyRole(DEFAULT_ADMIN_ROLE) {
_init();
}
/**
* @notice Increases the users locked amount for a token.
* @param owner The owner to update.
* @param token The token type to lock in box.
* @param amount The amount to add.
*/
function lockAmount(
address owner,
address token,
uint256 amount
) external override onlyRole(LOCKBOX_ROLE) onlyAllowedToken(token) {
_lock(owner, token, amount);
}
/**
* @notice Decreases the users locked amount.
* @param owner The owner to update.
* @param token The token type to unlock.
* @param amount The amount to unlock.
*/
function unlockAmount(
address owner,
address token,
uint256 amount
) external override onlyRole(LOCKBOX_ROLE) onlyAllowedToken(token) {
_unlock(owner, token, amount);
}
/**
* @notice Decreases an owners locked amount and sets allowance to other.
* This assumes tokens are owned by the box and sets allowance.
* @param owner The owner to update.
* @param to The receiver of the token allowance.
* @param token The token type to unlock.
* @param amount The amount to unlock and allow.
*/
function unlockAmountTo(
address owner,
address to,
address token,
uint256 amount
) external override onlyRole(LOCKBOX_ROLE) onlyAllowedToken(token) {
// We increase the allowance instead of setting it fixed,
// although allowances for the box should be spend immediately.
uint256 allowance = IERC20(token).allowance(address(this), to);
allowance += amount;
_unlock(owner, token, amount);
IERC20(token).approve(to, allowance);
}
/**
* @notice Gets the users locked amount for a token.
* @param owner The owner of the balance.
* @param token The token type.
* @return uint256 The amount currently locked.
*/
function getLockedAmount(
address owner,
address token
) external view override returns (uint256) {
return lockedTokens[owner][token];
}
/**
* @notice Checks if user has a locked amount for a token.
* @param owner The owner of the balance.
* @param token The token type.
* @param amount The amount to check.
* @return bool true if the amount is locked, false if not.
*/
function hasLockedAmount(
address owner,
address token,
uint256 amount
) external view override returns (bool) {
return lockedTokens[owner][token] >= amount;
}
/**
* @notice Init function that initializes the Accesshandler.
*/
function _init() internal {
BaseInitializer.initialize();
}
/**
* @notice Increases the users locked amount for a token.
* @param owner The owner to update.
* @param token The token type to lock in box.
* @param amount The amount to add.
*/
function _lock(address owner, address token, uint256 amount) internal {
lockedTokens[owner][token] += amount;
emit TokensLocked(owner, token, amount);
}
/**
* @notice Decreases the users locked amount.
* @param owner The owner to update.
* @param token The token type to unlock.
* @param amount The amount to unlock.
*/
function _unlock(address owner, address token, uint256 amount) internal {
if (amount == 0)
return;
if (amount > lockedTokens[owner][token]) {
revert InsufficientLockedTokens({
owner: owner,
token: token,
available: lockedTokens[owner][token],
required: amount
});
}
lockedTokens[owner][token] -= amount;
emit TokensUnlocked(owner, token, amount);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @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 {
bool private _paused;
/**
* @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);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @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 {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @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());
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import "../interfaces/utils/ITokenValidator.sol";
import "./AccessHandler.sol";
/**
* @title Token Validator
* @author BetBase Dev Team
* @notice An access control contract. It restricts access to otherwise public
* methods, by checking for assigned roles to tokens. Some other
* token validations are also perform (contract and 0 address).
* @notice This is a util contract for the BookieMain app.
*/
abstract contract TokenValidator is ITokenValidator, AccessHandler {
address internal constant DUMMY_ADDRESS = address(1);
// Mapping used to pair DistToken <-> ERC20Token, not used to validate
// tokenAdd (key) => distTokenAdd (value)
mapping(address => address) internal allowedTokens;
// (value) => (key), for cases where we dont use IDistToken,
// and need to find the key token from the value token
mapping(address => address) internal reversedTokens;
// Checks are only performed, if an allowed token pair is added
// or by manual enabling.
bool internal enabledValidation = false;
/**
* @notice Modifier that checks that only allowed distTokens are used.
* @param inDistToken The DistToken to verify.
*/
modifier onlyAllowedDistToken(address inDistToken) {
if (!getInitialized()) {
revert NotInitialized();
}
address tokenAdd = IDistToken(inDistToken).tokenAdd();
if (enabledValidation && !hasRole(TOKEN_ROLE, tokenAdd)) {
revert TokenNotAllowed({tokenAdd: inDistToken});
}
if (reversedTokens[inDistToken] != tokenAdd) {
// To avoid an unintented accept of a DistToken with matching key/currency token
revert TokenNotAllowed({tokenAdd: inDistToken});
}
_;
}
/**
* @notice Modifier that checks that only allowed valueTokens are used.
* @notice ValueToken refers to the keyToken/valueToken pair in allowedTokens.
* @param inValueToken The token to verify.
*/
modifier onlyAllowedValueToken(address inValueToken) {
if (!getInitialized()) {
revert NotInitialized();
}
address tokenAdd = reversedTokens[inValueToken];
if (enabledValidation && !hasRole(TOKEN_ROLE, tokenAdd)) {
revert TokenNotAllowed({tokenAdd: inValueToken});
}
_;
}
/**
* @notice Modifier that checks that only allowed tokens are used.
* @param inToken The token to verify.
*/
modifier onlyAllowedToken(address inToken) {
if (!getInitialized()) {
revert NotInitialized();
}
if (inToken == address(0)) {
revert BadTokenZero();
}
if (!isERC20(inToken)) {
revert InvalidToken({tokenAdd: inToken});
}
if (enabledValidation && !hasRole(TOKEN_ROLE, inToken)) {
revert TokenNotAllowed({tokenAdd: inToken});
}
_;
}
/**
* @notice Simple constructor, just calls Accasshandler constructor.
*/
constructor() AccessHandler() {}
/**
* @notice Add a distToken and the referenced token to the allowed list.
* @param inDistToken The DistToken to add to the allowed list.
*/
function addDistToken(
IDistToken inDistToken
) external override onlyRole(OPERATION_ADMIN_ROLE) {
_addTokenPair(inDistToken.tokenAdd(), address(inDistToken));
}
/**
* @notice Add a distToken and the referenced token to the allowed list.
* @param inTokenAdd The token to add to the allowed list.
*/
function addSingleToken(address inTokenAdd) external override onlyRole(OPERATION_ADMIN_ROLE) {
// We are only interested in the key token in this case,
// but the value cannot be the 0 addresse
_addTokenPair(inTokenAdd, DUMMY_ADDRESS);
}
/**
* @notice Add a pair of ERC20 tokens to the list of allowed tokens.
* @param inKeyToken The token address as key in the allowed list.
* @param inValueToken The token address as value in the allowed list.
*/
function addTokenPair(
address inKeyToken,
address inValueToken
) external override onlyRole(OPERATION_ADMIN_ROLE) {
// We are only interested in the key token in this case,
// but the value cannot be the 0 addresse
_addTokenPair(inKeyToken, inValueToken);
}
/**
* @notice Remove a distToken and ERC20 token from the list.
* @param inDistToken The DistToken to remove from the allowed list.
*/
function removeDistToken(
IDistToken inDistToken
) external override onlyRole(OPERATION_ADMIN_ROLE) {
// Remove the token from the role list of accepted tokens.
revokeRole(TOKEN_ROLE, inDistToken.tokenAdd());
// Clear the allowed list entry.
delete reversedTokens[address(inDistToken)];
delete allowedTokens[inDistToken.tokenAdd()];
}
/**
* @notice Remove an ERC20 token key (and value token?) from the list.
* @param inTokenAdd The token to remove from the allowed list.
*/
function removeToken(address inTokenAdd) external override onlyRole(OPERATION_ADMIN_ROLE) {
// Its not inportant if the value token was the dummy or a
// regular ERC20 or a DistToken. We just clear the data.
// Remove the key token from the role list of accepted tokens.
revokeRole(TOKEN_ROLE, inTokenAdd);
// Clear the allowed role list entry.
delete reversedTokens[allowedTokens[inTokenAdd]];
delete allowedTokens[inTokenAdd];
}
/**
* @notice Enable the token validation.
*/
function enableValidation() external override onlyRole(OPERATION_ADMIN_ROLE) {
enabledValidation = true;
}
/**
* @notice Disable the token validation.
*/
function disableValidation() external override onlyRole(OPERATION_ADMIN_ROLE) {
enabledValidation = false;
}
/**
* @notice Checks if an allowed distToken address is supplied.
* @param inDistToken The DistToken to check.
* @return bool true if the dist token is allowed, false if not.
*/
function isAllowedDistToken(address inDistToken) external view override returns (bool) {
if (!getInitialized()) {
revert NotInitialized();
}
if (reversedTokens[inDistToken] != IDistToken(inDistToken).tokenAdd()) {
// To avoid an unintented accept of a DistToken with matching key/currency token
return false;
}
return _isAllowedToken(reversedTokens[inDistToken]);
}
/**
* @notice Checks if an allowed valueToken address is supplied.
* @notice ValueToken refers to the keyToken/valueToken pair in allowedTokens.
* @param inValueToken The token to check.
* @return bool true if the token is allowed, false if not.
*/
function isAllowedValueToken(address inValueToken) external view override returns (bool) {
if (!getInitialized()) {
revert NotInitialized();
}
return _isAllowedToken(reversedTokens[inValueToken]);
}
/**
* @notice Checks if an allowed token address is supplied.
* @param inToken The token to check.
* @return bool true if the token is allowed, false if not.
*/
function isAllowedToken(address inToken) external view override returns (bool) {
if (!getInitialized()) {
revert NotInitialized();
}
return _isAllowedToken(inToken);
}
/**
* @notice Checks if an allowed token address is supplied.
* @param inToken The token to check.
* @return bool true if the token is allowed, false if not.
*/
function _isAllowedToken(address inToken) internal view returns (bool) {
if (inToken == address(0)) {
return false;
}
if (!isERC20(inToken)) {
return false;
}
if (enabledValidation) {
return hasRole(TOKEN_ROLE, inToken);
}
return true;
}
/**
* @notice Add a pair of ERC20 tokens to the list of allowed tokens.
* @param inKeyToken The token address as key in the allowed list.
* @param inValueToken The token address as value in the allowed list.
*/
function _addTokenPair(address inKeyToken, address inValueToken) internal {
if (inValueToken == address(0)) {
revert BadTokenZero();
}
if (inKeyToken == address(0)) {
revert BadTokenZero();
}
if (!(inValueToken == DUMMY_ADDRESS || isERC20(inValueToken))) {
revert InvalidToken({tokenAdd: inValueToken});
}
if (!isERC20(inKeyToken)) {
revert InvalidToken({tokenAdd: inKeyToken});
}
// Check if the tokens are added already, we dont want overwrites.
if (allowedTokens[inKeyToken] != address(0)) {
revert InvalidToken({tokenAdd: inKeyToken});
}
if (reversedTokens[inValueToken] != address(0)) {
revert InvalidToken({tokenAdd: inValueToken});
}
// Add the token to the role list of accepted tokens.
grantRole(TOKEN_ROLE, inKeyToken);
// Pair the new key token, with the matching value token.
allowedTokens[inKeyToken] = inValueToken;
if (inValueToken != DUMMY_ADDRESS) {
// and reversed.
reversedTokens[inValueToken] = inKeyToken;
}
enabledValidation = true;
}
/**
* @notice Check if an addresse is for an (ERC20 token) contract.
* @param inToken The token address to check.
* @return bool true if the address is compliant, false if not.
*/
function isERC20(address inToken) internal view returns (bool) {
// Since OZ ERC20 does not implement EIP165 or similar, we just make a contract code check.
// In contracts v5.0 Address.isContract() is removed as well.
uint32 size;
assembly {
size := extcodesize(inToken)
}
return (size > 0);
}
}
{
"compilationTarget": {
"contracts/utils/LockBox.sol": "LockBox"
},
"evmVersion": "cancun",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 10000
},
"remappings": [],
"viaIR": true
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"BadTokenZero","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"required","type":"uint256"}],"name":"InsufficientLockedTokens","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[{"internalType":"address","name":"tokenAdd","type":"address"}],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"NotInitialized","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"tokenAdd","type":"address"}],"name":"TokenNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockedAmount","type":"uint256"}],"name":"TokensLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"unlockedAmount","type":"uint256"}],"name":"TokensUnlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDistToken","name":"inDistToken","type":"address"}],"name":"addDistToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inTokenAdd","type":"address"}],"name":"addSingleToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inKeyToken","type":"address"},{"internalType":"address","name":"inValueToken","type":"address"}],"name":"addTokenPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableValidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableValidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getInitializedVersion","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"getLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"hasLockedAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inDistToken","type":"address"}],"name":"isAllowedDistToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"inToken","type":"address"}],"name":"isAllowedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"inValueToken","type":"address"}],"name":"isAllowedValueToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"lockAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"inAdmin","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDistToken","name":"inDistToken","type":"address"}],"name":"removeDistToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inTokenAdd","type":"address"}],"name":"removeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unlockAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unlockAmountTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]