Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 25 from a total of 36 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw Token | 21825328 | 388 days ago | IN | 0 ETH | 0.00031767 | ||||
| Flip | 19548855 | 706 days ago | IN | 0.004 ETH | 0.00792498 | ||||
| Flip | 19548815 | 706 days ago | IN | 0.004 ETH | 0.00891003 | ||||
| Flip | 19463758 | 718 days ago | IN | 0.004 ETH | 0.0118029 | ||||
| Flip | 19442305 | 721 days ago | IN | 0.004 ETH | 0.01341384 | ||||
| Flip | 19442299 | 721 days ago | IN | 0.004 ETH | 0.01529205 | ||||
| Flip | 18250433 | 888 days ago | IN | 0.004 ETH | 0.00347872 | ||||
| Flip | 18235250 | 890 days ago | IN | 0.004 ETH | 0.00771273 | ||||
| Flip | 18208638 | 894 days ago | IN | 0.004 ETH | 0.00308227 | ||||
| Flip | 18172176 | 899 days ago | IN | 0.004 ETH | 0.00698757 | ||||
| Flip | 18157937 | 901 days ago | IN | 0.004 ETH | 0.00327249 | ||||
| Flip | 18149308 | 902 days ago | IN | 0.004 ETH | 0.00489017 | ||||
| Flip | 18142555 | 903 days ago | IN | 0.004 ETH | 0.00543244 | ||||
| Flip | 18137690 | 904 days ago | IN | 0.004 ETH | 0.00476258 | ||||
| Flip | 18137680 | 904 days ago | IN | 0.004 ETH | 0.00469978 | ||||
| Flip | 18137666 | 904 days ago | IN | 0.004 ETH | 0.0047962 | ||||
| Flip | 18137659 | 904 days ago | IN | 0.004 ETH | 0.00500572 | ||||
| Flip | 18135511 | 904 days ago | IN | 0.004 ETH | 0.00789431 | ||||
| Flip | 18135505 | 904 days ago | IN | 0.004 ETH | 0.00748477 | ||||
| Flip | 18135282 | 904 days ago | IN | 0.004 ETH | 0.00974021 | ||||
| Flip | 18135276 | 904 days ago | IN | 0.004 ETH | 0.01025355 | ||||
| Flip | 18129870 | 905 days ago | IN | 0.004 ETH | 0.00550096 | ||||
| Flip | 18129864 | 905 days ago | IN | 0.004 ETH | 0.00527386 | ||||
| Flip | 18128324 | 905 days ago | IN | 0.004 ETH | 0.00668289 | ||||
| Flip | 18128282 | 905 days ago | IN | 0.004 ETH | 0.00816491 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 21825328 | 388 days ago | 0.05334618 ETH | ||||
| Transfer | 21825328 | 388 days ago | 0.05334618 ETH | ||||
| Transfer | 19548855 | 706 days ago | 0.004 ETH | ||||
| Transfer | 19548815 | 706 days ago | 0.00171096 ETH | ||||
| Transfer | 19548815 | 706 days ago | 0.00171096 ETH | ||||
| Transfer | 19548815 | 706 days ago | 0.004 ETH | ||||
| Transfer | 19463758 | 718 days ago | 0.004 ETH | ||||
| Transfer | 19442305 | 721 days ago | 0.004 ETH | ||||
| Transfer | 19442299 | 721 days ago | 0.08985287 ETH | ||||
| Transfer | 19442299 | 721 days ago | 0.08985287 ETH | ||||
| Transfer | 19442299 | 721 days ago | 0.004 ETH | ||||
| Transfer | 18250433 | 888 days ago | 0.00695051 ETH | ||||
| Transfer | 18250433 | 888 days ago | 0.00695051 ETH | ||||
| Transfer | 18250433 | 888 days ago | 0.004 ETH | ||||
| Transfer | 18235250 | 890 days ago | 0.0088322 ETH | ||||
| Transfer | 18235250 | 890 days ago | 0.0088322 ETH | ||||
| Transfer | 18235250 | 890 days ago | 0.004 ETH | ||||
| Transfer | 18208638 | 894 days ago | 0.0014477 ETH | ||||
| Transfer | 18208638 | 894 days ago | 0.0014477 ETH | ||||
| Transfer | 18208638 | 894 days ago | 0.004 ETH | ||||
| Transfer | 18172176 | 899 days ago | 0.00044083 ETH | ||||
| Transfer | 18172176 | 899 days ago | 0.00044083 ETH | ||||
| Transfer | 18172176 | 899 days ago | 0.004 ETH | ||||
| Transfer | 18157937 | 901 days ago | 0.004 ETH | ||||
| Transfer | 18149308 | 902 days ago | 0.004 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CoinFlip
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
import '@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol';
import '@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/interfaces/IERC20.sol';
contract CoinFlip is Context, Ownable, VRFConsumerBaseV2 {
using SafeERC20 for IERC20;
uint256 public createFee;
mapping(address => bool) public whitelist;
VRFCoordinatorV2Interface _vrfCoordinator;
uint64 _vrfSubId;
bytes32 _vrfKeyHash;
uint16 _vrfBlocks = 3;
uint32 _vrfCallbackLimit = 300000;
mapping(uint256 => address) _flipWagerInitUser;
mapping(uint256 => bool) _flipWagerInitIsHeads;
mapping(uint256 => address) _flipWagerInitToken;
mapping(uint256 => uint256) _flipWagerInitAmount;
mapping(uint256 => uint256) _flipWagerInitNonce;
mapping(uint256 => bool) _flipWagerInitSettled;
mapping(address => uint256) _userNonce;
struct Battle {
uint256 game;
address player1;
address player2;
address requiredP2;
address battleToken;
uint256 battleAmount;
}
Battle[] public battles;
event InitiatedCoinFlip(
address indexed wagerer,
uint256 indexed nonce,
uint256 _requestId,
bool isHeads,
uint256 amountWagered
);
event SettledCoinFlip(
address indexed wagerer,
uint256 indexed nonce,
uint256 _requestId,
bool isHeads,
uint256 amountWagered,
bool isWinner,
uint256 amountWon
);
constructor(
address _coord,
uint64 _subId,
bytes32 _keyHash
) VRFConsumerBaseV2(_coord) {
_vrfCoordinator = VRFCoordinatorV2Interface(_coord);
_vrfSubId = _subId;
_vrfKeyHash = _keyHash;
whitelist[0x85225Ed797fd4128Ac45A992C46eA4681a7A15dA] = true;
}
function flip(
address _token,
uint256 _amount,
bool _isHeads
) external payable {
require(whitelist[_token], 'TOKEN');
_processFee(msg.value, createFee);
uint256 _before = IERC20(_token).balanceOf(address(this));
require(_before >= _amount, 'PAYOUT');
IERC20(_token).safeTransferFrom(_msgSender(), address(this), _amount);
_amount = IERC20(_token).balanceOf(address(this)) - _before;
uint256 _requestId = _vrfCoordinator.requestRandomWords(
_vrfKeyHash,
_vrfSubId,
_vrfBlocks,
_vrfCallbackLimit,
uint16(1)
);
_flipWagerInitUser[_requestId] = _msgSender();
_flipWagerInitToken[_requestId] = _token;
_flipWagerInitAmount[_requestId] = _amount;
_flipWagerInitNonce[_requestId] = _userNonce[_msgSender()];
_flipWagerInitIsHeads[_requestId] = _isHeads;
_userNonce[_msgSender()]++;
emit InitiatedCoinFlip(
_msgSender(),
_flipWagerInitNonce[_requestId],
_requestId,
_isHeads,
_amount
);
}
function fulfillRandomWords(
uint256 _requestId,
uint256[] memory _randomNumbers
) internal override {
uint256 _randomNumber = _randomNumbers[0];
address _user = _flipWagerInitUser[_requestId];
require(_user != address(0), 'RECORD');
require(!_flipWagerInitSettled[_requestId], 'SETTLED');
_flipWagerInitSettled[_requestId] = true;
address _token = _flipWagerInitToken[_requestId];
uint256 _amountWagered = _flipWagerInitAmount[_requestId];
uint256 _nonce = _flipWagerInitNonce[_requestId];
bool _isHeads = _flipWagerInitIsHeads[_requestId];
uint256 _amountToWin = (_amountWagered * 95) / 100;
uint8 _selectionMod = _isHeads ? 0 : 1;
bool _didUserWin = _randomNumber % 2 == _selectionMod;
if (_didUserWin) {
IERC20(_token).safeTransfer(_user, _amountWagered + _amountToWin);
}
emit SettledCoinFlip(
_user,
_nonce,
_requestId,
_isHeads,
_amountWagered,
_didUserWin,
_amountToWin
);
}
function _processFee(uint256 _value, uint256 _fee) internal {
require(_value == _fee, 'FEESYNC');
if (_fee == 0) {
return;
}
(bool _s, ) = payable(owner()).call{ value: _fee }('');
require(_s, 'FEE');
}
function setWhitelistTokens(
address _token,
bool _isWhitelisted
) external onlyOwner {
require(whitelist[_token] != _isWhitelisted, 'TOGGLE');
whitelist[_token] = _isWhitelisted;
}
function setCreateFee(uint256 _wei) external onlyOwner {
createFee = _wei;
}
function setVrfSubId(uint64 _subId) external onlyOwner {
_vrfSubId = _subId;
}
function setVrfNumBlocks(uint16 _blocks) external onlyOwner {
_vrfBlocks = _blocks;
}
function setVrfCallbackGasLimit(uint32 _gas) external onlyOwner {
_vrfCallbackLimit = _gas;
}
function withdrawToken(IERC20 _token, uint256 _amount) external onlyOwner {
_amount = _amount == 0 ? _token.balanceOf(address(this)) : _amount;
_token.safeTransfer(owner(), _amount);
}
receive() external payable {
(bool _s, ) = payable(owner()).call{ value: msg.value }('');
require(_s, 'RECEIVE');
}
}// 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
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
// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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.9.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 (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/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;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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;
}
}{
"metadata": {
"bytecodeHash": "none"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_coord","type":"address"},{"internalType":"uint64","name":"_subId","type":"uint64"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wagerer","type":"address"},{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isHeads","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amountWagered","type":"uint256"}],"name":"InitiatedCoinFlip","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":true,"internalType":"address","name":"wagerer","type":"address"},{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isHeads","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amountWagered","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isWinner","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amountWon","type":"uint256"}],"name":"SettledCoinFlip","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"battles","outputs":[{"internalType":"uint256","name":"game","type":"uint256"},{"internalType":"address","name":"player1","type":"address"},{"internalType":"address","name":"player2","type":"address"},{"internalType":"address","name":"requiredP2","type":"address"},{"internalType":"address","name":"battleToken","type":"address"},{"internalType":"uint256","name":"battleAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_isHeads","type":"bool"}],"name":"flip","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_wei","type":"uint256"}],"name":"setCreateFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_gas","type":"uint32"}],"name":"setVrfCallbackGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_blocks","type":"uint16"}],"name":"setVrfNumBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_subId","type":"uint64"}],"name":"setVrfSubId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"setWhitelistTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60a06040526005805465ffffffffffff1916640493e00003179055348015610025575f80fd5b506040516115653803806115658339810160408190526100449161012b565b8261004e336100dc565b6001600160a01b03908116608052600380546001600160401b03909416600160a01b026001600160e01b03199094169490911693909317919091179091556004557385225ed797fd4128ac45a992c46ea4681a7a15da5f5260026020527fedfa850da31afe2b8d8e36b0206f8d5b5488aeaefa904806755be240092ba4d2805460ff19166001179055610181565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f805f6060848603121561013d575f80fd5b83516001600160a01b0381168114610153575f80fd5b60208501519093506001600160401b038116811461016f575f80fd5b80925050604084015190509250925092565b6080516113c56101a05f395f81816103bf015261040101526113c55ff3fe6080604052600436106100dc575f3560e01c80638da5cb5b1161007c5780639e281a98116100575780639e281a98146102fe578063b2db919b1461031d578063f2fde38b14610340578063f590e8e91461035f575f80fd5b80638da5cb5b1461027b57806396601924146102a15780639b19251a146102c0575f80fd5b8063606d2e96116100b7578063606d2e96146101d357806362914849146102355780636546940114610254578063715018a614610267575f80fd5b80631a1c4af9146101765780631fe543e3146101955780635a405c87146101b4575f80fd5b36610172575f80546040516001600160a01b039091169034908381818185875af1925050503d805f811461012b576040519150601f19603f3d011682016040523d82523d5f602084013e610130565b606091505b50509050806101705760405162461bcd60e51b81526020600482015260076024820152665245434549564560c81b60448201526064015b60405180910390fd5b005b5f80fd5b348015610181575f80fd5b5061017061019036600461101c565b61037e565b3480156101a0575f80fd5b506101706101af36600461105e565b6103b4565b3480156101bf575f80fd5b506101706101ce366004611123565b61043c565b3480156101de575f80fd5b506101f26101ed366004611146565b610468565b604080519687526001600160a01b039586166020880152938516938601939093529083166060850152909116608083015260a082015260c0015b60405180910390f35b348015610240575f80fd5b5061017061024f366004611146565b6104c0565b61017061026236600461117e565b6104cd565b348015610272575f80fd5b506101706107f9565b348015610286575f80fd5b505f546040516001600160a01b03909116815260200161022c565b3480156102ac575f80fd5b506101706102bb3660046111bd565b61080c565b3480156102cb575f80fd5b506102ee6102da3660046111de565b60026020525f908152604090205460ff1681565b604051901515815260200161022c565b348015610309575f80fd5b506101706103183660046111f9565b61082c565b348015610328575f80fd5b5061033260015481565b60405190815260200161022c565b34801561034b575f80fd5b5061017061035a3660046111de565b6108cd565b34801561036a575f80fd5b50610170610379366004611223565b610946565b6103866109d0565b6003805467ffffffffffffffff909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461042e5760405163073e64fd60e21b81523360048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166024820152604401610167565b6104388282610a29565b5050565b6104446109d0565b6005805463ffffffff909216620100000265ffffffff000019909216919091179055565b600d8181548110610477575f80fd5b5f9182526020909120600690910201805460018201546002830154600384015460048501546005909501549395506001600160a01b039283169491831693908316929091169086565b6104c86109d0565b600155565b6001600160a01b0383165f9081526002602052604090205460ff1661051c5760405162461bcd60e51b81526020600482015260056024820152642a27a5a2a760d91b6044820152606401610167565b61052834600154610c00565b6040516370a0823160e01b81523060048201525f906001600160a01b038516906370a0823190602401602060405180830381865afa15801561056c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610590919061125a565b9050828110156105cb5760405162461bcd60e51b815260206004820152600660248201526514105653d55560d21b6044820152606401610167565b6105e06001600160a01b038516333086610ccf565b6040516370a0823160e01b815230600482015281906001600160a01b038616906370a0823190602401602060405180830381865afa158015610624573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610648919061125a565b6106529190611285565b600354600480546005546040516305d3b1d360e41b815292830191909152600160a01b830467ffffffffffffffff16602483015261ffff8116604483015262010000900463ffffffff166064820152600160848201529194505f916001600160a01b0390911690635d3b1d309060a4016020604051808303815f875af11580156106de573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610702919061125a565b5f8181526006602090815260408083208054336001600160a01b031991821681179092556008845282852080549091166001600160a01b038c1617905560098352818420899055808452600c8084528285208054878752600a86528487205560078552928520805460ff19168a15151790559084529091528054929350906107898361129e565b90915550505f818152600a6020526040902054336001600160a01b03167f8809c5fec0f453576639d58cce4a7223c4245e4a942ec2337e39d18a9018d6218386886040516107ea939291909283529015156020830152604082015260600190565b60405180910390a35050505050565b6108016109d0565b61080a5f610d40565b565b6108146109d0565b6005805461ffff191661ffff92909216919091179055565b6108346109d0565b801561084057806108a6565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015610882573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a6919061125a565b90506104386108bc5f546001600160a01b031690565b6001600160a01b0384169083610d8f565b6108d56109d0565b6001600160a01b03811661093a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610167565b61094381610d40565b50565b61094e6109d0565b6001600160a01b0382165f9081526002602052604090205481151560ff9091161515036109a65760405162461bcd60e51b8152602060048201526006602482015265544f47474c4560d01b6044820152606401610167565b6001600160a01b03919091165f908152600260205260409020805460ff1916911515919091179055565b5f546001600160a01b0316331461080a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610167565b5f815f81518110610a3c57610a3c6112b6565b6020908102919091018101515f85815260069092526040909120549091506001600160a01b031680610a995760405162461bcd60e51b8152602060048201526006602482015265149150d3d49160d21b6044820152606401610167565b5f848152600b602052604090205460ff1615610ae15760405162461bcd60e51b815260206004820152600760248201526614d1551513115160ca1b6044820152606401610167565b5f848152600b60209081526040808320805460ff1916600117905560088252808320546009835281842054600a8452828520546007909452918420546001600160a01b039091169391929160ff91909116906064610b4085605f6112ca565b610b4a91906112f5565b90505f82610b59576001610b5b565b5f5b90505f60ff8216610b6d60028b611308565b1490508015610b9557610b9588610b84858961131b565b6001600160a01b038a169190610d8f565b604080518c8152851515602082015290810187905281151560608201526080810184905285906001600160a01b038a16907f8993d4b7f51a4109f2ff0d20199c4597c0be98600a3704da02688033b81dd0079060a00160405180910390a35050505050505050505050565b808214610c395760405162461bcd60e51b815260206004820152600760248201526646454553594e4360c81b6044820152606401610167565b805f03610c44575050565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f8114610c8e576040519150601f19603f3d011682016040523d82523d5f602084013e610c93565b606091505b5050905080610cca5760405162461bcd60e51b815260206004820152600360248201526246454560e81b6044820152606401610167565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610d3a9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610dbf565b50505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038316602482015260448101829052610cca90849063a9059cbb60e01b90606401610d03565b5f610e13826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e929092919063ffffffff16565b905080515f1480610e33575080806020019051810190610e33919061132e565b610cca5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610167565b6060610ea084845f85610ea8565b949350505050565b606082471015610f095760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610167565b5f80866001600160a01b03168587604051610f24919061136b565b5f6040518083038185875af1925050503d805f8114610f5e576040519150601f19603f3d011682016040523d82523d5f602084013e610f63565b606091505b5091509150610f7487838387610f7f565b979650505050505050565b60608315610fed5782515f03610fe6576001600160a01b0385163b610fe65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610167565b5081610ea0565b610ea083838151156110025781518083602001fd5b8060405162461bcd60e51b81526004016101679190611386565b5f6020828403121561102c575f80fd5b813567ffffffffffffffff81168114611043575f80fd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f806040838503121561106f575f80fd5b8235915060208084013567ffffffffffffffff8082111561108e575f80fd5b818601915086601f8301126110a1575f80fd5b8135818111156110b3576110b361104a565b8060051b604051601f19603f830116810181811085821117156110d8576110d861104a565b6040529182528482019250838101850191898311156110f5575f80fd5b938501935b82851015611113578435845293850193928501926110fa565b8096505050505050509250929050565b5f60208284031215611133575f80fd5b813563ffffffff81168114611043575f80fd5b5f60208284031215611156575f80fd5b5035919050565b6001600160a01b0381168114610943575f80fd5b8015158114610943575f80fd5b5f805f60608486031215611190575f80fd5b833561119b8161115d565b92506020840135915060408401356111b281611171565b809150509250925092565b5f602082840312156111cd575f80fd5b813561ffff81168114611043575f80fd5b5f602082840312156111ee575f80fd5b81356110438161115d565b5f806040838503121561120a575f80fd5b82356112158161115d565b946020939093013593505050565b5f8060408385031215611234575f80fd5b823561123f8161115d565b9150602083013561124f81611171565b809150509250929050565b5f6020828403121561126a575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561129857611298611271565b92915050565b5f600182016112af576112af611271565b5060010190565b634e487b7160e01b5f52603260045260245ffd5b808202811582820484141761129857611298611271565b634e487b7160e01b5f52601260045260245ffd5b5f82611303576113036112e1565b500490565b5f82611316576113166112e1565b500690565b8082018082111561129857611298611271565b5f6020828403121561133e575f80fd5b815161104381611171565b5f5b8381101561136357818101518382015260200161134b565b50505f910152565b5f825161137c818460208701611349565b9190910192915050565b602081525f82518060208401526113a4816040850160208701611349565b601f01601f1916919091016040019291505056fea164736f6c6343000815000a000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990900000000000000000000000000000000000000000000000000000000000003388af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef
Deployed Bytecode
0x6080604052600436106100dc575f3560e01c80638da5cb5b1161007c5780639e281a98116100575780639e281a98146102fe578063b2db919b1461031d578063f2fde38b14610340578063f590e8e91461035f575f80fd5b80638da5cb5b1461027b57806396601924146102a15780639b19251a146102c0575f80fd5b8063606d2e96116100b7578063606d2e96146101d357806362914849146102355780636546940114610254578063715018a614610267575f80fd5b80631a1c4af9146101765780631fe543e3146101955780635a405c87146101b4575f80fd5b36610172575f80546040516001600160a01b039091169034908381818185875af1925050503d805f811461012b576040519150601f19603f3d011682016040523d82523d5f602084013e610130565b606091505b50509050806101705760405162461bcd60e51b81526020600482015260076024820152665245434549564560c81b60448201526064015b60405180910390fd5b005b5f80fd5b348015610181575f80fd5b5061017061019036600461101c565b61037e565b3480156101a0575f80fd5b506101706101af36600461105e565b6103b4565b3480156101bf575f80fd5b506101706101ce366004611123565b61043c565b3480156101de575f80fd5b506101f26101ed366004611146565b610468565b604080519687526001600160a01b039586166020880152938516938601939093529083166060850152909116608083015260a082015260c0015b60405180910390f35b348015610240575f80fd5b5061017061024f366004611146565b6104c0565b61017061026236600461117e565b6104cd565b348015610272575f80fd5b506101706107f9565b348015610286575f80fd5b505f546040516001600160a01b03909116815260200161022c565b3480156102ac575f80fd5b506101706102bb3660046111bd565b61080c565b3480156102cb575f80fd5b506102ee6102da3660046111de565b60026020525f908152604090205460ff1681565b604051901515815260200161022c565b348015610309575f80fd5b506101706103183660046111f9565b61082c565b348015610328575f80fd5b5061033260015481565b60405190815260200161022c565b34801561034b575f80fd5b5061017061035a3660046111de565b6108cd565b34801561036a575f80fd5b50610170610379366004611223565b610946565b6103866109d0565b6003805467ffffffffffffffff909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909161461042e5760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909166024820152604401610167565b6104388282610a29565b5050565b6104446109d0565b6005805463ffffffff909216620100000265ffffffff000019909216919091179055565b600d8181548110610477575f80fd5b5f9182526020909120600690910201805460018201546002830154600384015460048501546005909501549395506001600160a01b039283169491831693908316929091169086565b6104c86109d0565b600155565b6001600160a01b0383165f9081526002602052604090205460ff1661051c5760405162461bcd60e51b81526020600482015260056024820152642a27a5a2a760d91b6044820152606401610167565b61052834600154610c00565b6040516370a0823160e01b81523060048201525f906001600160a01b038516906370a0823190602401602060405180830381865afa15801561056c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610590919061125a565b9050828110156105cb5760405162461bcd60e51b815260206004820152600660248201526514105653d55560d21b6044820152606401610167565b6105e06001600160a01b038516333086610ccf565b6040516370a0823160e01b815230600482015281906001600160a01b038616906370a0823190602401602060405180830381865afa158015610624573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610648919061125a565b6106529190611285565b600354600480546005546040516305d3b1d360e41b815292830191909152600160a01b830467ffffffffffffffff16602483015261ffff8116604483015262010000900463ffffffff166064820152600160848201529194505f916001600160a01b0390911690635d3b1d309060a4016020604051808303815f875af11580156106de573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610702919061125a565b5f8181526006602090815260408083208054336001600160a01b031991821681179092556008845282852080549091166001600160a01b038c1617905560098352818420899055808452600c8084528285208054878752600a86528487205560078552928520805460ff19168a15151790559084529091528054929350906107898361129e565b90915550505f818152600a6020526040902054336001600160a01b03167f8809c5fec0f453576639d58cce4a7223c4245e4a942ec2337e39d18a9018d6218386886040516107ea939291909283529015156020830152604082015260600190565b60405180910390a35050505050565b6108016109d0565b61080a5f610d40565b565b6108146109d0565b6005805461ffff191661ffff92909216919091179055565b6108346109d0565b801561084057806108a6565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015610882573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a6919061125a565b90506104386108bc5f546001600160a01b031690565b6001600160a01b0384169083610d8f565b6108d56109d0565b6001600160a01b03811661093a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610167565b61094381610d40565b50565b61094e6109d0565b6001600160a01b0382165f9081526002602052604090205481151560ff9091161515036109a65760405162461bcd60e51b8152602060048201526006602482015265544f47474c4560d01b6044820152606401610167565b6001600160a01b03919091165f908152600260205260409020805460ff1916911515919091179055565b5f546001600160a01b0316331461080a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610167565b5f815f81518110610a3c57610a3c6112b6565b6020908102919091018101515f85815260069092526040909120549091506001600160a01b031680610a995760405162461bcd60e51b8152602060048201526006602482015265149150d3d49160d21b6044820152606401610167565b5f848152600b602052604090205460ff1615610ae15760405162461bcd60e51b815260206004820152600760248201526614d1551513115160ca1b6044820152606401610167565b5f848152600b60209081526040808320805460ff1916600117905560088252808320546009835281842054600a8452828520546007909452918420546001600160a01b039091169391929160ff91909116906064610b4085605f6112ca565b610b4a91906112f5565b90505f82610b59576001610b5b565b5f5b90505f60ff8216610b6d60028b611308565b1490508015610b9557610b9588610b84858961131b565b6001600160a01b038a169190610d8f565b604080518c8152851515602082015290810187905281151560608201526080810184905285906001600160a01b038a16907f8993d4b7f51a4109f2ff0d20199c4597c0be98600a3704da02688033b81dd0079060a00160405180910390a35050505050505050505050565b808214610c395760405162461bcd60e51b815260206004820152600760248201526646454553594e4360c81b6044820152606401610167565b805f03610c44575050565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f8114610c8e576040519150601f19603f3d011682016040523d82523d5f602084013e610c93565b606091505b5050905080610cca5760405162461bcd60e51b815260206004820152600360248201526246454560e81b6044820152606401610167565b505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610d3a9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610dbf565b50505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038316602482015260448101829052610cca90849063a9059cbb60e01b90606401610d03565b5f610e13826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e929092919063ffffffff16565b905080515f1480610e33575080806020019051810190610e33919061132e565b610cca5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610167565b6060610ea084845f85610ea8565b949350505050565b606082471015610f095760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610167565b5f80866001600160a01b03168587604051610f24919061136b565b5f6040518083038185875af1925050503d805f8114610f5e576040519150601f19603f3d011682016040523d82523d5f602084013e610f63565b606091505b5091509150610f7487838387610f7f565b979650505050505050565b60608315610fed5782515f03610fe6576001600160a01b0385163b610fe65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610167565b5081610ea0565b610ea083838151156110025781518083602001fd5b8060405162461bcd60e51b81526004016101679190611386565b5f6020828403121561102c575f80fd5b813567ffffffffffffffff81168114611043575f80fd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f806040838503121561106f575f80fd5b8235915060208084013567ffffffffffffffff8082111561108e575f80fd5b818601915086601f8301126110a1575f80fd5b8135818111156110b3576110b361104a565b8060051b604051601f19603f830116810181811085821117156110d8576110d861104a565b6040529182528482019250838101850191898311156110f5575f80fd5b938501935b82851015611113578435845293850193928501926110fa565b8096505050505050509250929050565b5f60208284031215611133575f80fd5b813563ffffffff81168114611043575f80fd5b5f60208284031215611156575f80fd5b5035919050565b6001600160a01b0381168114610943575f80fd5b8015158114610943575f80fd5b5f805f60608486031215611190575f80fd5b833561119b8161115d565b92506020840135915060408401356111b281611171565b809150509250925092565b5f602082840312156111cd575f80fd5b813561ffff81168114611043575f80fd5b5f602082840312156111ee575f80fd5b81356110438161115d565b5f806040838503121561120a575f80fd5b82356112158161115d565b946020939093013593505050565b5f8060408385031215611234575f80fd5b823561123f8161115d565b9150602083013561124f81611171565b809150509250929050565b5f6020828403121561126a575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561129857611298611271565b92915050565b5f600182016112af576112af611271565b5060010190565b634e487b7160e01b5f52603260045260245ffd5b808202811582820484141761129857611298611271565b634e487b7160e01b5f52601260045260245ffd5b5f82611303576113036112e1565b500490565b5f82611316576113166112e1565b500690565b8082018082111561129857611298611271565b5f6020828403121561133e575f80fd5b815161104381611171565b5f5b8381101561136357818101518382015260200161134b565b50505f910152565b5f825161137c818460208701611349565b9190910192915050565b602081525f82518060208401526113a4816040850160208701611349565b601f01601f1916919091016040019291505056fea164736f6c6343000815000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990900000000000000000000000000000000000000000000000000000000000003388af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef
-----Decoded View---------------
Arg [0] : _coord (address): 0x271682DEB8C4E0901D1a1550aD2e64D568E69909
Arg [1] : _subId (uint64): 824
Arg [2] : _keyHash (bytes32): 0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000338
Arg [2] : 8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.