Source Code
Latest 25 from a total of 12,255 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw Overcha... | 316085667 | 316 days ago | IN | 0 ETH | 0.00000032 | ||||
| Withdraw Tokens ... | 277095294 | 429 days ago | IN | 0 ETH | 0.00000105 | ||||
| Withdraw Tokens ... | 277095118 | 429 days ago | IN | 0 ETH | 0.00000105 | ||||
| Wager | 276597286 | 431 days ago | IN | 0.00202801 ETH | 0.00000364 | ||||
| Wager | 274704068 | 436 days ago | IN | 0.0016253 ETH | 0.0000039 | ||||
| Withdraw Overcha... | 274704007 | 436 days ago | IN | 0 ETH | 0.00000107 | ||||
| Wager | 274703889 | 436 days ago | IN | 0.0037153 ETH | 0.0000039 | ||||
| Wager | 274703758 | 436 days ago | IN | 0.0011253 ETH | 0.0000039 | ||||
| Wager | 274703714 | 436 days ago | IN | 0.0011253 ETH | 0.0000039 | ||||
| Wager | 274703667 | 436 days ago | IN | 0.0011253 ETH | 0.0000041 | ||||
| Wager | 274703577 | 436 days ago | IN | 0.0011253 ETH | 0.0000039 | ||||
| Wager | 274703411 | 436 days ago | IN | 0.0011253 ETH | 0.00000389 | ||||
| Wager | 273826954 | 439 days ago | IN | 0.00013566 ETH | 0.00000506 | ||||
| Wager | 273826857 | 439 days ago | IN | 0.00028566 ETH | 0.0000051 | ||||
| Withdraw Overcha... | 273801865 | 439 days ago | IN | 0 ETH | 0.00000217 | ||||
| Wager | 273498167 | 440 days ago | IN | 0.00162625 ETH | 0.00000632 | ||||
| Wager | 273498137 | 440 days ago | IN | 0.00162625 ETH | 0.00000633 | ||||
| Wager | 273498052 | 440 days ago | IN | 0.00162625 ETH | 0.00000633 | ||||
| Wager | 273498000 | 440 days ago | IN | 0.00112625 ETH | 0.00000653 | ||||
| Wager | 273497962 | 440 days ago | IN | 0.00112625 ETH | 0.00000625 | ||||
| Wager | 273497904 | 440 days ago | IN | 0.00112625 ETH | 0.00000624 | ||||
| Wager | 273322839 | 440 days ago | IN | 0.01002694 ETH | 0.00000564 | ||||
| Wager | 273322595 | 440 days ago | IN | 0.00502694 ETH | 0.00000566 | ||||
| Wager | 273020924 | 441 days ago | IN | 0.00102626 ETH | 0.0000047 | ||||
| Wager | 273020836 | 441 days ago | IN | 0.00202626 ETH | 0.0000049 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 316085667 | 316 days ago | 0.00001218 ETH | ||||
| 277095294 | 429 days ago | 0.13893176 ETH | ||||
| 277095118 | 429 days ago | 0.13095602 ETH | ||||
| 276597295 | 431 days ago | 0.00006 ETH | ||||
| 276597295 | 431 days ago | 0.00194 ETH | ||||
| 274704079 | 436 days ago | 0.0016 ETH | ||||
| 274704007 | 436 days ago | 0.0000207 ETH | ||||
| 274703900 | 436 days ago | 0.00369 ETH | ||||
| 274703769 | 436 days ago | 0.0011 ETH | ||||
| 274703725 | 436 days ago | 0.0011 ETH | ||||
| 274703677 | 436 days ago | 0.000033 ETH | ||||
| 274703677 | 436 days ago | 0.001067 ETH | ||||
| 274703589 | 436 days ago | 0.0011 ETH | ||||
| 274703422 | 436 days ago | 0.000033 ETH | ||||
| 274703422 | 436 days ago | 0.001067 ETH | ||||
| 273826962 | 439 days ago | 0.00011 ETH | ||||
| 273826863 | 439 days ago | 0.00026 ETH | ||||
| 273801865 | 439 days ago | 0.00002059 ETH | ||||
| 273498175 | 440 days ago | 0.0016 ETH | ||||
| 273498142 | 440 days ago | 0.0016 ETH | ||||
| 273498059 | 440 days ago | 0.000048 ETH | ||||
| 273498059 | 440 days ago | 0.001552 ETH | ||||
| 273498006 | 440 days ago | 0.000033 ETH | ||||
| 273498006 | 440 days ago | 0.001067 ETH | ||||
| 273497968 | 440 days ago | 0.0011 ETH |
Cross-Chain Transactions
Loading...
Loading
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:
CoinToss
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {Game} from "./Game.sol";
/// @title BetSwirl's Coin Toss game
/// @notice The game is played with a two-sided coin. The game's goal is to guess whether the lucky coin face will be Heads or Tails.
/// @author Romuald Hog (based on Yakitori's Coin Toss)
contract CoinToss is Game {
/// @notice Full coin toss bet information struct.
/// @param bet The Bet struct information.
/// @param diceBet The Coin Toss bet struct information.
/// @dev Used to package bet information for the front-end.
struct FullCoinTossBet {
Bet bet;
CoinTossBet coinTossBet;
}
/// @notice Coin Toss bet information struct.
/// @param face The chosen coin face.
/// @param rolled The rolled coin face.
struct CoinTossBet {
bool face;
bool rolled;
}
/// @notice Maps bets IDs to chosen and rolled coin faces.
/// @dev Coin faces: true = Tails, false = Heads.
mapping(uint256 => CoinTossBet) public coinTossBets;
/// @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 face The chosen coin face.
event PlaceBet(
uint256 id,
address indexed user,
address indexed token,
uint256 amount,
uint256 vrfCost,
bool face
);
/// @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 face The chosen coin face.
/// @param rolled The rolled coin face.
/// @param payout The payout amount.
event Roll(
uint256 id,
address indexed user,
address indexed token,
uint256 amount,
bool face,
bool rolled,
uint256 payout
);
/// @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,
address wrappedGasToken
)
Game(
bankAddress,
chainlinkCoordinatorAddress,
1,
LINK_ETH_feedAddress,
wrappedGasToken
)
{}
/// @notice Calculates the target payout amount.
/// @param betAmount Bet amount.
/// @return The target payout amount.
function _getPayout(uint256 betAmount) private pure returns (uint256) {
return betAmount * 2;
}
/// @notice Creates a new bet and stores the chosen coin face.
/// @param face The chosen coin face.
/// @param token Address of the token.
/// @param tokenAmount The number of tokens bet.
function wager(
bool face,
address token,
uint256 tokenAmount
) external payable whenNotPaused {
Bet memory bet = _newBet(token, tokenAmount, _getPayout(10000));
coinTossBets[bet.id].face = face;
emit PlaceBet(
bet.id,
bet.user,
bet.token,
bet.amount,
bet.vrfCost,
face
);
}
/// @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();
CoinTossBet storage coinTossBet = coinTossBets[id];
Bet storage bet = bets[id];
uint256 rolled = randomWords[0] % 2;
coinTossBet.rolled = rolled == 1;
uint256 payout = _resolveBet(
bet,
(coinTossBet.face && rolled == 1) ||
(!coinTossBet.face && rolled == 0)
? _getPayout(bet.amount)
: 0
);
emit Roll(
bet.id,
bet.user,
bet.token,
bet.amount,
coinTossBet.face,
coinTossBet.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 Coin Toss bet.
function getLastUserBets(
address user,
uint256 dataLength
) external view returns (FullCoinTossBet[] memory) {
Bet[] memory lastBets = _getLastUserBets(user, dataLength);
FullCoinTossBet[] memory lastCoinTossBets = new FullCoinTossBet[](
lastBets.length
);
for (uint256 i; i < lastBets.length; i++) {
lastCoinTossBets[i] = FullCoinTossBet(
lastBets[i],
coinTossBets[lastBets[i].id]
);
}
return lastCoinTossBets;
}
}// 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 (last updated v4.8.0) (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() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// 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.8.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.8.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 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;
}
}// 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 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;
function getTokenOwner(address token) external view returns (address);
function getBetRequirements(address token, uint256 multiplier)
external
view
returns (
bool,
uint64,
uint256,
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 Wrapped {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
}
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 timestamp 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;
uint32 timestamp;
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 Set the wrapped token in case of transfer issue
Wrapped public immutable wrapped;
/// @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,
address wrappedGasToken
) 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);
wrapped = Wrapped(wrappedGasToken);
_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) {
(
bool isAllowedToken,
uint64 VRFSubId,
uint256 minBetAmount,
uint256 maxBetAmount
) = bank.getBetRequirements(tokenAddress, multiplier);
Token storage token = tokens[tokenAddress];
if (!isAllowedToken || token.houseEdge == 0) {
revert ForbiddenToken();
}
uint256 fee = tokenAddress == address(0)
? (msg.value - tokenAmount)
: msg.value;
{
// Charge user for Chainlink VRF fee.
uint256 chainlinkVRFCost = getChainlinkVRFCost(tokenAddress);
if (fee < (chainlinkVRFCost - ((10 * chainlinkVRFCost) / 100))) {
// 10% slippage.
revert WrongGasValueToCoverFee();
}
}
// Bet amount is capped.
if (tokenAmount < minBetAmount) {
revert UnderMinBetAmount(minBetAmount);
} else if (tokenAmount > maxBetAmount) {
if (tokenAddress == address(0)) {
Address.sendValue(
payable(msg.sender),
tokenAmount - maxBetAmount
);
}
tokenAmount = maxBetAmount;
}
// Create bet
uint256 id = _chainlinkConfig.chainlinkCoordinator.requestRandomWords(
_chainlinkConfig.keyHash,
VRFSubId,
_chainlinkConfig.requestConfirmations,
token.VRFCallbackGasLimit,
_chainlinkConfig.numRandomWords
);
Bet memory newBet = Bet(
false,
msg.sender,
tokenAddress,
id,
tokenAmount,
uint32(block.timestamp),
0,
fee
);
_userBets[msg.sender].push(id);
bets[id] = newBet;
token.pendingCount++;
// If ERC20, transfer the tokens
if (tokenAddress != address(0)) {
IERC20(tokenAddress).safeTransferFrom(
msg.sender,
address(this),
tokenAmount
);
}
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;
}
function silentTransfer(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
// Fallback to wrapped gas token in case of error
wrapped.deposit{value: amount}();
wrapped.transfer(recipient, amount);
}
}
/// @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.timestamp < bet.timestamp + 60 * 60 * 24) {
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)) {
silentTransfer(payable(bet.user), bet.amount + chainlinkVRFCost);
} else {
IERC20(bet.token).safeTransfer(bet.user, bet.amount);
silentTransfer(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);
}
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 7777777
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"bankAddress","type":"address"},{"internalType":"address","name":"chainlinkCoordinatorAddress","type":"address"},{"internalType":"address","name":"LINK_ETH_feedAddress","type":"address"},{"internalType":"address","name":"wrappedGasToken","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":[{"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":"bool","name":"face","type":"bool"}],"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":"bool","name":"face","type":"bool"},{"indexed":false,"internalType":"bool","name":"rolled","type":"bool"},{"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":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"coinTossBets","outputs":[{"internalType":"bool","name":"face","type":"bool"},{"internalType":"bool","name":"rolled","type":"bool"}],"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":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"vrfCost","type":"uint256"}],"internalType":"struct Game.Bet","name":"bet","type":"tuple"},{"components":[{"internalType":"bool","name":"face","type":"bool"},{"internalType":"bool","name":"rolled","type":"bool"}],"internalType":"struct CoinToss.CoinTossBet","name":"coinTossBet","type":"tuple"}],"internalType":"struct CoinToss.FullCoinTossBet[]","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":"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":"bool","name":"face","type":"bool"},{"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"},{"inputs":[],"name":"wrapped","outputs":[{"internalType":"contract Wrapped","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6101006040523480156200001257600080fd5b5060405162004014380380620040148339810160408190526200003591620001e0565b83836001848483620000473362000173565b6000805460ff60a01b191690556001600160a01b0390811660805260018055821615806200007c57506001600160a01b038416155b806200008f57506001600160a01b038516155b15620000ae5760405163e6c4247b60e01b815260040160405180910390fd5b61ffff831615801590620000c857506101f48361ffff1611155b620001195760405162461bcd60e51b815260206004820152601e60248201527f57726f6e6720436861696e6c696e6b204e756d52616e646f6d576f7264730000604482015260640160405180910390fd5b6001600160a01b0394851660c052841660e052600480549385166001600160a01b0319909416939093179092556002805461ffff909216620100000263ffff0000199092169190911790551660a052506200023d92505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620001db57600080fd5b919050565b60008060008060808587031215620001f757600080fd5b6200020285620001c3565b93506200021260208601620001c3565b92506200022260408601620001c3565b91506200023260608601620001c3565b905092959194509250565b60805160a05160c05160e051613d49620002cb600039600081816102f5015281816123ee01526124b601526000818161043801528181610a0a015281816117e9015281816127df015281816128060152818161298a015281816129b101528181612aad0152612ad4015260008181610cd90152612bbc01526000818161070f01526107770152613d496000f3fe60806040526004361061018b5760003560e01c80637d0807d7116100d6578063c2fb579f1161007f578063e32fe50411610059578063e32fe5041461061d578063e48603391461063d578063f2fde38b146106d757600080fd5b8063c2fb579f14610580578063e051ece9146105ad578063e1fdb4b4146105fd57600080fd5b80638da5cb5b116100b05780638da5cb5b14610508578063982c3fdd14610533578063ac9650d81461055357600080fd5b80637d0807d71461047a57806382b0c00b146104d35780638456cb59146104f357600080fd5b80635c975abb11610138578063715018a611610112578063715018a61461041157806376cdb03b1461042657806378bcde221461045a57600080fd5b80635c975abb146103a15780637038942f146103d1578063707cd55e146103f157600080fd5b806350462ea01161016957806350462ea0146102d057806350e70d48146102e3578063594043fd1461033c57600080fd5b80631fe543e31461019057806322af00fa146101b2578063277d35af14610295575b600080fd5b34801561019c57600080fd5b506101b06101ab3660046133e0565b6106f7565b005b3480156101be57600080fd5b506102346101cd3660046134c8565b6006602081905260009182526040909120805460018201546002830154600384015460048501546005860154959096015460ff85169661010090950473ffffffffffffffffffffffffffffffffffffffff908116969416949293919263ffffffff16919088565b60408051981515895273ffffffffffffffffffffffffffffffffffffffff97881660208a015295909616948701949094526060860192909252608085015263ffffffff1660a084015260c083015260e0820152610100015b60405180910390f35b3480156102a157600080fd5b506102c26102b0366004613503565b60096020526000908152604090205481565b60405190815260200161028c565b6101b06102de36600461352e565b6107b7565b3480156102ef57600080fd5b506103177f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161028c565b34801561034857600080fd5b50610391610357366004613503565b73ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604090205462010000900467ffffffffffffffff16151590565b604051901515815260200161028c565b3480156103ad57600080fd5b5060005474010000000000000000000000000000000000000000900460ff16610391565b3480156103dd57600080fd5b506101b06103ec366004613503565b610897565b3480156103fd57600080fd5b506101b061040c366004613503565b61097b565b34801561041d57600080fd5b506101b0610ac3565b34801561043257600080fd5b506103177f000000000000000000000000000000000000000000000000000000000000000081565b34801561046657600080fd5b506101b0610475366004613586565b610ad7565b34801561048657600080fd5b506002546003546004546005546040805161ffff9095168552602085019390935273ffffffffffffffffffffffffffffffffffffffff90911691830191909152606082015260800161028c565b3480156104df57600080fd5b506101b06104ee3660046135bb565b610c11565b3480156104ff57600080fd5b506101b0610c99565b34801561051457600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610317565b34801561053f57600080fd5b506102c261054e366004613503565b610cd4565b34801561055f57600080fd5b5061057361056e3660046135ee565b610ee7565b60405161028c91906136d1565b34801561058c57600080fd5b506105a061059b366004613751565b610fdd565b60405161028c919061377d565b3480156105b957600080fd5b506105e66105c83660046134c8565b600a6020526000908152604090205460ff8082169161010090041682565b60408051921515835290151560208301520161028c565b34801561060957600080fd5b506101b06106183660046134c8565b61116b565b34801561062957600080fd5b506101b0610638366004613858565b6113e8565b34801561064957600080fd5b5061069e610658366004613503565b6008602052600090815260409020805460019091015461ffff82169162010000810467ffffffffffffffff16916a010000000000000000000090910463ffffffff169084565b6040805161ffff909516855267ffffffffffffffff909316602085015263ffffffff90911691830191909152606082015260800161028c565b3480156106e357600080fd5b506101b06106f2366004613503565b611487565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146107a9576040517f1cf993f400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b6107b3828261153e565b5050565b6107bf6116b1565b60006107d683836107d1612710611736565b611743565b606081810180516000908152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168a15159081179091558286015182870151945160808089015160e08a0151875193845295830152948101939093529482015293945073ffffffffffffffffffffffffffffffffffffffff9283169392909116917fa056e15b055f378463e53b317d9503bc9aba54ace23957ea9ff7fbfa0bf2efc0910160405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260096020526040812054908190036108f7576040517f8ab4c5d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600960205260408120556109278282611d69565b8173ffffffffffffffffffffffffffffffffffffffff167f3f206d449945dd03c1742ee98a9c5b872ac6c165788363e06af2796dd5de1f548260405161096f91815260200190565b60405180910390a25050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526008602052604090206001015480156107b35773ffffffffffffffffffffffffffffffffffffffff82811660008181526008602052604080822060010191909155517fdc17c9ca0000000000000000000000000000000000000000000000000000000081526004810191909152610a7b917f0000000000000000000000000000000000000000000000000000000000000000169063dc17c9ca90602401602060405180830381865afa158015610a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a759190613891565b82611d69565b8173ffffffffffffffffffffffffffffffffffffffff167f1d3f9fc0810d9e182e982399cb91de735f6c415728fb9bc42664b84087c2af568260405161096f91815260200190565b610acb611ec8565b610ad56000611f49565b565b610adf611ec8565b6101908161ffff161115610b1f576040517f70b5774c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526008602052604090205462010000900467ffffffffffffffff1615610b8c576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff861690811790915591519182527f7dfd3ecb8ac83242184c019f85ca408558f2ac0a5a19af6be2a4aee697eac812910161096f565b610c19611ec8565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff851690811790915560038390556005829055604080519182526020820184905281018290527fdb0c33bbe22ccb7d7c379a53ef932b131d6fb1b3bd0a7cfe7247d9513ba2a22a9060600160405180910390a1505050565b610ca1611ec8565b60005474010000000000000000000000000000000000000000900460ff1615610ccc57610ad5611fbe565b610ad561203b565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610d42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6691906138c8565b50505091505060008113610da9576040517f43d4cf66000000000000000000000000000000000000000000000000000000008152600481018290526024016107a0565b60048054604080517f5fbbc0d2000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff90931692635fbbc0d292808201926101209290918290030181865afa158015610e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3f919061392b565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610e6a9190613a10565b610e749190613a10565b610e7e9190613a56565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260086020526040902054610ec5906a0100000000000000000000900463ffffffff166201c138613a6a565b610ed59063ffffffff163a613a10565b610edf9190613a87565b949350505050565b60608167ffffffffffffffff811115610f0257610f026133b1565b604051908082528060200260200182016040528015610f3557816020015b6060815260200190600190039081610f205790505b50905060005b82811015610fd557610fa530858584818110610f5957610f59613a9a565b9050602002810190610f6b9190613ac9565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506120aa92505050565b828281518110610fb757610fb7613a9a565b60200260200101819052508080610fcd90613b35565b915050610f3b565b505b92915050565b60606000610feb84846120cf565b90506000815167ffffffffffffffff811115611009576110096133b1565b60405190808252806020026020018201604052801561109c57816020015b60408051610140810182526000818301818152606083018290526080830182905260a0830182905260c0830182905260e0830182905261010083018290526101208301829052825282518084019093528083526020808401919091528101919091528152602001906001900390816110275790505b50905060005b82518110156111625760405180604001604052808483815181106110c8576110c8613a9a565b60200260200101518152602001600a60008685815181106110eb576110eb613a9a565b60209081029190910181015160600151825281810192909252604090810160002081518083019092525460ff80821615158352610100909104161515918101919091529052825183908390811061114457611144613a9a565b6020026020010181905250808061115a90613b35565b9150506110a2565b50949350505050565b6000818152600660205260409020805460ff1615156001148061119057506002810154155b156111c7576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60048101546111df9063ffffffff1662015180613a6a565b63ffffffff1642101561121e576040517f07bc6c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181015473ffffffffffffffffffffffffffffffffffffffff166000908152600860205260409020805462010000900467ffffffffffffffff1681600261126583613b6d565b825467ffffffffffffffff9182166101009390930a92830291909202199091161790555081547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811783556003830154600584015560068301549083015473ffffffffffffffffffffffffffffffffffffffff1661131d578254600384015461131891610100900473ffffffffffffffffffffffffffffffffffffffff1690611313908490613a87565b61231a565b61137c565b8254600384015460018501546113559273ffffffffffffffffffffffffffffffffffffffff918216926101009091049091169061252d565b825461137c90610100900473ffffffffffffffffffffffffffffffffffffffff168261231a565b825460038401546040805187815261010090930473ffffffffffffffffffffffffffffffffffffffff166020840152820152606081018290527fe282fd838bb937af0c0f54e49ba5f86229ed0c90344c3cc4e2135cb673493e699060800160405180910390a150505050565b6113f0611ec8565b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a010000000000000000000063ffffffff87169081029190911790915591519182527f9edb52532d26512950c91a14b132f6df3cd06bfb49e795e03e56736121cd24a8910161096f565b61148f611ec8565b73ffffffffffffffffffffffffffffffffffffffff8116611532576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107a0565b61153b81611f49565b50565b60005a6000848152600a6020908152604080832060069092528220855193945090929091906002908690839061157657611576613a9a565b60200260200101516115889190613baf565b835461010060018314027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff82168117865591925060009161160c91859160ff90811691161780156115d95750836001145b806115ef5750855460ff161580156115ef575083155b6115fa576000612601565b6116078560030154611736565b612601565b6001840154845460028601546003870154885460408051938452602084019290925260ff80821615158484015261010091829004161515606084015260808301869052905194955073ffffffffffffffffffffffffffffffffffffffff938416949204909216917f4a6c40516242d2bc8453081e1746087d26dc596dcc95d61f76381accb7469939919081900360a00190a36116a88386612bb8565b50505050505050565b60005474010000000000000000000000000000000000000000900460ff1615610ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107a0565b6000610fd7826002613a10565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915261178c6116b1565b611794612e7c565b6040517ff2e0afbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152602482018490526000918291829182917f0000000000000000000000000000000000000000000000000000000000000000169063f2e0afbb90604401608060405180830381865afa158015611830573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118549190613bc3565b73ffffffffffffffffffffffffffffffffffffffff8c166000908152600860205260409020939750919550935091508415806118935750805461ffff16155b156118ca576040517fc455905500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff8a16156118ee57346118f8565b6118f88934613c18565b905060006119058b610cd4565b9050606461191482600a613a10565b61191e9190613a56565b6119289082613c18565b821015611961576040517f0b56cefe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b508389101561199f576040517f022558f4000000000000000000000000000000000000000000000000000000008152600481018590526024016107a0565b828911156119d95773ffffffffffffffffffffffffffffffffffffffff8a166119d5576119d5336119d0858c613c18565b611d69565b8298505b6004805460035460025485546040517f5d3b1d300000000000000000000000000000000000000000000000000000000081529485019290925267ffffffffffffffff8916602485015261ffff80821660448601526a010000000000000000000090920463ffffffff16606485015262010000900416608483015260009173ffffffffffffffffffffffffffffffffffffffff90911690635d3b1d309060a4016020604051808303816000875af1158015611a97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611abb9190613c2b565b905060006040518061010001604052806000151581526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018c81526020014263ffffffff16815260200160008152602001848152509050600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055806006600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600201556080820151816003015560a08201518160040160006101000a81548163ffffffff021916908363ffffffff16021790555060c0820151816005015560e0820151816006015590505083600001600281819054906101000a900467ffffffffffffffff1680929190611cd390613c44565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050600073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff1614611d5057611d5073ffffffffffffffffffffffffffffffffffffffff8d1633308e612eef565b975050505050505050611d6260018055565b9392505050565b80471015611dd3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016107a0565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114611e2d576040519150601f19603f3d011682016040523d82523d6000602084013e611e32565b606091505b5050905080611ec3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016107a0565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a0565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611fc6612f4d565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b6120436116b1565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586120113390565b6060611d628383604051806060016040528060278152602001613ced60279139612fd1565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260076020908152604080832080548251818502810185019093528083526060949383018282801561213b57602002820191906000526020600020905b815481526020019060010190808311612127575b5050835193945050505083811015612151578093505b60008467ffffffffffffffff81111561216c5761216c6133b1565b6040519080825280602002602001820160405280156121f957816020015b604080516101008101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90920191018161218a5790505b5090508415612311576000825b6122108785613c18565b81111561230e576006600086612227600185613c18565b8151811061223757612237613a9a565b602090810291909101810151825281810192909252604090810160002081516101008082018452825460ff8116151583520473ffffffffffffffffffffffffffffffffffffffff908116948201949094526001820154909316918301919091526002810154606083015260038101546080830152600481015463ffffffff1660a0830152600581015460c08301526006015460e082015283518490849081106122e2576122e2613a9a565b602002602001018190525081806122f890613b35565b925050808061230690613c6b565b915050612206565b50505b95945050505050565b80471015612384576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016107a0565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146123de576040519150601f19603f3d011682016040523d82523d6000602084013e6123e3565b606091505b5050905080611ec3577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561245457600080fd5b505af1158015612468573d6000803e3d6000fd5b50506040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790527f000000000000000000000000000000000000000000000000000000000000000016935063a9059cbb925060440190506020604051808303816000875af1158015612503573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125279190613ca0565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611ec39084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613056565b815460009060ff1615156001148061261b57506002830154155b15612652576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117845583015473ffffffffffffffffffffffffffffffffffffffff166000818152600860205260409020805467ffffffffffffffff62010000909104169060026126c383613b6d565b825467ffffffffffffffff9182166101009390930a9283029190920219909116179055506003840154600185015473ffffffffffffffffffffffffffffffffffffffff1615818511156128ed578554610100900473ffffffffffffffffffffffffffffffffffffffff1660006127398488613c18565b905060006127478686613162565b905060006127558784613162565b905060006127638284613a87565b905061276f818b613c18565b9950600061277d8489613c18565b9050600061278b8487613c18565b905087156127a25761279d8783611d69565b612804565b6127c373ffffffffffffffffffffffffffffffffffffffff8b16888461252d565b61280473ffffffffffffffffffffffffffffffffffffffff8b167f00000000000000000000000000000000000000000000000000000000000000008761252d565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631f6150238961284c57600061284e565b865b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff808c1660048301528e16602482015260448101859052606481018790526084016000604051808303818588803b1580156128c857600080fd5b505af11580156128dc573d6000803e3d6000fd5b505050505050505050505050612ba8565b8415612a8c578554610100900473ffffffffffffffffffffffffffffffffffffffff16600061291c8588613162565b90506129288188613c18565b965060006129368886613c18565b9050831561294d576129488389611d69565b6129af565b61296e73ffffffffffffffffffffffffffffffffffffffff8716848a61252d565b6129af73ffffffffffffffffffffffffffffffffffffffff87167f00000000000000000000000000000000000000000000000000000000000000008361252d565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d41b8c6f856129f75760006129f9565b825b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff8a16600482015260248101859052604481018690526064016000604051808303818588803b158015612a6b57600080fd5b505af1158015612a7f573d6000803e3d6000fd5b5050505050505050612ba8565b80612ad257612ad273ffffffffffffffffffffffffffffffffffffffff84167f00000000000000000000000000000000000000000000000000000000000000008461252d565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d41b8c6f82612b1a576000612b1c565b835b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff8716600482015260248101869052600060448201526064016000604051808303818588803b158015612b8e57600080fd5b505af1158015612ba2573d6000803e3d6000fd5b50505050505b5050505060059190910181905590565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015612c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c4991906138c8565b5050509150506000811215612c5c575060005b60048054604080517f5fbbc0d2000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff90931692635fbbc0d292808201926101209290918290030181865afa158015612cce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf2919061392b565b505050505050505090506000670de0b6b3a7640000838363ffffffff1664e8d4a51000612d1f9190613a10565b612d299190613a10565b612d339190613a56565b90506000816002600301545a612d499088613c18565b612d539190613a87565b612d5d903a613a10565b612d679190613a87565b90508560060154811115612d8057506006850154612e32565b6000818760060154612d929190613c18565b8754610100900473ffffffffffffffffffffffffffffffffffffffff16600090815260096020526040812080549293508392909190612dd2908490613a87565b909155505060068701829055865460405182815261010090910473ffffffffffffffffffffffffffffffffffffffff16907fab2ddf26d0afffee84a37c11fdb1fe69dc5c541f00f62051ec706e71871638c89060200160405180910390a2505b60018087015473ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604081209091018054839290612e6f908490613a87565b9091555050505050505050565b600260015403612ee8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107a0565b6002600155565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526125279085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161257f565b60005474010000000000000000000000000000000000000000900460ff16610ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016107a0565b60606000808573ffffffffffffffffffffffffffffffffffffffff1685604051612ffb9190613cbd565b600060405180830381855af49150503d8060008114613036576040519150601f19603f3d011682016040523d82523d6000602084013e61303b565b606091505b509150915061304c868383876131a5565b9695505050505050565b60006130b8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166132459092919063ffffffff16565b805190915015611ec357808060200190518101906130d69190613ca0565b611ec3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107a0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600860205260408120546127109061319b90849061ffff16613a10565b611d629190613a56565b6060831561323b5782516000036132345773ffffffffffffffffffffffffffffffffffffffff85163b613234576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107a0565b5081610edf565b610edf8383613254565b6060610edf8484600085613298565b8151156132645781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a09190613cd9565b60608247101561332a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107a0565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133539190613cbd565b60006040518083038185875af1925050503d8060008114613390576040519150601f19603f3d011682016040523d82523d6000602084013e613395565b606091505b50915091506133a6878383876131a5565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156133f357600080fd5b8235915060208084013567ffffffffffffffff8082111561341357600080fd5b818601915086601f83011261342757600080fd5b813581811115613439576134396133b1565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f8301168101818110858211171561347c5761347c6133b1565b60405291825284820192508381018501918983111561349a57600080fd5b938501935b828510156134b85784358452938501939285019261349f565b8096505050505050509250929050565b6000602082840312156134da57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461153b57600080fd5b60006020828403121561351557600080fd5b8135611d62816134e1565b801515811461153b57600080fd5b60008060006060848603121561354357600080fd5b833561354e81613520565b9250602084013561355e816134e1565b929592945050506040919091013590565b803561ffff8116811461358157600080fd5b919050565b6000806040838503121561359957600080fd5b82356135a4816134e1565b91506135b26020840161356f565b90509250929050565b6000806000606084860312156135d057600080fd5b6135d98461356f565b95602085013595506040909401359392505050565b6000806020838503121561360157600080fd5b823567ffffffffffffffff8082111561361957600080fd5b818501915085601f83011261362d57600080fd5b81358181111561363c57600080fd5b8660208260051b850101111561365157600080fd5b60209290920196919550909350505050565b60005b8381101561367e578181015183820152602001613666565b50506000910152565b6000815180845261369f816020860160208601613663565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613744577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613732858351613687565b945092850192908501906001016136f8565b5092979650505050505050565b6000806040838503121561376457600080fd5b823561376f816134e1565b946020939093013593505050565b602080825282518282018190526000919060409081850190868401855b8281101561383957815180518051151586528781015173ffffffffffffffffffffffffffffffffffffffff90811689880152878201511687870152606080820151908701526080808201519087015260a08082015163ffffffff169087015260c0808201519087015260e0908101519086015286015180511515610100860152602001511515610120850152610140909301929085019060010161379a565b5091979650505050505050565b63ffffffff8116811461153b57600080fd5b6000806040838503121561386b57600080fd5b8235613876816134e1565b9150602083013561388681613846565b809150509250929050565b6000602082840312156138a357600080fd5b8151611d62816134e1565b805169ffffffffffffffffffff8116811461358157600080fd5b600080600080600060a086880312156138e057600080fd5b6138e9866138ae565b945060208601519350604086015192506060860151915061390c608087016138ae565b90509295509295909350565b805162ffffff8116811461358157600080fd5b60008060008060008060008060006101208a8c03121561394a57600080fd5b895161395581613846565b60208b015190995061396681613846565b60408b015190985061397781613846565b60608b015190975061398881613846565b60808b015190965061399981613846565b94506139a760a08b01613918565b93506139b560c08b01613918565b92506139c360e08b01613918565b91506139d26101008b01613918565b90509295985092959850929598565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417610fd757610fd76139e1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613a6557613a65613a27565b500490565b63ffffffff818116838216019080821115610fd557610fd56139e1565b80820180821115610fd757610fd76139e1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613afe57600080fd5b83018035915067ffffffffffffffff821115613b1957600080fd5b602001915036819003821315613b2e57600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613b6657613b666139e1565b5060010190565b600067ffffffffffffffff821680613b8757613b876139e1565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b600082613bbe57613bbe613a27565b500690565b60008060008060808587031215613bd957600080fd5b8451613be481613520565b602086015190945067ffffffffffffffff81168114613c0257600080fd5b6040860151606090960151949790965092505050565b81810381811115610fd757610fd76139e1565b600060208284031215613c3d57600080fd5b5051919050565b600067ffffffffffffffff808316818103613c6157613c616139e1565b6001019392505050565b600081613c7a57613c7a6139e1565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b600060208284031215613cb257600080fd5b8151611d6281613520565b60008251613ccf818460208701613663565b9190910192915050565b602081526000611d62602083018461368756fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122010269bfef26d49360a3698cdfbd5d8b84a45500d48695f850826ce702c405b2464736f6c6343000811003300000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a55449000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff634000000000000000000000000b7c8fb1db45007f98a68da0588e1aa524c317f2700000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1
Deployed Bytecode
0x60806040526004361061018b5760003560e01c80637d0807d7116100d6578063c2fb579f1161007f578063e32fe50411610059578063e32fe5041461061d578063e48603391461063d578063f2fde38b146106d757600080fd5b8063c2fb579f14610580578063e051ece9146105ad578063e1fdb4b4146105fd57600080fd5b80638da5cb5b116100b05780638da5cb5b14610508578063982c3fdd14610533578063ac9650d81461055357600080fd5b80637d0807d71461047a57806382b0c00b146104d35780638456cb59146104f357600080fd5b80635c975abb11610138578063715018a611610112578063715018a61461041157806376cdb03b1461042657806378bcde221461045a57600080fd5b80635c975abb146103a15780637038942f146103d1578063707cd55e146103f157600080fd5b806350462ea01161016957806350462ea0146102d057806350e70d48146102e3578063594043fd1461033c57600080fd5b80631fe543e31461019057806322af00fa146101b2578063277d35af14610295575b600080fd5b34801561019c57600080fd5b506101b06101ab3660046133e0565b6106f7565b005b3480156101be57600080fd5b506102346101cd3660046134c8565b6006602081905260009182526040909120805460018201546002830154600384015460048501546005860154959096015460ff85169661010090950473ffffffffffffffffffffffffffffffffffffffff908116969416949293919263ffffffff16919088565b60408051981515895273ffffffffffffffffffffffffffffffffffffffff97881660208a015295909616948701949094526060860192909252608085015263ffffffff1660a084015260c083015260e0820152610100015b60405180910390f35b3480156102a157600080fd5b506102c26102b0366004613503565b60096020526000908152604090205481565b60405190815260200161028c565b6101b06102de36600461352e565b6107b7565b3480156102ef57600080fd5b506103177f00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab181565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161028c565b34801561034857600080fd5b50610391610357366004613503565b73ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604090205462010000900467ffffffffffffffff16151590565b604051901515815260200161028c565b3480156103ad57600080fd5b5060005474010000000000000000000000000000000000000000900460ff16610391565b3480156103dd57600080fd5b506101b06103ec366004613503565b610897565b3480156103fd57600080fd5b506101b061040c366004613503565b61097b565b34801561041d57600080fd5b506101b0610ac3565b34801561043257600080fd5b506103177f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a5544981565b34801561046657600080fd5b506101b0610475366004613586565b610ad7565b34801561048657600080fd5b506002546003546004546005546040805161ffff9095168552602085019390935273ffffffffffffffffffffffffffffffffffffffff90911691830191909152606082015260800161028c565b3480156104df57600080fd5b506101b06104ee3660046135bb565b610c11565b3480156104ff57600080fd5b506101b0610c99565b34801561051457600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610317565b34801561053f57600080fd5b506102c261054e366004613503565b610cd4565b34801561055f57600080fd5b5061057361056e3660046135ee565b610ee7565b60405161028c91906136d1565b34801561058c57600080fd5b506105a061059b366004613751565b610fdd565b60405161028c919061377d565b3480156105b957600080fd5b506105e66105c83660046134c8565b600a6020526000908152604090205460ff8082169161010090041682565b60408051921515835290151560208301520161028c565b34801561060957600080fd5b506101b06106183660046134c8565b61116b565b34801561062957600080fd5b506101b0610638366004613858565b6113e8565b34801561064957600080fd5b5061069e610658366004613503565b6008602052600090815260409020805460019091015461ffff82169162010000810467ffffffffffffffff16916a010000000000000000000090910463ffffffff169084565b6040805161ffff909516855267ffffffffffffffff909316602085015263ffffffff90911691830191909152606082015260800161028c565b3480156106e357600080fd5b506101b06106f2366004613503565b611487565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff63416146107a9576040517f1cf993f400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff6341660248201526044015b60405180910390fd5b6107b3828261153e565b5050565b6107bf6116b1565b60006107d683836107d1612710611736565b611743565b606081810180516000908152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168a15159081179091558286015182870151945160808089015160e08a0151875193845295830152948101939093529482015293945073ffffffffffffffffffffffffffffffffffffffff9283169392909116917fa056e15b055f378463e53b317d9503bc9aba54ace23957ea9ff7fbfa0bf2efc0910160405180910390a350505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260096020526040812054908190036108f7576040517f8ab4c5d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600960205260408120556109278282611d69565b8173ffffffffffffffffffffffffffffffffffffffff167f3f206d449945dd03c1742ee98a9c5b872ac6c165788363e06af2796dd5de1f548260405161096f91815260200190565b60405180910390a25050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526008602052604090206001015480156107b35773ffffffffffffffffffffffffffffffffffffffff82811660008181526008602052604080822060010191909155517fdc17c9ca0000000000000000000000000000000000000000000000000000000081526004810191909152610a7b917f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a55449169063dc17c9ca90602401602060405180830381865afa158015610a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a759190613891565b82611d69565b8173ffffffffffffffffffffffffffffffffffffffff167f1d3f9fc0810d9e182e982399cb91de735f6c415728fb9bc42664b84087c2af568260405161096f91815260200190565b610acb611ec8565b610ad56000611f49565b565b610adf611ec8565b6101908161ffff161115610b1f576040517f70b5774c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526008602052604090205462010000900467ffffffffffffffff1615610b8c576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff861690811790915591519182527f7dfd3ecb8ac83242184c019f85ca408558f2ac0a5a19af6be2a4aee697eac812910161096f565b610c19611ec8565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff851690811790915560038390556005829055604080519182526020820184905281018290527fdb0c33bbe22ccb7d7c379a53ef932b131d6fb1b3bd0a7cfe7247d9513ba2a22a9060600160405180910390a1505050565b610ca1611ec8565b60005474010000000000000000000000000000000000000000900460ff1615610ccc57610ad5611fbe565b610ad561203b565b6000807f000000000000000000000000b7c8fb1db45007f98a68da0588e1aa524c317f2773ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610d42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6691906138c8565b50505091505060008113610da9576040517f43d4cf66000000000000000000000000000000000000000000000000000000008152600481018290526024016107a0565b60048054604080517f5fbbc0d2000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff90931692635fbbc0d292808201926101209290918290030181865afa158015610e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3f919061392b565b50505050505050509050670de0b6b3a7640000828263ffffffff1664e8d4a51000610e6a9190613a10565b610e749190613a10565b610e7e9190613a56565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260086020526040902054610ec5906a0100000000000000000000900463ffffffff166201c138613a6a565b610ed59063ffffffff163a613a10565b610edf9190613a87565b949350505050565b60608167ffffffffffffffff811115610f0257610f026133b1565b604051908082528060200260200182016040528015610f3557816020015b6060815260200190600190039081610f205790505b50905060005b82811015610fd557610fa530858584818110610f5957610f59613a9a565b9050602002810190610f6b9190613ac9565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506120aa92505050565b828281518110610fb757610fb7613a9a565b60200260200101819052508080610fcd90613b35565b915050610f3b565b505b92915050565b60606000610feb84846120cf565b90506000815167ffffffffffffffff811115611009576110096133b1565b60405190808252806020026020018201604052801561109c57816020015b60408051610140810182526000818301818152606083018290526080830182905260a0830182905260c0830182905260e0830182905261010083018290526101208301829052825282518084019093528083526020808401919091528101919091528152602001906001900390816110275790505b50905060005b82518110156111625760405180604001604052808483815181106110c8576110c8613a9a565b60200260200101518152602001600a60008685815181106110eb576110eb613a9a565b60209081029190910181015160600151825281810192909252604090810160002081518083019092525460ff80821615158352610100909104161515918101919091529052825183908390811061114457611144613a9a565b6020026020010181905250808061115a90613b35565b9150506110a2565b50949350505050565b6000818152600660205260409020805460ff1615156001148061119057506002810154155b156111c7576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60048101546111df9063ffffffff1662015180613a6a565b63ffffffff1642101561121e576040517f07bc6c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181015473ffffffffffffffffffffffffffffffffffffffff166000908152600860205260409020805462010000900467ffffffffffffffff1681600261126583613b6d565b825467ffffffffffffffff9182166101009390930a92830291909202199091161790555081547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811783556003830154600584015560068301549083015473ffffffffffffffffffffffffffffffffffffffff1661131d578254600384015461131891610100900473ffffffffffffffffffffffffffffffffffffffff1690611313908490613a87565b61231a565b61137c565b8254600384015460018501546113559273ffffffffffffffffffffffffffffffffffffffff918216926101009091049091169061252d565b825461137c90610100900473ffffffffffffffffffffffffffffffffffffffff168261231a565b825460038401546040805187815261010090930473ffffffffffffffffffffffffffffffffffffffff166020840152820152606081018290527fe282fd838bb937af0c0f54e49ba5f86229ed0c90344c3cc4e2135cb673493e699060800160405180910390a150505050565b6113f0611ec8565b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a010000000000000000000063ffffffff87169081029190911790915591519182527f9edb52532d26512950c91a14b132f6df3cd06bfb49e795e03e56736121cd24a8910161096f565b61148f611ec8565b73ffffffffffffffffffffffffffffffffffffffff8116611532576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107a0565b61153b81611f49565b50565b60005a6000848152600a6020908152604080832060069092528220855193945090929091906002908690839061157657611576613a9a565b60200260200101516115889190613baf565b835461010060018314027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff82168117865591925060009161160c91859160ff90811691161780156115d95750836001145b806115ef5750855460ff161580156115ef575083155b6115fa576000612601565b6116078560030154611736565b612601565b6001840154845460028601546003870154885460408051938452602084019290925260ff80821615158484015261010091829004161515606084015260808301869052905194955073ffffffffffffffffffffffffffffffffffffffff938416949204909216917f4a6c40516242d2bc8453081e1746087d26dc596dcc95d61f76381accb7469939919081900360a00190a36116a88386612bb8565b50505050505050565b60005474010000000000000000000000000000000000000000900460ff1615610ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107a0565b6000610fd7826002613a10565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915261178c6116b1565b611794612e7c565b6040517ff2e0afbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152602482018490526000918291829182917f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a55449169063f2e0afbb90604401608060405180830381865afa158015611830573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118549190613bc3565b73ffffffffffffffffffffffffffffffffffffffff8c166000908152600860205260409020939750919550935091508415806118935750805461ffff16155b156118ca576040517fc455905500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff8a16156118ee57346118f8565b6118f88934613c18565b905060006119058b610cd4565b9050606461191482600a613a10565b61191e9190613a56565b6119289082613c18565b821015611961576040517f0b56cefe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b508389101561199f576040517f022558f4000000000000000000000000000000000000000000000000000000008152600481018590526024016107a0565b828911156119d95773ffffffffffffffffffffffffffffffffffffffff8a166119d5576119d5336119d0858c613c18565b611d69565b8298505b6004805460035460025485546040517f5d3b1d300000000000000000000000000000000000000000000000000000000081529485019290925267ffffffffffffffff8916602485015261ffff80821660448601526a010000000000000000000090920463ffffffff16606485015262010000900416608483015260009173ffffffffffffffffffffffffffffffffffffffff90911690635d3b1d309060a4016020604051808303816000875af1158015611a97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611abb9190613c2b565b905060006040518061010001604052806000151581526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018c81526020014263ffffffff16815260200160008152602001848152509050600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020829080600181540180825580915050600190039060005260206000200160009091909190915055806006600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600201556080820151816003015560a08201518160040160006101000a81548163ffffffff021916908363ffffffff16021790555060c0820151816005015560e0820151816006015590505083600001600281819054906101000a900467ffffffffffffffff1680929190611cd390613c44565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050600073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff1614611d5057611d5073ffffffffffffffffffffffffffffffffffffffff8d1633308e612eef565b975050505050505050611d6260018055565b9392505050565b80471015611dd3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016107a0565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114611e2d576040519150601f19603f3d011682016040523d82523d6000602084013e611e32565b606091505b5050905080611ec3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016107a0565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a0565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611fc6612f4d565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b6120436116b1565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586120113390565b6060611d628383604051806060016040528060278152602001613ced60279139612fd1565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260076020908152604080832080548251818502810185019093528083526060949383018282801561213b57602002820191906000526020600020905b815481526020019060010190808311612127575b5050835193945050505083811015612151578093505b60008467ffffffffffffffff81111561216c5761216c6133b1565b6040519080825280602002602001820160405280156121f957816020015b604080516101008101825260008082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e082015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90920191018161218a5790505b5090508415612311576000825b6122108785613c18565b81111561230e576006600086612227600185613c18565b8151811061223757612237613a9a565b602090810291909101810151825281810192909252604090810160002081516101008082018452825460ff8116151583520473ffffffffffffffffffffffffffffffffffffffff908116948201949094526001820154909316918301919091526002810154606083015260038101546080830152600481015463ffffffff1660a0830152600581015460c08301526006015460e082015283518490849081106122e2576122e2613a9a565b602002602001018190525081806122f890613b35565b925050808061230690613c6b565b915050612206565b50505b95945050505050565b80471015612384576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016107a0565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146123de576040519150601f19603f3d011682016040523d82523d6000602084013e6123e3565b606091505b5050905080611ec3577f00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab173ffffffffffffffffffffffffffffffffffffffff1663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561245457600080fd5b505af1158015612468573d6000803e3d6000fd5b50506040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790527f00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab116935063a9059cbb925060440190506020604051808303816000875af1158015612503573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125279190613ca0565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611ec39084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613056565b815460009060ff1615156001148061261b57506002830154155b15612652576040517f21abe57a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117845583015473ffffffffffffffffffffffffffffffffffffffff166000818152600860205260409020805467ffffffffffffffff62010000909104169060026126c383613b6d565b825467ffffffffffffffff9182166101009390930a9283029190920219909116179055506003840154600185015473ffffffffffffffffffffffffffffffffffffffff1615818511156128ed578554610100900473ffffffffffffffffffffffffffffffffffffffff1660006127398488613c18565b905060006127478686613162565b905060006127558784613162565b905060006127638284613a87565b905061276f818b613c18565b9950600061277d8489613c18565b9050600061278b8487613c18565b905087156127a25761279d8783611d69565b612804565b6127c373ffffffffffffffffffffffffffffffffffffffff8b16888461252d565b61280473ffffffffffffffffffffffffffffffffffffffff8b167f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a554498761252d565b7f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a5544973ffffffffffffffffffffffffffffffffffffffff16631f6150238961284c57600061284e565b865b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff808c1660048301528e16602482015260448101859052606481018790526084016000604051808303818588803b1580156128c857600080fd5b505af11580156128dc573d6000803e3d6000fd5b505050505050505050505050612ba8565b8415612a8c578554610100900473ffffffffffffffffffffffffffffffffffffffff16600061291c8588613162565b90506129288188613c18565b965060006129368886613c18565b9050831561294d576129488389611d69565b6129af565b61296e73ffffffffffffffffffffffffffffffffffffffff8716848a61252d565b6129af73ffffffffffffffffffffffffffffffffffffffff87167f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a554498361252d565b7f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a5544973ffffffffffffffffffffffffffffffffffffffff1663d41b8c6f856129f75760006129f9565b825b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff8a16600482015260248101859052604481018690526064016000604051808303818588803b158015612a6b57600080fd5b505af1158015612a7f573d6000803e3d6000fd5b5050505050505050612ba8565b80612ad257612ad273ffffffffffffffffffffffffffffffffffffffff84167f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a554498461252d565b7f00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a5544973ffffffffffffffffffffffffffffffffffffffff1663d41b8c6f82612b1a576000612b1c565b835b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff8716600482015260248101869052600060448201526064016000604051808303818588803b158015612b8e57600080fd5b505af1158015612ba2573d6000803e3d6000fd5b50505050505b5050505060059190910181905590565b60007f000000000000000000000000b7c8fb1db45007f98a68da0588e1aa524c317f2773ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015612c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c4991906138c8565b5050509150506000811215612c5c575060005b60048054604080517f5fbbc0d2000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff90931692635fbbc0d292808201926101209290918290030181865afa158015612cce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf2919061392b565b505050505050505090506000670de0b6b3a7640000838363ffffffff1664e8d4a51000612d1f9190613a10565b612d299190613a10565b612d339190613a56565b90506000816002600301545a612d499088613c18565b612d539190613a87565b612d5d903a613a10565b612d679190613a87565b90508560060154811115612d8057506006850154612e32565b6000818760060154612d929190613c18565b8754610100900473ffffffffffffffffffffffffffffffffffffffff16600090815260096020526040812080549293508392909190612dd2908490613a87565b909155505060068701829055865460405182815261010090910473ffffffffffffffffffffffffffffffffffffffff16907fab2ddf26d0afffee84a37c11fdb1fe69dc5c541f00f62051ec706e71871638c89060200160405180910390a2505b60018087015473ffffffffffffffffffffffffffffffffffffffff1660009081526008602052604081209091018054839290612e6f908490613a87565b9091555050505050505050565b600260015403612ee8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107a0565b6002600155565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526125279085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161257f565b60005474010000000000000000000000000000000000000000900460ff16610ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016107a0565b60606000808573ffffffffffffffffffffffffffffffffffffffff1685604051612ffb9190613cbd565b600060405180830381855af49150503d8060008114613036576040519150601f19603f3d011682016040523d82523d6000602084013e61303b565b606091505b509150915061304c868383876131a5565b9695505050505050565b60006130b8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166132459092919063ffffffff16565b805190915015611ec357808060200190518101906130d69190613ca0565b611ec3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107a0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600860205260408120546127109061319b90849061ffff16613a10565b611d629190613a56565b6060831561323b5782516000036132345773ffffffffffffffffffffffffffffffffffffffff85163b613234576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107a0565b5081610edf565b610edf8383613254565b6060610edf8484600085613298565b8151156132645781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a09190613cd9565b60608247101561332a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107a0565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133539190613cbd565b60006040518083038185875af1925050503d8060008114613390576040519150601f19603f3d011682016040523d82523d6000602084013e613395565b606091505b50915091506133a6878383876131a5565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156133f357600080fd5b8235915060208084013567ffffffffffffffff8082111561341357600080fd5b818601915086601f83011261342757600080fd5b813581811115613439576134396133b1565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f8301168101818110858211171561347c5761347c6133b1565b60405291825284820192508381018501918983111561349a57600080fd5b938501935b828510156134b85784358452938501939285019261349f565b8096505050505050509250929050565b6000602082840312156134da57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461153b57600080fd5b60006020828403121561351557600080fd5b8135611d62816134e1565b801515811461153b57600080fd5b60008060006060848603121561354357600080fd5b833561354e81613520565b9250602084013561355e816134e1565b929592945050506040919091013590565b803561ffff8116811461358157600080fd5b919050565b6000806040838503121561359957600080fd5b82356135a4816134e1565b91506135b26020840161356f565b90509250929050565b6000806000606084860312156135d057600080fd5b6135d98461356f565b95602085013595506040909401359392505050565b6000806020838503121561360157600080fd5b823567ffffffffffffffff8082111561361957600080fd5b818501915085601f83011261362d57600080fd5b81358181111561363c57600080fd5b8660208260051b850101111561365157600080fd5b60209290920196919550909350505050565b60005b8381101561367e578181015183820152602001613666565b50506000910152565b6000815180845261369f816020860160208601613663565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613744577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452613732858351613687565b945092850192908501906001016136f8565b5092979650505050505050565b6000806040838503121561376457600080fd5b823561376f816134e1565b946020939093013593505050565b602080825282518282018190526000919060409081850190868401855b8281101561383957815180518051151586528781015173ffffffffffffffffffffffffffffffffffffffff90811689880152878201511687870152606080820151908701526080808201519087015260a08082015163ffffffff169087015260c0808201519087015260e0908101519086015286015180511515610100860152602001511515610120850152610140909301929085019060010161379a565b5091979650505050505050565b63ffffffff8116811461153b57600080fd5b6000806040838503121561386b57600080fd5b8235613876816134e1565b9150602083013561388681613846565b809150509250929050565b6000602082840312156138a357600080fd5b8151611d62816134e1565b805169ffffffffffffffffffff8116811461358157600080fd5b600080600080600060a086880312156138e057600080fd5b6138e9866138ae565b945060208601519350604086015192506060860151915061390c608087016138ae565b90509295509295909350565b805162ffffff8116811461358157600080fd5b60008060008060008060008060006101208a8c03121561394a57600080fd5b895161395581613846565b60208b015190995061396681613846565b60408b015190985061397781613846565b60608b015190975061398881613846565b60808b015190965061399981613846565b94506139a760a08b01613918565b93506139b560c08b01613918565b92506139c360e08b01613918565b91506139d26101008b01613918565b90509295985092959850929598565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417610fd757610fd76139e1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082613a6557613a65613a27565b500490565b63ffffffff818116838216019080821115610fd557610fd56139e1565b80820180821115610fd757610fd76139e1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613afe57600080fd5b83018035915067ffffffffffffffff821115613b1957600080fd5b602001915036819003821315613b2e57600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613b6657613b666139e1565b5060010190565b600067ffffffffffffffff821680613b8757613b876139e1565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b600082613bbe57613bbe613a27565b500690565b60008060008060808587031215613bd957600080fd5b8451613be481613520565b602086015190945067ffffffffffffffff81168114613c0257600080fd5b6040860151606090960151949790965092505050565b81810381811115610fd757610fd76139e1565b600060208284031215613c3d57600080fd5b5051919050565b600067ffffffffffffffff808316818103613c6157613c616139e1565b6001019392505050565b600081613c7a57613c7a6139e1565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b600060208284031215613cb257600080fd5b8151611d6281613520565b60008251613ccf818460208701613663565b9190910192915050565b602081526000611d62602083018461368756fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122010269bfef26d49360a3698cdfbd5d8b84a45500d48695f850826ce702c405b2464736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a55449000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff634000000000000000000000000b7c8fb1db45007f98a68da0588e1aa524c317f2700000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1
-----Decoded View---------------
Arg [0] : bankAddress (address): 0x61523749e6fb1ef538F2d57Db13A62ad33a55449
Arg [1] : chainlinkCoordinatorAddress (address): 0xd5D517aBE5cF79B7e95eC98dB0f0277788aFF634
Arg [2] : LINK_ETH_feedAddress (address): 0xb7c8Fb1dB45007F98A68Da0588e1AA524C317f27
Arg [3] : wrappedGasToken (address): 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000061523749e6fb1ef538f2d57db13a62ad33a55449
Arg [1] : 000000000000000000000000d5d517abe5cf79b7e95ec98db0f0277788aff634
Arg [2] : 000000000000000000000000b7c8fb1db45007f98a68da0588e1aa524c317f27
Arg [3] : 00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$184.31
Net Worth in ETH
0.064318
Token Allocations
ETH
99.46%
FUSDC
0.45%
ARB
0.09%
Multichain Portfolio | 35 Chains
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.