My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Roulette
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** **************************************************************************** * @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 VRFCoordinator * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constructor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator) 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 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), * @dev see (VRFCoordinatorInterface for a description of the arguments). * * @dev Once the VRFCoordinator 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 VRFConsumerBase.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 VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); address private immutable vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) { vrfCoordinator = _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 VRFConsumerBaseV2 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 */ function fulfillRandomWords(uint256 requestId, uint256[] memory 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[] memory randomWords) external { if (msg.sender != vrfCoordinator) { revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator); } fulfillRandomWords(requestId, randomWords); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface VRFCoordinatorV2Interface { /** * @notice Get configuration relevant for making requests * @return minimumRequestConfirmations global min for request confirmations * @return maxGasLimit global max for request gas limit * @return s_provingKeyHashes list of registered key hashes */ function getRequestConfig() external view returns ( uint16, uint32, bytes32[] memory ); /** * @notice Request a set of random words. * @param 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. * @param subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * @param minimumRequestConfirmations - 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]. * @param 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] * @param 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. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords( bytes32 keyHash, uint64 subId, uint16 minimumRequestConfirmations, uint32 callbackGasLimit, uint32 numWords ) external returns (uint256 requestId); /** * @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, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); */ function createSubscription() external returns (uint64 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return reqCount - number of requests for this subscription, determines fee tier. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription(uint64 subId) external view returns ( uint96 balance, uint64 reqCount, address owner, address[] memory consumers ); /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external; /** * @notice Request 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(uint64 subId) external; /** * @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(uint64 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(uint64 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(uint64 subId, address to) external; /* * @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(uint64 subId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol) pragma solidity ^0.8.0; import "./Address.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ abstract contract Multicall { /** * @dev Receives and executes a batch of function calls on this contract. */ function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; /// @notice Minimal interface for Bank. /// @author Romuald Hog. interface IBank { /// @notice Gets the token's allow status used on the games smart contracts. /// @param token Address of the token. /// @return Whether the token is enabled for bets. function isAllowedToken(address token) external view returns (bool); /// @notice Payouts a winning bet, and allocate the house edge fee. /// @param user Address of the gamer. /// @param token Address of the token. /// @param profit Number of tokens to be sent to the gamer. /// @param fees Bet amount and bet profit fees amount. function payout( address user, address token, uint256 profit, uint256 fees ) external payable; /// @notice Accounts a loss bet. /// @dev In case of an ERC20, the bet amount should be transfered prior to this tx. /// @dev In case of the gas token, the bet amount is sent along with this tx. /// @param tokenAddress Address of the token. /// @param amount Loss bet amount. /// @param fees Bet amount and bet profit fees amount. function cashIn( address tokenAddress, uint256 amount, uint256 fees ) external payable; /// @notice Calculates the max bet amount based on the token balance, the balance risk, and the game multiplier. /// @param token Address of the token. /// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit. /// @return Maximum bet amount for the token. /// @dev The multiplier should be at least 10000. function getMaxBetAmount(address token, uint256 multiplier) external view returns (uint256); function getVRFSubId(address token) external view returns (uint64); function getTokenOwner(address token) external view returns (address); function getMinBetAmount(address token) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {Multicall} from "@openzeppelin/contracts/utils/Multicall.sol"; import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {VRFConsumerBaseV2} from "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol"; import {VRFCoordinatorV2Interface} from "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol"; import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import {IBank} from "../bank/IBank.sol"; // import "hardhat/console.sol"; interface IVRFCoordinatorV2 is VRFCoordinatorV2Interface { function getFeeConfig() external view returns ( uint32 fulfillmentFlatFeeLinkPPMTier1, uint32 fulfillmentFlatFeeLinkPPMTier2, uint32 fulfillmentFlatFeeLinkPPMTier3, uint32 fulfillmentFlatFeeLinkPPMTier4, uint32 fulfillmentFlatFeeLinkPPMTier5, uint24 reqsForTier2, uint24 reqsForTier3, uint24 reqsForTier4, uint24 reqsForTier5 ); } /// @title Game base contract /// @author Romuald Hog /// @notice This should be parent contract of each games. /// It defines all the games common functions and state variables. /// @dev All rates are in basis point. Chainlink VRF v2 is used. abstract contract Game is Ownable, Pausable, Multicall, VRFConsumerBaseV2, ReentrancyGuard { using SafeERC20 for IERC20; /// @notice Bet information struct. /// @param resolved Whether the bet has been resolved. /// @param user Address of the gamer. /// @param token Address of the token. /// @param id Bet ID generated by Chainlink VRF. /// @param amount The bet amount. /// @param blockNumber Block number of the bet used to refund in case Chainlink's callback fail. /// @param payout The payout amount. /// @param vrfCost The Chainlink VRF cost paid by player. struct Bet { bool resolved; address user; address token; uint256 id; uint256 amount; uint256 blockNumber; uint256 payout; uint256 vrfCost; } /// @notice Token struct. /// @param houseEdge House edge rate. /// @param pendingCount Number of pending bets. /// @param VRFCallbackGasLimit How much gas is needed in the Chainlink VRF callback. /// @param VRFFees Chainlink's VRF collected fees amount. struct Token { uint16 houseEdge; uint64 pendingCount; uint32 VRFCallbackGasLimit; uint256 VRFFees; } /// @notice Chainlink VRF configuration struct. /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding. /// @param numRandomWords How many random words is needed to resolve a game's bet. /// @param keyHash Hash of the public key used to verify the VRF proof. /// @param chainlinkCoordinator Reference to the VRFCoordinatorV2 deployed contract. /// @param gasAfterCalculation Gas to be added for VRF cost refund. struct ChainlinkConfig { uint16 requestConfirmations; uint16 numRandomWords; bytes32 keyHash; IVRFCoordinatorV2 chainlinkCoordinator; uint256 gasAfterCalculation; } /// @notice Chainlink VRF configuration state. ChainlinkConfig private _chainlinkConfig; /// @notice Chainlink price feed. AggregatorV3Interface private immutable _LINK_ETH_feed; /// @notice Maps bets IDs to Bet information. mapping(uint256 => Bet) public bets; /// @notice Maps users addresses to bets IDs mapping(address => uint256[]) internal _userBets; /// @notice Maps tokens addresses to token configuration. mapping(address => Token) public tokens; /// @notice Maps user addresses to VRF overcharged cost. mapping(address => uint256) public userOverchargedVRFCost; /// @notice The bank that manage to payout a won bet and collect a loss bet. IBank public immutable bank; /// @notice Emitted after the house edge is set for a token. /// @param token Address of the token. /// @param houseEdge House edge rate. event SetHouseEdge(address indexed token, uint16 houseEdge); /// @notice Emitted after the Chainlink callback gas limit is set for a token. /// @param token Address of the token. /// @param callbackGasLimit New Chainlink VRF callback gas limit. event SetVRFCallbackGasLimit( address indexed token, uint32 callbackGasLimit ); /// @notice Emitted after the Chainlink config is set. /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding. /// @param keyHash Hash of the public key used to verify the VRF proof. /// @param gasAfterCalculation Gas to be added for VRF cost refund. event SetChainlinkConfig( uint16 requestConfirmations, bytes32 keyHash, uint256 gasAfterCalculation ); /// @notice Emitted after the bet amount is transfered to the user. /// @param id The bet ID. /// @param user Address of the gamer. /// @param amount Number of tokens refunded. /// @param chainlinkVRFCost The Chainlink VRF cost refunded to player. event BetRefunded( uint256 id, address user, uint256 amount, uint256 chainlinkVRFCost ); /// @notice Emitted after the token's VRF fees amount is transfered to the user. /// @param token Address of the token. /// @param amount Number of tokens refunded. event DistributeTokenVRFFees(address indexed token, uint256 amount); /// @notice Emitted after the user's overcharged VRF cost amount is transfered. /// @param user Address of the user. /// @param overchargedVRFCost Number of tokens refunded. event DistributeOverchargedVRFCost( address indexed user, uint256 overchargedVRFCost ); /// @notice Emitted after the overcharged VRF cost amount is accounted. /// @param user Address of the user. /// @param overchargedVRFCost Number of tokens overcharged. event AccountOverchargedVRFCost( address indexed user, uint256 overchargedVRFCost ); /// @notice No user's overcharged Chainlink fee. error NoOverchargedVRFCost(); /// @notice Insufficient bet amount. /// @param minBetAmount Bet amount. error UnderMinBetAmount(uint256 minBetAmount); /// @notice Bet provided doesn't exist or was already resolved. error NotPendingBet(); /// @notice Bet isn't resolved yet. error NotFulfilled(); /// @notice House edge is capped at 4%. error ExcessiveHouseEdge(); /// @notice Token is not allowed. error ForbiddenToken(); /// @notice Chainlink price feed not working /// @param linkWei LINK/ETH price returned. error InvalidLinkWeiPrice(int256 linkWei); /// @notice The msg.value is not enough to cover Chainlink's fee. error WrongGasValueToCoverFee(); /// @notice Reverting error when sender isn't allowed. error AccessDenied(); /// @notice Reverting error when provided address isn't valid. error InvalidAddress(); /// @notice Reverting error when token has pending bets. error TokenHasPendingBets(); /// @notice Initialize contract's state variables and VRF Consumer. /// @param bankAddress The address of the bank. /// @param chainlinkCoordinatorAddress Address of the Chainlink VRF Coordinator. /// @param numRandomWords How many random words is needed to resolve a game's bet. /// @param LINK_ETH_feedAddress Address of the Chainlink LINK/ETH price feed. constructor( address bankAddress, address chainlinkCoordinatorAddress, uint16 numRandomWords, address LINK_ETH_feedAddress ) VRFConsumerBaseV2(chainlinkCoordinatorAddress) { if ( LINK_ETH_feedAddress == address(0) || chainlinkCoordinatorAddress == address(0) || bankAddress == address(0) ) { revert InvalidAddress(); } require( numRandomWords != 0 && numRandomWords <= 500, "Wrong Chainlink NumRandomWords" ); bank = IBank(bankAddress); _chainlinkConfig.chainlinkCoordinator = IVRFCoordinatorV2( chainlinkCoordinatorAddress ); _chainlinkConfig.numRandomWords = numRandomWords; _LINK_ETH_feed = AggregatorV3Interface(LINK_ETH_feedAddress); } /// @notice Calculates the amount's fee based on the house edge. /// @param token Address of the token. /// @param amount From which the fee amount will be calculated. /// @return The fee amount. function _getFees(address token, uint256 amount) private view returns (uint256) { return (tokens[token].houseEdge * amount) / 10000; } /// @notice Creates a new bet and request randomness to Chainlink, /// transfer the ERC20 tokens to the contract or refund the bet amount overflow if the bet amount exceed the maxBetAmount. /// @param tokenAddress Address of the token. /// @param tokenAmount The number of tokens bet. /// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit. /// @return A new Bet struct information. function _newBet( address tokenAddress, uint256 tokenAmount, uint256 multiplier ) internal whenNotPaused nonReentrant returns (Bet memory) { Token storage token = tokens[tokenAddress]; if ( bank.isAllowedToken(tokenAddress) == false || token.houseEdge == 0 ) { revert ForbiddenToken(); } address user = msg.sender; bool isGasToken = tokenAddress == address(0); uint256 fee = isGasToken ? (msg.value - tokenAmount) : msg.value; uint256 betAmount = isGasToken ? msg.value - fee : tokenAmount; // Charge user for Chainlink VRF fee. { uint256 chainlinkVRFCost = getChainlinkVRFCost(tokenAddress); if (fee < (chainlinkVRFCost - ((10 * chainlinkVRFCost) / 100))) { // 10% slippage. revert WrongGasValueToCoverFee(); } } // Bet amount is capped. { uint256 minBetAmount = bank.getMinBetAmount(tokenAddress); if (betAmount < minBetAmount) { revert UnderMinBetAmount(minBetAmount); } uint256 maxBetAmount = bank.getMaxBetAmount( tokenAddress, multiplier ); if (betAmount > maxBetAmount) { if (isGasToken) { Address.sendValue(payable(user), betAmount - maxBetAmount); } betAmount = maxBetAmount; } } // Create bet uint256 id = _chainlinkConfig.chainlinkCoordinator.requestRandomWords( _chainlinkConfig.keyHash, bank.getVRFSubId(tokenAddress), _chainlinkConfig.requestConfirmations, token.VRFCallbackGasLimit, _chainlinkConfig.numRandomWords ); Bet memory newBet = Bet( false, user, tokenAddress, id, betAmount, block.number, 0, fee ); _userBets[user].push(id); bets[id] = newBet; token.pendingCount++; // If ERC20, transfer the tokens if (!isGasToken) { IERC20(tokenAddress).safeTransferFrom( user, address(this), betAmount ); } return newBet; } /// @notice Calculates the overcharged VRF cost based on the gas consumed. /// @param bet The Bet struct information. /// @param startGas Gas amount at start. function _accountVRFCost(Bet storage bet, uint256 startGas) internal { (, int256 weiPerUnitLink, , , ) = _LINK_ETH_feed.latestRoundData(); if (weiPerUnitLink < 0) { weiPerUnitLink = 0; } // Get Chainlink VRF v2 fee amount. ( uint32 fulfillmentFlatFeeLinkPPMTier1, , , , , , , , ) = _chainlinkConfig.chainlinkCoordinator.getFeeConfig(); // Calculates the VRF premium fee in ETH uint256 chainlinkPremium = ((1e12 * uint256(fulfillmentFlatFeeLinkPPMTier1) * uint256(weiPerUnitLink)) / 1e18); // Calculate the gas fee (adding the estimated gas spent after this calculation) + premium uint256 actualVRFCost = (tx.gasprice * (startGas - gasleft() + _chainlinkConfig.gasAfterCalculation)) + chainlinkPremium; // If the actual VRF cost is higher than what the player paid. if (actualVRFCost > bet.vrfCost) { actualVRFCost = bet.vrfCost; } else { // Otherwise credits it to his account. uint256 overchargedVRFCost = bet.vrfCost - actualVRFCost; userOverchargedVRFCost[bet.user] += overchargedVRFCost; bet.vrfCost = actualVRFCost; emit AccountOverchargedVRFCost(bet.user, overchargedVRFCost); } // Credits the actual VRF cost to fund the VRF subscription. tokens[bet.token].VRFFees += actualVRFCost; } /// @notice Resolves the bet based on the game child contract result. /// In case bet is won, the bet amount minus the house edge is transfered to user from the game contract, and the profit is transfered to the user from the Bank. /// In case bet is lost, the bet amount is transfered to the Bank from the game contract. /// @param bet The Bet struct information. /// @param payout What should be sent to the user in case of a won bet. Payout = bet amount + profit amount. /// @return The payout amount. /// @dev Should not revert as it resolves the bet with the randomness. function _resolveBet(Bet storage bet, uint256 payout) internal returns (uint256) { if (bet.resolved == true || bet.id == 0) { revert NotPendingBet(); } bet.resolved = true; address token = bet.token; tokens[token].pendingCount--; uint256 betAmount = bet.amount; bool isGasToken = bet.token == address(0); if (payout > betAmount) { // The user has won more than his bet address user = bet.user; uint256 profit = payout - betAmount; uint256 betAmountFee = _getFees(token, betAmount); uint256 profitFee = _getFees(token, profit); uint256 fee = betAmountFee + profitFee; payout -= fee; uint256 betAmountPayout = betAmount - betAmountFee; uint256 profitPayout = profit - profitFee; // Transfer the bet amount payout to the player if (isGasToken) { Address.sendValue(payable(user), betAmountPayout); } else { IERC20(token).safeTransfer(user, betAmountPayout); // Transfer the bet amount fee to the bank. IERC20(token).safeTransfer(address(bank), betAmountFee); } // Transfer the payout from the bank, the bet amount fee to the bank, and account fees. bank.payout{value: isGasToken ? betAmountFee : 0}( user, token, profitPayout, fee ); } else if (payout > 0) { // The user has won something smaller than his bet address user = bet.user; uint256 fee = _getFees(token, payout); payout -= fee; uint256 bankCashIn = betAmount - payout; // Transfer the bet amount payout to the player if (isGasToken) { Address.sendValue(payable(user), payout); } else { IERC20(token).safeTransfer(user, payout); // Transfer the lost bet amount and fee to the bank IERC20(token).safeTransfer(address(bank), bankCashIn); } bank.cashIn{value: isGasToken ? bankCashIn : 0}( token, bankCashIn, fee ); } else { // The user did not win anything if (!isGasToken) { IERC20(token).safeTransfer(address(bank), betAmount); } bank.cashIn{value: isGasToken ? betAmount : 0}(token, betAmount, 0); } bet.payout = payout; return payout; } /// @notice Gets the list of the last user bets. /// @param user Address of the gamer. /// @param dataLength The amount of bets to return. /// @return A list of Bet. function _getLastUserBets(address user, uint256 dataLength) internal view returns (Bet[] memory) { uint256[] memory userBetsIds = _userBets[user]; uint256 betsLength = userBetsIds.length; if (betsLength < dataLength) { dataLength = betsLength; } Bet[] memory userBets = new Bet[](dataLength); if (dataLength != 0) { uint256 userBetsIndex; for (uint256 i = betsLength; i > betsLength - dataLength; i--) { userBets[userBetsIndex] = bets[userBetsIds[i - 1]]; userBetsIndex++; } } return userBets; } /// @notice Sets the game house edge rate for a specific token. /// @param token Address of the token. /// @param houseEdge House edge rate. /// @dev The house edge rate couldn't exceed 4%. function setHouseEdge(address token, uint16 houseEdge) external onlyOwner { if (houseEdge > 400) { revert ExcessiveHouseEdge(); } if (hasPendingBets(token)) { revert TokenHasPendingBets(); } tokens[token].houseEdge = houseEdge; emit SetHouseEdge(token, houseEdge); } /// @notice Pauses the contract to disable new bets. function pause() external onlyOwner { if (paused()) { _unpause(); } else { _pause(); } } /// @notice Sets the Chainlink VRF V2 configuration. /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding. /// @param keyHash Hash of the public key used to verify the VRF proof. /// @param gasAfterCalculation Gas to be added for VRF cost refund. function setChainlinkConfig( uint16 requestConfirmations, bytes32 keyHash, uint256 gasAfterCalculation ) external onlyOwner { _chainlinkConfig.requestConfirmations = requestConfirmations; _chainlinkConfig.keyHash = keyHash; _chainlinkConfig.gasAfterCalculation = gasAfterCalculation; emit SetChainlinkConfig( requestConfirmations, keyHash, gasAfterCalculation ); } /// @notice Sets the Chainlink VRF V2 configuration. /// @param callbackGasLimit How much gas is needed in the Chainlink VRF callback. function setVRFCallbackGasLimit(address token, uint32 callbackGasLimit) external onlyOwner { tokens[token].VRFCallbackGasLimit = callbackGasLimit; emit SetVRFCallbackGasLimit(token, callbackGasLimit); } /// @notice Distributes the token's collected Chainlink fees. /// @param token Address of the token. function withdrawTokensVRFFees(address token) external { uint256 tokenChainlinkFees = tokens[token].VRFFees; if (tokenChainlinkFees != 0) { delete tokens[token].VRFFees; Address.sendValue( payable(bank.getTokenOwner(token)), tokenChainlinkFees ); emit DistributeTokenVRFFees(token, tokenChainlinkFees); } } /// @notice Withdraw user's overcharged Chainlink fees. function withdrawOverchargedVRFCost(address user) external { uint256 overchargedVRFCost = userOverchargedVRFCost[user]; if (overchargedVRFCost == 0) { revert NoOverchargedVRFCost(); } delete userOverchargedVRFCost[user]; Address.sendValue(payable(user), overchargedVRFCost); emit DistributeOverchargedVRFCost(user, overchargedVRFCost); } /// @notice Refunds the bet to the user if the Chainlink VRF callback failed. /// @param id The Bet ID. function refundBet(uint256 id) external { Bet storage bet = bets[id]; if (bet.resolved == true || bet.id == 0) { revert NotPendingBet(); } else if (block.number < bet.blockNumber + 30) { revert NotFulfilled(); } Token storage token = tokens[bet.token]; token.pendingCount--; bet.resolved = true; bet.payout = bet.amount; uint256 chainlinkVRFCost = bet.vrfCost; if (bet.token == address(0)) { Address.sendValue(payable(bet.user), bet.amount + chainlinkVRFCost); } else { IERC20(bet.token).safeTransfer(bet.user, bet.amount); Address.sendValue(payable(bet.user), chainlinkVRFCost); } emit BetRefunded(id, bet.user, bet.amount, chainlinkVRFCost); } /// @notice Returns the Chainlink VRF config. /// @param requestConfirmations How many confirmations the Chainlink node should wait before responding. /// @param keyHash Hash of the public key used to verify the VRF proof. /// @param chainlinkCoordinator Reference to the VRFCoordinatorV2 deployed contract. /// @param gasAfterCalculation Gas to be added for VRF cost refund. function getChainlinkConfig() external view returns ( uint16 requestConfirmations, bytes32 keyHash, IVRFCoordinatorV2 chainlinkCoordinator, uint256 gasAfterCalculation ) { return ( _chainlinkConfig.requestConfirmations, _chainlinkConfig.keyHash, _chainlinkConfig.chainlinkCoordinator, _chainlinkConfig.gasAfterCalculation ); } /// @notice Returns whether the token has pending bets. /// @return Whether the token has pending bets. function hasPendingBets(address token) public view returns (bool) { return tokens[token].pendingCount != 0; } /// @notice Returns the amount of ETH that should be passed to the wager transaction. /// to cover Chainlink VRF fee. /// @return The bet resolution cost amount. function getChainlinkVRFCost(address token) public view returns (uint256) { (, int256 weiPerUnitLink, , , ) = _LINK_ETH_feed.latestRoundData(); if (weiPerUnitLink <= 0) { revert InvalidLinkWeiPrice(weiPerUnitLink); } // Get Chainlink VRF v2 fee amount. ( uint32 fulfillmentFlatFeeLinkPPMTier1, , , , , , , , ) = _chainlinkConfig.chainlinkCoordinator.getFeeConfig(); // 115000 gas is the average Verification gas of Chainlink VRF. return (tx.gasprice * (115000 + tokens[token].VRFCallbackGasLimit)) + ((1e12 * uint256(fulfillmentFlatFeeLinkPPMTier1) * uint256(weiPerUnitLink)) / 1e18); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {Game} from "./Game.sol"; /// @title BetSwirl's Roulette game /// @notice /// @author Romuald Hog contract Roulette is Game { /// @notice Full roulette bet information struct. /// @param bet The Bet struct information. /// @param rouletteBet The Roulette bet struct information. /// @dev Used to package bet information for the front-end. struct FullRouletteBet { Bet bet; RouletteBet rouletteBet; } /// @notice Roulette bet information struct. /// @param bet The Bet struct information. /// @param numbers The chosen numbers. struct RouletteBet { uint40 numbers; uint8 rolled; } uint8 private constant MODULO = 37; uint256 private constant POPCNT_MULT = 0x0000000000002000000000100000000008000000000400000000020000000001; uint256 private constant POPCNT_MASK = 0x0001041041041041041041041041041041041041041041041041041041041041; uint256 private constant POPCNT_MODULO = 0x3F; /// @notice Maps bets IDs to chosen numbers. mapping(uint256 => RouletteBet) public rouletteBets; /// @notice Emitted after a bet is placed. /// @param id The bet ID. /// @param user Address of the gamer. /// @param token Address of the token. /// @param amount The bet amount. /// @param vrfCost The Chainlink VRF cost paid by player. /// @param numbers The chosen numbers. event PlaceBet( uint256 id, address indexed user, address indexed token, uint256 amount, uint256 vrfCost, uint40 numbers ); /// @notice Emitted after a bet is rolled. /// @param id The bet ID. /// @param user Address of the gamer. /// @param token Address of the token. /// @param amount The bet amount. /// @param numbers The chosen numbers. /// @param rolled The rolled number. /// @param payout The payout amount. event Roll( uint256 id, address indexed user, address indexed token, uint256 amount, uint40 numbers, uint8 rolled, uint256 payout ); /// @notice Provided cap is under the minimum. error NumbersNotInRange(); /// @notice Initialize the game base contract. /// @param bankAddress The address of the bank. /// @param chainlinkCoordinatorAddress Address of the Chainlink VRF Coordinator. /// @param LINK_ETH_feedAddress Address of the Chainlink LINK/ETH price feed. constructor( address bankAddress, address chainlinkCoordinatorAddress, address LINK_ETH_feedAddress ) Game(bankAddress, chainlinkCoordinatorAddress, 1, LINK_ETH_feedAddress) {} /// @notice Calculates the target payout amount. /// @param betAmount Bet amount. /// @param numbers The chosen numbers. /// @return The target payout amount. function _getPayout(uint256 betAmount, uint40 numbers) private pure returns (uint256) { return (betAmount * MODULO) / (((numbers * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO); } /// @notice Creates a new bet and stores the chosen bet mask. /// @param numbers The chosen numbers. /// @param token Address of the token. /// @param tokenAmount The number of tokens bet. function wager( uint40 numbers, address token, uint256 tokenAmount ) external payable whenNotPaused { if (numbers == 0 || numbers >= 2**MODULO - 1) { revert NumbersNotInRange(); } Bet memory bet = _newBet( token, tokenAmount, _getPayout(10000, numbers) ); rouletteBets[bet.id].numbers = numbers; emit PlaceBet( bet.id, bet.user, bet.token, bet.amount, bet.vrfCost, numbers ); } /// @notice Resolves the bet using the Chainlink randomness. /// @param id The bet ID. /// @param randomWords Random words list. Contains only one for this game. // solhint-disable-next-line private-vars-leading-underscore function fulfillRandomWords(uint256 id, uint256[] memory randomWords) internal override { uint256 startGas = gasleft(); RouletteBet storage rouletteBet = rouletteBets[id]; Bet storage bet = bets[id]; uint8 rolled = uint8(randomWords[0] % MODULO); rouletteBet.rolled = rolled; uint256 payout = _resolveBet( bet, (2**rolled) & rouletteBet.numbers != 0 ? _getPayout(bet.amount, rouletteBet.numbers) : 0 ); emit Roll( bet.id, bet.user, bet.token, bet.amount, rouletteBet.numbers, rolled, payout ); _accountVRFCost(bet, startGas); } /// @notice Gets the list of the last user bets. /// @param user Address of the gamer. /// @param dataLength The amount of bets to return. /// @return A list of Roulette bet. function getLastUserBets(address user, uint256 dataLength) external view returns (FullRouletteBet[] memory) { Bet[] memory lastBets = _getLastUserBets(user, dataLength); FullRouletteBet[] memory lastRouletteBets = new FullRouletteBet[]( lastBets.length ); for (uint256 i; i < lastBets.length; i++) { lastRouletteBets[i] = FullRouletteBet( lastBets[i], rouletteBets[lastBets[i].id] ); } return lastRouletteBets; } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 80000 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"bankAddress","type":"address"},{"internalType":"address","name":"chainlinkCoordinatorAddress","type":"address"},{"internalType":"address","name":"LINK_ETH_feedAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[],"name":"ExcessiveHouseEdge","type":"error"},{"inputs":[],"name":"ForbiddenToken","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[{"internalType":"int256","name":"linkWei","type":"int256"}],"name":"InvalidLinkWeiPrice","type":"error"},{"inputs":[],"name":"NoOverchargedVRFCost","type":"error"},{"inputs":[],"name":"NotFulfilled","type":"error"},{"inputs":[],"name":"NotPendingBet","type":"error"},{"inputs":[],"name":"NumbersNotInRange","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"TokenHasPendingBets","type":"error"},{"inputs":[{"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"UnderMinBetAmount","type":"error"},{"inputs":[],"name":"WrongGasValueToCoverFee","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"overchargedVRFCost","type":"uint256"}],"name":"AccountOverchargedVRFCost","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainlinkVRFCost","type":"uint256"}],"name":"BetRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"overchargedVRFCost","type":"uint256"}],"name":"DistributeOverchargedVRFCost","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeTokenVRFFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vrfCost","type":"uint256"},{"indexed":false,"internalType":"uint40","name":"numbers","type":"uint40"}],"name":"PlaceBet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint40","name":"numbers","type":"uint40"},{"indexed":false,"internalType":"uint8","name":"rolled","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"payout","type":"uint256"}],"name":"Roll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"indexed":false,"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"gasAfterCalculation","type":"uint256"}],"name":"SetChainlinkConfig","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"SetHouseEdge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"SetVRFCallbackGasLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"bank","outputs":[{"internalType":"contract IBank","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bets","outputs":[{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainlinkConfig","outputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"contract IVRFCoordinatorV2","name":"chainlinkCoordinator","type":"address"},{"internalType":"uint256","name":"gasAfterCalculation","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getChainlinkVRFCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"dataLength","type":"uint256"}],"name":"getLastUserBets","outputs":[{"components":[{"components":[{"internalType":"bool","name":"resolved","type":"bool"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"internalType":"struct Game.Bet","name":"bet","type":"tuple"},{"components":[{"internalType":"uint40","name":"numbers","type":"uint40"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"internalType":"struct Roulette.RouletteBet","name":"rouletteBet","type":"tuple"}],"internalType":"struct Roulette.FullRouletteBet[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"hasPendingBets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"refundBet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rouletteBets","outputs":[{"internalType":"uint40","name":"numbers","type":"uint40"},{"internalType":"uint8","name":"rolled","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"requestConfirmations","type":"uint16"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"gasAfterCalculation","type":"uint256"}],"name":"setChainlinkConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"houseEdge","type":"uint16"}],"name":"setHouseEdge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint32","name":"callbackGasLimit","type":"uint32"}],"name":"setVRFCallbackGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"internalType":"uint16","name":"houseEdge","type":"uint16"},{"internalType":"uint64","name":"pendingCount","type":"uint64"},{"internalType":"uint32","name":"VRFCallbackGasLimit","type":"uint32"},{"internalType":"uint256","name":"VRFFees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userOverchargedVRFCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint40","name":"numbers","type":"uint40"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"wager","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"withdrawOverchargedVRFCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawTokensVRFFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b5060405162004148380380620041488339810160408190526200003491620001d8565b82826001838262000045336200016b565b6000805460ff60a01b191690556001600160a01b0390811660805260018055811615806200007a57506001600160a01b038316155b806200008d57506001600160a01b038416155b15620000ac5760405163e6c4247b60e01b815260040160405180910390fd5b61ffff821615801590620000c657506101f48261ffff1611155b620001175760405162461bcd60e51b815260206004820152601e60248201527f57726f6e6720436861696e6c696e6b204e756d52616e646f6d576f7264730000604482015260640160405180910390fd5b6001600160a01b0393841660c052600480549385166001600160a01b0319909416939093179092556002805461ffff909216620100000263ffff0000199092169190911790551660a0525062000222915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620001d357600080fd5b919050565b600080600060608486031215620001ee57600080fd5b620001f984620001bb565b92506200020960208501620001bb565b91506200021960408501620001bb565b90509250925092565b60805160a05160c051613e9b620002ad600039600081816103c801528181610a3f0152818161191c01528181611ac801528181611bc301528181611cb0015281816128aa015281816128d101528181612a5501528181612a7c01528181612b780152612b9f015260008181610d0e0152612c870152600081816106d5015261073d0152613e9b6000f3fe6080604052600436106101805760003560e01c80637d0807d7116100d6578063be27e5301161007f578063e32fe50411610059578063e32fe504146105e3578063e486033914610603578063f2fde38b1461069d57600080fd5b8063be27e53014610535578063c2fb579f14610596578063e1fdb4b4146105c357600080fd5b80638da5cb5b116100b05780638da5cb5b146104bd578063982c3fdd146104e8578063ac9650d81461050857600080fd5b80637d0807d71461042f57806382b0c00b146104885780638456cb59146104a857600080fd5b80635c975abb11610138578063715018a611610112578063715018a6146103a157806376cdb03b146103b657806378bcde221461040f57600080fd5b80635c975abb146103315780637038942f14610361578063707cd55e1461038157600080fd5b8063277d35af11610169578063277d35af1461027e578063594043fd146102b95780635c592e721461031e57600080fd5b80631fe543e31461018557806322af00fa146101a7575b600080fd5b34801561019157600080fd5b506101a56101a036600461342d565b6106bd565b005b3480156101b357600080fd5b506102236101c2366004613515565b6006602081905260009182526040909120805460018201546002830154600384015460048501546005860154959096015460ff85169661010090950473ffffffffffffffffffffffffffffffffffffffff9081169694169492939192919088565b60408051981515895273ffffffffffffffffffffffffffffffffffffffff97881660208a015295909616948701949094526060860192909252608085015260a084015260c083015260e0820152610100015b60405180910390f35b34801561028a57600080fd5b506102ab610299366004613550565b60096020526000908152604090205481565b604051908152602001610275565b3480156102c557600080fd5b5061030e6102d4366004613550565b73ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604090205462010000900467ffffffffffffffff16151590565b6040519015158152602001610275565b6101a561032c36600461356d565b61077d565b34801561033d57600080fd5b5060005474010000000000000000000000000000000000000000900460ff1661030e565b34801561036d57600080fd5b506101a561037c366004613550565b6108cc565b34801561038d57600080fd5b506101a561039c366004613550565b6109b0565b3480156103ad57600080fd5b506101a5610af8565b3480156103c257600080fd5b506103ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610275565b34801561041b57600080fd5b506101a561042a3660046135cf565b610b0c565b34801561043b57600080fd5b506002546003546004546005546040805161ffff9095168552602085019390935273ffffffffffffffffffffffffffffffffffffffff909116918301919091526060820152608001610275565b34801561049457600080fd5b506101a56104a3366004613604565b610c46565b3480156104b457600080fd5b506101a5610cce565b3480156104c957600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166103ea565b3480156104f457600080fd5b506102ab610503366004613550565b610d09565b34801561051457600080fd5b50610528610523366004613637565b610f1c565b604051610275919061371a565b34801561054157600080fd5b50610577610550366004613515565b600a6020526000908152604090205464ffffffffff81169065010000000000900460ff1682565b6040805164ffffffffff909316835260ff909116602083015201610275565b3480156105a257600080fd5b506105b66105b136600461379a565b611012565b60405161027591906137c6565b3480156105cf57600080fd5b506101a56105de366004613515565b6111a4565b3480156105ef57600080fd5b506101a56105fe3660046138a1565b611413565b34801561060f57600080fd5b5061066461061e366004613550565b6008602052600090815260409020805460019091015461ffff82169162010000810467ffffffffffffffff16916a010000000000000000000090910463ffffffff169084565b6040805161ffff909516855267ffffffffffffffff909316602085015263ffffffff909116918301919091526060820152608001610275565b3480156106a957600080fd5b506101a56106b8366004613550565b6114b2565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461076f576040517f1cf993f400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b6107798282611569565b5050565b6107856116da565b64ffffffffff831615806107b7575060016107a260256002613a29565b6107ac9190613a38565b8364ffffffffff1610155b156107ee576040517f9f7d67a400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061080683836108016127108861175f565b6117d5565b606081810180516000908152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000001664ffffffffff8b169081179091558286015182870151945160808089015160e08a0151875193845295830152948101939093529482015293945073ffffffffffffffffffffffffffffffffffffffff9283169392909116917fc68a28552c2af0dc893d789f7458205e8879657e306b928a0e93340fddc5ec1a910160405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600960205260408120549081900361092c576040517f8ab4c5d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526009602052604081205561095c8282612033565b8173ffffffffffffffffffffffffffffffffffffffff167f3f206d449945dd03c1742ee98a9c5b872ac6c165788363e06af2796dd5de1f54826040516109a491815260200190565b60405180910390a25050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526008602052604090206001015480156107795773ffffffffffffffffffffffffffffffffffffffff82811660008181526008602052604080822060010191909155517fdc17c9ca0000000000000000000000000000000000000000000000000000000081526004810191909152610ab0917f0000000000000000000000000000000000000000000000000000000000000000169063dc17c9ca90602401602060405180830381865afa158015610a86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aaa9190613a4b565b82612033565b8173ffffffffffffffffffffffffffffffffffffffff167f1d3f9fc0810d9e182e982399cb91de735f6c415728fb9bc42664b84087c2af56826040516109a491815260200190565b610b00612192565b610b0a6000612213565b565b610b14612192565b6101908161ffff161115610b54576040517f70b5774c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526008602052604090205462010000900467ffffffffffffffff1615610bc1576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff861690811790915591519182527f7dfd3ecb8ac83242184c019f85ca408558f2ac0a5a19af6be2a4aee697eac81291016109a4565b610c4e612192565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff851690811790915560038390556005829055604080519182526020820184905281018290527fdb0c33bbe22ccb7d7c379a53ef932b131d6fb1b3bd0a7cfe7247d9513ba2a22a9060600160405180910390a1505050565b610cd6612192565b60005474010000000000000000000000000000000000000000900460ff1615610d0157610b0a612288565b610b0a612305565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610d77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9b9190613a82565b50505091505060008113610dde576040517f43d4cf6600000000000000000000000000000000000000000000000000000000815260048101829052602401610766565b60048054604080517f5fbbc0d2000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff90931692635fbbc0d292808201926101209290918290030181865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e749190613ae5565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610e9f9190613b9b565b610ea99190613b9b565b610eb39190613be1565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260086020526040902054610efa906a0100000000000000000000900463ffffffff166201c138613bf5565b610f0a9063ffffffff163a613b9b565b610f149190613c12565b949350505050565b60608167ffffffffffffffff811115610f3757610f376133fe565b604051908082528060200260200182016040528015610f6a57816020015b6060815260200190600190039081610f555790505b50905060005b8281101561100a57610fda30858584818110610f8e57610f8e613c25565b9050602002810190610fa09190613c54565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061237492505050565b828281518110610fec57610fec613c25565b6020026020010181905250808061100290613cc0565b915050610f70565b505b92915050565b606060006110208484612399565b90506000815167ffffffffffffffff81111561103e5761103e6133fe565b6040519080825280602002602001820160405280156110d157816020015b60408051610140810182526000818301818152606083018290526080830182905260a0830182905260c0830182905260e08301829052610100830182905261012083018290528252825180840190935280835260208084019190915281019190915281526020019060019003908161105c5790505b50905060005b825181101561119b5760405180604001604052808483815181106110fd576110fd613c25565b60200260200101518152602001600a600086858151811061112057611120613c25565b60209081029190910181015160600151825281810192909252604090810160002081518083019092525464ffffffffff8116825265010000000000900460ff16918101919091529052825183908390811061117d5761117d613c25565b6020026020010181905250808061119390613cc0565b9150506110d7565b50949350505050565b6000818152600660205260409020805460ff161515600114806111c957506002810154155b15611200576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481015461121090601e613c12565b431015611249576040517f07bc6c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181015473ffffffffffffffffffffffffffffffffffffffff166000908152600860205260409020805462010000900467ffffffffffffffff1681600261129083613cf8565b825467ffffffffffffffff9182166101009390930a92830291909202199091161790555081547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811783556003830154600584015560068301549083015473ffffffffffffffffffffffffffffffffffffffff16611348578254600384015461134391610100900473ffffffffffffffffffffffffffffffffffffffff169061133e908490613c12565b612033565b6113a7565b8254600384015460018501546113809273ffffffffffffffffffffffffffffffffffffffff91821692610100909104909116906125f8565b82546113a790610100900473ffffffffffffffffffffffffffffffffffffffff1682612033565b825460038401546040805187815261010090930473ffffffffffffffffffffffffffffffffffffffff166020840152820152606081018290527fe282fd838bb937af0c0f54e49ba5f86229ed0c90344c3cc4e2135cb673493e699060800160405180910390a150505050565b61141b612192565b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a010000000000000000000063ffffffff87169081029190911790915591519182527f9edb52532d26512950c91a14b132f6df3cd06bfb49e795e03e56736121cd24a891016109a4565b6114ba612192565b73ffffffffffffffffffffffffffffffffffffffff811661155d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610766565b61156681612213565b50565b60005a6000848152600a602090815260408083206006909252822085519394509092909190602590869083906115a1576115a1613c25565b60200260200101516115b39190613d3a565b835460ff821665010000000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffff82168117865591925060009161163791859164ffffffffff90811691161761160b856002613a29565b1660000361161a5760006126cc565b60038501548654611632919064ffffffffff1661175f565b6126cc565b6001840154845460028601546003870154885460408051938452602084019290925264ffffffffff169082015260ff861660608201526080810184905292935073ffffffffffffffffffffffffffffffffffffffff91821692610100909104909116907f31f298f8512cd20a0c9f7631142286da4f52772d89b405b5c68274c4c64cb4339060a00160405180910390a36116d18386612c83565b50505050505050565b60005474010000000000000000000000000000000000000000900460ff1615610b0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610766565b6000603f7e010410410410410410410410410410410410410410410410410410410410416117ae79200000000010000000000800000000040000000002000000000164ffffffffff8616613b9b565b166117b99190613d3a565b6117c4602585613b9b565b6117ce9190613be1565b9392505050565b61184b604051806101000160405280600015158152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081525090565b6118536116da565b6002600154036118bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610766565b600260015573ffffffffffffffffffffffffffffffffffffffff8481166000818152600860205260409081902090517fcbe230c30000000000000000000000000000000000000000000000000000000081526004810192909252917f0000000000000000000000000000000000000000000000000000000000000000169063cbe230c390602401602060405180830381865afa158015611963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119879190613d4e565b15806119965750805461ffff16155b156119cd576040517fc455905500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff8616156000816119f357346119fd565b6119fd8734613a38565b9050600082611a0c5787611a16565b611a168234613a38565b90506000611a238a610d09565b90506064611a3282600a613b9b565b611a3c9190613be1565b611a469082613a38565b831015611a7f576040517f0b56cefe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506040517ff6b2a2f100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063f6b2a2f190602401602060405180830381865afa158015611b11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b359190613d70565b905080821015611b74576040517f022558f400000000000000000000000000000000000000000000000000000000815260048101829052602401610766565b6040517f278b39de00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152602482018a90526000917f00000000000000000000000000000000000000000000000000000000000000009091169063278b39de90604401602060405180830381865afa158015611c0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c309190613d70565b905080831115611c52578415611c4e57611c4e8661133e8386613a38565b8092505b5050600480546003546040517f279e341500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d81169482019490945260009392831692635d3b1d3092917f00000000000000000000000000000000000000000000000000000000000000009091169063279e341590602401602060405180830381865afa158015611cf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1d9190613d89565b6002548a5460405160e086901b7fffffffff00000000000000000000000000000000000000000000000000000000168152600481019490945267ffffffffffffffff909216602484015261ffff80821660448501526a010000000000000000000090920463ffffffff16606484015262010000900416608482015260a4016020604051808303816000875af1158015611dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dde9190613d70565b905060006040518061010001604052806000151581526020018773ffffffffffffffffffffffffffffffffffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff16815260200183815260200184815260200143815260200160008152602001858152509050600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055806006600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e0820151816006015590505086600001600281819054906101000a900467ffffffffffffffff1680929190611fd390613db3565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050846120215761202173ffffffffffffffffffffffffffffffffffffffff8c16873086612f47565b600180559a9950505050505050505050565b8047101561209d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610766565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146120f7576040519150601f19603f3d011682016040523d82523d6000602084013e6120fc565b606091505b505090508061218d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610766565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610b0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610766565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612290612fab565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b61230d6116da565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122db3390565b60606117ce8383604051806060016040528060278152602001613e3f6027913961302f565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260076020908152604080832080548251818502810185019093528083526060949383018282801561240557602002820191906000526020600020905b8154815260200190600101908083116123f1575b505083519394505050508381101561241b578093505b60008467ffffffffffffffff811115612436576124366133fe565b6040519080825280602002602001820160405280156124dd57816020015b6124ca604051806101000160405280600015158152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081525090565b8152602001906001900390816124545790505b50905084156125ef576000825b6124f48785613a38565b8111156125ec57600660008661250b600185613a38565b8151811061251b5761251b613c25565b602090810291909101810151825281810192909252604090810160002081516101008082018452825460ff8116151583520473ffffffffffffffffffffffffffffffffffffffff908116948201949094526001820154909316918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e082015283518490849081106125c0576125c0613c25565b602002602001018190525081806125d690613cc0565b92505080806125e490613dda565b9150506124ea565b50505b95945050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261218d9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613157565b815460009060ff161515600114806126e657506002830154155b1561271d576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117845583015473ffffffffffffffffffffffffffffffffffffffff166000818152600860205260409020805467ffffffffffffffff620100009091041690600261278e83613cf8565b825467ffffffffffffffff9182166101009390930a9283029190920219909116179055506003840154600185015473ffffffffffffffffffffffffffffffffffffffff1615818511156129b8578554610100900473ffffffffffffffffffffffffffffffffffffffff1660006128048488613a38565b905060006128128686613263565b905060006128208784613263565b9050600061282e8284613c12565b905061283a818b613a38565b995060006128488489613a38565b905060006128568487613a38565b9050871561286d576128688783612033565b6128cf565b61288e73ffffffffffffffffffffffffffffffffffffffff8b1688846125f8565b6128cf73ffffffffffffffffffffffffffffffffffffffff8b167f0000000000000000000000000000000000000000000000000000000000000000876125f8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631f61502389612917576000612919565b865b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff808c1660048301528e16602482015260448101859052606481018790526084016000604051808303818588803b15801561299357600080fd5b505af11580156129a7573d6000803e3d6000fd5b505050505050505050505050612c73565b8415612b57578554610100900473ffffffffffffffffffffffffffffffffffffffff1660006129e78588613263565b90506129f38188613a38565b96506000612a018886613a38565b90508315612a1857612a138389612033565b612a7a565b612a3973ffffffffffffffffffffffffffffffffffffffff8716848a6125f8565b612a7a73ffffffffffffffffffffffffffffffffffffffff87167f0000000000000000000000000000000000000000000000000000000000000000836125f8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d41b8c6f85612ac2576000612ac4565b825b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff8a16600482015260248101859052604481018690526064016000604051808303818588803b158015612b3657600080fd5b505af1158015612b4a573d6000803e3d6000fd5b5050505050505050612c73565b80612b9d57612b9d73ffffffffffffffffffffffffffffffffffffffff84167f0000000000000000000000000000000000000000000000000000000000000000846125f8565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d41b8c6f82612be5576000612be7565b835b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff8716600482015260248101869052600060448201526064016000604051808303818588803b158015612c5957600080fd5b505af1158015612c6d573d6000803e3d6000fd5b50505050505b5050505060059190910181905590565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015612cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d149190613a82565b5050509150506000811215612d27575060005b60048054604080517f5fbbc0d2000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff90931692635fbbc0d292808201926101209290918290030181865afa158015612d99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dbd9190613ae5565b505050505050505090506000670de0b6b3a7640000838363ffffffff1664e8d4a51000612dea9190613b9b565b612df49190613b9b565b612dfe9190613be1565b90506000816002600301545a612e149088613a38565b612e1e9190613c12565b612e28903a613b9b565b612e329190613c12565b90508560060154811115612e4b57506006850154612efd565b6000818760060154612e5d9190613a38565b8754610100900473ffffffffffffffffffffffffffffffffffffffff16600090815260096020526040812080549293508392909190612e9d908490613c12565b909155505060068701829055865460405182815261010090910473ffffffffffffffffffffffffffffffffffffffff16907fab2ddf26d0afffee84a37c11fdb1fe69dc5c541f00f62051ec706e71871638c89060200160405180910390a2505b60018087015473ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604081209091018054839290612f3a908490613c12565b9091555050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052612fa59085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161264a565b50505050565b60005474010000000000000000000000000000000000000000900460ff16610b0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610766565b606073ffffffffffffffffffffffffffffffffffffffff84163b6130d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610766565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516130fd9190613e0f565b600060405180830381855af49150503d8060008114613138576040519150601f19603f3d011682016040523d82523d6000602084013e61313d565b606091505b509150915061314d82828661329c565b9695505050505050565b60006131b9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166132ef9092919063ffffffff16565b80519091501561218d57808060200190518101906131d79190613d4e565b61218d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610766565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260086020526040812054612710906117c490849061ffff16613b9b565b606083156132ab5750816117ce565b8251156132bb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107669190613e2b565b6060610f1484846000858573ffffffffffffffffffffffffffffffffffffffff85163b613378576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610766565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133a19190613e0f565b60006040518083038185875af1925050503d80600081146133de576040519150601f19603f3d011682016040523d82523d6000602084013e6133e3565b606091505b50915091506133f382828661329c565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806040838503121561344057600080fd5b8235915060208084013567ffffffffffffffff8082111561346057600080fd5b818601915086601f83011261347457600080fd5b813581811115613486576134866133fe565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156134c9576134c96133fe565b6040529182528482019250838101850191898311156134e757600080fd5b938501935b82851015613505578435845293850193928501926134ec565b8096505050505050509250929050565b60006020828403121561352757600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461156657600080fd5b60006020828403121561356257600080fd5b81356117ce8161352e565b60008060006060848603121561358257600080fd5b833564ffffffffff8116811461359757600080fd5b925060208401356135a78161352e565b929592945050506040919091013590565b803561ffff811681146135ca57600080fd5b919050565b600080604083850312156135e257600080fd5b82356135ed8161352e565b91506135fb602084016135b8565b90509250929050565b60008060006060848603121561361957600080fd5b613622846135b8565b95602085013595506040909401359392505050565b6000806020838503121561364a57600080fd5b823567ffffffffffffffff8082111561366257600080fd5b818501915085601f83011261367657600080fd5b81358181111561368557600080fd5b8660208260051b850101111561369a57600080fd5b60209290920196919550909350505050565b60005b838110156136c75781810151838201526020016136af565b50506000910152565b600081518084526136e88160208601602086016136ac565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561378d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261377b8583516136d0565b94509285019290850190600101613741565b5092979650505050505050565b600080604083850312156137ad57600080fd5b82356137b88161352e565b946020939093013593505050565b602080825282518282018190526000919060409081850190868401855b8281101561388257815180518051151586528781015173ffffffffffffffffffffffffffffffffffffffff90811689880152878201511687870152606080820151908701526080808201519087015260a0808201519087015260c0808201519087015260e09081015190860152860151805164ffffffffff166101008601526020015160ff1661012085015261014090930192908501906001016137e3565b5091979650505050505050565b63ffffffff8116811461156657600080fd5b600080604083850312156138b457600080fd5b82356138bf8161352e565b915060208301356138cf8161388f565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600181815b8085111561396257817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115613948576139486138da565b8085161561395557918102915b93841c939080029061390e565b509250929050565b6000826139795750600161100c565b816139865750600061100c565b816001811461399c57600281146139a6576139c2565b600191505061100c565b60ff8411156139b7576139b76138da565b50506001821b61100c565b5060208310610133831016604e8410600b84101617156139e5575081810a61100c565b6139ef8383613909565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115613a2157613a216138da565b029392505050565b60006117ce60ff84168361396a565b8181038181111561100c5761100c6138da565b600060208284031215613a5d57600080fd5b81516117ce8161352e565b805169ffffffffffffffffffff811681146135ca57600080fd5b600080600080600060a08688031215613a9a57600080fd5b613aa386613a68565b9450602086015193506040860151925060608601519150613ac660808701613a68565b90509295509295909350565b805162ffffff811681146135ca57600080fd5b60008060008060008060008060006101208a8c031215613b0457600080fd5b8951613b0f8161388f565b60208b0151909950613b208161388f565b60408b0151909850613b318161388f565b60608b0151909750613b428161388f565b60808b0151909650613b538161388f565b9450613b6160a08b01613ad2565b9350613b6f60c08b01613ad2565b9250613b7d60e08b01613ad2565b9150613b8c6101008b01613ad2565b90509295985092959850929598565b808202811582820484141761100c5761100c6138da565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613bf057613bf0613bb2565b500490565b63ffffffff81811683821601908082111561100a5761100a6138da565b8082018082111561100c5761100c6138da565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613c8957600080fd5b83018035915067ffffffffffffffff821115613ca457600080fd5b602001915036819003821315613cb957600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613cf157613cf16138da565b5060010190565b600067ffffffffffffffff821680613d1257613d126138da565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b600082613d4957613d49613bb2565b500690565b600060208284031215613d6057600080fd5b815180151581146117ce57600080fd5b600060208284031215613d8257600080fd5b5051919050565b600060208284031215613d9b57600080fd5b815167ffffffffffffffff811681146117ce57600080fd5b600067ffffffffffffffff808316818103613dd057613dd06138da565b6001019392505050565b600081613de957613de96138da565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60008251613e218184602087016136ac565b9190910192915050565b6020815260006117ce60208301846136d056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220e462fb65e669021273ada87a1f809f0e6dd38d57301fcdb64ddb4a8644fd4c7764736f6c63430008110033000000000000000000000000999b6d28a9e78c4be13d51469c49585d6d25be5e000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000999b6d28a9e78c4be13d51469c49585d6d25be5e000000000000000000000000ae975071be8f8ee67addbc1a82488f1c248580670000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802
-----Decoded View---------------
Arg [0] : bankAddress (address): 0x999b6d28a9e78c4be13d51469c49585d6d25be5e
Arg [1] : chainlinkCoordinatorAddress (address): 0xae975071be8f8ee67addbc1a82488f1c24858067
Arg [2] : LINK_ETH_feedAddress (address): 0x5787befdc0ecd210dfa948264631cd53e68f7802
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000999b6d28a9e78c4be13d51469c49585d6d25be5e
Arg [1] : 000000000000000000000000ae975071be8f8ee67addbc1a82488f1c24858067
Arg [2] : 0000000000000000000000005787befdc0ecd210dfa948264631cd53e68f7802
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.