Overview
S Balance
0 S
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
Raffle
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol"; import {IRandomizerRouter} from "../randomizer/interfaces/IRandomizerRouter.sol"; import {IRandomizerConsumer} from "../randomizer/interfaces/IRandomizerConsumer.sol"; contract Raffle is AccessControlEnumerable, IRandomizerConsumer { event WinnersSelected(uint256[] winners); IRandomizerRouter public randomizer; address public walletAddress; uint256 public participantsCount; bytes32 public lastCommitment; constructor() { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); } function setRandomizer( address _randomizer ) external onlyRole(DEFAULT_ADMIN_ROLE) { randomizer = IRandomizerRouter(_randomizer); } function randomizerCallback( bytes32 commitment, uint256 requestId, uint256[] calldata _rngList ) external override { require( msg.sender == address(randomizer), "Only randomizer can call this function" ); require(commitment == lastCommitment, "Invalid commitment"); uint256[] memory winners = new uint256[](_rngList.length); for (uint256 i = 0; i < _rngList.length; i++) { uint256 winningIndex = _rngList[i] % participantsCount; winners[i] = winningIndex; participantsCount--; } emit WinnersSelected(winners); } function request( uint256 _participantsCount, uint32 winnerCount, uint256 minConfirmations ) external onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256 requestId_) { participantsCount = _participantsCount; bytes32 commitment = keccak256( abi.encodePacked(block.timestamp, msg.sender) ); lastCommitment = commitment; requestId_ = randomizer.request( commitment, winnerCount, minConfirmations ); } }
// 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 // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol) pragma solidity ^0.8.20; import {IAccessControlEnumerable} from "./IAccessControlEnumerable.sol"; import {AccessControl} from "../AccessControl.sol"; import {EnumerableSet} from "../../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 role => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {AccessControl-_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override returns (bool) { bool granted = super._grantRole(role, account); if (granted) { _roleMembers[role].add(account); } return granted; } /** * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) { bool revoked = super._revokeRole(role, account); if (revoked) { _roleMembers[role].remove(account); } return revoked; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol) pragma solidity ^0.8.20; import {IAccessControl} from "../IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// 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 // 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) (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) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.20; interface IRandomizerConsumer { function randomizerCallback( bytes32 commitment, uint256 _requestId, uint256[] calldata _rngList ) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.20; import "./IRandomizerConsumer.sol"; interface IRandomizerRouter { function request( bytes32 commitment, uint32 count, uint256 _minConfirmations ) external returns (uint256); function reRequest(bytes32 commitment, uint256 _requestId) external; function scheduledRequest( bytes32 commitment, uint32 _count, uint256 targetTime ) external returns (uint256); function response( bytes32 commitment, uint256 _requestId, uint256[] calldata _rngList ) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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"},{"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":false,"internalType":"uint256[]","name":"winners","type":"uint256[]"}],"name":"WinnersSelected","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"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":"lastCommitment","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"participantsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomizer","outputs":[{"internalType":"contract IRandomizerRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"commitment","type":"bytes32"},{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"_rngList","type":"uint256[]"}],"name":"randomizerCallback","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":"uint256","name":"_participantsCount","type":"uint256"},{"internalType":"uint32","name":"winnerCount","type":"uint32"},{"internalType":"uint256","name":"minConfirmations","type":"uint256"}],"name":"request","outputs":[{"internalType":"uint256","name":"requestId_","type":"uint256"}],"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":"address","name":"_randomizer","type":"address"}],"name":"setRandomizer","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":[],"name":"walletAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001c600033610022565b5061015b565b60008061002f848461005a565b9050801561005157600084815260016020526040902061004f9084610104565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166100fc576000838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556100b43390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610054565b506000610054565b6000610051836001600160a01b03841660008181526001830160205260408120546100fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610054565b610c9a8061016a6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80638b8c06f511610097578063ca15c87311610066578063ca15c87314610221578063d547741f14610234578063dd60c89814610247578063f10fb5841461025057600080fd5b80638b8c06f5146101e05780639010d07c146101f357806391d1485414610206578063a217fddf1461021957600080fd5b80632f2ff15d116100d35780632f2ff15d1461017a57806336568abe1461018f5780636ad5b3ea146101a2578063767bcab5146101cd57600080fd5b806301ffc9a714610105578063072418ae1461012d578063248a9ca31461014e57806327ff01e914610171575b600080fd5b6101186101133660046109be565b610263565b60405190151581526020015b60405180910390f35b61014061013b3660046109e8565b61028e565b604051908152602001610124565b61014061015c366004610a29565b60009081526020819052604090206001015490565b61014060055481565b61018d610188366004610a5e565b610371565b005b61018d61019d366004610a5e565b61039c565b6003546101b5906001600160a01b031681565b6040516001600160a01b039091168152602001610124565b61018d6101db366004610a8a565b6103d4565b61018d6101ee366004610aa5565b610402565b6101b5610201366004610b28565b6105b8565b610118610214366004610a5e565b6105d7565b610140600081565b61014061022f366004610a29565b610600565b61018d610242366004610a5e565b610617565b61014060045481565b6002546101b5906001600160a01b031681565b60006001600160e01b03198216635a05180f60e01b148061028857506102888261063c565b92915050565b60008061029a81610671565b6004859055604080514260208201526bffffffffffffffffffffffff193360601b169181019190915260009060540160408051808303601f190181529082905280516020909101206005819055600254630280de6d60e51b83526004830182905263ffffffff88166024840152604483018790529092506001600160a01b03169063501bcda0906064016020604051808303816000875af1158015610343573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103679190610b4a565b9695505050505050565b60008281526020819052604090206001015461038c81610671565b610396838361067e565b50505050565b6001600160a01b03811633146103c55760405163334bd91960e11b815260040160405180910390fd5b6103cf82826106b3565b505050565b60006103df81610671565b50600280546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146104705760405162461bcd60e51b815260206004820152602660248201527f4f6e6c792072616e646f6d697a65722063616e2063616c6c20746869732066756044820152653731ba34b7b760d11b60648201526084015b60405180910390fd5b60055484146104b65760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a590818dbdb5b5a5d1b595b9d60721b6044820152606401610467565b60008167ffffffffffffffff8111156104d1576104d1610b63565b6040519080825280602002602001820160405280156104fa578160200160208202803683370190505b50905060005b8281101561057957600060045485858481811061051f5761051f610b79565b905060200201356105309190610b8f565b90508083838151811061054557610545610b79565b60209081029190910101526004805490600061056083610bc7565b919050555050808061057190610bde565b915050610500565b507f22147de70633ee9152c6e2ce61b68ee61ec10e1fc83423f550176bb03744f5b0816040516105a99190610bf7565b60405180910390a15050505050565b60008281526001602052604081206105d090836106e0565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000818152600160205260408120610288906106ec565b60008281526020819052604090206001015461063281610671565b61039683836106b3565b60006001600160e01b03198216637965db0b60e01b148061028857506301ffc9a760e01b6001600160e01b0319831614610288565b61067b81336106f6565b50565b60008061068b8484610733565b905080156105d05760008481526001602052604090206106ab90846107c5565b509392505050565b6000806106c084846107da565b905080156105d05760008481526001602052604090206106ab9084610845565b60006105d0838361085a565b6000610288825490565b61070082826105d7565b61072f5760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610467565b5050565b600061073f83836105d7565b6107bd576000838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556107753390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610288565b506000610288565b60006105d0836001600160a01b038416610884565b60006107e683836105d7565b156107bd576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610288565b60006105d0836001600160a01b0384166108cb565b600082600001828154811061087157610871610b79565b9060005260206000200154905092915050565b60008181526001830160205260408120546107bd57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610288565b600081815260018301602052604081205480156109b45760006108ef600183610c3b565b855490915060009061090390600190610c3b565b905080821461096857600086600001828154811061092357610923610b79565b906000526020600020015490508087600001848154811061094657610946610b79565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061097957610979610c4e565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610288565b6000915050610288565b6000602082840312156109d057600080fd5b81356001600160e01b0319811681146105d057600080fd5b6000806000606084860312156109fd57600080fd5b83359250602084013563ffffffff81168114610a1857600080fd5b929592945050506040919091013590565b600060208284031215610a3b57600080fd5b5035919050565b80356001600160a01b0381168114610a5957600080fd5b919050565b60008060408385031215610a7157600080fd5b82359150610a8160208401610a42565b90509250929050565b600060208284031215610a9c57600080fd5b6105d082610a42565b60008060008060608587031215610abb57600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115610ae157600080fd5b818701915087601f830112610af557600080fd5b813581811115610b0457600080fd5b8860208260051b8501011115610b1957600080fd5b95989497505060200194505050565b60008060408385031215610b3b57600080fd5b50508035926020909101359150565b600060208284031215610b5c57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600082610bac57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b600081610bd657610bd6610bb1565b506000190190565b600060018201610bf057610bf0610bb1565b5060010190565b6020808252825182820181905260009190848201906040850190845b81811015610c2f57835183529284019291840191600101610c13565b50909695505050505050565b8181038181111561028857610288610bb1565b634e487b7160e01b600052603160045260246000fdfea26469706673582212200209433725e56d2dc535ff5e3de9a446612c4266241202de1e7f0c82f973103064736f6c63430008140033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638b8c06f511610097578063ca15c87311610066578063ca15c87314610221578063d547741f14610234578063dd60c89814610247578063f10fb5841461025057600080fd5b80638b8c06f5146101e05780639010d07c146101f357806391d1485414610206578063a217fddf1461021957600080fd5b80632f2ff15d116100d35780632f2ff15d1461017a57806336568abe1461018f5780636ad5b3ea146101a2578063767bcab5146101cd57600080fd5b806301ffc9a714610105578063072418ae1461012d578063248a9ca31461014e57806327ff01e914610171575b600080fd5b6101186101133660046109be565b610263565b60405190151581526020015b60405180910390f35b61014061013b3660046109e8565b61028e565b604051908152602001610124565b61014061015c366004610a29565b60009081526020819052604090206001015490565b61014060055481565b61018d610188366004610a5e565b610371565b005b61018d61019d366004610a5e565b61039c565b6003546101b5906001600160a01b031681565b6040516001600160a01b039091168152602001610124565b61018d6101db366004610a8a565b6103d4565b61018d6101ee366004610aa5565b610402565b6101b5610201366004610b28565b6105b8565b610118610214366004610a5e565b6105d7565b610140600081565b61014061022f366004610a29565b610600565b61018d610242366004610a5e565b610617565b61014060045481565b6002546101b5906001600160a01b031681565b60006001600160e01b03198216635a05180f60e01b148061028857506102888261063c565b92915050565b60008061029a81610671565b6004859055604080514260208201526bffffffffffffffffffffffff193360601b169181019190915260009060540160408051808303601f190181529082905280516020909101206005819055600254630280de6d60e51b83526004830182905263ffffffff88166024840152604483018790529092506001600160a01b03169063501bcda0906064016020604051808303816000875af1158015610343573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103679190610b4a565b9695505050505050565b60008281526020819052604090206001015461038c81610671565b610396838361067e565b50505050565b6001600160a01b03811633146103c55760405163334bd91960e11b815260040160405180910390fd5b6103cf82826106b3565b505050565b60006103df81610671565b50600280546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146104705760405162461bcd60e51b815260206004820152602660248201527f4f6e6c792072616e646f6d697a65722063616e2063616c6c20746869732066756044820152653731ba34b7b760d11b60648201526084015b60405180910390fd5b60055484146104b65760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a590818dbdb5b5a5d1b595b9d60721b6044820152606401610467565b60008167ffffffffffffffff8111156104d1576104d1610b63565b6040519080825280602002602001820160405280156104fa578160200160208202803683370190505b50905060005b8281101561057957600060045485858481811061051f5761051f610b79565b905060200201356105309190610b8f565b90508083838151811061054557610545610b79565b60209081029190910101526004805490600061056083610bc7565b919050555050808061057190610bde565b915050610500565b507f22147de70633ee9152c6e2ce61b68ee61ec10e1fc83423f550176bb03744f5b0816040516105a99190610bf7565b60405180910390a15050505050565b60008281526001602052604081206105d090836106e0565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000818152600160205260408120610288906106ec565b60008281526020819052604090206001015461063281610671565b61039683836106b3565b60006001600160e01b03198216637965db0b60e01b148061028857506301ffc9a760e01b6001600160e01b0319831614610288565b61067b81336106f6565b50565b60008061068b8484610733565b905080156105d05760008481526001602052604090206106ab90846107c5565b509392505050565b6000806106c084846107da565b905080156105d05760008481526001602052604090206106ab9084610845565b60006105d0838361085a565b6000610288825490565b61070082826105d7565b61072f5760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610467565b5050565b600061073f83836105d7565b6107bd576000838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556107753390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610288565b506000610288565b60006105d0836001600160a01b038416610884565b60006107e683836105d7565b156107bd576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610288565b60006105d0836001600160a01b0384166108cb565b600082600001828154811061087157610871610b79565b9060005260206000200154905092915050565b60008181526001830160205260408120546107bd57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610288565b600081815260018301602052604081205480156109b45760006108ef600183610c3b565b855490915060009061090390600190610c3b565b905080821461096857600086600001828154811061092357610923610b79565b906000526020600020015490508087600001848154811061094657610946610b79565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061097957610979610c4e565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610288565b6000915050610288565b6000602082840312156109d057600080fd5b81356001600160e01b0319811681146105d057600080fd5b6000806000606084860312156109fd57600080fd5b83359250602084013563ffffffff81168114610a1857600080fd5b929592945050506040919091013590565b600060208284031215610a3b57600080fd5b5035919050565b80356001600160a01b0381168114610a5957600080fd5b919050565b60008060408385031215610a7157600080fd5b82359150610a8160208401610a42565b90509250929050565b600060208284031215610a9c57600080fd5b6105d082610a42565b60008060008060608587031215610abb57600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115610ae157600080fd5b818701915087601f830112610af557600080fd5b813581811115610b0457600080fd5b8860208260051b8501011115610b1957600080fd5b95989497505060200194505050565b60008060408385031215610b3b57600080fd5b50508035926020909101359150565b600060208284031215610b5c57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600082610bac57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b600081610bd657610bd6610bb1565b506000190190565b600060018201610bf057610bf0610bb1565b5060010190565b6020808252825182820181905260009190848201906040850190845b81811015610c2f57835183529284019291840191600101610c13565b50909695505050505050565b8181038181111561028857610288610bb1565b634e487b7160e01b600052603160045260246000fdfea26469706673582212200209433725e56d2dc535ff5e3de9a446612c4266241202de1e7f0c82f973103064736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.