More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
21050288 | 31 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
LotusBloomPool
Compiler Version
v0.8.27+commit.40a35a09
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.27; /* == OZ == */ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol"; /* == CHAINLINK == */ import {VRFConsumerBaseV2Plus} from "@chainlink/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol"; import {VRFV2PlusClient} from "@chainlink/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol"; /* == UTILS == */ import {Time} from "@utils/Time.sol"; import {Errors} from "@utils/Errors.sol"; struct WinnerRequest { uint128 upForGrabs; // To total rewards up for grabs at the time of requesting bool fulfilled; // Whether the request has been fullfilled } /** * @title LotusBloomPool * @dev A staking pool contract for managing participants, distributing rewards, and selecting winners based on randomness. */ contract LotusBloomPool is VRFConsumerBaseV2Plus, Errors { using EnumerableSet for EnumerableSet.AddressSet; /* == CONST == */ uint256 INTERVAL_TIME = 2 weeks; /* == IMMUTABLE == */ /// @notice Address of the staking contract address immutable staking; address public admin; bytes32 public keyHash; uint16 public requestConfirmations = 3; IERC20 immutable titanX; /// @notice The start timestamp for the pool uint32 immutable startTimestamp; /// @notice Chainlink subscription ID for requesting randomness uint256 immutable subscriptionId; /* == STATE == */ /// @notice Stores the ID of the last randomness request uint256 lastRequestId; /// @notice Mapping from randomness request ID to WinnerRequest details mapping(uint256 requestId => WinnerRequest) requests; /// @notice Last timestamp when bi-weekly interval logic was called uint32 public lastIntervalCall; /// @notice The total amount of rewards available to be distributed uint128 public upForGrabs; /// @notice Set of participants in the pool EnumerableSet.AddressSet participants; /* == MODIFIERS == */ /** * @dev Modifier to restrict function access to only the staking contract. */ modifier onlyStaking() { _onlyStaking(); _; } /** * @dev Modifier to ensure no pending randomness requests. * Reverts if a previous randomness request has not been fulfilled yet. */ modifier noPendingRandomness() { _noPendingRandomness(); _; } modifier onlyAdmin() { _onlyAdmin(); _; } /* == ERRORS == */ /// @notice Error thrown when the caller is not the staking contract. error OnlyStaking(); /// @notice Error thrown when randomness is requested but a previous request is still pending. error RandomnessAlreadyRequested(); /// @notice Error thrown when an operation is called before the interval time has passed. error OnlyAfterIntervalTime(); /// @notice Error thrown when trying to pick a winner, while having no rewards acumulated. error EmptyTreasury(); /// @notice Error thrown when trying to pick a winner, while having no participants error NoParticipation(); ///@notice Error thrown when a non-admin user is trying to access an admin function error OnlyAdmin(); /* == EVENTS == */ event WinnerSelected(address indexed winner, uint256 indexed amountWon); /* == CONSTRUCTOR == */ /** * @notice Initializes the contract with the staking contract address, VRF coordinator, subscription ID, and start timestamp. * @param _staking Address of the staking contract. * @param _vrfCoordinator Address of the Chainlink VRF coordinator. * @param _subscriptionId The Chainlink subscription ID for randomness requests. * @param _startTimestamp Start timestamp for the pool. */ constructor( address _staking, address _vrfCoordinator, uint256 _subscriptionId, address _titanX, bytes32 _keyHash, address _admin, uint32 _startTimestamp ) VRFConsumerBaseV2Plus(_vrfCoordinator) { staking = _staking; startTimestamp = _startTimestamp; titanX = IERC20(_titanX); lastIntervalCall = _startTimestamp; keyHash = _keyHash; subscriptionId = _subscriptionId; admin = _admin; } /* == ADMIN == */ function changeRequestConfirmations(uint16 _newRequestConfirmations) external notAmount0(_newRequestConfirmations) onlyAdmin { requestConfirmations = _newRequestConfirmations; } function changeKeyHash(bytes32 _newKeyHash) external onlyAdmin { keyHash = _newKeyHash; } /* == EXTERNAL == */ /** * @notice Requests random words to determine the winner and distribute rewards. * @dev Ensures that the function is called only after the defined interval time has passed, * and no other randomness request is pending. * @return requestId The ID of the randomness request. */ function pickWinner() external noPendingRandomness returns (uint256 requestId) { require(upForGrabs != 0, EmptyTreasury()); require(lastIntervalCall + INTERVAL_TIME <= Time.blockTs(), OnlyAfterIntervalTime()); require(participants.length() != 0, NoParticipation()); requestId = s_vrfCoordinator.requestRandomWords( VRFV2PlusClient.RandomWordsRequest({ keyHash: keyHash, subId: subscriptionId, requestConfirmations: requestConfirmations, callbackGasLimit: 250_000, numWords: 1, extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false})) }) ); lastRequestId = requestId; requests[requestId] = WinnerRequest({fulfilled: false, upForGrabs: upForGrabs}); } /** * @notice Checks if a user is a participant in the pool. * @param _user Address of the user. * @return bool Returns true if the user is a participant. */ function isParticipant(address _user) public view returns (bool) { return participants.contains(_user); } /** * @notice Fulfills the randomness request and selects a winner from the participants. * @param requestId The ID of the randomness request. * @param randomWords Array of random words provided by Chainlink VRF. */ function fulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) internal override { WinnerRequest storage _winnerReq = requests[requestId]; uint256 missedIntervals = (Time.blockTs() - lastIntervalCall) / INTERVAL_TIME; lastIntervalCall = uint32(lastIntervalCall + (INTERVAL_TIME * missedIntervals)); uint256 randomness = randomWords[0]; address winner = participants.at(randomness % participants.length()); upForGrabs -= _winnerReq.upForGrabs; titanX.transfer(winner, _winnerReq.upForGrabs); emit WinnerSelected(winner, _winnerReq.upForGrabs); _winnerReq.fulfilled = true; } /** * @notice Adds a participant to the pool. * @dev Can only be called by the staking contract. * @param _participant Address of the participant to add. */ function participate(address _participant) external onlyStaking noPendingRandomness { participants.add(_participant); } /** * @notice Removes a participant from the pool. * @dev Can only be called by the staking contract. * @param _participant Address of the participant to remove. */ function removeParticipant(address _participant) external onlyStaking noPendingRandomness { participants.remove(_participant); } /** * @notice Increases the reward pool by a specified amount. * @dev Can only be called by the staking contract. * @param _amount Amount to add to the reward pool. */ function distributeRewards(uint128 _amount) external onlyStaking { upForGrabs += _amount; } /* == PRIVATE == */ /** * @dev Internal function to restrict access to only the staking contract. * @notice Throws OnlyStaking error if the caller is not the staking contract. */ function _onlyStaking() internal view { require(msg.sender == staking, OnlyStaking()); } /** * @dev Internal function to check that no pending randomness requests are active. * @notice Throws RandomnessAlreadyRequested if the last randomness request is still pending. */ function _noPendingRandomness() internal view { WinnerRequest memory _lastReq = requests[lastRequestId]; require(lastRequestId == 0 || _lastReq.fulfilled, RandomnessAlreadyRequested()); } function _onlyAdmin() internal view { require(msg.sender == admin, OnlyAdmin()); } }
// 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: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {IVRFCoordinatorV2Plus} from "./interfaces/IVRFCoordinatorV2Plus.sol"; import {IVRFMigratableConsumerV2Plus} from "./interfaces/IVRFMigratableConsumerV2Plus.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. It ensures 2 things: * @dev 1. The fulfillment came from the VRFCoordinatorV2Plus. * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBaseV2Plus, and can * @dev initialize VRFConsumerBaseV2Plus's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumerV2Plus is VRFConsumerBaseV2Plus { * @dev constructor(<other arguments>, address _vrfCoordinator, address _subOwner) * @dev VRFConsumerBaseV2Plus(_vrfCoordinator, _subOwner) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash). Create a subscription, fund it * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface * @dev subscription management functions). * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations, * @dev callbackGasLimit, numWords, extraArgs), * @dev see (IVRFCoordinatorV2Plus for a description of the arguments). * * @dev Once the VRFCoordinatorV2Plus has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomWords method. * * @dev The randomness argument to fulfillRandomWords is a set of random words * @dev generated from your requestId and the blockHash of the request. * * @dev If your contract could have concurrent requests open, you can use the * @dev requestId returned from requestRandomWords to track which response is associated * @dev with which randomness request. * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously. * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBaseV2Plus.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. It is for this reason that * @dev that you can signal to an oracle you'd like them to wait longer before * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ abstract contract VRFConsumerBaseV2Plus is IVRFMigratableConsumerV2Plus, ConfirmedOwner { error OnlyCoordinatorCanFulfill(address have, address want); error OnlyOwnerOrCoordinator(address have, address owner, address coordinator); error ZeroAddress(); // s_vrfCoordinator should be used by consumers to make requests to vrfCoordinator // so that coordinator reference is updated after migration IVRFCoordinatorV2Plus public s_vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) ConfirmedOwner(msg.sender) { if (_vrfCoordinator == address(0)) { revert ZeroAddress(); } s_vrfCoordinator = IVRFCoordinatorV2Plus(_vrfCoordinator); } /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBaseV2Plus expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomWords the VRF output expanded to the requested number of words */ // solhint-disable-next-line chainlink-solidity/prefix-internal-functions-with-underscore function fulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) internal virtual; // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) external { if (msg.sender != address(s_vrfCoordinator)) { revert OnlyCoordinatorCanFulfill(msg.sender, address(s_vrfCoordinator)); } fulfillRandomWords(requestId, randomWords); } /** * @inheritdoc IVRFMigratableConsumerV2Plus */ function setCoordinator(address _vrfCoordinator) external override onlyOwnerOrCoordinator { if (_vrfCoordinator == address(0)) { revert ZeroAddress(); } s_vrfCoordinator = IVRFCoordinatorV2Plus(_vrfCoordinator); emit CoordinatorSet(_vrfCoordinator); } modifier onlyOwnerOrCoordinator() { if (msg.sender != owner() && msg.sender != address(s_vrfCoordinator)) { revert OnlyOwnerOrCoordinator(msg.sender, owner(), address(s_vrfCoordinator)); } _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // End consumer library. library VRFV2PlusClient { // extraArgs will evolve to support new features bytes4 public constant EXTRA_ARGS_V1_TAG = bytes4(keccak256("VRF ExtraArgsV1")); struct ExtraArgsV1 { bool nativePayment; } struct RandomWordsRequest { bytes32 keyHash; uint256 subId; uint16 requestConfirmations; uint32 callbackGasLimit; uint32 numWords; bytes extraArgs; } function _argsToBytes(ExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EXTRA_ARGS_V1_TAG, extraArgs); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.27; library Time { ///@notice The cut-off time in seconds from the start of the day for a day turnover, equivalent to 16 hours (57,600 seconds). uint32 constant TURN_OVER_TIME = 57600; ///@notice The total number of seconds in a day. uint32 constant SECONDS_PER_DAY = 86400; /** * @notice Returns the current block timestamp. * @dev This function retrieves the timestamp using assembly for gas efficiency. * @return ts The current block timestamp. */ function blockTs() internal view returns (uint32 ts) { assembly { ts := timestamp() } } /** * @notice Calculates the number of weeks passed since a given timestamp. * @dev Uses assembly to retrieve the current timestamp and calculates the number of turnover time periods passed. * @param t The starting timestamp. * @return weeksPassed The number of weeks that have passed since the provided timestamp. */ function weekSince(uint32 t) internal view returns (uint32 weeksPassed) { assembly { let currentTime := timestamp() let timeElapsed := sub(currentTime, t) weeksPassed := div(timeElapsed, TURN_OVER_TIME) } } /** * @notice Calculates the number of full days between two timestamps. * @dev Subtracts the start time from the end time and divides by the seconds per day. * @param start The starting timestamp. * @param end The ending timestamp. * @return daysPassed The number of full days between the two timestamps. */ function dayGap(uint32 start, uint256 end) public pure returns (uint32 daysPassed) { assembly { daysPassed := div(sub(end, start), SECONDS_PER_DAY) } } function weekDayByT(uint32 t) public pure returns (uint8 weekDay) { assembly { // Subtract 14 hours from the timestamp let adjustedTimestamp := sub(t, TURN_OVER_TIME) // Divide by the number of seconds in a day (86400) let days := div(adjustedTimestamp, SECONDS_PER_DAY) // Add 4 to align with weekday and calculate mod 7 let result := mod(add(days, 4), 7) // Store result as uint8 weekDay := result } } /** * @notice Calculates the end of the day at 2 PM UTC based on a given timestamp. * @dev Adjusts the provided timestamp by subtracting the turnover time, calculates the next day's timestamp at 2 PM UTC. * @param t The starting timestamp. * @return nextDayStartAt2PM The timestamp for the next day ending at 2 PM UTC. */ function getDayEnd(uint32 t) public pure returns (uint32 nextDayStartAt2PM) { // Adjust the timestamp to the cutoff time (2 PM UTC) uint32 adjustedTime = t - TURN_OVER_TIME; // Calculate the number of days since Unix epoch uint32 daysSinceEpoch = adjustedTime / 86400; // Calculate the start of the next day at 2 PM UTC nextDayStartAt2PM = (daysSinceEpoch + 1) * 86400 + TURN_OVER_TIME; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.27; contract Errors { /// @notice Error thrown when an address is the zero address. error Address0(); /// @notice Error thrown when an amount is zero. error Amount0(); /// @notice Error thrown when an operation is attempted after the specified deadline. error Expired(); /// @notice Error thrown when one value is greater than another. /// @param a The first value that is greater than the second value. /// @param b The second value which is smaller or equal to the first value. error GreaterThan(uint256 a, uint256 b); /** * @notice Modifier to prevent operations with a zero amount. * @dev Throws an `Amount0` error if the provided amount is zero. * @param a The amount to be checked. */ modifier notAmount0(uint256 a) { require(a != 0, Amount0()); _; } /** * @notice Modifier to ensure a function is called before a specified deadline. * @dev Throws an `Expired` error if the current block timestamp exceeds the provided deadline. * @param _deadline The deadline timestamp by which the function must be called. */ modifier notExpired(uint32 _deadline) { require(block.timestamp <= _deadline, Expired()); _; } /** * @notice Modifier to prevent operations with the zero address. * @dev Throws an `Address0` error if the provided address is the zero address. * @param a The address to be checked. */ modifier notAddress0(address a) { require(a != address(0), Address0()); _; } /** * @notice Modifier to ensure the first value is not greater than the second value. * @dev Throws a `GreaterThan` error if `b` is smaller than `a`. * @param a The first value to be compared. * @param b The second value to be compared. */ modifier notGt(uint256 a, uint256 b) { require(b >= a, GreaterThan(a, b)); _; } }
// 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.0; import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; import {IVRFSubscriptionV2Plus} from "./IVRFSubscriptionV2Plus.sol"; // Interface that enables consumers of VRFCoordinatorV2Plus to be future-proof for upgrades // This interface is supported by subsequent versions of VRFCoordinatorV2Plus interface IVRFCoordinatorV2Plus is IVRFSubscriptionV2Plus { /** * @notice Request a set of random words. * @param req - a struct containing following fields for randomness request: * keyHash - Corresponds to a particular oracle job which uses * that key for generating the VRF proof. Different keyHash's have different gas price * ceilings, so you can select a specific one to bound your maximum per request cost. * subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * requestConfirmations - How many blocks you'd like the * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS * for why you may want to request more. The acceptable range is * [minimumRequestBlockConfirmations, 200]. * callbackGasLimit - How much gas you'd like to receive in your * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords * may be slightly less than this amount because of gas used calling the function * (argument decoding etc.), so you may need to request slightly more than you expect * to have inside fulfillRandomWords. The acceptable range is * [0, maxGasLimit] * numWords - The number of uint256 random values you'd like to receive * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * extraArgs - abi-encoded extra args * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords(VRFV2PlusClient.RandomWordsRequest calldata req) external returns (uint256 requestId); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @notice The IVRFMigratableConsumerV2Plus interface defines the /// @notice method required to be implemented by all V2Plus consumers. /// @dev This interface is designed to be used in VRFConsumerBaseV2Plus. interface IVRFMigratableConsumerV2Plus { event CoordinatorSet(address vrfCoordinator); /// @notice Sets the VRF Coordinator address /// @notice This method should only be callable by the coordinator or contract owner function setCoordinator(address vrfCoordinator) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ConfirmedOwnerWithProposal} from "./ConfirmedOwnerWithProposal.sol"; /// @title The ConfirmedOwner contract /// @notice A contract with helpers for basic contract ownership. contract ConfirmedOwner is ConfirmedOwnerWithProposal { constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @notice The IVRFSubscriptionV2Plus interface defines the subscription /// @notice related methods implemented by the V2Plus coordinator. interface IVRFSubscriptionV2Plus { /** * @notice Add a consumer to a VRF subscription. * @param subId - ID of the subscription * @param consumer - New consumer which can use the subscription */ function addConsumer(uint256 subId, address consumer) external; /** * @notice Remove a consumer from a VRF subscription. * @param subId - ID of the subscription * @param consumer - Consumer to remove from the subscription */ function removeConsumer(uint256 subId, address consumer) external; /** * @notice Cancel a subscription * @param subId - ID of the subscription * @param to - Where to send the remaining LINK to */ function cancelSubscription(uint256 subId, address to) external; /** * @notice Accept subscription owner transfer. * @param subId - ID of the subscription * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ function acceptSubscriptionOwnerTransfer(uint256 subId) external; /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint256 subId, address newOwner) external; /** * @notice Create a VRF subscription. * @return subId - A unique subscription id. * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer. * @dev Note to fund the subscription with LINK, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); * @dev Note to fund the subscription with Native, use fundSubscriptionWithNative. Be sure * @dev to send Native with the call, for example: * @dev COORDINATOR.fundSubscriptionWithNative{value: amount}(subId); */ function createSubscription() external returns (uint256 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return nativeBalance - native balance of the subscription in wei. * @return reqCount - Requests count of subscription. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription( uint256 subId ) external view returns (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers); /* * @notice Check to see if there exists a request commitment consumers * for all consumers and keyhashes for a given sub. * @param subId - ID of the subscription * @return true if there exists at least one unfulfilled request for the subscription, false * otherwise. */ function pendingRequestExists(uint256 subId) external view returns (bool); /** * @notice Paginate through all active VRF subscriptions. * @param startIndex index of the subscription to start from * @param maxCount maximum number of subscriptions to return, 0 to return all * @dev the order of IDs in the list is **not guaranteed**, therefore, if making successive calls, one * @dev should consider keeping the blockheight constant to ensure a holistic picture of the contract state */ function getActiveSubscriptionIds(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); /** * @notice Fund a subscription with native. * @param subId - ID of the subscription * @notice This method expects msg.value to be greater than or equal to 0. */ function fundSubscriptionWithNative(uint256 subId) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IOwnable} from "../interfaces/IOwnable.sol"; /// @title The ConfirmedOwner contract /// @notice A contract with helpers for basic contract ownership. contract ConfirmedOwnerWithProposal is IOwnable { address private s_owner; address private s_pendingOwner; event OwnershipTransferRequested(address indexed from, address indexed to); event OwnershipTransferred(address indexed from, address indexed to); constructor(address newOwner, address pendingOwner) { // solhint-disable-next-line gas-custom-errors require(newOwner != address(0), "Cannot set owner to zero"); s_owner = newOwner; if (pendingOwner != address(0)) { _transferOwnership(pendingOwner); } } /// @notice Allows an owner to begin transferring ownership to a new address. function transferOwnership(address to) public override onlyOwner { _transferOwnership(to); } /// @notice Allows an ownership transfer to be completed by the recipient. function acceptOwnership() external override { // solhint-disable-next-line gas-custom-errors require(msg.sender == s_pendingOwner, "Must be proposed owner"); address oldOwner = s_owner; s_owner = msg.sender; s_pendingOwner = address(0); emit OwnershipTransferred(oldOwner, msg.sender); } /// @notice Get the current owner function owner() public view override returns (address) { return s_owner; } /// @notice validate, transfer ownership, and emit relevant events function _transferOwnership(address to) private { // solhint-disable-next-line gas-custom-errors require(to != msg.sender, "Cannot transfer to self"); s_pendingOwner = to; emit OwnershipTransferRequested(s_owner, to); } /// @notice validate access function _validateOwnership() internal view { // solhint-disable-next-line gas-custom-errors require(msg.sender == s_owner, "Only callable by owner"); } /// @notice Reverts if called by anyone other than the contract owner. modifier onlyOwner() { _validateOwnership(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IOwnable { function owner() external returns (address); function transferOwnership(address recipient) external; function acceptOwnership() external; }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "@uniswap/v2-periphery/=lib/v2-periphery/", "@uniswap/v2-core/=lib/v2-core/", "@chainlink/=lib/chainlink/", "@utils/=src/utils/", "@libs/=src/libs/", "@core/=src/", "@const/=src/const/", "@actions/=src/actions/", "@interfaces/=src/interfaces/", "@script/=script/", "chainlink/=lib/chainlink/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "v3-core/=lib/v3-core/contracts/", "v3-periphery/=lib/v3-periphery/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_staking","type":"address"},{"internalType":"address","name":"_vrfCoordinator","type":"address"},{"internalType":"uint256","name":"_subscriptionId","type":"uint256"},{"internalType":"address","name":"_titanX","type":"address"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"uint32","name":"_startTimestamp","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Address0","type":"error"},{"inputs":[],"name":"Amount0","type":"error"},{"inputs":[],"name":"EmptyTreasury","type":"error"},{"inputs":[],"name":"Expired","type":"error"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"}],"name":"GreaterThan","type":"error"},{"inputs":[],"name":"NoParticipation","type":"error"},{"inputs":[],"name":"OnlyAdmin","type":"error"},{"inputs":[],"name":"OnlyAfterIntervalTime","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"coordinator","type":"address"}],"name":"OnlyOwnerOrCoordinator","type":"error"},{"inputs":[],"name":"OnlyStaking","type":"error"},{"inputs":[],"name":"RandomnessAlreadyRequested","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vrfCoordinator","type":"address"}],"name":"CoordinatorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"winner","type":"address"},{"indexed":true,"internalType":"uint256","name":"amountWon","type":"uint256"}],"name":"WinnerSelected","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_newKeyHash","type":"bytes32"}],"name":"changeKeyHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_newRequestConfirmations","type":"uint16"}],"name":"changeRequestConfirmations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_amount","type":"uint128"}],"name":"distributeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"isParticipant","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"keyHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastIntervalCall","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_participant","type":"address"}],"name":"participate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pickWinner","outputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_participant","type":"address"}],"name":"removeParticipant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestConfirmations","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"s_vrfCoordinator","outputs":[{"internalType":"contract IVRFCoordinatorV2Plus","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vrfCoordinator","type":"address"}],"name":"setCoordinator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upForGrabs","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101006040526212750060039081556006805461ffff19169091179055348015610027575f5ffd5b5060405161136b38038061136b83398101604081905261004691610221565b8533805f8161009c5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b5f80546001600160a01b0319166001600160a01b03848116919091179091558116156100cb576100cb8161015e565b5050506001600160a01b0381166100f55760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b03199081166001600160a01b039384161790915597811660805263ffffffff9190911660c081905293811660a0526009805463ffffffff191690941790935560059190915560e09290925260048054909416911617909155506102a0565b336001600160a01b038216036101b65760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610093565b600180546001600160a01b0319166001600160a01b038381169182179092555f8054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b80516001600160a01b038116811461021c575f5ffd5b919050565b5f5f5f5f5f5f5f60e0888a031215610237575f5ffd5b61024088610206565b965061024e60208901610206565b95506040880151945061026360608901610206565b93506080880151925061027860a08901610206565b915060c088015163ffffffff81168114610290575f5ffd5b8091505092959891949750929550565b60805160a05160c05160e05161109b6102d05f395f6103d601525f50505f6108c601525f610aa3015261109b5ff3fe608060405234801561000f575f5ffd5b5060043610610111575f3560e01c8063929066f51161009e578063bb20995a1161006e578063bb20995a14610250578063c82e3efb14610275578063f2fde38b14610288578063f50d390d1461029b578063f851a440146102ae575f5ffd5b8063929066f5146101e65780639eccacf614610209578063b0fb162f1461021c578063b91038c71461023d575f5ffd5b806361728f39116100e457806361728f391461018b578063668a20011461019457806379ba5097146101a75780638da5cb5b146101af5780638ea98117146101d3575f5ffd5b80631df47acc146101155780631fe543e31461014d5780632f68f482146101625780635d495aea14610175575b5f5ffd5b6009546101309064010000000090046001600160801b031681565b6040516001600160801b0390911681526020015b60405180910390f35b61016061015b366004610d8b565b6102c1565b005b610160610170366004610e05565b610316565b61017d610323565b604051908152602001610144565b61017d60055481565b6101606101a2366004610e1c565b61050f565b61016061052e565b5f546001600160a01b03165b6040516001600160a01b039091168152602001610144565b6101606101e1366004610e1c565b6105d7565b6101f96101f4366004610e1c565b6106c7565b6040519015158152602001610144565b6002546101bb906001600160a01b031681565b60065461022a9061ffff1681565b60405161ffff9091168152602001610144565b61016061024b366004610e1c565b6106d9565b6009546102609063ffffffff1681565b60405163ffffffff9091168152602001610144565b610160610283366004610e42565b6106f4565b610160610296366004610e1c565b610747565b6101606102a9366004610e68565b61075b565b6004546101bb906001600160a01b031681565b6002546001600160a01b031633146103065760025460405163073e64fd60e21b81523360048201526001600160a01b0390911660248201526044015b60405180910390fd5b6103118383836107a1565b505050565b61031e61098d565b600555565b5f61032c6109ba565b60095464010000000090046001600160801b03165f0361035f57604051633372d42d60e21b815260040160405180910390fd5b4260035460095463ffffffff9283169261037a929116610e9d565b111561039957604051635ded5d6b60e01b815260040160405180910390fd5b6103a3600a610a1e565b5f036103c257604051632ac217f560e11b815260040160405180910390fd5b6002546040805160c08101825260055481527f000000000000000000000000000000000000000000000000000000000000000060208083019190915260065461ffff16828401526203d09060608301526001608083015282519081019092525f82526001600160a01b0390921691639b1c385e9160a082019061044490610a27565b8152506040518263ffffffff1660e01b81526004016104639190610eb0565b6020604051808303815f875af115801561047f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104a39190610f49565b60078190556040805180820182526009546001600160801b03640100000000909104811682525f602080840182815286835260089091529390209151825493511515600160801b0270ffffffffffffffffffffffffffffffffff19909416911617919091179055919050565b610517610a98565b61051f6109ba565b61052a600a82610ae1565b5050565b6001546001600160a01b031633146105815760405162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b60448201526064016102fd565b5f8054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b5f546001600160a01b031633148015906105fc57506002546001600160a01b03163314155b1561064c57336106135f546001600160a01b031690565b60025460405163061db9c160e01b81526001600160a01b03938416600482015291831660248301529190911660448201526064016102fd565b6001600160a01b0381166106735760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fd1a6a14209a385a964d036e404cb5cfb71f4000cdb03c9366292430787261be69060200160405180910390a150565b5f6106d3600a83610afc565b92915050565b6106e1610a98565b6106e96109ba565b61052a600a82610b1d565b6106fc610a98565b80600960048282829054906101000a90046001600160801b03166107209190610f60565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555050565b61074f610b31565b61075881610b83565b50565b8061ffff16805f0361078057604051635a53a6e960e01b815260040160405180910390fd5b61078861098d565b506006805461ffff191661ffff92909216919091179055565b5f8381526008602052604081206003546009549192916107c79063ffffffff1642610f7f565b63ffffffff166107d79190610faf565b9050806003546107e79190610fc2565b6009546107fa919063ffffffff16610e9d565b6009805463ffffffff191663ffffffff929092169190911790555f8484828161082557610825610fd9565b9050602002013590505f61084e61083c600a610a1e565b6108469084610fed565b600a90610c2b565b8454600980549293506001600160801b0391821692909160049161087c918591640100000000900416611000565b82546101009290920a6001600160801b03818102199093169183160217909155855460405163a9059cbb60e01b81526001600160a01b0385811660048301529190921660248301527f000000000000000000000000000000000000000000000000000000000000000016915063a9059cbb906044016020604051808303815f875af115801561090d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610931919061101f565b5083546040516001600160801b03909116906001600160a01b038316907f75060f9e79552df167b73353fee6237a75bb5ba8ea022f77224e32f152138bcb905f90a35050815460ff60801b1916600160801b1790915550505050565b6004546001600160a01b031633146109b857604051634755657960e01b815260040160405180910390fd5b565b6007545f818152600860209081526040918290208251808401909352546001600160801b0381168352600160801b900460ff16151590820152901580610a01575080602001515b61075857604051639ce4cccf60e01b815260040160405180910390fd5b5f6106d3825490565b60607f92fd13387c7fe7befbc38d303d6468778fb9731bc4583f17d92989c6fcfdeaaa82604051602401610a6091511515815260200190565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915292915050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109b857604051631eb823b160e11b815260040160405180910390fd5b5f610af5836001600160a01b038416610c36565b9392505050565b6001600160a01b0381165f9081526001830160205260408120541515610af5565b5f610af5836001600160a01b038416610d19565b5f546001600160a01b031633146109b85760405162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b60448201526064016102fd565b336001600160a01b03821603610bdb5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c6600000000000000000060448201526064016102fd565b600180546001600160a01b0319166001600160a01b038381169182179092555f8054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b5f610af58383610d65565b5f8181526001830160205260408120548015610d10575f610c5860018361103e565b85549091505f90610c6b9060019061103e565b9050808214610cca575f865f018281548110610c8957610c89610fd9565b905f5260205f200154905080875f018481548110610ca957610ca9610fd9565b5f918252602080832090910192909255918252600188019052604090208390555b8554869080610cdb57610cdb611051565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506106d3565b5f9150506106d3565b5f818152600183016020526040812054610d5e57508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556106d3565b505f6106d3565b5f825f018281548110610d7a57610d7a610fd9565b905f5260205f200154905092915050565b5f5f5f60408486031215610d9d575f5ffd5b83359250602084013567ffffffffffffffff811115610dba575f5ffd5b8401601f81018613610dca575f5ffd5b803567ffffffffffffffff811115610de0575f5ffd5b8660208260051b8401011115610df4575f5ffd5b939660209190910195509293505050565b5f60208284031215610e15575f5ffd5b5035919050565b5f60208284031215610e2c575f5ffd5b81356001600160a01b0381168114610af5575f5ffd5b5f60208284031215610e52575f5ffd5b81356001600160801b0381168114610af5575f5ffd5b5f60208284031215610e78575f5ffd5b813561ffff81168114610af5575f5ffd5b634e487b7160e01b5f52601160045260245ffd5b808201808211156106d3576106d3610e89565b60208152815160208201526020820151604082015261ffff604083015116606082015263ffffffff606083015116608082015263ffffffff60808301511660a08201525f60a083015160c08084015280518060e08501525f5b81811015610f27576020818401810151610100878401015201610f09565b505f6101008286010152610100601f19601f8301168501019250505092915050565b5f60208284031215610f59575f5ffd5b5051919050565b6001600160801b0381811683821601908111156106d3576106d3610e89565b63ffffffff82811682821603908111156106d3576106d3610e89565b634e487b7160e01b5f52601260045260245ffd5b5f82610fbd57610fbd610f9b565b500490565b80820281158282048414176106d3576106d3610e89565b634e487b7160e01b5f52603260045260245ffd5b5f82610ffb57610ffb610f9b565b500690565b6001600160801b0382811682821603908111156106d3576106d3610e89565b5f6020828403121561102f575f5ffd5b81518015158114610af5575f5ffd5b818103818111156106d3576106d3610e89565b634e487b7160e01b5f52603160045260245ffdfea2646970667358221220e2505e0c4d49e9fdf916d74d590a6594d173a987708770f87b8e9c5839cdff4364736f6c634300081b0033000000000000000000000000e2fb977affe038189766b35e4321e328769ac7cf000000000000000000000000d7f86b4b8cae7d942340ff628f82735b7a20893aff69e45a452760adf8bbae506631197cc41f0e2d83580febb35bc2548a878dc0000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b18077df514608a09f83e4e8d300645594e5d7234665448ba83f51a50f842bd3d90000000000000000000000005da227386e0fd73329fe3923394913eca3a624f700000000000000000000000000000000000000000000000000000000671d1200
Deployed Bytecode
0x608060405234801561000f575f5ffd5b5060043610610111575f3560e01c8063929066f51161009e578063bb20995a1161006e578063bb20995a14610250578063c82e3efb14610275578063f2fde38b14610288578063f50d390d1461029b578063f851a440146102ae575f5ffd5b8063929066f5146101e65780639eccacf614610209578063b0fb162f1461021c578063b91038c71461023d575f5ffd5b806361728f39116100e457806361728f391461018b578063668a20011461019457806379ba5097146101a75780638da5cb5b146101af5780638ea98117146101d3575f5ffd5b80631df47acc146101155780631fe543e31461014d5780632f68f482146101625780635d495aea14610175575b5f5ffd5b6009546101309064010000000090046001600160801b031681565b6040516001600160801b0390911681526020015b60405180910390f35b61016061015b366004610d8b565b6102c1565b005b610160610170366004610e05565b610316565b61017d610323565b604051908152602001610144565b61017d60055481565b6101606101a2366004610e1c565b61050f565b61016061052e565b5f546001600160a01b03165b6040516001600160a01b039091168152602001610144565b6101606101e1366004610e1c565b6105d7565b6101f96101f4366004610e1c565b6106c7565b6040519015158152602001610144565b6002546101bb906001600160a01b031681565b60065461022a9061ffff1681565b60405161ffff9091168152602001610144565b61016061024b366004610e1c565b6106d9565b6009546102609063ffffffff1681565b60405163ffffffff9091168152602001610144565b610160610283366004610e42565b6106f4565b610160610296366004610e1c565b610747565b6101606102a9366004610e68565b61075b565b6004546101bb906001600160a01b031681565b6002546001600160a01b031633146103065760025460405163073e64fd60e21b81523360048201526001600160a01b0390911660248201526044015b60405180910390fd5b6103118383836107a1565b505050565b61031e61098d565b600555565b5f61032c6109ba565b60095464010000000090046001600160801b03165f0361035f57604051633372d42d60e21b815260040160405180910390fd5b4260035460095463ffffffff9283169261037a929116610e9d565b111561039957604051635ded5d6b60e01b815260040160405180910390fd5b6103a3600a610a1e565b5f036103c257604051632ac217f560e11b815260040160405180910390fd5b6002546040805160c08101825260055481527fff69e45a452760adf8bbae506631197cc41f0e2d83580febb35bc2548a878dc060208083019190915260065461ffff16828401526203d09060608301526001608083015282519081019092525f82526001600160a01b0390921691639b1c385e9160a082019061044490610a27565b8152506040518263ffffffff1660e01b81526004016104639190610eb0565b6020604051808303815f875af115801561047f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104a39190610f49565b60078190556040805180820182526009546001600160801b03640100000000909104811682525f602080840182815286835260089091529390209151825493511515600160801b0270ffffffffffffffffffffffffffffffffff19909416911617919091179055919050565b610517610a98565b61051f6109ba565b61052a600a82610ae1565b5050565b6001546001600160a01b031633146105815760405162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b60448201526064016102fd565b5f8054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b5f546001600160a01b031633148015906105fc57506002546001600160a01b03163314155b1561064c57336106135f546001600160a01b031690565b60025460405163061db9c160e01b81526001600160a01b03938416600482015291831660248301529190911660448201526064016102fd565b6001600160a01b0381166106735760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fd1a6a14209a385a964d036e404cb5cfb71f4000cdb03c9366292430787261be69060200160405180910390a150565b5f6106d3600a83610afc565b92915050565b6106e1610a98565b6106e96109ba565b61052a600a82610b1d565b6106fc610a98565b80600960048282829054906101000a90046001600160801b03166107209190610f60565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555050565b61074f610b31565b61075881610b83565b50565b8061ffff16805f0361078057604051635a53a6e960e01b815260040160405180910390fd5b61078861098d565b506006805461ffff191661ffff92909216919091179055565b5f8381526008602052604081206003546009549192916107c79063ffffffff1642610f7f565b63ffffffff166107d79190610faf565b9050806003546107e79190610fc2565b6009546107fa919063ffffffff16610e9d565b6009805463ffffffff191663ffffffff929092169190911790555f8484828161082557610825610fd9565b9050602002013590505f61084e61083c600a610a1e565b6108469084610fed565b600a90610c2b565b8454600980549293506001600160801b0391821692909160049161087c918591640100000000900416611000565b82546101009290920a6001600160801b03818102199093169183160217909155855460405163a9059cbb60e01b81526001600160a01b0385811660048301529190921660248301527f000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b116915063a9059cbb906044016020604051808303815f875af115801561090d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610931919061101f565b5083546040516001600160801b03909116906001600160a01b038316907f75060f9e79552df167b73353fee6237a75bb5ba8ea022f77224e32f152138bcb905f90a35050815460ff60801b1916600160801b1790915550505050565b6004546001600160a01b031633146109b857604051634755657960e01b815260040160405180910390fd5b565b6007545f818152600860209081526040918290208251808401909352546001600160801b0381168352600160801b900460ff16151590820152901580610a01575080602001515b61075857604051639ce4cccf60e01b815260040160405180910390fd5b5f6106d3825490565b60607f92fd13387c7fe7befbc38d303d6468778fb9731bc4583f17d92989c6fcfdeaaa82604051602401610a6091511515815260200190565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915292915050565b336001600160a01b037f000000000000000000000000e2fb977affe038189766b35e4321e328769ac7cf16146109b857604051631eb823b160e11b815260040160405180910390fd5b5f610af5836001600160a01b038416610c36565b9392505050565b6001600160a01b0381165f9081526001830160205260408120541515610af5565b5f610af5836001600160a01b038416610d19565b5f546001600160a01b031633146109b85760405162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b60448201526064016102fd565b336001600160a01b03821603610bdb5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c6600000000000000000060448201526064016102fd565b600180546001600160a01b0319166001600160a01b038381169182179092555f8054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b5f610af58383610d65565b5f8181526001830160205260408120548015610d10575f610c5860018361103e565b85549091505f90610c6b9060019061103e565b9050808214610cca575f865f018281548110610c8957610c89610fd9565b905f5260205f200154905080875f018481548110610ca957610ca9610fd9565b5f918252602080832090910192909255918252600188019052604090208390555b8554869080610cdb57610cdb611051565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506106d3565b5f9150506106d3565b5f818152600183016020526040812054610d5e57508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556106d3565b505f6106d3565b5f825f018281548110610d7a57610d7a610fd9565b905f5260205f200154905092915050565b5f5f5f60408486031215610d9d575f5ffd5b83359250602084013567ffffffffffffffff811115610dba575f5ffd5b8401601f81018613610dca575f5ffd5b803567ffffffffffffffff811115610de0575f5ffd5b8660208260051b8401011115610df4575f5ffd5b939660209190910195509293505050565b5f60208284031215610e15575f5ffd5b5035919050565b5f60208284031215610e2c575f5ffd5b81356001600160a01b0381168114610af5575f5ffd5b5f60208284031215610e52575f5ffd5b81356001600160801b0381168114610af5575f5ffd5b5f60208284031215610e78575f5ffd5b813561ffff81168114610af5575f5ffd5b634e487b7160e01b5f52601160045260245ffd5b808201808211156106d3576106d3610e89565b60208152815160208201526020820151604082015261ffff604083015116606082015263ffffffff606083015116608082015263ffffffff60808301511660a08201525f60a083015160c08084015280518060e08501525f5b81811015610f27576020818401810151610100878401015201610f09565b505f6101008286010152610100601f19601f8301168501019250505092915050565b5f60208284031215610f59575f5ffd5b5051919050565b6001600160801b0381811683821601908111156106d3576106d3610e89565b63ffffffff82811682821603908111156106d3576106d3610e89565b634e487b7160e01b5f52601260045260245ffd5b5f82610fbd57610fbd610f9b565b500490565b80820281158282048414176106d3576106d3610e89565b634e487b7160e01b5f52603260045260245ffd5b5f82610ffb57610ffb610f9b565b500690565b6001600160801b0382811682821603908111156106d3576106d3610e89565b5f6020828403121561102f575f5ffd5b81518015158114610af5575f5ffd5b818103818111156106d3576106d3610e89565b634e487b7160e01b5f52603160045260245ffdfea2646970667358221220e2505e0c4d49e9fdf916d74d590a6594d173a987708770f87b8e9c5839cdff4364736f6c634300081b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e2fb977affe038189766b35e4321e328769ac7cf000000000000000000000000d7f86b4b8cae7d942340ff628f82735b7a20893aff69e45a452760adf8bbae506631197cc41f0e2d83580febb35bc2548a878dc0000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b18077df514608a09f83e4e8d300645594e5d7234665448ba83f51a50f842bd3d90000000000000000000000005da227386e0fd73329fe3923394913eca3a624f700000000000000000000000000000000000000000000000000000000671d1200
-----Decoded View---------------
Arg [0] : _staking (address): 0xE2Fb977AFFe038189766b35E4321E328769AC7cf
Arg [1] : _vrfCoordinator (address): 0xD7f86b4b8Cae7D942340FF628F82735b7a20893a
Arg [2] : _subscriptionId (uint256): 115526871362379674834559119022895456518217000507353055451425935878966695398848
Arg [3] : _titanX (address): 0xF19308F923582A6f7c465e5CE7a9Dc1BEC6665B1
Arg [4] : _keyHash (bytes32): 0x8077df514608a09f83e4e8d300645594e5d7234665448ba83f51a50f842bd3d9
Arg [5] : _admin (address): 0x5da227386E0FD73329FE3923394913ecA3A624f7
Arg [6] : _startTimestamp (uint32): 1729958400
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 000000000000000000000000e2fb977affe038189766b35e4321e328769ac7cf
Arg [1] : 000000000000000000000000d7f86b4b8cae7d942340ff628f82735b7a20893a
Arg [2] : ff69e45a452760adf8bbae506631197cc41f0e2d83580febb35bc2548a878dc0
Arg [3] : 000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b1
Arg [4] : 8077df514608a09f83e4e8d300645594e5d7234665448ba83f51a50f842bd3d9
Arg [5] : 0000000000000000000000005da227386e0fd73329fe3923394913eca3a624f7
Arg [6] : 00000000000000000000000000000000000000000000000000000000671d1200
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.000001 | 18,217,257.876 | $12.31 |
Loading...
Loading
[ Download: CSV Export ]
[ 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.