Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Latest 25 from a total of 13,175 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Start Spin | 421780259 | 21 days ago | IN | 0 ETH | 0.00000463 | ||||
| Start Spin | 421765664 | 21 days ago | IN | 0 ETH | 0.00000447 | ||||
| Start Spin | 421761071 | 21 days ago | IN | 0 ETH | 0.00000519 | ||||
| Start Spin | 421760848 | 21 days ago | IN | 0 ETH | 0.00000451 | ||||
| Emergency Withdr... | 421760084 | 21 days ago | IN | 0 ETH | 0.00000081 | ||||
| Start Spin | 421758386 | 21 days ago | IN | 0 ETH | 0.00001642 | ||||
| Start Spin | 421758288 | 21 days ago | IN | 0 ETH | 0.00001647 | ||||
| Start Spin | 421758201 | 21 days ago | IN | 0 ETH | 0.0000164 | ||||
| Start Spin | 421757886 | 21 days ago | IN | 0 ETH | 0.00001673 | ||||
| Start Spin | 421755820 | 21 days ago | IN | 0 ETH | 0.00001618 | ||||
| Start Spin | 421755730 | 21 days ago | IN | 0 ETH | 0.00001616 | ||||
| Start Spin | 421755570 | 21 days ago | IN | 0 ETH | 0.00001616 | ||||
| Start Spin | 421755362 | 21 days ago | IN | 0 ETH | 0.00001617 | ||||
| Start Spin | 421755207 | 21 days ago | IN | 0 ETH | 0.00001616 | ||||
| Start Spin | 421755024 | 21 days ago | IN | 0 ETH | 0.00001629 | ||||
| Start Spin | 421754876 | 21 days ago | IN | 0 ETH | 0.00001617 | ||||
| Start Spin | 421754719 | 21 days ago | IN | 0 ETH | 0.00001618 | ||||
| Start Spin | 421754636 | 21 days ago | IN | 0 ETH | 0.00001629 | ||||
| Start Spin | 421754543 | 21 days ago | IN | 0 ETH | 0.0000163 | ||||
| Start Spin | 421754458 | 21 days ago | IN | 0 ETH | 0.00001616 | ||||
| Start Spin | 421754382 | 21 days ago | IN | 0 ETH | 0.00001618 | ||||
| Start Spin | 421754214 | 21 days ago | IN | 0 ETH | 0.00001654 | ||||
| Start Spin | 421754099 | 21 days ago | IN | 0 ETH | 0.00001619 | ||||
| Start Spin | 421754021 | 21 days ago | IN | 0 ETH | 0.00001622 | ||||
| Start Spin | 421753934 | 21 days ago | IN | 0 ETH | 0.00001552 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SingleRandomRouletteV2
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.20;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import {IRandomConsumer} from "./interfaces/IRandomConsumer.sol";
import {RandomDeriveLib} from "./libraries/RandomDeriveLib.sol";
import {JackpotScalingLib} from "./libraries/JackpotScalingLib.sol";
interface IPaymentHandlerMinimal {
function processDirectBetFromGame(address bettor, address potentialReferrer, uint256 baseCost)
external
returns (uint256 netAmount);
function getGameConfig(address game)
external
view
returns (
bool enabled,
address payoutTarget,
address feeRecipient,
uint16 houseEdgeBps,
uint16 referralBps
);
}
interface IRandomProviderMinimal {
function requestRandomNumbers(RandomDeriveLib.Range[] calldata ranges) external returns (uint256 requestId);
}
interface IProgressiveJackpotV2 {
function addFunds(uint256 amount) external;
function processJackpotEntry(address player, uint256 betAmount, uint256 roll) external returns (uint256 payout);
function PROBABILITY_PRECISION() external view returns (uint256);
function ensurePayable(address game, uint256 betAmount) external view;
}
/**
* @title SingleRandomRouletteV2
* @notice Roulette game with optional jackpot participation
* @dev When jackpot is disabled per-spin, jackpot probability transfers to replay
*/
contract SingleRandomRouletteV2 is IRandomConsumer, Ownable2Step, ReentrancyGuard {
using SafeERC20 for IERC20;
uint16 internal constant BPS_DENOMINATOR = 10_000;
uint8 internal constant MAX_ROLLS = 6;
uint16 internal constant MULTIPLIER_SCALE = 100;
uint16 internal constant MIN_MULTIPLIER_HUNDREDTHS = 101; // 1.01x
enum SpinResolution {
Lose,
Multiplier,
Jackpot
}
// ─────────────────────────────────────────────────────────────────────────
// Structs
// ─────────────────────────────────────────────────────────────────────────
struct TableConfig {
bool enabled;
uint16 replayBps; // Base replay probability
uint16 jackpotBps; // Jackpot probability (transfers to replay if jackpot disabled)
uint16 jackpotContributionBps;
uint16 minMultiplier;
uint16 maxMultiplier;
uint256 minWager;
uint256 maxWager;
}
struct JackpotScalingConfig {
bool enabled;
uint16 minJackpotBps;
uint16 maxJackpotBps;
uint256 minJackpotWager;
uint256 maxJackpotWager;
JackpotScalingLib.ScalingFunction functionId;
bytes extraData;
}
struct PendingSpin {
address player;
uint256 wager;
uint256 netStake;
uint256 maxPayout;
uint256 jackpotContribution;
uint24 multiplierHundredths;
uint16 multiplierBps;
uint16 jackpotBps; // 0 if player opted out of jackpot
uint16 replayBps; // Includes transferred jackpot probability if opted out
uint32 configIndex;
bool participatingInJackpot;
bool exists;
}
struct SpinParams {
uint256 wager;
uint256 netStake;
uint256 maxPayout;
uint256 jackpotContribution;
uint24 multiplierHundredths;
uint16 multiplierBps;
uint16 replayBps;
uint16 jackpotBps;
uint32 configIndex;
bool participatingInJackpot;
}
// ─────────────────────────────────────────────────────────────────────────
// Errors
// ─────────────────────────────────────────────────────────────────────────
error UnauthorizedCaller();
error RouletteDisabled();
error InvalidMultiplier(uint256 requested);
error WagerTooLow(uint256 provided, uint256 required);
error WagerTooHigh(uint256 provided, uint256 allowed);
error LiquidityShortfall(uint256 available, uint256 required);
error ProbabilityOverflow();
error JackpotNotConfigured();
error InvalidRandomResponse(uint256 length);
error InvalidRandomSlice(uint256 value);
error PaymentHandlerMisconfigured();
// ─────────────────────────────────────────────────────────────────────────
// State
// ─────────────────────────────────────────────────────────────────────────
IPaymentHandlerMinimal public immutable paymentHandler;
IRandomProviderMinimal public immutable randomProvider;
IERC20 public immutable evaToken;
IProgressiveJackpotV2 public jackpot;
TableConfig[] private tableConfigs;
JackpotScalingConfig[] private scalingConfigs;
uint32 public currentConfigIndex;
uint256 public lockedExposure;
uint256 private jackpotRollCap;
mapping(uint256 => PendingSpin) public pendingSpins;
// ─────────────────────────────────────────────────────────────────────────
// Events
// ─────────────────────────────────────────────────────────────────────────
event TableConfigUpdated(
uint32 index,
bool enabled,
uint16 replayBps,
uint16 jackpotBps,
uint16 jackpotContributionBps,
uint16 minMultiplier,
uint16 maxMultiplier,
uint256 minWager,
uint256 maxWager
);
event JackpotScalingUpdated(
uint32 index,
bool enabled,
uint16 minJackpotBps,
uint16 maxJackpotBps,
uint256 minJackpotWager,
uint256 maxJackpotWager,
JackpotScalingLib.ScalingFunction functionId
);
event JackpotUpdated(address indexed jackpot, uint256 probabilityPrecision);
event SpinStarted(
uint256 indexed requestId,
address indexed player,
uint256 wager,
uint256 netStake,
uint256 multiplierHundredths,
uint256 maxPayout,
uint256 jackpotContribution,
uint32 configIndex,
bool participatingInJackpot
);
event SpinResolved(
uint256 indexed requestId,
address indexed player,
uint8 outcome,
uint256 payout,
uint8 spinsConsumed,
uint256 jackpotPayout
);
event SpinFailed(uint256 indexed requestId, address indexed player, bytes32 reason);
// ─────────────────────────────────────────────────────────────────────────
// Constructor
// ─────────────────────────────────────────────────────────────────────────
constructor(address handler, address provider, address eva) {
if (handler == address(0) || provider == address(0) || eva == address(0)) {
revert PaymentHandlerMisconfigured();
}
paymentHandler = IPaymentHandlerMinimal(handler);
randomProvider = IRandomProviderMinimal(provider);
evaToken = IERC20(eva);
tableConfigs.push(
TableConfig({
enabled: false,
replayBps: 0,
jackpotBps: 0,
jackpotContributionBps: 0,
minMultiplier: MIN_MULTIPLIER_HUNDREDTHS,
maxMultiplier: MIN_MULTIPLIER_HUNDREDTHS,
minWager: 0,
maxWager: 0
})
);
scalingConfigs.push(
JackpotScalingConfig({
enabled: false,
minJackpotBps: 0,
maxJackpotBps: 0,
minJackpotWager: 0,
maxJackpotWager: 0,
functionId: JackpotScalingLib.ScalingFunction.Linear,
extraData: ""
})
);
currentConfigIndex = 0;
}
// ─────────────────────────────────────────────────────────────────────────
// Admin - Table Configuration
// ─────────────────────────────────────────────────────────────────────────
function setTableConfig(TableConfig calldata config) external onlyOwner {
if (config.replayBps + config.jackpotBps > BPS_DENOMINATOR) revert ProbabilityOverflow();
if (config.jackpotContributionBps > BPS_DENOMINATOR) revert ProbabilityOverflow();
if (config.minMultiplier < MIN_MULTIPLIER_HUNDREDTHS) revert InvalidMultiplier(config.minMultiplier);
if (config.maxMultiplier != 0 && config.maxMultiplier < config.minMultiplier) {
revert InvalidMultiplier(config.maxMultiplier);
}
if (config.maxWager != 0 && config.maxWager < config.minWager) {
revert WagerTooHigh(config.maxWager, config.minWager);
}
if (config.jackpotBps > 0 || config.jackpotContributionBps > 0) {
if (address(jackpot) == address(0)) revert JackpotNotConfigured();
}
tableConfigs.push(config);
scalingConfigs.push(scalingConfigs[currentConfigIndex]);
currentConfigIndex = uint32(tableConfigs.length - 1);
emit TableConfigUpdated(
currentConfigIndex,
config.enabled,
config.replayBps,
config.jackpotBps,
config.jackpotContributionBps,
config.minMultiplier,
config.maxMultiplier,
config.minWager,
config.maxWager
);
}
function setJackpotScalingConfig(JackpotScalingConfig calldata config) external onlyOwner {
uint32 index = currentConfigIndex;
JackpotScalingConfig storage stored = scalingConfigs[index];
if (config.enabled) {
if (config.maxJackpotBps > BPS_DENOMINATOR) revert ProbabilityOverflow();
if (config.maxJackpotBps < config.minJackpotBps) revert ProbabilityOverflow();
if (config.maxJackpotWager <= config.minJackpotWager) revert ProbabilityOverflow();
}
stored.enabled = config.enabled;
stored.minJackpotBps = config.minJackpotBps;
stored.maxJackpotBps = config.maxJackpotBps;
stored.minJackpotWager = config.minJackpotWager;
stored.maxJackpotWager = config.maxJackpotWager;
stored.functionId = config.functionId;
stored.extraData = config.extraData;
emit JackpotScalingUpdated(
index,
config.enabled,
config.minJackpotBps,
config.maxJackpotBps,
config.minJackpotWager,
config.maxJackpotWager,
config.functionId
);
}
function setJackpot(address newJackpot) external onlyOwner {
address oldJackpot = address(jackpot);
if (oldJackpot != address(0)) {
evaToken.safeApprove(oldJackpot, 0);
}
if (newJackpot == address(0)) {
jackpot = IProgressiveJackpotV2(address(0));
jackpotRollCap = 0;
emit JackpotUpdated(address(0), 0);
return;
}
IProgressiveJackpotV2 candidate = IProgressiveJackpotV2(newJackpot);
uint256 precision = candidate.PROBABILITY_PRECISION();
if (precision == 0 || precision > type(uint128).max) revert ProbabilityOverflow();
jackpot = candidate;
jackpotRollCap = precision;
evaToken.safeApprove(newJackpot, type(uint256).max);
emit JackpotUpdated(newJackpot, precision);
}
// ─────────────────────────────────────────────────────────────────────────
// View Functions
// ─────────────────────────────────────────────────────────────────────────
function getTableConfig() external view returns (TableConfig memory) {
return tableConfigs[currentConfigIndex];
}
function getTableConfig(uint256 index) external view returns (TableConfig memory) {
require(index < tableConfigs.length, "config index");
return tableConfigs[index];
}
function getJackpotScalingConfig() external view returns (JackpotScalingConfig memory) {
return scalingConfigs[currentConfigIndex];
}
function getJackpotScalingConfig(uint256 index) external view returns (JackpotScalingConfig memory) {
require(index < scalingConfigs.length, "config index");
return scalingConfigs[index];
}
function availableLiquidity() external view returns (uint256) {
uint256 balance = evaToken.balanceOf(address(this));
if (balance <= lockedExposure) return 0;
return balance - lockedExposure;
}
/**
* @notice Preview spin probabilities with jackpot participation choice
* @param wager The wager amount
* @param multiplierHundredths The multiplier (e.g., 200 = 2x)
* @param configIndex Config index (type(uint32).max for current)
* @param participateInJackpot Whether to include jackpot probability
*/
function previewSpin(
uint256 wager,
uint256 multiplierHundredths,
uint32 configIndex,
bool participateInJackpot
)
external
view
returns (
uint16 multiplierProbability,
uint16 replayProbability,
uint16 jackpotProbability,
uint16 loseProbability,
uint256 maxPayout,
uint256 jackpotContribution
)
{
uint32 index = configIndex == type(uint32).max ? currentConfigIndex : configIndex;
require(index < tableConfigs.length, "config index");
TableConfig memory cfg = tableConfigs[index];
// Compute probabilities using helper
(multiplierProbability, jackpotProbability, replayProbability) = _computeSpinProbabilitiesForIndex(
wager, multiplierHundredths, index, cfg, participateInJackpot
);
// Compute lose probability
loseProbability = BPS_DENOMINATOR - multiplierProbability - replayProbability - jackpotProbability;
// Compute contribution and payout
jackpotContribution = _previewJackpotContribution(wager, cfg.jackpotContributionBps);
maxPayout = (wager * multiplierHundredths) / MULTIPLIER_SCALE;
}
// ─────────────────────────────────────────────────────────────────────────
// Core Gameplay
// ─────────────────────────────────────────────────────────────────────────
/**
* @notice Start a spin with optional jackpot participation
* @param wager The wager amount in EVA
* @param multiplierHundredths The desired multiplier (e.g., 200 = 2x)
* @param potentialReferrer Referrer address (or zero)
* @param participateInJackpot If true, contribute to and participate in jackpot
* @return requestId The VRF request ID
*/
function startSpin(
uint256 wager,
uint256 multiplierHundredths,
address potentialReferrer,
bool participateInJackpot
)
external
nonReentrant
returns (uint256 requestId)
{
SpinParams memory params;
params.configIndex = currentConfigIndex;
params.participatingInJackpot = participateInJackpot;
// Validate and compute probabilities in scoped block
{
TableConfig memory cfg = tableConfigs[currentConfigIndex];
if (!cfg.enabled) revert RouletteDisabled();
if (multiplierHundredths < cfg.minMultiplier) revert InvalidMultiplier(multiplierHundredths);
if (cfg.maxMultiplier != 0 && multiplierHundredths > cfg.maxMultiplier) {
revert InvalidMultiplier(multiplierHundredths);
}
if (cfg.minWager > 0 && wager < cfg.minWager) revert WagerTooLow(wager, cfg.minWager);
if (cfg.maxWager > 0 && wager > cfg.maxWager) revert WagerTooHigh(wager, cfg.maxWager);
// Check jackpot configured if needed
if (cfg.jackpotContributionBps > 0 && address(jackpot) == address(0)) {
revert JackpotNotConfigured();
}
if (participateInJackpot && cfg.jackpotBps > 0 && jackpotRollCap == 0) {
revert JackpotNotConfigured();
}
// Compute probabilities
(params.multiplierBps, params.jackpotBps, params.replayBps) = _computeSpinProbabilities(
wager, multiplierHundredths, cfg, participateInJackpot
);
}
// Process payment
params.netStake = paymentHandler.processDirectBetFromGame(msg.sender, potentialReferrer, wager);
require(params.netStake > 0, "net zero");
// Compute derived values
params.wager = wager;
params.multiplierHundredths = uint24(multiplierHundredths);
params.maxPayout = _computeMaxPayout(wager, multiplierHundredths);
params.jackpotContribution = _computeJackpotContribution(params.netStake, tableConfigs[currentConfigIndex].jackpotContributionBps);
// Ensure payability
_ensurePayabilitySimple(wager, multiplierHundredths, params.netStake, params.jackpotBps, participateInJackpot);
// Lock exposure
_lockExposure(params.maxPayout, params.jackpotContribution);
// Request randomness and store
requestId = _requestSpinRandomness(uint128(participateInJackpot && jackpotRollCap > 0 ? jackpotRollCap : BPS_DENOMINATOR));
_storePendingSpin(requestId, msg.sender, params);
emit SpinStarted(
requestId,
msg.sender,
wager,
params.netStake,
multiplierHundredths,
params.maxPayout,
params.jackpotContribution,
currentConfigIndex,
participateInJackpot
);
}
function fulfillRandomness(
uint256 requestId,
uint256 /*randomWord*/,
uint256[] memory derivedValues
)
external
override
nonReentrant
{
if (msg.sender != address(randomProvider)) revert UnauthorizedCaller();
if (derivedValues.length < MAX_ROLLS + 1) revert InvalidRandomResponse(derivedValues.length);
PendingSpin memory spin = pendingSpins[requestId];
if (!spin.exists) revert UnauthorizedCaller();
_unlockExposure(spin.maxPayout, spin.jackpotContribution);
delete pendingSpins[requestId];
TableConfig memory config = tableConfigs[spin.configIndex];
(SpinResolution outcome, uint8 spinsConsumed) = _resolveSpin(spin, config, spin.jackpotBps, derivedValues);
uint256 jackpotPayout;
// Always deposit jackpot contribution (regardless of participation)
_depositToJackpot(spin.jackpotContribution);
if (outcome == SpinResolution.Jackpot && spin.participatingInJackpot) {
// Player participating: process jackpot entry
uint256 jackpotRoll = derivedValues[MAX_ROLLS];
if (jackpotRollCap == 0 || jackpotRoll >= jackpotRollCap) revert InvalidRandomSlice(jackpotRoll);
jackpotPayout = jackpot.processJackpotEntry(spin.player, spin.wager, jackpotRoll);
} else if (outcome == SpinResolution.Multiplier) {
// Multiplier win: pay out
evaToken.safeTransfer(spin.player, spin.maxPayout);
}
// Note: If Jackpot outcome but not participating, it's already converted to replay
// so this case shouldn't happen (jackpotBps = 0 when not participating)
uint256 payout = outcome == SpinResolution.Multiplier ? spin.maxPayout : 0;
emit SpinResolved(requestId, spin.player, uint8(outcome), payout, spinsConsumed, jackpotPayout);
}
function handleRandomFailure(
uint256 requestId,
bytes32 reason,
bytes calldata /*details*/
)
external
override
nonReentrant
{
if (msg.sender != address(randomProvider)) revert UnauthorizedCaller();
PendingSpin memory spin = pendingSpins[requestId];
if (!spin.exists) {
return;
}
_unlockExposure(spin.maxPayout, spin.jackpotContribution);
delete pendingSpins[requestId];
emit SpinFailed(requestId, spin.player, reason);
}
// ─────────────────────────────────────────────────────────────────────────
// Internal Helpers
// ─────────────────────────────────────────────────────────────────────────
function _toScalingConfig(JackpotScalingConfig storage config)
internal
view
returns (JackpotScalingLib.ScalingConfig memory)
{
bytes memory extra = config.extraData.length > 0 ? abi.encodePacked(config.extraData) : bytes("");
return JackpotScalingLib.ScalingConfig({
enabled: config.enabled,
minJackpotBps: config.minJackpotBps,
maxJackpotBps: config.maxJackpotBps,
minJackpotWager: config.minJackpotWager,
maxJackpotWager: config.maxJackpotWager,
functionId: config.functionId,
extraData: extra
});
}
function _computeJackpotProbability(uint32 configIndex, uint16 staticBps, uint256 wager)
internal
view
returns (uint16)
{
JackpotScalingConfig storage scalingStorage = scalingConfigs[configIndex];
if (!scalingStorage.enabled) {
return staticBps;
}
return JackpotScalingLib.computeProbability(_toScalingConfig(scalingStorage), wager);
}
function _depositToJackpot(uint256 amount) internal {
if (amount == 0 || address(jackpot) == address(0)) {
return;
}
jackpot.addFunds(amount);
}
function _computeSpinProbabilities(
uint256 wager,
uint256 multiplierHundredths,
TableConfig memory cfg,
bool participateInJackpot
) internal view returns (uint16 multiplierBps, uint16 jackpotBps, uint16 replayBps) {
return _computeSpinProbabilitiesForIndex(wager, multiplierHundredths, currentConfigIndex, cfg, participateInJackpot);
}
function _computeSpinProbabilitiesForIndex(
uint256 wager,
uint256 multiplierHundredths,
uint32 index,
TableConfig memory cfg,
bool participateInJackpot
) internal view returns (uint16 multiplierBps, uint16 jackpotBps, uint16 replayBps) {
// Get fees
(, , , uint16 houseEdgeBps, uint16 referralBps) = paymentHandler.getGameConfig(address(this));
// Base jackpot probability
uint16 baseJackpotBps = _computeJackpotProbability(index, cfg.jackpotBps, wager);
// Apply participation choice
if (participateInJackpot) {
jackpotBps = baseJackpotBps;
replayBps = cfg.replayBps;
} else {
jackpotBps = 0;
replayBps = cfg.replayBps + baseJackpotBps;
}
// Effective edge always includes contribution
uint16 effectiveEdge = _calculateEffectiveEdge(houseEdgeBps, referralBps, cfg.jackpotContributionBps);
(multiplierBps, ) = _deriveMultiplierProbability(multiplierHundredths, replayBps, jackpotBps, effectiveEdge);
}
function _previewJackpotContribution(uint256 wager, uint16 contributionBps) internal view returns (uint256) {
if (contributionBps == 0) return 0;
(, , , uint16 houseEdgeBps, uint16 referralBps) = paymentHandler.getGameConfig(address(this));
uint256 netStake = (wager * (BPS_DENOMINATOR - houseEdgeBps - referralBps)) / BPS_DENOMINATOR;
return (netStake * contributionBps) / BPS_DENOMINATOR;
}
function _computeJackpotContribution(uint256 netStake, uint16 contributionBps) internal pure returns (uint256) {
if (contributionBps == 0) return 0;
return Math.mulDiv(netStake, contributionBps, BPS_DENOMINATOR);
}
function _ensurePayabilitySimple(
uint256 betAmount,
uint256 multiplierHundredths,
uint256 netStake,
uint16 jackpotBps,
bool participateInJackpot
) internal view {
TableConfig memory cfg = tableConfigs[currentConfigIndex];
uint16 effectiveMultiplier = cfg.maxMultiplier == 0 ? uint16(multiplierHundredths) : cfg.maxMultiplier;
uint256 requiredPayout = Math.mulDiv(betAmount, effectiveMultiplier, MULTIPLIER_SCALE);
uint256 projectedExposure = lockedExposure + requiredPayout;
uint256 balance = evaToken.balanceOf(address(this));
if (balance < projectedExposure) revert LiquidityShortfall(balance, projectedExposure);
if (cfg.jackpotContributionBps > 0 && address(jackpot) == address(0)) {
revert JackpotNotConfigured();
}
if (participateInJackpot && jackpotBps > 0) {
jackpot.ensurePayable(address(this), netStake);
}
}
function _deriveMultiplierProbability(
uint256 multiplierHundredths,
uint16 replayBps,
uint16 jackpotBps,
uint16 houseEdgeBps
) internal pure returns (uint16 multiplierBps, uint16 loseBps) {
uint256 baseRtp = BPS_DENOMINATOR - houseEdgeBps;
uint256 chainMultiplierBps = _chainMultiplier(replayBps);
uint256 adjustedRtp = Math.mulDiv(baseRtp, BPS_DENOMINATOR, chainMultiplierBps);
multiplierBps = uint16(Math.min(BPS_DENOMINATOR, (adjustedRtp * MULTIPLIER_SCALE) / multiplierHundredths));
if (uint256(multiplierBps) + replayBps + jackpotBps > BPS_DENOMINATOR) {
jackpotBps = BPS_DENOMINATOR - multiplierBps - replayBps - 100;
}
loseBps = uint16(BPS_DENOMINATOR - multiplierBps - replayBps - jackpotBps);
}
function _resolveSpin(
PendingSpin memory spin,
TableConfig memory /*config*/,
uint16 jackpotBps,
uint256[] memory derivedValues
) internal pure returns (SpinResolution outcome, uint8 spinsConsumed) {
uint256 multiplierThreshold = spin.multiplierBps;
uint256 replayThreshold = multiplierThreshold + spin.replayBps;
uint256 jackpotThreshold = replayThreshold + jackpotBps;
for (uint8 i = 0; i < MAX_ROLLS; i++) {
uint256 roll = derivedValues[i];
if (roll >= BPS_DENOMINATOR) revert InvalidRandomSlice(roll);
spinsConsumed = i + 1;
if (roll < multiplierThreshold) {
return (SpinResolution.Multiplier, spinsConsumed);
}
if (roll < replayThreshold) {
if (i == MAX_ROLLS - 1) {
return (SpinResolution.Lose, spinsConsumed);
}
continue;
}
if (roll < jackpotThreshold) {
return (SpinResolution.Jackpot, spinsConsumed);
}
return (SpinResolution.Lose, spinsConsumed);
}
return (SpinResolution.Lose, MAX_ROLLS);
}
function _buildRanges(uint128 jackpotCap)
internal
pure
returns (RandomDeriveLib.Range[] memory ranges)
{
ranges = new RandomDeriveLib.Range[](MAX_ROLLS + 1);
RandomDeriveLib.Range memory base = RandomDeriveLib.Range({min: 0, max: uint128(BPS_DENOMINATOR)});
for (uint256 i = 0; i < MAX_ROLLS; i++) {
ranges[i] = base;
}
ranges[MAX_ROLLS] = RandomDeriveLib.Range({min: 0, max: jackpotCap});
}
function _requestSpinRandomness(uint128 jackpotCap) internal returns (uint256 requestId) {
RandomDeriveLib.Range[] memory ranges = _buildRanges(jackpotCap);
requestId = randomProvider.requestRandomNumbers(ranges);
}
function _storePendingSpin(uint256 requestId, address player, SpinParams memory params) internal {
PendingSpin storage stored = pendingSpins[requestId];
stored.player = player;
stored.wager = params.wager;
stored.netStake = params.netStake;
stored.maxPayout = params.maxPayout;
stored.jackpotContribution = params.jackpotContribution;
stored.multiplierHundredths = params.multiplierHundredths;
stored.multiplierBps = params.multiplierBps;
stored.jackpotBps = params.jackpotBps;
stored.replayBps = params.replayBps;
stored.configIndex = params.configIndex;
stored.participatingInJackpot = params.participatingInJackpot;
stored.exists = true;
}
function _chainMultiplier(uint16 replayBps) internal pure returns (uint256 acc) {
acc = BPS_DENOMINATOR;
uint256 term = BPS_DENOMINATOR;
for (uint8 i = 0; i < MAX_ROLLS - 1; i++) {
term = (term * replayBps) / BPS_DENOMINATOR;
if (term == 0) break;
acc += term;
}
}
function _lockExposure(uint256 maxPayout, uint256 jackpotContribution) internal {
uint256 proposedLocked = lockedExposure + maxPayout + jackpotContribution;
uint256 balance = evaToken.balanceOf(address(this));
if (balance < proposedLocked) revert LiquidityShortfall(balance, proposedLocked);
lockedExposure = proposedLocked;
}
function _unlockExposure(uint256 maxPayout, uint256 jackpotContribution) internal {
uint256 reduction = maxPayout + jackpotContribution;
if (lockedExposure < reduction) {
lockedExposure = 0;
} else {
lockedExposure -= reduction;
}
}
function _computeMaxPayout(uint256 wager, uint256 multiplierHundredths) internal pure returns (uint256) {
return Math.mulDiv(wager, multiplierHundredths, MULTIPLIER_SCALE);
}
/**
* @notice Calculate effective edge accounting for all fee layers
* @param houseEdgeBps House fee in basis points
* @param referralBps Referral fee in basis points
* @param jackpotContributionBps Jackpot contribution in basis points of net stake
* @return effectiveEdgeBps The combined effective edge
*/
function _calculateEffectiveEdge(
uint16 houseEdgeBps,
uint16 referralBps,
uint16 jackpotContributionBps
) internal pure returns (uint16 effectiveEdgeBps) {
uint256 netStakeRate = BPS_DENOMINATOR - houseEdgeBps - referralBps;
uint256 poolFundingRate = (netStakeRate * (BPS_DENOMINATOR - jackpotContributionBps)) / BPS_DENOMINATOR;
effectiveEdgeBps = uint16(BPS_DENOMINATOR - poolFundingRate);
return effectiveEdgeBps;
}
// ─────────────────────────────────────────────────────────────────────────
// Emergency
// ─────────────────────────────────────────────────────────────────────────
function emergencyWithdraw(address to, uint256 amount) external onlyOwner nonReentrant {
require(to != address(0), "to");
uint256 bal = evaToken.balanceOf(address(this));
uint256 amt = amount == 0 ? bal : amount;
require(amt <= bal, "insufficient");
evaToken.safeTransfer(to, amt);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./Ownable.sol";
/**
* @dev Contract module which provides 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} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
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].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
interface IRandomConsumer {
/**
* @notice Called by RandomProvider when randomness is ready.
* @param requestId The id of the randomness request.
* @param randomWord The raw VRF word received from the coordinator.
* @param derivedValues The bounded numbers produced using the requested ranges.
*/
function fulfillRandomness(
uint256 requestId,
uint256 randomWord,
uint256[] memory derivedValues
) external;
/**
* @notice Called by RandomProvider when a request cannot be fulfilled.
* @param requestId The id of the randomness request.
* @param reason Identifier describing the failure (e.g. keccak256("TIMEOUT")).
* @param details Additional context encoded as bytes (may be empty).
*/
function handleRandomFailure(
uint256 requestId,
bytes32 reason,
bytes calldata details
) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
library JackpotScalingLib {
using Math for uint256;
uint256 internal constant ONE = 1e18;
enum ScalingFunction {
Linear,
Quadratic,
Logarithmic,
Exponential
}
struct ScalingConfig {
bool enabled;
uint16 minJackpotBps;
uint16 maxJackpotBps;
uint256 minJackpotWager;
uint256 maxJackpotWager;
ScalingFunction functionId;
bytes extraData;
}
error ScalingDisabled();
error InvalidScalingBounds();
error InvalidScalingRange();
error InvalidScalingFunction();
function computeProbability(ScalingConfig memory config, uint256 wager) internal pure returns (uint16) {
if (!config.enabled) revert ScalingDisabled();
if (config.maxJackpotBps < config.minJackpotBps) revert InvalidScalingRange();
if (config.maxJackpotBps == 0) return 0;
if (wager < config.minJackpotWager) {
return 0;
}
if (config.maxJackpotWager <= config.minJackpotWager) revert InvalidScalingBounds();
if (wager >= config.maxJackpotWager) {
return config.maxJackpotBps;
}
uint256 span = config.maxJackpotWager - config.minJackpotWager;
uint256 position = ((wager - config.minJackpotWager) * ONE) / span;
uint256 scaled = applyCurve(config.functionId, position);
uint256 base = uint256(config.minJackpotBps);
uint256 delta = uint256(config.maxJackpotBps) - base;
return uint16(base + (delta * scaled) / ONE);
}
function applyCurve(ScalingFunction functionId, uint256 normalized) internal pure returns (uint256) {
return _applyCurve(uint8(functionId), normalized);
}
function applyCurveUnsafe(uint8 functionId, uint256 normalized) internal pure returns (uint256) {
return _applyCurve(functionId, normalized);
}
function _applyCurve(uint8 functionId, uint256 normalized) private pure returns (uint256) {
if (normalized == 0) return 0;
if (normalized >= ONE) return ONE;
if (functionId == uint8(ScalingFunction.Linear)) {
return normalized;
}
if (functionId == uint8(ScalingFunction.Quadratic)) {
return (normalized * normalized) / ONE;
}
if (functionId == uint8(ScalingFunction.Logarithmic)) {
// Approximate a logarithmic-style curve using square root for concave growth
return Math.sqrt(normalized * ONE);
}
if (functionId == uint8(ScalingFunction.Exponential)) {
uint256 square = (normalized * normalized) / ONE;
return (square * normalized) / ONE;
}
revert InvalidScalingFunction();
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
/// @title RandomDeriveLib
/// @notice Utility helpers to deterministically derive bounded random values from a
/// single 256-bit VRF word.
library RandomDeriveLib {
/// @notice Configuration for a bounded random number.
struct Range {
uint128 min; // inclusive lower bound
uint128 max; // exclusive upper bound
}
/// @notice Thrown when a requested range is invalid.
error InvalidRange(uint256 index);
/// @notice Derives bounded random numbers from a single 256-bit seed.
/// @param seed The initial random seed (typically a VRF word).
/// @param ranges The list of ranges to derive numbers for.
/// @return values The derived numbers, each constrained to its range.
/// @return lastSeed The final seed after processing all ranges (can be reused).
function deriveBounded(
uint256 seed,
Range[] memory ranges
) internal pure returns (uint256[] memory values, uint256 lastSeed) {
uint256 length = ranges.length;
values = new uint256[](length);
for (uint256 i = 0; i < length; i++) {
Range memory range = ranges[i];
uint256 minValue = uint256(range.min);
uint256 maxValue = uint256(range.max);
if (maxValue <= minValue) {
revert InvalidRange(i);
}
uint256 span = maxValue - minValue; // guaranteed > 0
uint256 boundedValue = (seed % span) + minValue;
values[i] = boundedValue;
// Derive the next seed for the following iteration.
seed = uint256(keccak256(abi.encode(seed, i)));
}
lastSeed = seed;
}
/// @notice Derives a single bounded number and the next seed.
/// @param seed The current random seed.
/// @param minValue Inclusive lower bound for the derived value.
/// @param maxValue Exclusive upper bound for the derived value.
/// @param index Position of this derivation in the sequence (used for hashing and error reporting).
/// @return value The derived random number within [minValue, maxValue).
/// @return nextSeed The next seed to use for subsequent derivations.
function deriveOnce(
uint256 seed,
uint128 minValue,
uint128 maxValue,
uint256 index
) internal pure returns (uint256 value, uint256 nextSeed) {
uint256 min = uint256(minValue);
uint256 max = uint256(maxValue);
if (max <= min) {
revert InvalidRange(index);
}
uint256 span = max - min;
value = (seed % span) + min;
nextSeed = uint256(keccak256(abi.encode(seed, index)));
}
/// @notice Derives a deterministic sequence of 256-bit words from an initial seed.
/// @dev Useful when the consumer wants raw words instead of bounded numbers.
/// @param seed The initial random seed.
/// @param count How many additional words to derive.
/// @return words The sequence of derived words (length == count).
/// @return lastSeed The final seed after derivation.
function deriveWordSequence(
uint256 seed,
uint256 count
) internal pure returns (uint256[] memory words, uint256 lastSeed) {
words = new uint256[](count);
for (uint256 i = 0; i < count; i++) {
seed = uint256(keccak256(abi.encode(seed, i)));
words[i] = seed;
}
lastSeed = seed;
}
}{
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "shanghai",
"remappings": [
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/"
],
"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":"handler","type":"address"},{"internalType":"address","name":"provider","type":"address"},{"internalType":"address","name":"eva","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"}],"name":"InvalidMultiplier","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"InvalidRandomResponse","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"InvalidRandomSlice","type":"error"},{"inputs":[],"name":"InvalidScalingBounds","type":"error"},{"inputs":[],"name":"InvalidScalingFunction","type":"error"},{"inputs":[],"name":"InvalidScalingRange","type":"error"},{"inputs":[],"name":"JackpotNotConfigured","type":"error"},{"inputs":[{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"required","type":"uint256"}],"name":"LiquidityShortfall","type":"error"},{"inputs":[],"name":"PaymentHandlerMisconfigured","type":"error"},{"inputs":[],"name":"ProbabilityOverflow","type":"error"},{"inputs":[],"name":"RouletteDisabled","type":"error"},{"inputs":[],"name":"ScalingDisabled","type":"error"},{"inputs":[],"name":"UnauthorizedCaller","type":"error"},{"inputs":[{"internalType":"uint256","name":"provided","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"WagerTooHigh","type":"error"},{"inputs":[{"internalType":"uint256","name":"provided","type":"uint256"},{"internalType":"uint256","name":"required","type":"uint256"}],"name":"WagerTooLow","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"index","type":"uint32"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"},{"indexed":false,"internalType":"uint16","name":"minJackpotBps","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"maxJackpotBps","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"minJackpotWager","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxJackpotWager","type":"uint256"},{"indexed":false,"internalType":"enum JackpotScalingLib.ScalingFunction","name":"functionId","type":"uint8"}],"name":"JackpotScalingUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"jackpot","type":"address"},{"indexed":false,"internalType":"uint256","name":"probabilityPrecision","type":"uint256"}],"name":"JackpotUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"bytes32","name":"reason","type":"bytes32"}],"name":"SpinFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint8","name":"outcome","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"payout","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"spinsConsumed","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"jackpotPayout","type":"uint256"}],"name":"SpinResolved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"wager","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netStake","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplierHundredths","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxPayout","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"jackpotContribution","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"configIndex","type":"uint32"},{"indexed":false,"internalType":"bool","name":"participatingInJackpot","type":"bool"}],"name":"SpinStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"index","type":"uint32"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"},{"indexed":false,"internalType":"uint16","name":"replayBps","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"jackpotBps","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"jackpotContributionBps","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"minMultiplier","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"maxMultiplier","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"minWager","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxWager","type":"uint256"}],"name":"TableConfigUpdated","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentConfigIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"evaToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"derivedValues","type":"uint256[]"}],"name":"fulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getJackpotScalingConfig","outputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"minJackpotBps","type":"uint16"},{"internalType":"uint16","name":"maxJackpotBps","type":"uint16"},{"internalType":"uint256","name":"minJackpotWager","type":"uint256"},{"internalType":"uint256","name":"maxJackpotWager","type":"uint256"},{"internalType":"enum JackpotScalingLib.ScalingFunction","name":"functionId","type":"uint8"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SingleRandomRouletteV2.JackpotScalingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getJackpotScalingConfig","outputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"minJackpotBps","type":"uint16"},{"internalType":"uint16","name":"maxJackpotBps","type":"uint16"},{"internalType":"uint256","name":"minJackpotWager","type":"uint256"},{"internalType":"uint256","name":"maxJackpotWager","type":"uint256"},{"internalType":"enum JackpotScalingLib.ScalingFunction","name":"functionId","type":"uint8"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SingleRandomRouletteV2.JackpotScalingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getTableConfig","outputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"replayBps","type":"uint16"},{"internalType":"uint16","name":"jackpotBps","type":"uint16"},{"internalType":"uint16","name":"jackpotContributionBps","type":"uint16"},{"internalType":"uint16","name":"minMultiplier","type":"uint16"},{"internalType":"uint16","name":"maxMultiplier","type":"uint16"},{"internalType":"uint256","name":"minWager","type":"uint256"},{"internalType":"uint256","name":"maxWager","type":"uint256"}],"internalType":"struct SingleRandomRouletteV2.TableConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTableConfig","outputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"replayBps","type":"uint16"},{"internalType":"uint16","name":"jackpotBps","type":"uint16"},{"internalType":"uint16","name":"jackpotContributionBps","type":"uint16"},{"internalType":"uint16","name":"minMultiplier","type":"uint16"},{"internalType":"uint16","name":"maxMultiplier","type":"uint16"},{"internalType":"uint256","name":"minWager","type":"uint256"},{"internalType":"uint256","name":"maxWager","type":"uint256"}],"internalType":"struct SingleRandomRouletteV2.TableConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"bytes32","name":"reason","type":"bytes32"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"handleRandomFailure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"jackpot","outputs":[{"internalType":"contract IProgressiveJackpotV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockedExposure","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentHandler","outputs":[{"internalType":"contract IPaymentHandlerMinimal","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendingSpins","outputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"uint256","name":"netStake","type":"uint256"},{"internalType":"uint256","name":"maxPayout","type":"uint256"},{"internalType":"uint256","name":"jackpotContribution","type":"uint256"},{"internalType":"uint24","name":"multiplierHundredths","type":"uint24"},{"internalType":"uint16","name":"multiplierBps","type":"uint16"},{"internalType":"uint16","name":"jackpotBps","type":"uint16"},{"internalType":"uint16","name":"replayBps","type":"uint16"},{"internalType":"uint32","name":"configIndex","type":"uint32"},{"internalType":"bool","name":"participatingInJackpot","type":"bool"},{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"uint256","name":"multiplierHundredths","type":"uint256"},{"internalType":"uint32","name":"configIndex","type":"uint32"},{"internalType":"bool","name":"participateInJackpot","type":"bool"}],"name":"previewSpin","outputs":[{"internalType":"uint16","name":"multiplierProbability","type":"uint16"},{"internalType":"uint16","name":"replayProbability","type":"uint16"},{"internalType":"uint16","name":"jackpotProbability","type":"uint16"},{"internalType":"uint16","name":"loseProbability","type":"uint16"},{"internalType":"uint256","name":"maxPayout","type":"uint256"},{"internalType":"uint256","name":"jackpotContribution","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomProvider","outputs":[{"internalType":"contract IRandomProviderMinimal","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newJackpot","type":"address"}],"name":"setJackpot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"minJackpotBps","type":"uint16"},{"internalType":"uint16","name":"maxJackpotBps","type":"uint16"},{"internalType":"uint256","name":"minJackpotWager","type":"uint256"},{"internalType":"uint256","name":"maxJackpotWager","type":"uint256"},{"internalType":"enum JackpotScalingLib.ScalingFunction","name":"functionId","type":"uint8"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SingleRandomRouletteV2.JackpotScalingConfig","name":"config","type":"tuple"}],"name":"setJackpotScalingConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"replayBps","type":"uint16"},{"internalType":"uint16","name":"jackpotBps","type":"uint16"},{"internalType":"uint16","name":"jackpotContributionBps","type":"uint16"},{"internalType":"uint16","name":"minMultiplier","type":"uint16"},{"internalType":"uint16","name":"maxMultiplier","type":"uint16"},{"internalType":"uint256","name":"minWager","type":"uint256"},{"internalType":"uint256","name":"maxWager","type":"uint256"}],"internalType":"struct SingleRandomRouletteV2.TableConfig","name":"config","type":"tuple"}],"name":"setTableConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"uint256","name":"multiplierHundredths","type":"uint256"},{"internalType":"address","name":"potentialReferrer","type":"address"},{"internalType":"bool","name":"participateInJackpot","type":"bool"}],"name":"startSpin","outputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e060405234801562000010575f80fd5b50604051620049ff380380620049ff8339810160408190526200003391620003f2565b6200003e3362000369565b60016002556001600160a01b03831615806200006157506001600160a01b038216155b806200007457506001600160a01b038116155b156200009357604051630347bc3160e11b815260040160405180910390fd5b826001600160a01b03166080816001600160a01b031681525050816001600160a01b031660a0816001600160a01b031681525050806001600160a01b031660c0816001600160a01b03168152505060046040518061010001604052805f151581526020015f61ffff1681526020015f61ffff1681526020015f61ffff168152602001606561ffff168152602001606561ffff1681526020015f81526020015f815250908060018154018082558091505060019003905f5260205f2090600302015f909190919091505f820151815f015f6101000a81548160ff0219169083151502179055506020820151815f0160016101000a81548161ffff021916908361ffff1602179055506040820151815f0160036101000a81548161ffff021916908361ffff1602179055506060820151815f0160056101000a81548161ffff021916908361ffff1602179055506080820151815f0160076101000a81548161ffff021916908361ffff16021790555060a0820151815f0160096101000a81548161ffff021916908361ffff16021790555060c0820151816001015560e08201518160020155505060056040518060e001604052805f151581526020015f61ffff1681526020015f61ffff1681526020015f81526020015f81526020015f600381111562000282576200028262000439565b815260408051602080820183525f808352938101919091528454600180820187559584529281902084516005909402018054918501519285015162ffffff1990921693151562ffff0019169390931761010061ffff938416021764ffff0000001916630100000092909116919091021781556060820151818401556080820151600282015560a082015160038083018054949593949293909260ff191691849081111562000334576200033462000439565b021790555060c082015160048201906200034f9082620004ed565b50506006805463ffffffff1916905550620005b592505050565b600180546001600160a01b0319169055620003848162000387565b50565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620003ed575f80fd5b919050565b5f805f6060848603121562000405575f80fd5b6200041084620003d6565b92506200042060208501620003d6565b91506200043060408501620003d6565b90509250925092565b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806200047657607f821691505b6020821081036200049557634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115620004e8575f81815260208120601f850160051c81016020861015620004c35750805b601f850160051c820191505b81811015620004e457828155600101620004cf565b5050505b505050565b81516001600160401b038111156200050957620005096200044d565b62000521816200051a845462000461565b846200049b565b602080601f83116001811462000557575f84156200053f5750858301515b5f19600386901b1c1916600185901b178555620004e4565b5f85815260208120601f198616915b82811015620005875788860151825594840194600190910190840162000566565b5085821015620005a557878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c0516143bd620006425f395f81816101b1015281816111ae015281816112dd01528181611422015281816117a90152818161187901528181611ed20152818161242001526125b001525f81816103a9015281816104e801528181611b17015261267301525f81816104090152818161099401528181612aa60152612bb901526143bd5ff3fe608060405234801561000f575f80fd5b506004361061016d575f3560e01c80638da5cb5b116100d9578063cdd5bd2111610093578063daa5eb921161006e578063daa5eb9214610484578063e30c3978146104a9578063f2fde38b146104ba578063fe574315146104cd575f80fd5b8063cdd5bd2114610404578063d12cc5e21461042b578063da7f5bd414610434575f80fd5b80638da5cb5b146103815780638e70e256146103915780638f46500e146103a457806395ccea67146103cb578063a262496b146103de578063b1d94c95146103f1575f80fd5b8063715018a61161012a578063715018a6146103215780637222cc0d14610329578063743753591461034957806379ba5097146103515780637e95385c146103595780638a2cc52d1461036c575f80fd5b806310be33011461017157806326ca096f1461018657806349cd772e146101ac5780634cbe6423146101eb578063516e3e7f146102fb5780636b31ee011461030e575b5f80fd5b61018461017f36600461385f565b6104d5565b005b6101996101943660046138f9565b6106ac565b6040519081526020015b60405180910390f35b6101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101a3565b6102806101f9366004613940565b60096020525f90815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039094169492939192909162ffffff81169061ffff63010000008204811691600160281b8104821691600160381b8204169063ffffffff600160481b8204169060ff600160681b8204811691600160701b9004168c565b604080516001600160a01b03909d168d5260208d019b909b52998b019890985260608a0196909652608089019490945262ffffff90921660a088015261ffff90811660c088015290811660e08701521661010085015263ffffffff1661012084015215156101408301521515610160820152610180016101a3565b610184610309366004613957565b610c87565b6003546101d3906001600160a01b031681565b6101846110b0565b61033c610337366004613940565b6110c3565b6040516101a3919061396e565b61019961118d565b61018461123c565b6101846103673660046139e2565b6112b6565b610374611493565b6040516101a39190613a7e565b5f546001600160a01b03166101d3565b61037461039f366004613940565b6115e1565b6101d37f000000000000000000000000000000000000000000000000000000000000000081565b6101846103d9366004613aea565b611747565b6101846103ec366004613b14565b6118b0565b6101846103ff366004613b5f565b611b04565b6101d37f000000000000000000000000000000000000000000000000000000000000000081565b61019960075481565b610447610442366004613c2c565b611fa0565b6040805161ffff978816815295871660208701529386169385019390935293166060830152608082019290925260a081019190915260c0016101a3565b6006546104949063ffffffff1681565b60405163ffffffff90911681526020016101a3565b6001546001600160a01b03166101d3565b6101846104c83660046139e2565b612102565b61033c612172565b6104dd612225565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461052657604051635c427cd960e01b815260040160405180910390fd5b5f8481526009602090815260409182902082516101808101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015462ffffff811660a083015261ffff63010000008204811660c0840152600160281b8204811660e0840152600160381b82041661010083015263ffffffff600160481b82041661012083015260ff600160681b820481161515610140840152600160701b90910416151561016082018190526105fa575061069c565b61060c8160600151826080015161227c565b5f85815260096020908152604080832080546001600160a01b03191681556001810184905560028101849055600381018490556004810193909355600590920180546001600160781b0319169055825191518681526001600160a01b039092169187917f60ba136ab58a4f463e4c4ba498ce1c0319590f78afb19cc51d0896562850d7fa910160405180910390a3505b6106a66001600255565b50505050565b5f6106b5612225565b60408051610140810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905260065463ffffffff16610100820181905284151561012083015260048054929392909190811061072657610726613c60565b5f9182526020918290206040805161010080820183526003909402909201805460ff8116151580855261ffff95820486169685019690965263010000008104851692840192909252600160281b820484166060840152600160381b820484166080840152600160481b90910490921660a0820152600182015460c082015260029091015460e082015291506107ce5760405163807c29d560e01b815260040160405180910390fd5b806080015161ffff168610156107ff57604051639f44c9eb60e01b8152600481018790526024015b60405180910390fd5b60a081015161ffff161580159061081d57508060a0015161ffff1686115b1561083e57604051639f44c9eb60e01b8152600481018790526024016107f6565b5f8160c0015111801561085457508060c0015187105b156108825760c0810151604051630c7753cf60e11b81526107f6918991600401918252602082015260400190565b5f8160e0015111801561089857508060e0015187115b156108c65760e08101516040516305674a3d60e11b81526107f6918991600401918252602082015260400190565b5f816060015161ffff161180156108e657506003546001600160a01b0316155b156109045760405163a39da84760e01b815260040160405180910390fd5b83801561091857505f816040015161ffff16115b80156109245750600854155b156109425760405163a39da84760e01b815260040160405180910390fd5b61094e878783876122b7565b61ffff90811660c086015290811660e08501521660a083015250604051639179d03160e01b81523360048201526001600160a01b038581166024830152604482018890527f00000000000000000000000000000000000000000000000000000000000000001690639179d031906064016020604051808303815f875af11580156109da573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109fe9190613c74565b60208201819052610a3c5760405162461bcd60e51b81526020600482015260086024820152676e6574207a65726f60c01b60448201526064016107f6565b85815262ffffff85166080820152610a5486866122e5565b6040820152602081015160065460048054610a9f939263ffffffff16908110610a7f57610a7f613c60565b5f918252602090912060039091020154600160281b900461ffff166122fb565b816060018181525050610abd868683602001518460e001518761231f565b610acf81604001518260600151612574565b610af4838015610ae057505f600854115b610aec5761271061264e565b60085461264e565b5f8181526009602090815260409182902080546001600160a01b03191633178155845160018201559084015160028201559083015160038201556060830151600482015560808301516005909101805460a085015160e086015160c0870151610100880151610120890151600160701b62ffffff90981664ffffffffff1990961695909517630100000061ffff958616021768ffffffff00000000001916600160281b9385169390930261ffff60381b191692909217600160381b9390911692909202919091176dffffffffff0000000000000000001916600160481b63ffffffff9092169190910260ff60681b191617600160681b911515919091021760ff60701b1916919091179055915060208181015160408084015160608086015160065484518d8152968701959095529285018a9052840152608083015263ffffffff1660a082015283151560c0820152339083907f3139bcae24ce576ba9f45009f04d6527eb8d72a378730c2522a70615df801bac9060e00160405180910390a350610c7f6001600255565b949350505050565b610c8f6126ef565b612710610ca26060830160408401613c9a565b610cb26040840160208501613c9a565b610cbc9190613cc9565b61ffff161115610cdf576040516303ea9f9160e41b815260040160405180910390fd5b612710610cf26080830160608401613c9a565b61ffff161115610d15576040516303ea9f9160e41b815260040160405180910390fd5b6065610d2760a0830160808401613c9a565b61ffff161015610d6157610d4160a0820160808301613c9a565b604051639f44c9eb60e01b815261ffff90911660048201526024016107f6565b610d7160c0820160a08301613c9a565b61ffff1615801590610da85750610d8e60a0820160808301613c9a565b61ffff16610da260c0830160a08401613c9a565b61ffff16105b15610dbd57610d4160c0820160a08301613c9a565b60e081013515801590610dd757508060c001358160e00135105b15610e05576040516305674a3d60e11b815260e0820135600482015260c082013560248201526044016107f6565b5f610e166060830160408401613c9a565b61ffff161180610e3857505f610e326080830160608401613c9a565b61ffff16115b15610e66576003546001600160a01b0316610e665760405163a39da84760e01b815260040160405180910390fd5b600480546001810182555f9190915281906003027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01610ea68282613cf7565b5050600654600580549091829163ffffffff909116908110610eca57610eca613c60565b5f9182526020808320845460018082018755958552919093206005928302909301805492909102909201805460ff1980821660ff94851615159081178455855462ffffff1990931662ffff0019909116176101009283900461ffff90811690930217808455855464ffff0000001990911663010000009182900490931602919091178255838501548286015560028085015490830155600380850154818401805496979496919095169493921691908490811115610f8a57610f8a6139fd565b0217905550600481810190610fa190840182613e91565b5050600454610fb39150600190613f68565b6006805463ffffffff191663ffffffff9290921691821790557fca932f23940aec2001f8636330f1f10ac2124c06e5a4934bcb3a4382b3c59afa90610ffb6020840184613f7b565b61100b6040850160208601613c9a565b61101b6060860160408701613c9a565b61102b6080870160608801613c9a565b61103b60a0880160808901613c9a565b61104b60c0890160a08a01613c9a565b6040805163ffffffff989098168852951515602088015261ffff9485168787015292841660608701529083166080860152821660a08501521660c08084019190915284013560e08084019190915284013561010083015251908190036101200190a150565b6110b86126ef565b6110c15f612748565b565b6110cb6137e0565b60045482106110ec5760405162461bcd60e51b81526004016107f690613f96565b600482815481106110ff576110ff613c60565b5f9182526020918290206040805161010080820183526003909402909201805460ff81161515845261ffff94810485169584019590955263010000008504841691830191909152600160281b840483166060830152600160381b840483166080830152600160481b90930490911660a0820152600182015460c082015260029091015460e082015292915050565b6040516370a0823160e01b81523060048201525f9081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156111f3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112179190613c74565b90506007548111611229575f91505090565b6007546112369082613f68565b91505090565b60015433906001600160a01b031681146112aa5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016107f6565b6112b381612748565b50565b6112be6126ef565b6003546001600160a01b03168015611304576113046001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016825f612761565b6001600160a01b03821661135f57600380546001600160a01b03191690555f60088190556040518181527f6811f857fbf7fb128d096479e00fea9cb36ebeaeeb323cd490ddaf17620bb09b9060200160405180910390a25050565b5f8290505f816001600160a01b031663623860fd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113a0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113c49190613c74565b90508015806113d957506001600160801b0381115b156113f7576040516303ea9f9160e41b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0384811691909117909155600882905561144a907f000000000000000000000000000000000000000000000000000000000000000016855f19612761565b836001600160a01b03167f6811f857fbf7fb128d096479e00fea9cb36ebeaeeb323cd490ddaf17620bb09b8260405161148591815260200190565b60405180910390a250505050565b61149b613823565b60065460058054909163ffffffff169081106114b9576114b9613c60565b5f9182526020918290206040805160e0810182526005909302909101805460ff8082161515855261ffff610100830481169686019690965263010000009091049094169183019190915260018101546060830152600281015460808301526003808201549293919260a08501921690811115611537576115376139fd565b6003811115611548576115486139fd565b815260200160048201805461155c90613e12565b80601f016020809104026020016040519081016040528092919081815260200182805461158890613e12565b80156115d35780601f106115aa576101008083540402835291602001916115d3565b820191905f5260205f20905b8154815290600101906020018083116115b657829003601f168201915b505050505081525050905090565b6115e9613823565b600554821061160a5760405162461bcd60e51b81526004016107f690613f96565b6005828154811061161d5761161d613c60565b5f9182526020918290206040805160e0810182526005909302909101805460ff8082161515855261ffff610100830481169686019690965263010000009091049094169183019190915260018101546060830152600281015460808301526003808201549293919260a0850192169081111561169b5761169b6139fd565b60038111156116ac576116ac6139fd565b81526020016004820180546116c090613e12565b80601f01602080910402602001604051908101604052809291908181526020018280546116ec90613e12565b80156117375780601f1061170e57610100808354040283529160200191611737565b820191905f5260205f20905b81548152906001019060200180831161171a57829003601f168201915b5050505050815250509050919050565b61174f6126ef565b611757612225565b6001600160a01b0382166117925760405162461bcd60e51b8152602060048201526002602482015261746f60f01b60448201526064016107f6565b6040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156117f6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061181a9190613c74565b90505f8215611829578261182b565b815b90508181111561186c5760405162461bcd60e51b815260206004820152600c60248201526b1a5b9cdd59999a58da595b9d60a21b60448201526064016107f6565b6118a06001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001685836128a7565b50506118ac6001600255565b5050565b6118b86126ef565b6006546005805463ffffffff909216915f9190839081106118db576118db613c60565b5f91825260209182902060059091020191506118f990840184613f7b565b156119a3576127106119116060850160408601613c9a565b61ffff161115611934576040516303ea9f9160e41b815260040160405180910390fd5b6119446040840160208501613c9a565b61ffff166119586060850160408601613c9a565b61ffff16101561197b576040516303ea9f9160e41b815260040160405180910390fd5b82606001358360800135116119a3576040516303ea9f9160e41b815260040160405180910390fd5b6119b06020840184613f7b565b815460ff19169015151781556119cc6040840160208501613c9a565b815461ffff919091166101000262ffff00199091161781556119f46060840160408501613c9a565b815461ffff9190911663010000000264ffff000000199091161781556060830135600182015560808301356002820155611a3460c0840160a08501613fbc565b816003015f6101000a81548160ff02191690836003811115611a5857611a586139fd565b0217905550611a6a60c0840184613fda565b6004830191611a7a919083614024565b507f4d91897f905c3724d61ac88d6c8bb1357c715ce479b0fecdd41c061bd3b480df82611aaa6020860186613f7b565b611aba6040870160208801613c9a565b611aca6060880160408901613c9a565b60608801356080890135611ae460c08b0160a08c01613fbc565b604051611af797969594939291906140df565b60405180910390a1505050565b611b0c612225565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611b5557604051635c427cd960e01b815260040160405180910390fd5b611b6160066001614121565b60ff1681511015611b8a578051604051631ac7debd60e31b81526004016107f691815260200190565b5f8381526009602090815260409182902082516101808101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015462ffffff811660a083015261ffff63010000008204811660c0840152600160281b8204811660e0840152600160381b82041661010083015263ffffffff600160481b82041661012083015260ff600160681b820481161515610140840152600160701b9091041615156101608201819052611c7157604051635c427cd960e01b815260040160405180910390fd5b611c838160600151826080015161227c565b5f84815260096020526040812080546001600160a01b03191681556001810182905560028101829055600381018290556004808201839055600590910180546001600160781b0319169055610120830151815463ffffffff909116908110611ced57611ced613c60565b5f91825260208083206040805161010080820183526003909502909201805460ff81161515845261ffff95810486169484019490945263010000008404851691830191909152600160281b830484166060830152600160381b830484166080830152600160481b90920490921660a0830152600181015460c08301526002015460e0808301919091528401519092508190611d8c9085908590886128d7565b915091505f611d9e8560800151612a05565b6002836002811115611db257611db26139fd565b148015611dc157508461014001515b15611ea4575f86600660ff1681518110611ddd57611ddd613c60565b602002602001015190506008545f1480611df957506008548110155b15611e1a576040516372f608b960e01b8152600481018290526024016107f6565b60035486516020880151604051639f93d29760e01b81526001600160a01b039283166004820152602481019190915260448101849052911690639f93d297906064016020604051808303815f875af1158015611e78573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e9c9190613c74565b915050611ef8565b6001836002811115611eb857611eb86139fd565b03611ef85784516060860151611ef8916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916128a7565b5f6001846002811115611f0d57611f0d6139fd565b14611f18575f611f1e565b85606001515b86519091506001600160a01b0316897f1023c725b169595eced03b027e3e43cf5c3d32b69dca8f80ef0ef4965f5025fe866002811115611f6057611f606139fd565b6040805160ff928316815260208101879052918816908201526060810186905260800160405180910390a3505050505050611f9b6001600255565b505050565b5f80808080808063ffffffff89811614611fba5788611fc4565b60065463ffffffff165b60045490915063ffffffff821610611fee5760405162461bcd60e51b81526004016107f690613f96565b5f60048263ffffffff168154811061200857612008613c60565b5f9182526020918290206040805161010080820183526003909402909201805460ff81161515845261ffff94810485169584019590955263010000008504841691830191909152600160281b840483166060830152600160381b840483166080830152600160481b90930490911660a0820152600182015460c082015260029091015460e0820152905061209f8c8c84848d612a7f565b919950909750955085876120b58a61271061413a565b6120bf919061413a565b6120c9919061413a565b94506120d98c8260600151612b85565b925060646120e78c8e614155565b6120f19190614180565b935050509499939850945094509450565b61210a6126ef565b600180546001600160a01b0383166001600160a01b0319909116811790915561213a5f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61217a6137e0565b60065460048054909163ffffffff1690811061219857612198613c60565b5f9182526020918290206040805161010080820183526003909402909201805460ff81161515845261ffff94810485169584019590955263010000008504841691830191909152600160281b840483166060830152600160381b840483166080830152600160481b90930490911660a0820152600182015460c082015260029091015460e0820152919050565b60028054036122765760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107f6565b60028055565b5f612287828461419f565b905080600754101561229c575f600755505050565b8060075f8282546122ad9190613f68565b9091555050505050565b6006545f90819081906122d5908890889063ffffffff168888612a7f565b9250925092509450945094915050565b5f6122f283836064612c89565b90505b92915050565b5f8161ffff165f0361230e57505f6122f5565b6122f28361ffff8416612710612c89565b600654600480545f9263ffffffff1690811061233d5761233d613c60565b5f91825260208083206040805161010080820183526003909502909201805460ff81161515845261ffff95810486169484019490945263010000008404851691830191909152600160281b830484166060830152600160381b830484166080830152600160481b90920490921660a08301819052600182015460c084015260029091015460e0830152909250156123d8578160a001516123da565b855b90505f6123ed8861ffff84166064612c89565b90505f816007546123fe919061419f565b6040516370a0823160e01b81523060048201529091505f906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612465573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124899190613c74565b9050818110156124b657604051633767435f60e21b815260048101829052602481018390526044016107f6565b5f856060015161ffff161180156124d657506003546001600160a01b0316155b156124f45760405163a39da84760e01b815260040160405180910390fd5b85801561250457505f8761ffff16115b15612568576003546040516309a3196f60e11b8152306004820152602481018a90526001600160a01b039091169063134632de906044015f6040518083038186803b158015612551575f80fd5b505afa158015612563573d5f803e3d5ffd5b505050505b50505050505050505050565b5f8183600754612584919061419f565b61258e919061419f565b6040516370a0823160e01b81523060048201529091505f906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156125f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126199190613c74565b90508181101561264657604051633767435f60e21b815260048101829052602481018390526044016107f6565b506007555050565b5f8061265983612d6d565b6040516342dc46ad60e11b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906385b88d5a906126a89084906004016141b2565b6020604051808303815f875af11580156126c4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126e89190613c74565b9392505050565b5f546001600160a01b031633146110c15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107f6565b600180546001600160a01b03191690556112b381612e73565b8015806127d95750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156127b3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127d79190613c74565b155b6128445760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016107f6565b6040516001600160a01b038316602482015260448101829052611f9b90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612ec2565b6040516001600160a01b038316602482015260448101829052611f9b90849063a9059cbb60e01b90606401612870565b5f805f8660c0015161ffff1690505f87610100015161ffff16826128fb919061419f565b90505f61290c61ffff88168361419f565b90505f5b600660ff821610156129f0575f878260ff168151811061293257612932613c60565b6020026020010151905061271061ffff168110612965576040516372f608b960e01b8152600481018290526024016107f6565b612970826001614121565b955084811015612988576001965050505050506129fc565b838110156129bb5761299c6001600661420d565b60ff168260ff16036129b5575f965050505050506129fc565b506129de565b828110156129d1576002965050505050506129fc565b5f965050505050506129fc565b806129e881614226565b915050612910565b505f6006945094505050505b94509492505050565b801580612a1b57506003546001600160a01b0316155b15612a235750565b60035460405163be99970560e01b8152600481018390526001600160a01b039091169063be999705906024015f604051808303815f87803b158015612a66575f80fd5b505af1158015612a78573d5f803e3d5ffd5b5050505050565b60405163fdbae39560e01b81523060048201525f9081908190819081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063fdbae3959060240160a060405180830381865afa158015612aeb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b0f9190614244565b945094505050505f612b268989604001518d612f95565b90508615612b3d5780945087602001519350612b53565b5f9450808860200151612b509190613cc9565b93505b5f612b6384848b60600151612fef565b9050612b718b868884613042565b508097505050505050955095509592505050565b5f8161ffff165f03612b9857505f6122f5565b60405163fdbae39560e01b81523060048201525f9081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063fdbae3959060240160a060405180830381865afa158015612bfe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c229190614244565b945094505050505f61271061ffff168284612710612c40919061413a565b612c4a919061413a565b612c589061ffff1688614155565b612c629190614180565b9050612710612c7561ffff871683614155565b612c7f9190614180565b9695505050505050565b5f80805f19858709858702925082811083820303915050805f03612cc057838281612cb657612cb661416c565b04925050506126e8565b808411612d075760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b60448201526064016107f6565b5f84868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203025f889003889004909101858311909403939093029303949094049190911702949350505050565b6060612d7b60066001614121565b60ff1667ffffffffffffffff811115612d9657612d96613b4b565b604051908082528060200260200182016040528015612dda57816020015b604080518082019091525f8082526020820152815260200190600190039081612db45790505b50604080518082019091525f8082526127106020830152919250905b6006811015612e305781838281518110612e1257612e12613c60565b60200260200101819052508080612e28906142b5565b915050612df6565b50604080518082019091525f81526001600160801b0384166020820152825183906006908110612e6257612e62613c60565b602002602001018190525050919050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f612f16826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131159092919063ffffffff16565b905080515f1480612f36575080806020019051810190612f3691906142cd565b611f9b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107f6565b5f8060058563ffffffff1681548110612fb057612fb0613c60565b5f9182526020909120600590910201805490915060ff16612fd457839150506126e8565b612fe6612fe082613123565b846131f5565b95945050505050565b5f8083612ffe8661271061413a565b613008919061413a565b61ffff1690505f61271061301c858261413a565b61302a9061ffff1684614155565b6130349190614180565b9050612c7f81612710613f68565b5f80806130518461271061413a565b61ffff1690505f6130618761335d565b90505f6130718361271084612c89565b90506130946127108a613085606485614155565b61308f9190614180565b6133c4565b945061271061ffff888116906130af908b811690891661419f565b6130b9919061419f565b11156130e5576064886130ce8761271061413a565b6130d8919061413a565b6130e2919061413a565b96505b86886130f38761271061413a565b6130fd919061413a565b613107919061413a565b935050505094509492505050565b6060610c7f84845f856133d9565b61312b613823565b5f8083600401805461313c90613e12565b9050116131575760405180602001604052805f81525061317b565b8260040160405160200161316b91906142e8565b6040516020818303038152906040525b6040805160e081018252855460ff8082161515835261ffff6101008304811660208501526301000000909204909116928201929092526001860154606082015260028601546080820152600380870154939450909260a084019216908111156131e6576131e66139fd565b81526020019190915292915050565b81515f9061321657604051630526e7cf60e31b815260040160405180910390fd5b826020015161ffff16836040015161ffff16101561324757604051635b5e411160e11b815260040160405180910390fd5b826040015161ffff165f0361325d57505f6122f5565b826060015182101561327057505f6122f5565b82606001518360800151116132985760405163bc5b36f560e01b815260040160405180910390fd5b826080015182106132ae575060408201516122f5565b5f836060015184608001516132c39190613f68565b90505f81670de0b6b3a76400008660600151866132e09190613f68565b6132ea9190614155565b6132f49190614180565b90505f6133058660a00151836134b0565b90505f866020015161ffff1690505f81886040015161ffff166133289190613f68565b9050670de0b6b3a764000061333d8483614155565b6133479190614180565b613351908361419f565b98975050505050505050565b612710805f5b61336f6001600661420d565b60ff168160ff1610156133bd5761271061338d61ffff861684614155565b6133979190614180565b915081156133bd576133a9828461419f565b9250806133b581614226565b915050613363565b5050919050565b5f8183106133d257816122f2565b5090919050565b60608247101561343a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107f6565b5f80866001600160a01b03168587604051613455919061435a565b5f6040518083038185875af1925050503d805f811461348f576040519150601f19603f3d011682016040523d82523d5f602084013e613494565b606091505b50915091506134a5878383876134cc565b979650505050505050565b5f6122f28360038111156134c6576134c66139fd565b83613544565b6060831561353a5782515f03613533576001600160a01b0385163b6135335760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107f6565b5081610c7f565b610c7f838361363f565b5f815f0361355357505f6122f5565b670de0b6b3a764000082106135715750670de0b6b3a76400006122f5565b60ff83166135805750806122f5565b5f1960ff8416016135af57670de0b6b3a764000061359e8380614155565b6135a89190614180565b90506122f5565b60011960ff8416016135d5576135a86135d0670de0b6b3a764000084614155565b613669565b60021960ff841601613626575f670de0b6b3a76400006135f58480614155565b6135ff9190614180565b9050670de0b6b3a76400006136148483614155565b61361e9190614180565b9150506122f5565b60405163f57ae95760e01b815260040160405180910390fd5b81511561364f5781518083602001fd5b8060405162461bcd60e51b81526004016107f69190614375565b5f815f0361367857505f919050565b5f60016136848461374d565b901c6001901b9050600181848161369d5761369d61416c565b048201901c905060018184816136b5576136b561416c565b048201901c905060018184816136cd576136cd61416c565b048201901c905060018184816136e5576136e561416c565b048201901c905060018184816136fd576136fd61416c565b048201901c905060018184816137155761371561416c565b048201901c9050600181848161372d5761372d61416c565b048201901c90506126e8818285816137475761374761416c565b046133c4565b5f80608083901c1561376157608092831c92015b604083901c1561377357604092831c92015b602083901c1561378557602092831c92015b601083901c1561379757601092831c92015b600883901c156137a957600892831c92015b600483901c156137bb57600492831c92015b600283901c156137cd57600292831c92015b600183901c156122f55760010192915050565b60408051610100810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915290565b6040805160e0810182525f8082526020820181905291810182905260608101829052608081018290529060a08201908152602001606081525090565b5f805f8060608587031215613872575f80fd5b8435935060208501359250604085013567ffffffffffffffff80821115613897575f80fd5b818701915087601f8301126138aa575f80fd5b8135818111156138b8575f80fd5b8860208285010111156138c9575f80fd5b95989497505060200194505050565b6001600160a01b03811681146112b3575f80fd5b80151581146112b3575f80fd5b5f805f806080858703121561390c575f80fd5b84359350602085013592506040850135613925816138d8565b91506060850135613935816138ec565b939692955090935050565b5f60208284031215613950575f80fd5b5035919050565b5f6101008284031215613968575f80fd5b50919050565b5f61010082019050825115158252602083015161ffff8082166020850152806040860151166040850152806060860151166060850152806080860151166080850152505060a08301516139c760a084018261ffff169052565b5060c083015160c083015260e083015160e083015292915050565b5f602082840312156139f2575f80fd5b81356126e8816138d8565b634e487b7160e01b5f52602160045260245ffd5b60048110613a2d57634e487b7160e01b5f52602160045260245ffd5b9052565b5f5b83811015613a4b578181015183820152602001613a33565b50505f910152565b5f8151808452613a6a816020860160208601613a31565b601f01601f19169290920160200192915050565b602081528151151560208201525f602083015161ffff8082166040850152806040860151166060850152505060608301516080830152608083015160a083015260a0830151613ad060c0840182613a11565b5060c083015160e080840152610c7f610100840182613a53565b5f8060408385031215613afb575f80fd5b8235613b06816138d8565b946020939093013593505050565b5f60208284031215613b24575f80fd5b813567ffffffffffffffff811115613b3a575f80fd5b820160e081850312156126e8575f80fd5b634e487b7160e01b5f52604160045260245ffd5b5f805f60608486031215613b71575f80fd5b833592506020808501359250604085013567ffffffffffffffff80821115613b97575f80fd5b818701915087601f830112613baa575f80fd5b813581811115613bbc57613bbc613b4b565b8060051b604051601f19603f83011681018181108582111715613be157613be1613b4b565b60405291825284820192508381018501918a831115613bfe575f80fd5b938501935b82851015613c1c57843584529385019392850192613c03565b8096505050505050509250925092565b5f805f8060808587031215613c3f575f80fd5b8435935060208501359250604085013563ffffffff81168114613925575f80fd5b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215613c84575f80fd5b5051919050565b61ffff811681146112b3575f80fd5b5f60208284031215613caa575f80fd5b81356126e881613c8b565b634e487b7160e01b5f52601160045260245ffd5b61ffff818116838216019080821115613ce457613ce4613cb5565b5092915050565b5f81356122f581613c8b565b8135613d02816138ec565b815460ff19811691151560ff1691821783556020840135613d2281613c8b565b62ffff008160081b168362ffffff19841617178455505050613d65613d4960408401613ceb565b825464ffff000000191660189190911b64ffff00000016178255565b613d94613d7460608401613ceb565b825466ffff0000000000191660289190911b66ffff000000000016178255565b613dc3613da360808401613ceb565b825461ffff60381b191660389190911b68ffff0000000000000016178255565b613dfa613dd260a08401613ceb565b82546affff000000000000000000191660489190911b6affff00000000000000000016178255565b60c0820135600182015560e082013560028201555050565b600181811c90821680613e2657607f821691505b60208210810361396857634e487b7160e01b5f52602260045260245ffd5b601f821115611f9b575f81815260208120601f850160051c81016020861015613e6a5750805b601f850160051c820191505b81811015613e8957828155600101613e76565b505050505050565b818103613e9c575050565b613ea68254613e12565b67ffffffffffffffff811115613ebe57613ebe613b4b565b613ed281613ecc8454613e12565b84613e44565b5f601f821160018114613f03575f8315613eec5750848201545b5f19600385901b1c1916600184901b178455612a78565b5f85815260209020601f198416905f86815260209020845b83811015613f3b5782860154825560019586019590910190602001613f1b565b5085831015613f5857818501545f19600388901b60f8161c191681555b5050505050600190811b01905550565b818103818111156122f5576122f5613cb5565b5f60208284031215613f8b575f80fd5b81356126e8816138ec565b6020808252600c908201526b0c6dedcccd2ce40d2dcc8caf60a31b604082015260600190565b5f60208284031215613fcc575f80fd5b8135600481106126e8575f80fd5b5f808335601e19843603018112613fef575f80fd5b83018035915067ffffffffffffffff821115614009575f80fd5b60200191503681900382131561401d575f80fd5b9250929050565b67ffffffffffffffff83111561403c5761403c613b4b565b6140508361404a8354613e12565b83613e44565b5f601f841160018114614081575f851561406a5750838201355b5f19600387901b1c1916600186901b178355612a78565b5f83815260209020601f19861690835b828110156140b15786850135825560209485019460019092019101614091565b50868210156140cd575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b63ffffffff88168152861515602082015261ffff8681166040830152851660608201526080810184905260a0810183905260e0810161335160c0830184613a11565b60ff81811683821601908111156122f5576122f5613cb5565b61ffff828116828216039080821115613ce457613ce4613cb5565b80820281158282048414176122f5576122f5613cb5565b634e487b7160e01b5f52601260045260245ffd5b5f8261419a57634e487b7160e01b5f52601260045260245ffd5b500490565b808201808211156122f5576122f5613cb5565b602080825282518282018190525f919060409081850190868401855b8281101561420057815180516001600160801b03908116865290870151168685015292840192908501906001016141ce565b5091979650505050505050565b60ff82811682821603908111156122f5576122f5613cb5565b5f60ff821660ff810361423b5761423b613cb5565b60010192915050565b5f805f805f60a08688031215614258575f80fd5b8551614263816138ec565b6020870151909550614274816138d8565b6040870151909450614285816138d8565b606087015190935061429681613c8b565b60808701519092506142a781613c8b565b809150509295509295909350565b5f600182016142c6576142c6613cb5565b5060010190565b5f602082840312156142dd575f80fd5b81516126e8816138ec565b5f8083546142f581613e12565b6001828116801561430d57600181146143225761434e565b60ff198416875282151583028701945061434e565b875f526020805f205f5b858110156143455781548a82015290840190820161432c565b50505082870194505b50929695505050505050565b5f825161436b818460208701613a31565b9190910192915050565b602081525f6122f26020830184613a5356fea264697066735822122008e546751e66c050b151fa5ed681e355574249771f28644b28cd0ea088736fce64736f6c634300081400330000000000000000000000003bdfa6ba04d81af6835405a96c253ccd7d55c1de0000000000000000000000006d1c1a97f3cc43475142900ebb5ebb890791eae800000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061016d575f3560e01c80638da5cb5b116100d9578063cdd5bd2111610093578063daa5eb921161006e578063daa5eb9214610484578063e30c3978146104a9578063f2fde38b146104ba578063fe574315146104cd575f80fd5b8063cdd5bd2114610404578063d12cc5e21461042b578063da7f5bd414610434575f80fd5b80638da5cb5b146103815780638e70e256146103915780638f46500e146103a457806395ccea67146103cb578063a262496b146103de578063b1d94c95146103f1575f80fd5b8063715018a61161012a578063715018a6146103215780637222cc0d14610329578063743753591461034957806379ba5097146103515780637e95385c146103595780638a2cc52d1461036c575f80fd5b806310be33011461017157806326ca096f1461018657806349cd772e146101ac5780634cbe6423146101eb578063516e3e7f146102fb5780636b31ee011461030e575b5f80fd5b61018461017f36600461385f565b6104d5565b005b6101996101943660046138f9565b6106ac565b6040519081526020015b60405180910390f35b6101d37f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c81565b6040516001600160a01b0390911681526020016101a3565b6102806101f9366004613940565b60096020525f90815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039094169492939192909162ffffff81169061ffff63010000008204811691600160281b8104821691600160381b8204169063ffffffff600160481b8204169060ff600160681b8204811691600160701b9004168c565b604080516001600160a01b03909d168d5260208d019b909b52998b019890985260608a0196909652608089019490945262ffffff90921660a088015261ffff90811660c088015290811660e08701521661010085015263ffffffff1661012084015215156101408301521515610160820152610180016101a3565b610184610309366004613957565b610c87565b6003546101d3906001600160a01b031681565b6101846110b0565b61033c610337366004613940565b6110c3565b6040516101a3919061396e565b61019961118d565b61018461123c565b6101846103673660046139e2565b6112b6565b610374611493565b6040516101a39190613a7e565b5f546001600160a01b03166101d3565b61037461039f366004613940565b6115e1565b6101d37f0000000000000000000000006d1c1a97f3cc43475142900ebb5ebb890791eae881565b6101846103d9366004613aea565b611747565b6101846103ec366004613b14565b6118b0565b6101846103ff366004613b5f565b611b04565b6101d37f0000000000000000000000003bdfa6ba04d81af6835405a96c253ccd7d55c1de81565b61019960075481565b610447610442366004613c2c565b611fa0565b6040805161ffff978816815295871660208701529386169385019390935293166060830152608082019290925260a081019190915260c0016101a3565b6006546104949063ffffffff1681565b60405163ffffffff90911681526020016101a3565b6001546001600160a01b03166101d3565b6101846104c83660046139e2565b612102565b61033c612172565b6104dd612225565b336001600160a01b037f0000000000000000000000006d1c1a97f3cc43475142900ebb5ebb890791eae8161461052657604051635c427cd960e01b815260040160405180910390fd5b5f8481526009602090815260409182902082516101808101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015462ffffff811660a083015261ffff63010000008204811660c0840152600160281b8204811660e0840152600160381b82041661010083015263ffffffff600160481b82041661012083015260ff600160681b820481161515610140840152600160701b90910416151561016082018190526105fa575061069c565b61060c8160600151826080015161227c565b5f85815260096020908152604080832080546001600160a01b03191681556001810184905560028101849055600381018490556004810193909355600590920180546001600160781b0319169055825191518681526001600160a01b039092169187917f60ba136ab58a4f463e4c4ba498ce1c0319590f78afb19cc51d0896562850d7fa910160405180910390a3505b6106a66001600255565b50505050565b5f6106b5612225565b60408051610140810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905260065463ffffffff16610100820181905284151561012083015260048054929392909190811061072657610726613c60565b5f9182526020918290206040805161010080820183526003909402909201805460ff8116151580855261ffff95820486169685019690965263010000008104851692840192909252600160281b820484166060840152600160381b820484166080840152600160481b90910490921660a0820152600182015460c082015260029091015460e082015291506107ce5760405163807c29d560e01b815260040160405180910390fd5b806080015161ffff168610156107ff57604051639f44c9eb60e01b8152600481018790526024015b60405180910390fd5b60a081015161ffff161580159061081d57508060a0015161ffff1686115b1561083e57604051639f44c9eb60e01b8152600481018790526024016107f6565b5f8160c0015111801561085457508060c0015187105b156108825760c0810151604051630c7753cf60e11b81526107f6918991600401918252602082015260400190565b5f8160e0015111801561089857508060e0015187115b156108c65760e08101516040516305674a3d60e11b81526107f6918991600401918252602082015260400190565b5f816060015161ffff161180156108e657506003546001600160a01b0316155b156109045760405163a39da84760e01b815260040160405180910390fd5b83801561091857505f816040015161ffff16115b80156109245750600854155b156109425760405163a39da84760e01b815260040160405180910390fd5b61094e878783876122b7565b61ffff90811660c086015290811660e08501521660a083015250604051639179d03160e01b81523360048201526001600160a01b038581166024830152604482018890527f0000000000000000000000003bdfa6ba04d81af6835405a96c253ccd7d55c1de1690639179d031906064016020604051808303815f875af11580156109da573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109fe9190613c74565b60208201819052610a3c5760405162461bcd60e51b81526020600482015260086024820152676e6574207a65726f60c01b60448201526064016107f6565b85815262ffffff85166080820152610a5486866122e5565b6040820152602081015160065460048054610a9f939263ffffffff16908110610a7f57610a7f613c60565b5f918252602090912060039091020154600160281b900461ffff166122fb565b816060018181525050610abd868683602001518460e001518761231f565b610acf81604001518260600151612574565b610af4838015610ae057505f600854115b610aec5761271061264e565b60085461264e565b5f8181526009602090815260409182902080546001600160a01b03191633178155845160018201559084015160028201559083015160038201556060830151600482015560808301516005909101805460a085015160e086015160c0870151610100880151610120890151600160701b62ffffff90981664ffffffffff1990961695909517630100000061ffff958616021768ffffffff00000000001916600160281b9385169390930261ffff60381b191692909217600160381b9390911692909202919091176dffffffffff0000000000000000001916600160481b63ffffffff9092169190910260ff60681b191617600160681b911515919091021760ff60701b1916919091179055915060208181015160408084015160608086015160065484518d8152968701959095529285018a9052840152608083015263ffffffff1660a082015283151560c0820152339083907f3139bcae24ce576ba9f45009f04d6527eb8d72a378730c2522a70615df801bac9060e00160405180910390a350610c7f6001600255565b949350505050565b610c8f6126ef565b612710610ca26060830160408401613c9a565b610cb26040840160208501613c9a565b610cbc9190613cc9565b61ffff161115610cdf576040516303ea9f9160e41b815260040160405180910390fd5b612710610cf26080830160608401613c9a565b61ffff161115610d15576040516303ea9f9160e41b815260040160405180910390fd5b6065610d2760a0830160808401613c9a565b61ffff161015610d6157610d4160a0820160808301613c9a565b604051639f44c9eb60e01b815261ffff90911660048201526024016107f6565b610d7160c0820160a08301613c9a565b61ffff1615801590610da85750610d8e60a0820160808301613c9a565b61ffff16610da260c0830160a08401613c9a565b61ffff16105b15610dbd57610d4160c0820160a08301613c9a565b60e081013515801590610dd757508060c001358160e00135105b15610e05576040516305674a3d60e11b815260e0820135600482015260c082013560248201526044016107f6565b5f610e166060830160408401613c9a565b61ffff161180610e3857505f610e326080830160608401613c9a565b61ffff16115b15610e66576003546001600160a01b0316610e665760405163a39da84760e01b815260040160405180910390fd5b600480546001810182555f9190915281906003027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01610ea68282613cf7565b5050600654600580549091829163ffffffff909116908110610eca57610eca613c60565b5f9182526020808320845460018082018755958552919093206005928302909301805492909102909201805460ff1980821660ff94851615159081178455855462ffffff1990931662ffff0019909116176101009283900461ffff90811690930217808455855464ffff0000001990911663010000009182900490931602919091178255838501548286015560028085015490830155600380850154818401805496979496919095169493921691908490811115610f8a57610f8a6139fd565b0217905550600481810190610fa190840182613e91565b5050600454610fb39150600190613f68565b6006805463ffffffff191663ffffffff9290921691821790557fca932f23940aec2001f8636330f1f10ac2124c06e5a4934bcb3a4382b3c59afa90610ffb6020840184613f7b565b61100b6040850160208601613c9a565b61101b6060860160408701613c9a565b61102b6080870160608801613c9a565b61103b60a0880160808901613c9a565b61104b60c0890160a08a01613c9a565b6040805163ffffffff989098168852951515602088015261ffff9485168787015292841660608701529083166080860152821660a08501521660c08084019190915284013560e08084019190915284013561010083015251908190036101200190a150565b6110b86126ef565b6110c15f612748565b565b6110cb6137e0565b60045482106110ec5760405162461bcd60e51b81526004016107f690613f96565b600482815481106110ff576110ff613c60565b5f9182526020918290206040805161010080820183526003909402909201805460ff81161515845261ffff94810485169584019590955263010000008504841691830191909152600160281b840483166060830152600160381b840483166080830152600160481b90930490911660a0820152600182015460c082015260029091015460e082015292915050565b6040516370a0823160e01b81523060048201525f9081906001600160a01b037f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c16906370a0823190602401602060405180830381865afa1580156111f3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112179190613c74565b90506007548111611229575f91505090565b6007546112369082613f68565b91505090565b60015433906001600160a01b031681146112aa5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016107f6565b6112b381612748565b50565b6112be6126ef565b6003546001600160a01b03168015611304576113046001600160a01b037f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c16825f612761565b6001600160a01b03821661135f57600380546001600160a01b03191690555f60088190556040518181527f6811f857fbf7fb128d096479e00fea9cb36ebeaeeb323cd490ddaf17620bb09b9060200160405180910390a25050565b5f8290505f816001600160a01b031663623860fd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113a0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113c49190613c74565b90508015806113d957506001600160801b0381115b156113f7576040516303ea9f9160e41b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0384811691909117909155600882905561144a907f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c16855f19612761565b836001600160a01b03167f6811f857fbf7fb128d096479e00fea9cb36ebeaeeb323cd490ddaf17620bb09b8260405161148591815260200190565b60405180910390a250505050565b61149b613823565b60065460058054909163ffffffff169081106114b9576114b9613c60565b5f9182526020918290206040805160e0810182526005909302909101805460ff8082161515855261ffff610100830481169686019690965263010000009091049094169183019190915260018101546060830152600281015460808301526003808201549293919260a08501921690811115611537576115376139fd565b6003811115611548576115486139fd565b815260200160048201805461155c90613e12565b80601f016020809104026020016040519081016040528092919081815260200182805461158890613e12565b80156115d35780601f106115aa576101008083540402835291602001916115d3565b820191905f5260205f20905b8154815290600101906020018083116115b657829003601f168201915b505050505081525050905090565b6115e9613823565b600554821061160a5760405162461bcd60e51b81526004016107f690613f96565b6005828154811061161d5761161d613c60565b5f9182526020918290206040805160e0810182526005909302909101805460ff8082161515855261ffff610100830481169686019690965263010000009091049094169183019190915260018101546060830152600281015460808301526003808201549293919260a0850192169081111561169b5761169b6139fd565b60038111156116ac576116ac6139fd565b81526020016004820180546116c090613e12565b80601f01602080910402602001604051908101604052809291908181526020018280546116ec90613e12565b80156117375780601f1061170e57610100808354040283529160200191611737565b820191905f5260205f20905b81548152906001019060200180831161171a57829003601f168201915b5050505050815250509050919050565b61174f6126ef565b611757612225565b6001600160a01b0382166117925760405162461bcd60e51b8152602060048201526002602482015261746f60f01b60448201526064016107f6565b6040516370a0823160e01b81523060048201525f907f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c6001600160a01b0316906370a0823190602401602060405180830381865afa1580156117f6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061181a9190613c74565b90505f8215611829578261182b565b815b90508181111561186c5760405162461bcd60e51b815260206004820152600c60248201526b1a5b9cdd59999a58da595b9d60a21b60448201526064016107f6565b6118a06001600160a01b037f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c1685836128a7565b50506118ac6001600255565b5050565b6118b86126ef565b6006546005805463ffffffff909216915f9190839081106118db576118db613c60565b5f91825260209182902060059091020191506118f990840184613f7b565b156119a3576127106119116060850160408601613c9a565b61ffff161115611934576040516303ea9f9160e41b815260040160405180910390fd5b6119446040840160208501613c9a565b61ffff166119586060850160408601613c9a565b61ffff16101561197b576040516303ea9f9160e41b815260040160405180910390fd5b82606001358360800135116119a3576040516303ea9f9160e41b815260040160405180910390fd5b6119b06020840184613f7b565b815460ff19169015151781556119cc6040840160208501613c9a565b815461ffff919091166101000262ffff00199091161781556119f46060840160408501613c9a565b815461ffff9190911663010000000264ffff000000199091161781556060830135600182015560808301356002820155611a3460c0840160a08501613fbc565b816003015f6101000a81548160ff02191690836003811115611a5857611a586139fd565b0217905550611a6a60c0840184613fda565b6004830191611a7a919083614024565b507f4d91897f905c3724d61ac88d6c8bb1357c715ce479b0fecdd41c061bd3b480df82611aaa6020860186613f7b565b611aba6040870160208801613c9a565b611aca6060880160408901613c9a565b60608801356080890135611ae460c08b0160a08c01613fbc565b604051611af797969594939291906140df565b60405180910390a1505050565b611b0c612225565b336001600160a01b037f0000000000000000000000006d1c1a97f3cc43475142900ebb5ebb890791eae81614611b5557604051635c427cd960e01b815260040160405180910390fd5b611b6160066001614121565b60ff1681511015611b8a578051604051631ac7debd60e31b81526004016107f691815260200190565b5f8381526009602090815260409182902082516101808101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015462ffffff811660a083015261ffff63010000008204811660c0840152600160281b8204811660e0840152600160381b82041661010083015263ffffffff600160481b82041661012083015260ff600160681b820481161515610140840152600160701b9091041615156101608201819052611c7157604051635c427cd960e01b815260040160405180910390fd5b611c838160600151826080015161227c565b5f84815260096020526040812080546001600160a01b03191681556001810182905560028101829055600381018290556004808201839055600590910180546001600160781b0319169055610120830151815463ffffffff909116908110611ced57611ced613c60565b5f91825260208083206040805161010080820183526003909502909201805460ff81161515845261ffff95810486169484019490945263010000008404851691830191909152600160281b830484166060830152600160381b830484166080830152600160481b90920490921660a0830152600181015460c08301526002015460e0808301919091528401519092508190611d8c9085908590886128d7565b915091505f611d9e8560800151612a05565b6002836002811115611db257611db26139fd565b148015611dc157508461014001515b15611ea4575f86600660ff1681518110611ddd57611ddd613c60565b602002602001015190506008545f1480611df957506008548110155b15611e1a576040516372f608b960e01b8152600481018290526024016107f6565b60035486516020880151604051639f93d29760e01b81526001600160a01b039283166004820152602481019190915260448101849052911690639f93d297906064016020604051808303815f875af1158015611e78573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e9c9190613c74565b915050611ef8565b6001836002811115611eb857611eb86139fd565b03611ef85784516060860151611ef8916001600160a01b037f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c16916128a7565b5f6001846002811115611f0d57611f0d6139fd565b14611f18575f611f1e565b85606001515b86519091506001600160a01b0316897f1023c725b169595eced03b027e3e43cf5c3d32b69dca8f80ef0ef4965f5025fe866002811115611f6057611f606139fd565b6040805160ff928316815260208101879052918816908201526060810186905260800160405180910390a3505050505050611f9b6001600255565b505050565b5f80808080808063ffffffff89811614611fba5788611fc4565b60065463ffffffff165b60045490915063ffffffff821610611fee5760405162461bcd60e51b81526004016107f690613f96565b5f60048263ffffffff168154811061200857612008613c60565b5f9182526020918290206040805161010080820183526003909402909201805460ff81161515845261ffff94810485169584019590955263010000008504841691830191909152600160281b840483166060830152600160381b840483166080830152600160481b90930490911660a0820152600182015460c082015260029091015460e0820152905061209f8c8c84848d612a7f565b919950909750955085876120b58a61271061413a565b6120bf919061413a565b6120c9919061413a565b94506120d98c8260600151612b85565b925060646120e78c8e614155565b6120f19190614180565b935050509499939850945094509450565b61210a6126ef565b600180546001600160a01b0383166001600160a01b0319909116811790915561213a5f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61217a6137e0565b60065460048054909163ffffffff1690811061219857612198613c60565b5f9182526020918290206040805161010080820183526003909402909201805460ff81161515845261ffff94810485169584019590955263010000008504841691830191909152600160281b840483166060830152600160381b840483166080830152600160481b90930490911660a0820152600182015460c082015260029091015460e0820152919050565b60028054036122765760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107f6565b60028055565b5f612287828461419f565b905080600754101561229c575f600755505050565b8060075f8282546122ad9190613f68565b9091555050505050565b6006545f90819081906122d5908890889063ffffffff168888612a7f565b9250925092509450945094915050565b5f6122f283836064612c89565b90505b92915050565b5f8161ffff165f0361230e57505f6122f5565b6122f28361ffff8416612710612c89565b600654600480545f9263ffffffff1690811061233d5761233d613c60565b5f91825260208083206040805161010080820183526003909502909201805460ff81161515845261ffff95810486169484019490945263010000008404851691830191909152600160281b830484166060830152600160381b830484166080830152600160481b90920490921660a08301819052600182015460c084015260029091015460e0830152909250156123d8578160a001516123da565b855b90505f6123ed8861ffff84166064612c89565b90505f816007546123fe919061419f565b6040516370a0823160e01b81523060048201529091505f906001600160a01b037f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c16906370a0823190602401602060405180830381865afa158015612465573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124899190613c74565b9050818110156124b657604051633767435f60e21b815260048101829052602481018390526044016107f6565b5f856060015161ffff161180156124d657506003546001600160a01b0316155b156124f45760405163a39da84760e01b815260040160405180910390fd5b85801561250457505f8761ffff16115b15612568576003546040516309a3196f60e11b8152306004820152602481018a90526001600160a01b039091169063134632de906044015f6040518083038186803b158015612551575f80fd5b505afa158015612563573d5f803e3d5ffd5b505050505b50505050505050505050565b5f8183600754612584919061419f565b61258e919061419f565b6040516370a0823160e01b81523060048201529091505f906001600160a01b037f00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c16906370a0823190602401602060405180830381865afa1580156125f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126199190613c74565b90508181101561264657604051633767435f60e21b815260048101829052602481018390526044016107f6565b506007555050565b5f8061265983612d6d565b6040516342dc46ad60e11b81529091506001600160a01b037f0000000000000000000000006d1c1a97f3cc43475142900ebb5ebb890791eae816906385b88d5a906126a89084906004016141b2565b6020604051808303815f875af11580156126c4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126e89190613c74565b9392505050565b5f546001600160a01b031633146110c15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107f6565b600180546001600160a01b03191690556112b381612e73565b8015806127d95750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156127b3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127d79190613c74565b155b6128445760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016107f6565b6040516001600160a01b038316602482015260448101829052611f9b90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612ec2565b6040516001600160a01b038316602482015260448101829052611f9b90849063a9059cbb60e01b90606401612870565b5f805f8660c0015161ffff1690505f87610100015161ffff16826128fb919061419f565b90505f61290c61ffff88168361419f565b90505f5b600660ff821610156129f0575f878260ff168151811061293257612932613c60565b6020026020010151905061271061ffff168110612965576040516372f608b960e01b8152600481018290526024016107f6565b612970826001614121565b955084811015612988576001965050505050506129fc565b838110156129bb5761299c6001600661420d565b60ff168260ff16036129b5575f965050505050506129fc565b506129de565b828110156129d1576002965050505050506129fc565b5f965050505050506129fc565b806129e881614226565b915050612910565b505f6006945094505050505b94509492505050565b801580612a1b57506003546001600160a01b0316155b15612a235750565b60035460405163be99970560e01b8152600481018390526001600160a01b039091169063be999705906024015f604051808303815f87803b158015612a66575f80fd5b505af1158015612a78573d5f803e3d5ffd5b5050505050565b60405163fdbae39560e01b81523060048201525f9081908190819081906001600160a01b037f0000000000000000000000003bdfa6ba04d81af6835405a96c253ccd7d55c1de169063fdbae3959060240160a060405180830381865afa158015612aeb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b0f9190614244565b945094505050505f612b268989604001518d612f95565b90508615612b3d5780945087602001519350612b53565b5f9450808860200151612b509190613cc9565b93505b5f612b6384848b60600151612fef565b9050612b718b868884613042565b508097505050505050955095509592505050565b5f8161ffff165f03612b9857505f6122f5565b60405163fdbae39560e01b81523060048201525f9081906001600160a01b037f0000000000000000000000003bdfa6ba04d81af6835405a96c253ccd7d55c1de169063fdbae3959060240160a060405180830381865afa158015612bfe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c229190614244565b945094505050505f61271061ffff168284612710612c40919061413a565b612c4a919061413a565b612c589061ffff1688614155565b612c629190614180565b9050612710612c7561ffff871683614155565b612c7f9190614180565b9695505050505050565b5f80805f19858709858702925082811083820303915050805f03612cc057838281612cb657612cb661416c565b04925050506126e8565b808411612d075760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b60448201526064016107f6565b5f84868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203025f889003889004909101858311909403939093029303949094049190911702949350505050565b6060612d7b60066001614121565b60ff1667ffffffffffffffff811115612d9657612d96613b4b565b604051908082528060200260200182016040528015612dda57816020015b604080518082019091525f8082526020820152815260200190600190039081612db45790505b50604080518082019091525f8082526127106020830152919250905b6006811015612e305781838281518110612e1257612e12613c60565b60200260200101819052508080612e28906142b5565b915050612df6565b50604080518082019091525f81526001600160801b0384166020820152825183906006908110612e6257612e62613c60565b602002602001018190525050919050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f612f16826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131159092919063ffffffff16565b905080515f1480612f36575080806020019051810190612f3691906142cd565b611f9b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107f6565b5f8060058563ffffffff1681548110612fb057612fb0613c60565b5f9182526020909120600590910201805490915060ff16612fd457839150506126e8565b612fe6612fe082613123565b846131f5565b95945050505050565b5f8083612ffe8661271061413a565b613008919061413a565b61ffff1690505f61271061301c858261413a565b61302a9061ffff1684614155565b6130349190614180565b9050612c7f81612710613f68565b5f80806130518461271061413a565b61ffff1690505f6130618761335d565b90505f6130718361271084612c89565b90506130946127108a613085606485614155565b61308f9190614180565b6133c4565b945061271061ffff888116906130af908b811690891661419f565b6130b9919061419f565b11156130e5576064886130ce8761271061413a565b6130d8919061413a565b6130e2919061413a565b96505b86886130f38761271061413a565b6130fd919061413a565b613107919061413a565b935050505094509492505050565b6060610c7f84845f856133d9565b61312b613823565b5f8083600401805461313c90613e12565b9050116131575760405180602001604052805f81525061317b565b8260040160405160200161316b91906142e8565b6040516020818303038152906040525b6040805160e081018252855460ff8082161515835261ffff6101008304811660208501526301000000909204909116928201929092526001860154606082015260028601546080820152600380870154939450909260a084019216908111156131e6576131e66139fd565b81526020019190915292915050565b81515f9061321657604051630526e7cf60e31b815260040160405180910390fd5b826020015161ffff16836040015161ffff16101561324757604051635b5e411160e11b815260040160405180910390fd5b826040015161ffff165f0361325d57505f6122f5565b826060015182101561327057505f6122f5565b82606001518360800151116132985760405163bc5b36f560e01b815260040160405180910390fd5b826080015182106132ae575060408201516122f5565b5f836060015184608001516132c39190613f68565b90505f81670de0b6b3a76400008660600151866132e09190613f68565b6132ea9190614155565b6132f49190614180565b90505f6133058660a00151836134b0565b90505f866020015161ffff1690505f81886040015161ffff166133289190613f68565b9050670de0b6b3a764000061333d8483614155565b6133479190614180565b613351908361419f565b98975050505050505050565b612710805f5b61336f6001600661420d565b60ff168160ff1610156133bd5761271061338d61ffff861684614155565b6133979190614180565b915081156133bd576133a9828461419f565b9250806133b581614226565b915050613363565b5050919050565b5f8183106133d257816122f2565b5090919050565b60608247101561343a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107f6565b5f80866001600160a01b03168587604051613455919061435a565b5f6040518083038185875af1925050503d805f811461348f576040519150601f19603f3d011682016040523d82523d5f602084013e613494565b606091505b50915091506134a5878383876134cc565b979650505050505050565b5f6122f28360038111156134c6576134c66139fd565b83613544565b6060831561353a5782515f03613533576001600160a01b0385163b6135335760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107f6565b5081610c7f565b610c7f838361363f565b5f815f0361355357505f6122f5565b670de0b6b3a764000082106135715750670de0b6b3a76400006122f5565b60ff83166135805750806122f5565b5f1960ff8416016135af57670de0b6b3a764000061359e8380614155565b6135a89190614180565b90506122f5565b60011960ff8416016135d5576135a86135d0670de0b6b3a764000084614155565b613669565b60021960ff841601613626575f670de0b6b3a76400006135f58480614155565b6135ff9190614180565b9050670de0b6b3a76400006136148483614155565b61361e9190614180565b9150506122f5565b60405163f57ae95760e01b815260040160405180910390fd5b81511561364f5781518083602001fd5b8060405162461bcd60e51b81526004016107f69190614375565b5f815f0361367857505f919050565b5f60016136848461374d565b901c6001901b9050600181848161369d5761369d61416c565b048201901c905060018184816136b5576136b561416c565b048201901c905060018184816136cd576136cd61416c565b048201901c905060018184816136e5576136e561416c565b048201901c905060018184816136fd576136fd61416c565b048201901c905060018184816137155761371561416c565b048201901c9050600181848161372d5761372d61416c565b048201901c90506126e8818285816137475761374761416c565b046133c4565b5f80608083901c1561376157608092831c92015b604083901c1561377357604092831c92015b602083901c1561378557602092831c92015b601083901c1561379757601092831c92015b600883901c156137a957600892831c92015b600483901c156137bb57600492831c92015b600283901c156137cd57600292831c92015b600183901c156122f55760010192915050565b60408051610100810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915290565b6040805160e0810182525f8082526020820181905291810182905260608101829052608081018290529060a08201908152602001606081525090565b5f805f8060608587031215613872575f80fd5b8435935060208501359250604085013567ffffffffffffffff80821115613897575f80fd5b818701915087601f8301126138aa575f80fd5b8135818111156138b8575f80fd5b8860208285010111156138c9575f80fd5b95989497505060200194505050565b6001600160a01b03811681146112b3575f80fd5b80151581146112b3575f80fd5b5f805f806080858703121561390c575f80fd5b84359350602085013592506040850135613925816138d8565b91506060850135613935816138ec565b939692955090935050565b5f60208284031215613950575f80fd5b5035919050565b5f6101008284031215613968575f80fd5b50919050565b5f61010082019050825115158252602083015161ffff8082166020850152806040860151166040850152806060860151166060850152806080860151166080850152505060a08301516139c760a084018261ffff169052565b5060c083015160c083015260e083015160e083015292915050565b5f602082840312156139f2575f80fd5b81356126e8816138d8565b634e487b7160e01b5f52602160045260245ffd5b60048110613a2d57634e487b7160e01b5f52602160045260245ffd5b9052565b5f5b83811015613a4b578181015183820152602001613a33565b50505f910152565b5f8151808452613a6a816020860160208601613a31565b601f01601f19169290920160200192915050565b602081528151151560208201525f602083015161ffff8082166040850152806040860151166060850152505060608301516080830152608083015160a083015260a0830151613ad060c0840182613a11565b5060c083015160e080840152610c7f610100840182613a53565b5f8060408385031215613afb575f80fd5b8235613b06816138d8565b946020939093013593505050565b5f60208284031215613b24575f80fd5b813567ffffffffffffffff811115613b3a575f80fd5b820160e081850312156126e8575f80fd5b634e487b7160e01b5f52604160045260245ffd5b5f805f60608486031215613b71575f80fd5b833592506020808501359250604085013567ffffffffffffffff80821115613b97575f80fd5b818701915087601f830112613baa575f80fd5b813581811115613bbc57613bbc613b4b565b8060051b604051601f19603f83011681018181108582111715613be157613be1613b4b565b60405291825284820192508381018501918a831115613bfe575f80fd5b938501935b82851015613c1c57843584529385019392850192613c03565b8096505050505050509250925092565b5f805f8060808587031215613c3f575f80fd5b8435935060208501359250604085013563ffffffff81168114613925575f80fd5b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215613c84575f80fd5b5051919050565b61ffff811681146112b3575f80fd5b5f60208284031215613caa575f80fd5b81356126e881613c8b565b634e487b7160e01b5f52601160045260245ffd5b61ffff818116838216019080821115613ce457613ce4613cb5565b5092915050565b5f81356122f581613c8b565b8135613d02816138ec565b815460ff19811691151560ff1691821783556020840135613d2281613c8b565b62ffff008160081b168362ffffff19841617178455505050613d65613d4960408401613ceb565b825464ffff000000191660189190911b64ffff00000016178255565b613d94613d7460608401613ceb565b825466ffff0000000000191660289190911b66ffff000000000016178255565b613dc3613da360808401613ceb565b825461ffff60381b191660389190911b68ffff0000000000000016178255565b613dfa613dd260a08401613ceb565b82546affff000000000000000000191660489190911b6affff00000000000000000016178255565b60c0820135600182015560e082013560028201555050565b600181811c90821680613e2657607f821691505b60208210810361396857634e487b7160e01b5f52602260045260245ffd5b601f821115611f9b575f81815260208120601f850160051c81016020861015613e6a5750805b601f850160051c820191505b81811015613e8957828155600101613e76565b505050505050565b818103613e9c575050565b613ea68254613e12565b67ffffffffffffffff811115613ebe57613ebe613b4b565b613ed281613ecc8454613e12565b84613e44565b5f601f821160018114613f03575f8315613eec5750848201545b5f19600385901b1c1916600184901b178455612a78565b5f85815260209020601f198416905f86815260209020845b83811015613f3b5782860154825560019586019590910190602001613f1b565b5085831015613f5857818501545f19600388901b60f8161c191681555b5050505050600190811b01905550565b818103818111156122f5576122f5613cb5565b5f60208284031215613f8b575f80fd5b81356126e8816138ec565b6020808252600c908201526b0c6dedcccd2ce40d2dcc8caf60a31b604082015260600190565b5f60208284031215613fcc575f80fd5b8135600481106126e8575f80fd5b5f808335601e19843603018112613fef575f80fd5b83018035915067ffffffffffffffff821115614009575f80fd5b60200191503681900382131561401d575f80fd5b9250929050565b67ffffffffffffffff83111561403c5761403c613b4b565b6140508361404a8354613e12565b83613e44565b5f601f841160018114614081575f851561406a5750838201355b5f19600387901b1c1916600186901b178355612a78565b5f83815260209020601f19861690835b828110156140b15786850135825560209485019460019092019101614091565b50868210156140cd575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b63ffffffff88168152861515602082015261ffff8681166040830152851660608201526080810184905260a0810183905260e0810161335160c0830184613a11565b60ff81811683821601908111156122f5576122f5613cb5565b61ffff828116828216039080821115613ce457613ce4613cb5565b80820281158282048414176122f5576122f5613cb5565b634e487b7160e01b5f52601260045260245ffd5b5f8261419a57634e487b7160e01b5f52601260045260245ffd5b500490565b808201808211156122f5576122f5613cb5565b602080825282518282018190525f919060409081850190868401855b8281101561420057815180516001600160801b03908116865290870151168685015292840192908501906001016141ce565b5091979650505050505050565b60ff82811682821603908111156122f5576122f5613cb5565b5f60ff821660ff810361423b5761423b613cb5565b60010192915050565b5f805f805f60a08688031215614258575f80fd5b8551614263816138ec565b6020870151909550614274816138d8565b6040870151909450614285816138d8565b606087015190935061429681613c8b565b60808701519092506142a781613c8b565b809150509295509295909350565b5f600182016142c6576142c6613cb5565b5060010190565b5f602082840312156142dd575f80fd5b81516126e8816138ec565b5f8083546142f581613e12565b6001828116801561430d57600181146143225761434e565b60ff198416875282151583028701945061434e565b875f526020805f205f5b858110156143455781548a82015290840190820161432c565b50505082870194505b50929695505050505050565b5f825161436b818460208701613a31565b9190910192915050565b602081525f6122f26020830184613a5356fea264697066735822122008e546751e66c050b151fa5ed681e355574249771f28644b28cd0ea088736fce64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003bdfa6ba04d81af6835405a96c253ccd7d55c1de0000000000000000000000006d1c1a97f3cc43475142900ebb5ebb890791eae800000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c
-----Decoded View---------------
Arg [0] : handler (address): 0x3BdFa6ba04d81af6835405A96C253cCd7d55C1de
Arg [1] : provider (address): 0x6D1C1a97F3CC43475142900EBB5EBb890791eae8
Arg [2] : eva (address): 0x45D9831d8751B2325f3DBf48db748723726e1C8c
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000003bdfa6ba04d81af6835405a96c253ccd7d55c1de
Arg [1] : 0000000000000000000000006d1c1a97f3cc43475142900ebb5ebb890791eae8
Arg [2] : 00000000000000000000000045d9831d8751b2325f3dbf48db748723726e1c8c
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.