Source Code
Latest 24 from a total of 24 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw House E... | 277094610 | 429 days ago | IN | 0 ETH | 0.00000108 | ||||
| Withdraw House E... | 277094566 | 429 days ago | IN | 0 ETH | 0.00000108 | ||||
| Withdraw House E... | 220120410 | 595 days ago | IN | 0 ETH | 0.000001 | ||||
| Withdraw House E... | 180780713 | 711 days ago | IN | 0 ETH | 0.00004303 | ||||
| Withdraw House E... | 138792925 | 840 days ago | IN | 0 ETH | 0.000022 | ||||
| Withdraw House E... | 138792840 | 840 days ago | IN | 0 ETH | 0.00002474 | ||||
| Withdraw House E... | 134558261 | 853 days ago | IN | 0 ETH | 0.00003644 | ||||
| Accept Token Par... | 128663155 | 872 days ago | IN | 0 ETH | 0.00004689 | ||||
| Withdraw House E... | 108580733 | 934 days ago | IN | 0 ETH | 0.00005197 | ||||
| Revoke Role | 83793650 | 1007 days ago | IN | 0 ETH | 0.00007377 | ||||
| Grant Role | 83793223 | 1007 days ago | IN | 0 ETH | 0.00007919 | ||||
| Set House Edge S... | 83790869 | 1007 days ago | IN | 0 ETH | 0.00011 | ||||
| Set Token VRF Su... | 83790749 | 1007 days ago | IN | 0 ETH | 0.00006432 | ||||
| Set Balance Risk | 83790729 | 1007 days ago | IN | 0 ETH | 0.00006434 | ||||
| Set Allowed Toke... | 83790725 | 1007 days ago | IN | 0 ETH | 0.00006603 | ||||
| Add Token | 83790705 | 1007 days ago | IN | 0 ETH | 0.00005562 | ||||
| Set House Edge S... | 83790302 | 1007 days ago | IN | 0 ETH | 0.00010191 | ||||
| Set Token VRF Su... | 83790212 | 1007 days ago | IN | 0 ETH | 0.00006429 | ||||
| Set Balance Risk | 83790193 | 1007 days ago | IN | 0 ETH | 0.00006432 | ||||
| Set Allowed Toke... | 83790189 | 1007 days ago | IN | 0 ETH | 0.000066 | ||||
| Add Token | 83790186 | 1007 days ago | IN | 0 ETH | 0.00005334 | ||||
| Grant Role | 83780015 | 1007 days ago | IN | 0 ETH | 0.00006963 | ||||
| Grant Role | 83780011 | 1007 days ago | IN | 0 ETH | 0.00006963 | ||||
| Grant Role | 83780007 | 1007 days ago | IN | 0 ETH | 0.00007134 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 277094920 | 429 days ago | 0.0078269 ETH | ||||
| 277094566 | 429 days ago | 0.14057933 ETH | ||||
| 277094566 | 429 days ago | 0.14057933 ETH | ||||
| 277094153 | 429 days ago | 35.94267122 ETH | ||||
| 277022617 | 429 days ago | 0.03 ETH | ||||
| 277021714 | 429 days ago | 0.03 ETH | ||||
| 277021133 | 429 days ago | 0.03 ETH | ||||
| 277020685 | 429 days ago | 0.004 ETH | ||||
| 277020350 | 429 days ago | 0.006 ETH | ||||
| 276856382 | 430 days ago | 0.005 ETH | ||||
| 276856275 | 430 days ago | 0.004 ETH | ||||
| 276856055 | 430 days ago | 0.004 ETH | ||||
| 276597295 | 431 days ago | 0.00194 ETH | ||||
| 276597295 | 431 days ago | 0.00006 ETH | ||||
| 275958238 | 433 days ago | 0.004 ETH | ||||
| 275958143 | 433 days ago | 0.004 ETH | ||||
| 275957947 | 433 days ago | 0.00210816 ETH | ||||
| 275957947 | 433 days ago | 0.000108 ETH | ||||
| 275957831 | 433 days ago | 0.004 ETH | ||||
| 275924311 | 433 days ago | 0.00105408 ETH | ||||
| 275924311 | 433 days ago | 0.000054 ETH | ||||
| 275577595 | 434 days ago | 0.002 ETH | ||||
| 275577486 | 434 days ago | 0.002 ETH | ||||
| 275577164 | 434 days ago | 0.00205411 ETH | ||||
| 275577164 | 434 days ago | 0.000054 ETH |
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Bank
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {IERC20Metadata, IERC20} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Multicall} from "@openzeppelin/contracts/utils/Multicall.sol";
import {KeeperCompatibleInterface} from "@chainlink/contracts/src/v0.8/KeeperCompatible.sol";
interface IGame {
function hasPendingBets(address token) external view returns (bool);
function withdrawTokensVRFFees(address token) external;
}
// import "hardhat/console.sol";
/// @title BetSwirl's Bank
/// @author Romuald Hog
/// @notice The Bank contract holds the casino's funds,
/// whitelist the games betting tokens,
/// define the max bet amount based on a risk,
/// payout the bet profit to user and collect the loss bet amount from the game's contract,
/// split and allocate the house edge taken from each bet (won or loss).
/// The admin role is transfered to a Timelock that execute administrative tasks,
/// only the Games could payout the bet profit from the bank, and send the loss bet amount to the bank.
/// @dev All rates are in basis point.
contract Bank is AccessControlEnumerable, KeeperCompatibleInterface, Multicall {
using SafeERC20 for IERC20;
/// @notice Enum to identify the Chainlink Upkeep registration.
enum UpkeepActions {
DistributePartnerHouseEdge,
DistributeOwnHouseEdge
}
/// @notice Token's house edge allocations struct.
/// The games house edge is split into several allocations.
/// The allocated amounts stays in the bank until authorized parties withdraw. They are subtracted from the balance.
/// @param bank Rate to be allocated to the bank, on bet payout.
/// @param dividend Rate to be allocated as staking rewards, on bet payout.
/// @param partner Rate to be allocated to the partner, on bet payout.
/// @param treasury Rate to be allocated to the treasury, on bet payout.
/// @param team Rate to be allocated to the team, on bet payout.
/// @param dividendAmount The number of tokens to be sent as staking rewards.
/// @param partnerAmount The number of tokens to be sent to the partner.
/// @param treasuryAmount The number of tokens to be sent to the treasury.
/// @param teamAmount The number of tokens to be sent to the team.
struct HouseEdgeSplit {
uint16 bank;
uint16 dividend;
uint16 partner;
uint16 treasury;
uint16 team;
uint256 dividendAmount;
uint256 partnerAmount;
uint256 treasuryAmount;
uint256 teamAmount;
}
/// @notice Token struct.
/// List of tokens to bet on games.
/// @param allowed Whether the token is allowed for bets.
/// @param paused Whether the token is paused for bets.
/// @param balanceRisk Defines the maximum bank payout, used to calculate the max bet amount.
/// @param VRFSubId Chainlink VRF v2 subscription ID.
/// @param partner Address of the partner to manage the token and receive the house edge.
/// @param pendingPartner Address of the elected new partner during transfer
/// @param minBetAmount Minimum bet amount.
/// @param minHouseEdgeWithdrawAmount The minimum amount of token to trigger the distribution of the house edge.
/// @param houseEdgeSplit House edge allocations.
struct Token {
bool allowed;
bool paused;
uint16 balanceRisk;
uint64 VRFSubId;
address partner;
address pendingPartner;
uint256 minBetAmount;
uint256 minHouseEdgeWithdrawAmount;
HouseEdgeSplit houseEdgeSplit;
}
/// @notice Token's metadata struct. It contains additional information from the ERC20 token.
/// @dev Only used on the `getTokens` getter for the front-end.
/// @param decimals Number of token's decimals.
/// @param tokenAddress Contract address of the token.
/// @param name Name of the token.
/// @param symbol Symbol of the token.
/// @param token Token data.
struct TokenMetadata {
uint8 decimals;
address tokenAddress;
string name;
string symbol;
Token token;
}
/// @notice Number of tokens added.
uint8 private _tokensCount;
/// @notice Treasury multi-sig wallet.
address public immutable treasury;
/// @notice Team wallet.
address public teamWallet;
/// @notice Role associated to Games smart contracts.
bytes32 public constant GAME_ROLE = keccak256("GAME_ROLE");
/// @notice Role associated to harvester smart contract.
bytes32 public constant HARVESTER_ROLE = keccak256("HARVESTER_ROLE");
/// @notice Maps tokens addresses to token configuration.
mapping(address => Token) public tokens;
/// @notice Maps tokens indexes to token address.
mapping(uint8 => address) private _tokensList;
/// @notice Emitted after the team wallet is set.
/// @param teamWallet The team wallet address.
event SetTeamWallet(address teamWallet);
/// @notice Emitted after a token is added.
/// @param token Address of the token.
event AddToken(address token);
/// @notice Emitted after the balance risk is set.
/// @param balanceRisk Rate defining the balance risk.
event SetBalanceRisk(address indexed token, uint16 balanceRisk);
/// @notice Emitted after a token is allowed.
/// @param token Address of the token.
/// @param allowed Whether the token is allowed for betting.
event SetAllowedToken(address indexed token, bool allowed);
/// @notice Emitted after the minimum bet amount is set for a token.
/// @param token Address of the token.
/// @param minBetAmount Minimum bet amount.
event SetTokenMinBetAmount(address indexed token, uint256 minBetAmount);
/// @notice Emitted after the token's VRF subscription ID is set.
/// @param token Address of the token.
/// @param subId Subscription ID.
event SetTokenVRFSubId(address indexed token, uint64 subId);
/// @notice Emitted after a token is paused.
/// @param token Address of the token.
/// @param paused Whether the token is paused for betting.
event SetPausedToken(address indexed token, bool paused);
/// @notice Emitted after the Upkeep minimum transfer amount is set.
/// @param token Address of the token.
/// @param minHouseEdgeWithdrawAmount Minimum amount of token to allow transfer.
event SetMinHouseEdgeWithdrawAmount(
address indexed token,
uint256 minHouseEdgeWithdrawAmount
);
/// @notice Emitted after a token partner is set.
/// @param token Address of the token.
/// @param partner Address of the partner.
event SetTokenPartner(address indexed token, address partner);
/// @notice Emitted after a token deposit.
/// @param token Address of the token.
/// @param amount The number of token deposited.
event Deposit(address indexed token, uint256 amount);
/// @notice Emitted after a token withdrawal.
/// @param token Address of the token.
/// @param amount The number of token withdrawn.
/// @param to who gets the funds.
event Withdraw(address indexed token, uint256 amount, address indexed to);
/// @notice Emitted after the token's house edge allocations for bet payout is set.
/// @param token Address of the token.
/// @param bank Rate to be allocated to the bank, on bet payout.
/// @param dividend Rate to be allocated as staking rewards, on bet payout.
/// @param partner Rate to be allocated to the partner, on bet payout.
/// @param treasury Rate to be allocated to the treasury, on bet payout.
/// @param team Rate to be allocated to the team, on bet payout.
event SetTokenHouseEdgeSplit(
address indexed token,
uint16 bank,
uint16 dividend,
uint16 partner,
uint16 treasury,
uint16 team
);
/// @notice Emitted after the token's treasury and team allocations are distributed.
/// @param token Address of the token.
/// @param treasuryAmount The number of tokens sent to the treasury.
/// @param teamAmount The number of tokens sent to the team.
event HouseEdgeDistribution(
address indexed token,
uint256 treasuryAmount,
uint256 teamAmount
);
/// @notice Emitted after the token's partner allocation is distributed.
/// @param token Address of the token.
/// @param partnerAmount The number of tokens sent to the partner.
event HouseEdgePartnerDistribution(
address indexed token,
uint256 partnerAmount
);
/// @notice Emitted after the token's dividend allocation is distributed.
/// @param token Address of the token.
/// @param amount The number of tokens sent to the Harvester.
event HarvestDividend(address indexed token, uint256 amount);
/// @notice Emitted after the token's house edge is allocated.
/// @param token Address of the token.
/// @param bank The number of tokens allocated to bank.
/// @param dividend The number of tokens allocated as staking rewards.
/// @param partner The number of tokens allocated to the partner.
/// @param treasury The number of tokens allocated to the treasury.
/// @param team The number of tokens allocated to the team.
event AllocateHouseEdgeAmount(
address indexed token,
uint256 bank,
uint256 dividend,
uint256 partner,
uint256 treasury,
uint256 team
);
/// @notice Emitted after the bet profit amount is sent to the user.
/// @param token Address of the token.
/// @param newBalance New token balance.
/// @param profit Bet profit amount sent.
event Payout(address indexed token, uint256 newBalance, uint256 profit);
/// @notice Emitted after the bet amount is collected from the game smart contract.
/// @param token Address of the token.
/// @param newBalance New token balance.
/// @param amount Bet amount collected.
event CashIn(address indexed token, uint256 newBalance, uint256 amount);
/// @notice emitted when starting a token's partner transfer
event TokenPartnerTransferStarted(address token, address newPartner);
/// @notice emitted when accepting a token's partner transfer
event TokenPartnerTransferAccepted(address token, address newPartner);
/// @notice Reverting error when trying to add an existing token.
error TokenExists();
/// @notice Reverting error when setting the house edge allocations, but the sum isn't 100%.
/// @param splitSum Sum of the house edge allocations rates.
error WrongHouseEdgeSplit(uint16 splitSum);
/// @notice Reverting error when sender isn't allowed.
error AccessDenied();
/// @notice Reverting error when team wallet or treasury is the zero address.
error WrongAddress();
/// @notice Reverting error when withdrawing a non paused token.
error TokenNotPaused();
/// @notice Reverting error when token has pending bets on a game.
error TokenHasPendingBets();
/// @notice Reverting error when token min bet amount isn't >= 10000.
error UnderMinBetAmountCap(uint16 minBetAmountCap);
/// @notice Modifier that checks that an account is allowed to interact with a token.
/// @param role The required role.
/// @param token The token address.
modifier onlyTokenOwner(bytes32 role, address token) {
address partner = tokens[token].partner;
if (partner == address(0)) {
_checkRole(role, msg.sender);
} else if (msg.sender != partner) {
revert AccessDenied();
}
_;
}
/// @notice Initialize the contract's admin role to the deployer, and state variables.
/// @param treasuryAddress Treasury multi-sig wallet.
/// @param teamWalletAddress Team wallet.
constructor(address treasuryAddress, address teamWalletAddress) {
if (treasuryAddress == address(0)) {
revert WrongAddress();
}
treasury = treasuryAddress;
// The ownership should then be transfered to a multi-sig.
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
setTeamWallet(teamWalletAddress);
}
/// @notice Transfers a specific amount of token to an address.
/// Uses native transfer or ERC20 transfer depending on the token.
/// @dev The 0x address is considered the gas token.
/// @param user Address of destination.
/// @param token Address of the token.
/// @param amount Number of tokens.
function _safeTransfer(
address user,
address token,
uint256 amount
) private {
if (_isGasToken(token)) {
Address.sendValue(payable(user), amount);
} else {
IERC20(token).safeTransfer(user, amount);
}
}
/// @notice Check if the token has the 0x address.
/// @param token Address of the token.
/// @return Whether the token's address is the 0x address.
function _isGasToken(address token) private pure returns (bool) {
return token == address(0);
}
/// @notice Deposit funds in the bank to allow gamers to win more.
/// ERC20 token allowance should be given prior to deposit.
/// @param token Address of the token.
/// @param amount Number of tokens.
function deposit(address token, uint256 amount)
external
payable
onlyTokenOwner(DEFAULT_ADMIN_ROLE, token)
{
if (_isGasToken(token)) {
amount = msg.value;
} else {
IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
}
emit Deposit(token, amount);
}
/// @notice Withdraw funds from the bank. Token has to be paused and no pending bet resolution on games.
/// @param token Address of the token.
/// @param amount Number of tokens.
function withdraw(address token, uint256 amount)
external
onlyTokenOwner(DEFAULT_ADMIN_ROLE, token)
{
uint256 balance = getBalance(token);
if (balance != 0) {
if (!tokens[token].paused) {
revert TokenNotPaused();
}
uint256 roleMemberCount = getRoleMemberCount(GAME_ROLE);
for (uint256 i; i < roleMemberCount; i++) {
if (IGame(getRoleMember(GAME_ROLE, i)).hasPendingBets(token)) {
revert TokenHasPendingBets();
}
}
if (amount > balance) {
amount = balance;
}
_safeTransfer(msg.sender, token, amount);
emit Withdraw(token, amount, msg.sender);
}
}
/// @notice Sets the new token balance risk.
/// @param token Address of the token.
/// @param balanceRisk Risk rate.
function setBalanceRisk(address token, uint16 balanceRisk)
external
onlyTokenOwner(DEFAULT_ADMIN_ROLE, token)
{
tokens[token].balanceRisk = balanceRisk;
emit SetBalanceRisk(token, balanceRisk);
}
/// @notice Adds a new token that'll be enabled for the games' betting.
/// Token shouldn't exist yet.
/// @param token Address of the token.
function addToken(address token) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (_tokensCount != 0) {
for (uint8 i; i < _tokensCount; i++) {
if (_tokensList[i] == token) {
revert TokenExists();
}
}
}
_tokensList[_tokensCount] = token;
_tokensCount += 1;
emit AddToken(token);
}
/// @notice Changes the token's bet permission.
/// @param token Address of the token.
/// @param allowed Whether the token is enabled for bets.
function setAllowedToken(address token, bool allowed)
external
onlyRole(DEFAULT_ADMIN_ROLE)
{
tokens[token].allowed = allowed;
emit SetAllowedToken(token, allowed);
}
/// @notice Changes the token's paused status.
/// @param token Address of the token.
/// @param paused Whether the token is paused.
function setPausedToken(address token, bool paused)
external
onlyTokenOwner(DEFAULT_ADMIN_ROLE, token)
{
tokens[token].paused = paused;
emit SetPausedToken(token, paused);
}
/// @notice Changes the token's Upkeep min transfer amount.
/// @param token Address of the token.
/// @param minHouseEdgeWithdrawAmount Minimum amount of token to allow transfer.
function setMinHouseEdgeWithdrawAmount(
address token,
uint256 minHouseEdgeWithdrawAmount
) external onlyTokenOwner(DEFAULT_ADMIN_ROLE, token) {
tokens[token].minHouseEdgeWithdrawAmount = minHouseEdgeWithdrawAmount;
emit SetMinHouseEdgeWithdrawAmount(token, minHouseEdgeWithdrawAmount);
}
/// @notice Sets the token's house edge allocations for bet payout.
/// @param token Address of the token.
/// @param bank Rate to be allocated to the bank, on bet payout.
/// @param dividend Rate to be allocated as staking rewards, on bet payout.
/// @param partner Rate to be allocated to the partner, on bet payout.
/// @param _treasury Rate to be allocated to the treasury, on bet payout.
/// @param team Rate to be allocated to the team, on bet payout.
/// @dev `bank`, `dividend`, `_treasury` and `team` rates sum must equals 10000.
function setHouseEdgeSplit(
address token,
uint16 bank,
uint16 dividend,
uint16 partner,
uint16 _treasury,
uint16 team
) external onlyRole(DEFAULT_ADMIN_ROLE) {
uint16 splitSum = bank + dividend + team + partner + _treasury;
if (splitSum != 10000) {
revert WrongHouseEdgeSplit(splitSum);
}
HouseEdgeSplit storage tokenHouseEdge = tokens[token].houseEdgeSplit;
tokenHouseEdge.bank = bank;
tokenHouseEdge.dividend = dividend;
tokenHouseEdge.partner = partner;
tokenHouseEdge.treasury = _treasury;
tokenHouseEdge.team = team;
emit SetTokenHouseEdgeSplit(
token,
bank,
dividend,
partner,
_treasury,
team
);
}
/// @notice Sets the minimum bet amount for a specific token.
/// @param token Address of the token.
/// @param tokenMinBetAmount Minimum bet amount.
function setTokenMinBetAmount(address token, uint256 tokenMinBetAmount)
external
onlyTokenOwner(DEFAULT_ADMIN_ROLE, token)
{
if (tokenMinBetAmount < 10000) {
revert UnderMinBetAmountCap(10000);
}
tokens[token].minBetAmount = tokenMinBetAmount;
emit SetTokenMinBetAmount(token, tokenMinBetAmount);
}
/// @notice Sets the Chainlink VRF subscription ID for a specific token.
/// @param token Address of the token.
/// @param subId Subscription ID.
function setTokenVRFSubId(address token, uint64 subId)
external
onlyRole(DEFAULT_ADMIN_ROLE)
{
tokens[token].VRFSubId = subId;
emit SetTokenVRFSubId(token, subId);
}
/// @notice Harvests token dividends.
/// @param tokenAddress Address of the token.
function harvestDividend(address tokenAddress) public onlyRole(HARVESTER_ROLE) {
Token storage token = tokens[tokenAddress];
uint256 dividendAmount = token.houseEdgeSplit.dividendAmount;
if (dividendAmount != 0) {
delete token.houseEdgeSplit.dividendAmount;
_safeTransfer(msg.sender, tokenAddress, dividendAmount);
emit HarvestDividend(tokenAddress, dividendAmount);
}
}
/// @notice Harvests all tokens dividends.
function harvestDividends() external onlyRole(HARVESTER_ROLE) {
for (uint8 i; i < _tokensCount; i++) {
harvestDividend(_tokensList[i]);
}
}
/// @notice Splits the house edge fees and allocates them as dividends, to the partner, the bank, the treasury, and team.
/// @param token Address of the token.
/// @param fees Bet amount and bet profit fees amount.
function _allocateHouseEdge(address token, uint256 fees) private {
HouseEdgeSplit storage tokenHouseEdge = tokens[token].houseEdgeSplit;
uint256 partnerAmount;
if (tokenHouseEdge.partner != 0) {
partnerAmount = ((fees * tokenHouseEdge.partner) / 10000);
tokenHouseEdge.partnerAmount += partnerAmount;
}
uint256 dividendAmount = (fees * tokenHouseEdge.dividend) / 10000;
tokenHouseEdge.dividendAmount += dividendAmount;
// The bank also get allocated a share of the house edge.
uint256 bankAmount = (fees * tokenHouseEdge.bank) / 10000;
uint256 treasuryAmount = (fees * tokenHouseEdge.treasury) / 10000;
tokenHouseEdge.treasuryAmount += treasuryAmount;
uint256 teamAmount = (fees * tokenHouseEdge.team) / 10000;
tokenHouseEdge.teamAmount += teamAmount;
emit AllocateHouseEdgeAmount(
token,
bankAmount,
dividendAmount,
partnerAmount,
treasuryAmount,
teamAmount
);
}
/// @notice Payouts a winning bet, and allocate the house edge fee.
/// @param user Address of the gamer.
/// @param token Address of the token.
/// @param profit Number of tokens to be sent to the gamer.
/// @param fees Bet amount and bet profit fees amount.
function payout(
address user,
address token,
uint256 profit,
uint256 fees
) external payable onlyRole(GAME_ROLE) {
_allocateHouseEdge(token, fees);
// Pay the user
_safeTransfer(user, token, profit);
emit Payout(token, getBalance(token), profit);
}
/// @notice Accounts a loss bet.
/// @dev In case of an ERC20, the bet amount should be transfered prior to this tx.
/// @dev In case of the gas token, the bet amount is sent along with this tx.
/// @param tokenAddress Address of the token.
/// @param amount Loss bet amount.
/// @param fees Bet amount and bet profit fees amount.
function cashIn(
address tokenAddress,
uint256 amount,
uint256 fees
) external payable onlyRole(GAME_ROLE) {
if (fees != 0) {
_allocateHouseEdge(tokenAddress, fees);
}
emit CashIn(tokenAddress, getBalance(tokenAddress), amount);
}
/// @notice Executed by Chainlink Keepers when `upkeepNeeded` is true.
/// @param performData Data which was passed back from `checkUpkeep`.
function performUpkeep(bytes calldata performData) external override {
(UpkeepActions upkeepAction, address tokenAddress) = abi.decode(
performData,
(UpkeepActions, address)
);
Token memory token = tokens[tokenAddress];
if (
upkeepAction == UpkeepActions.DistributePartnerHouseEdge &&
token.houseEdgeSplit.partnerAmount >
token.minHouseEdgeWithdrawAmount
) {
withdrawPartnerAmount(tokenAddress);
} else if (
upkeepAction == UpkeepActions.DistributeOwnHouseEdge &&
token.houseEdgeSplit.treasuryAmount +
token.houseEdgeSplit.teamAmount >
token.minHouseEdgeWithdrawAmount
) {
withdrawHouseEdgeAmount(tokenAddress);
}
}
/// @dev For the front-end
function getTokens() external view returns (TokenMetadata[] memory) {
TokenMetadata[] memory _tokens = new TokenMetadata[](_tokensCount);
for (uint8 i; i < _tokensCount; i++) {
address tokenAddress = _tokensList[i];
Token memory token = tokens[tokenAddress];
if (_isGasToken(tokenAddress)) {
_tokens[i] = TokenMetadata({
decimals: 18,
tokenAddress: tokenAddress,
name: "ETH",
symbol: "ETH",
token: token
});
} else {
IERC20Metadata erc20Metadata = IERC20Metadata(tokenAddress);
_tokens[i] = TokenMetadata({
decimals: erc20Metadata.decimals(),
tokenAddress: tokenAddress,
name: erc20Metadata.name(),
symbol: erc20Metadata.symbol(),
token: token
});
}
}
return _tokens;
}
/// @notice Calculates the max bet amount based on the token balance, the balance risk, and the game multiplier.
/// @param token Address of the token.
/// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit.
/// @return Maximum bet amount for the token.
/// @dev The multiplier should be at least 10000.
function getMaxBetAmount(address token, uint256 multiplier)
external
view
returns (uint256)
{
return (getBalance(token) * tokens[token].balanceRisk) / multiplier;
}
/// @notice Calculates the max bet amount based on the token balance, the balance risk, and the game multiplier.
/// @param tokenAddress Address of the token.
/// @param multiplier The bet amount leverage determines the user's profit amount. 10000 = 100% = no profit.
/// @notice Gets the token's min bet amount.
/// @return isAllowedToken Whether the token is enabled for bets.
/// @return VRFSubId Chainlink VRF v2 Subscription ID.
/// @return minBetAmount Min bet amount.
/// @return maxBetAmount Maximum bet amount for the token.
/// @dev The min bet amount should be at least 10000 cause of the `getMaxBetAmount` calculation.
/// @dev The multiplier should be at least 10000.
function getBetRequirements(address tokenAddress, uint256 multiplier)
external
view
returns (
bool isAllowedToken,
uint64 VRFSubId,
uint256 minBetAmount,
uint256 maxBetAmount
)
{
Token memory token = tokens[tokenAddress];
isAllowedToken = token.allowed && !token.paused;
VRFSubId = token.VRFSubId;
minBetAmount = token.minBetAmount;
if (minBetAmount < 10000) {
minBetAmount = 10000;
}
maxBetAmount =
(getBalance(tokenAddress) * token.balanceRisk) /
multiplier;
}
/// @notice Runs by Chainlink Keepers at every block to determine if `performUpkeep` should be called.
/// @param checkData Fixed and specified at Upkeep registration.
/// @return upkeepNeeded Boolean that when True will trigger the on-chain performUpkeep call.
/// @return performData Bytes that will be used as input parameter when calling performUpkeep.
/// @dev `checkData` and `performData` are encoded with types (uint8, address).
function checkUpkeep(bytes calldata checkData)
external
view
override
returns (bool upkeepNeeded, bytes memory performData)
{
(UpkeepActions upkeepAction, address tokenAddressData) = abi.decode(
checkData,
(UpkeepActions, address)
);
Token memory token = tokens[tokenAddressData];
if (
(upkeepAction == UpkeepActions.DistributePartnerHouseEdge &&
token.houseEdgeSplit.partnerAmount >
token.minHouseEdgeWithdrawAmount) ||
(upkeepAction == UpkeepActions.DistributeOwnHouseEdge &&
token.houseEdgeSplit.treasuryAmount +
token.houseEdgeSplit.teamAmount >
token.minHouseEdgeWithdrawAmount)
) {
upkeepNeeded = true;
performData = abi.encode(upkeepAction, tokenAddressData);
}
}
/// @notice Gets the token's owner.
/// @param token Address of the token.
/// @return Address of the owner.
function getTokenOwner(address token) external view returns (address) {
address partner = tokens[token].partner;
if (partner == address(0)) {
return getRoleMember(DEFAULT_ADMIN_ROLE, 0);
} else {
return partner;
}
}
/// @notice Sets the new team wallet.
/// @param _teamWallet The team wallet address.
function setTeamWallet(address _teamWallet)
public
onlyRole(DEFAULT_ADMIN_ROLE)
{
if (_teamWallet == address(0)) {
revert WrongAddress();
}
teamWallet = _teamWallet;
emit SetTeamWallet(teamWallet);
}
/// @notice Distributes the token's treasury and team allocations amounts.
/// @param tokenAddress Address of the token.
function withdrawHouseEdgeAmount(address tokenAddress) public {
HouseEdgeSplit storage tokenHouseEdge = tokens[tokenAddress]
.houseEdgeSplit;
uint256 treasuryAmount = tokenHouseEdge.treasuryAmount;
uint256 teamAmount = tokenHouseEdge.teamAmount;
if (treasuryAmount != 0) {
delete tokenHouseEdge.treasuryAmount;
_safeTransfer(treasury, tokenAddress, treasuryAmount);
}
if (teamAmount != 0) {
delete tokenHouseEdge.teamAmount;
_safeTransfer(teamWallet, tokenAddress, teamAmount);
}
if (treasuryAmount != 0 || teamAmount != 0) {
emit HouseEdgeDistribution(
tokenAddress,
treasuryAmount,
teamAmount
);
}
}
/// @notice Distributes the token's partner amount.
/// @param tokenAddress Address of the token.
function withdrawPartnerAmount(address tokenAddress) public {
Token storage token = tokens[tokenAddress];
uint256 partnerAmount = token.houseEdgeSplit.partnerAmount;
address partner = token.partner;
if (partnerAmount != 0 && partner != address(0)) {
delete token.houseEdgeSplit.partnerAmount;
_safeTransfer(partner, tokenAddress, partnerAmount);
emit HouseEdgePartnerDistribution(tokenAddress, partnerAmount);
}
}
/// @notice Gets the token's balance.
/// The token's house edge allocation amounts are subtracted from the balance.
/// @param token Address of the token.
/// @return The amount of token available for profits.
function getBalance(address token) public view returns (uint256) {
uint256 balance;
if (_isGasToken(token)) {
balance = address(this).balance;
} else {
balance = IERC20(token).balanceOf(address(this));
}
HouseEdgeSplit memory tokenHouseEdgeSplit = tokens[token]
.houseEdgeSplit;
return
balance -
tokenHouseEdgeSplit.dividendAmount -
tokenHouseEdgeSplit.partnerAmount -
tokenHouseEdgeSplit.treasuryAmount -
tokenHouseEdgeSplit.teamAmount;
}
/// @notice starts a token's partner transfer
/// @param token address to tranfer
/// @param to sets the new parner
function startTokenPartnerTransfer(address token, address to) external
onlyTokenOwner(DEFAULT_ADMIN_ROLE, token) {
tokens[token].pendingPartner = to;
emit TokenPartnerTransferStarted(token, to);
}
/// @notice accepts a token's partner transfer
/// @param token address to tranfer
function acceptTokenPartnerTransfer(address token) external {
if (msg.sender != tokens[token].pendingPartner)
revert AccessDenied();
tokens[token].partner = tokens[token].pendingPartner;
delete tokens[token].pendingPartner;
emit TokenPartnerTransferAccepted(token, tokens[token].partner);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract AutomationBase {
error OnlySimulatedBackend();
/**
* @notice method that allows it to be simulated via eth_call by checking that
* the sender is the zero address.
*/
function preventExecution() internal view {
if (tx.origin != address(0)) {
revert OnlySimulatedBackend();
}
}
/**
* @notice modifier that allows it to be simulated via eth_call by checking
* that the sender is the zero address.
*/
modifier cannotExecute() {
preventExecution();
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./AutomationBase.sol";
import "./interfaces/AutomationCompatibleInterface.sol";
abstract contract AutomationCompatible is AutomationBase, AutomationCompatibleInterface {}// SPDX-License-Identifier: MIT
/**
* @notice This is a deprecated interface. Please use AutomationCompatible directly.
*/
pragma solidity ^0.8.0;
import {AutomationCompatible as KeeperCompatible} from "./AutomationCompatible.sol";
import {AutomationBase as KeeperBase} from "./AutomationBase.sol";
import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "./interfaces/AutomationCompatibleInterface.sol";// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AutomationCompatibleInterface {
/**
* @notice method that is simulated by the keepers to see if any work actually
* needs to be performed. This method does does not actually need to be
* executable, and since it is only ever simulated it can consume lots of gas.
* @dev To ensure that it is never called, you may want to add the
* cannotExecute modifier from KeeperBase to your implementation of this
* method.
* @param checkData specified in the upkeep registration so it is always the
* same for a registered upkeep. This can easily be broken down into specific
* arguments using `abi.decode`, so multiple upkeeps can be registered on the
* same contract and easily differentiated by the contract.
* @return upkeepNeeded boolean to indicate whether the keeper should call
* performUpkeep or not.
* @return performData bytes that the keeper should call performUpkeep with, if
* upkeep is needed. If you would like to encode data to decode later, try
* `abi.encode`.
*/
function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData);
/**
* @notice method that is actually executed by the keepers, via the registry.
* The data returned by the checkUpkeep simulation will be passed into
* this method to actually be executed.
* @dev The input to this method should not be trusted, and the caller of the
* method should not even be restricted to any single registry. Anyone should
* be able call it, and the input should be validated, there is no guarantee
* that the data passed in is the performData returned from checkUpkeep. This
* could happen due to malicious keepers, racing keepers, or simply a state
* change while the performUpkeep transaction is waiting for confirmation.
* Always validate the data passed in.
* @param performData is the data which was passed back from the checkData
* simulation. If it is encoded, it can easily be decoded into other types by
* calling `abi.decode`. This data should not be trusted, and should be
* validated against the contract's current state.
*/
function performUpkeep(bytes calldata performData) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
return _roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
return _roleMembers[role].length();
}
/**
* @dev Overload {_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override {
super._grantRole(role, account);
_roleMembers[role].add(account);
}
/**
* @dev Overload {_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)
pragma solidity ^0.8.0;
import "./Address.sol";
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* _Available since v4.1._
*/
abstract contract Multicall {
/**
* @dev Receives and executes a batch of function calls on this contract.
*/
function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = Address.functionDelegateCall(address(this), data[i]);
}
return results;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 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 10, 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 * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 7777777
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"treasuryAddress","type":"address"},{"internalType":"address","name":"teamWalletAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[],"name":"TokenExists","type":"error"},{"inputs":[],"name":"TokenHasPendingBets","type":"error"},{"inputs":[],"name":"TokenNotPaused","type":"error"},{"inputs":[{"internalType":"uint16","name":"minBetAmountCap","type":"uint16"}],"name":"UnderMinBetAmountCap","type":"error"},{"inputs":[],"name":"WrongAddress","type":"error"},{"inputs":[{"internalType":"uint16","name":"splitSum","type":"uint16"}],"name":"WrongHouseEdgeSplit","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"AddToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"bank","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dividend","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"partner","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasury","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"team","type":"uint256"}],"name":"AllocateHouseEdgeAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CashIn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"HarvestDividend","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"treasuryAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"teamAmount","type":"uint256"}],"name":"HouseEdgeDistribution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"partnerAmount","type":"uint256"}],"name":"HouseEdgePartnerDistribution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"profit","type":"uint256"}],"name":"Payout","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"allowed","type":"bool"}],"name":"SetAllowedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"balanceRisk","type":"uint16"}],"name":"SetBalanceRisk","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"minHouseEdgeWithdrawAmount","type":"uint256"}],"name":"SetMinHouseEdgeWithdrawAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"SetPausedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"teamWallet","type":"address"}],"name":"SetTeamWallet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint16","name":"bank","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"dividend","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"partner","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"treasury","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"team","type":"uint16"}],"name":"SetTokenHouseEdgeSplit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"SetTokenMinBetAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"partner","type":"address"}],"name":"SetTokenPartner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint64","name":"subId","type":"uint64"}],"name":"SetTokenVRFSubId","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"newPartner","type":"address"}],"name":"TokenPartnerTransferAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"newPartner","type":"address"}],"name":"TokenPartnerTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GAME_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HARVESTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"acceptTokenPartnerTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"addToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"fees","type":"uint256"}],"name":"cashIn","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"checkData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"multiplier","type":"uint256"}],"name":"getBetRequirements","outputs":[{"internalType":"bool","name":"isAllowedToken","type":"bool"},{"internalType":"uint64","name":"VRFSubId","type":"uint64"},{"internalType":"uint256","name":"minBetAmount","type":"uint256"},{"internalType":"uint256","name":"maxBetAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"multiplier","type":"uint256"}],"name":"getMaxBetAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTokenOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokens","outputs":[{"components":[{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"components":[{"internalType":"bool","name":"allowed","type":"bool"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"uint16","name":"balanceRisk","type":"uint16"},{"internalType":"uint64","name":"VRFSubId","type":"uint64"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"address","name":"pendingPartner","type":"address"},{"internalType":"uint256","name":"minBetAmount","type":"uint256"},{"internalType":"uint256","name":"minHouseEdgeWithdrawAmount","type":"uint256"},{"components":[{"internalType":"uint16","name":"bank","type":"uint16"},{"internalType":"uint16","name":"dividend","type":"uint16"},{"internalType":"uint16","name":"partner","type":"uint16"},{"internalType":"uint16","name":"treasury","type":"uint16"},{"internalType":"uint16","name":"team","type":"uint16"},{"internalType":"uint256","name":"dividendAmount","type":"uint256"},{"internalType":"uint256","name":"partnerAmount","type":"uint256"},{"internalType":"uint256","name":"treasuryAmount","type":"uint256"},{"internalType":"uint256","name":"teamAmount","type":"uint256"}],"internalType":"struct Bank.HouseEdgeSplit","name":"houseEdgeSplit","type":"tuple"}],"internalType":"struct Bank.Token","name":"token","type":"tuple"}],"internalType":"struct Bank.TokenMetadata[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"harvestDividend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvestDividends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"profit","type":"uint256"},{"internalType":"uint256","name":"fees","type":"uint256"}],"name":"payout","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"performUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"setAllowedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"balanceRisk","type":"uint16"}],"name":"setBalanceRisk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint16","name":"bank","type":"uint16"},{"internalType":"uint16","name":"dividend","type":"uint16"},{"internalType":"uint16","name":"partner","type":"uint16"},{"internalType":"uint16","name":"_treasury","type":"uint16"},{"internalType":"uint16","name":"team","type":"uint16"}],"name":"setHouseEdgeSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minHouseEdgeWithdrawAmount","type":"uint256"}],"name":"setMinHouseEdgeWithdrawAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"paused","type":"bool"}],"name":"setPausedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_teamWallet","type":"address"}],"name":"setTeamWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenMinBetAmount","type":"uint256"}],"name":"setTokenMinBetAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint64","name":"subId","type":"uint64"}],"name":"setTokenVRFSubId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"startTokenPartnerTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"internalType":"bool","name":"allowed","type":"bool"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"uint16","name":"balanceRisk","type":"uint16"},{"internalType":"uint64","name":"VRFSubId","type":"uint64"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"address","name":"pendingPartner","type":"address"},{"internalType":"uint256","name":"minBetAmount","type":"uint256"},{"internalType":"uint256","name":"minHouseEdgeWithdrawAmount","type":"uint256"},{"components":[{"internalType":"uint16","name":"bank","type":"uint16"},{"internalType":"uint16","name":"dividend","type":"uint16"},{"internalType":"uint16","name":"partner","type":"uint16"},{"internalType":"uint16","name":"treasury","type":"uint16"},{"internalType":"uint16","name":"team","type":"uint16"},{"internalType":"uint256","name":"dividendAmount","type":"uint256"},{"internalType":"uint256","name":"partnerAmount","type":"uint256"},{"internalType":"uint256","name":"treasuryAmount","type":"uint256"},{"internalType":"uint256","name":"teamAmount","type":"uint256"}],"internalType":"struct Bank.HouseEdgeSplit","name":"houseEdgeSplit","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"withdrawHouseEdgeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"withdrawPartnerAmount","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b50604051620051ef380380620051ef833981016040819052620000349162000514565b6001600160a01b0382166200005c57604051630d23cf4160e11b815260040160405180910390fd5b6001600160a01b0382166080526200007660003362000089565b620000818162000099565b5050620006ac565b6200009582826200012e565b5050565b6000620000a68162000171565b6001600160a01b038216620000ce57604051630d23cf4160e11b815260040160405180910390fd5b60028054610100600160a81b0319166101006001600160a01b038581168202929092179283905560405192041681527fc6a5dd316fe9d0339f2769deab7e31f64c8f5b101ffd85dfc9a83dbeaf2e69da9060200160405180910390a15050565b6200014582826200018060201b62002d6f1760201c565b60008281526001602090815260409091206200016c91839062002e5f62000220821b17901c565b505050565b6200017d813362000240565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000095576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001dc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000237836001600160a01b038416620002d9565b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000095576200027f816200032b60201b62002e811760201c565b6200029583602062002ea06200033e821b17811c565b604051602001620002a892919062000572565b60408051601f198184030181529082905262461bcd60e51b8252620002d091600401620005eb565b60405180910390fd5b600081815260018301602052604081205462000322575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200023a565b5060006200023a565b60606200023a6001600160a01b03831660145b606060006200034f83600262000636565b6200035c90600262000650565b6001600160401b0381111562000376576200037662000666565b6040519080825280601f01601f191660200182016040528015620003a1576020820181803683370190505b509050600360fc1b81600081518110620003bf57620003bf6200067c565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620003f157620003f16200067c565b60200101906001600160f81b031916908160001a90535060006200041784600262000636565b6200042490600162000650565b90505b6001811115620004a6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106200045c576200045c6200067c565b1a60f81b8282815181106200047557620004756200067c565b60200101906001600160f81b031916908160001a90535060049490941c936200049e8162000692565b905062000427565b508315620002375760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401620002d0565b80516001600160a01b03811681146200050f57600080fd5b919050565b600080604083850312156200052857600080fd5b6200053383620004f7565b91506200054360208401620004f7565b90509250929050565b60005b83811015620005695781810151838201526020016200054f565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351620005ac8160178501602088016200054c565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351620005df8160288401602088016200054c565b01602801949350505050565b60208152600082518060208401526200060c8160408501602087016200054c565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176200023a576200023a62000620565b808201808211156200023a576200023a62000620565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081620006a457620006a462000620565b506000190190565b608051614b20620006cf6000396000818161052f0152610a810152614b206000f3fe6080604052600436106102c65760003560e01c8063802ad8fb11610179578063ca15c873116100d6578063dc17c9ca1161008a578063f3fef3a311610064578063f3fef3a31461097e578063f743b84c1461099e578063f8b2cb4f146109be57600080fd5b8063dc17c9ca146107e4578063e486033914610804578063f2e0afbb1461093357600080fd5b8063d41b8c6f116100bb578063d41b8c6f14610791578063d48bfca7146107a4578063d547741f146107c457600080fd5b8063ca15c87314610751578063cfee03771461077157600080fd5b8063a217fddf1161012d578063ab40070611610112578063ab400706146106d0578063ac9650d814610704578063c437afde1461073157600080fd5b8063a217fddf14610699578063aa6ca808146106ae57600080fd5b80638aaa22841161015e5780638aaa2284146106085780639010d07c1461062857806391d148541461064857600080fd5b8063802ad8fb146105d3578063814a15b2146105e857600080fd5b80634297dcbe1161022757806359927044116101db57806363a560ec116101c057806363a560ec146105515780636dfa8e52146105855780636e04ff0d146105a557600080fd5b806359927044146104c657806361d027b31461051d57600080fd5b80634585e33b1161020c5780634585e33b1461047357806347e7ef241461049357806356f0406d146104a657600080fd5b80634297dcbe146104335780634511e1851461045357600080fd5b8063278b39de1161027e5780632f2ff15d116102635780632f2ff15d146103d357806336568abe146103f357806338c64d2f1461041357600080fd5b8063278b39de146103935780632ee99d3e146103b357600080fd5b80631525ff7d116102af5780631525ff7d146103225780631f61502314610342578063248a9ca31461035557600080fd5b806301ffc9a7146102cb5780630ae30cb014610300575b600080fd5b3480156102d757600080fd5b506102eb6102e6366004613e89565b6109de565b60405190151581526020015b60405180910390f35b34801561030c57600080fd5b5061032061031b366004613eed565b610a3a565b005b34801561032e57600080fd5b5061032061033d366004613eed565b610b48565b610320610350366004613f0a565b610c25565b34801561036157600080fd5b50610385610370366004613f50565b60009081526020819052604090206001015490565b6040519081526020016102f7565b34801561039f57600080fd5b506103856103ae366004613f69565b610cc4565b3480156103bf57600080fd5b506103206103ce366004613fac565b610d1a565b3480156103df57600080fd5b506103206103ee366004614022565b610f08565b3480156103ff57600080fd5b5061032061040e366004614022565b610f32565b34801561041f57600080fd5b5061032061042e366004613eed565b610fe5565b34801561043f57600080fd5b5061032061044e366004613f69565b6110aa565b34801561045f57600080fd5b5061032061046e366004613eed565b6111e6565b34801561047f57600080fd5b5061032061048e366004614052565b61130b565b6103206104a1366004613f69565b6114f7565b3480156104b257600080fd5b506103206104c13660046140c4565b611623565b3480156104d257600080fd5b506002546104f890610100900473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102f7565b34801561052957600080fd5b506104f87f000000000000000000000000000000000000000000000000000000000000000081565b34801561055d57600080fd5b506103857f3fc733b4d20d27a28452ddf0e9351aced28242fe03389a653cdb783955316b9b81565b34801561059157600080fd5b506103206105a03660046140f9565b61174f565b3480156105b157600080fd5b506105c56105c0366004614052565b6117f8565b6040516102f79291906141a2565b3480156105df57600080fd5b506103206119fd565b3480156105f457600080fd5b506103206106033660046141bd565b611a7f565b34801561061457600080fd5b506103206106233660046141f9565b611bb4565b34801561063457600080fd5b506104f8610643366004614227565b611c42565b34801561065457600080fd5b506102eb610663366004614022565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156106a557600080fd5b50610385600081565b3480156106ba57600080fd5b506106c3611c5a565b6040516102f791906142c1565b3480156106dc57600080fd5b506103857f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8881565b34801561071057600080fd5b5061072461071f366004614457565b61210b565b6040516102f791906144ba565b34801561073d57600080fd5b5061032061074c3660046141f9565b612200565b34801561075d57600080fd5b5061038561076c366004613f50565b612328565b34801561077d57600080fd5b5061032061078c366004613eed565b61233f565b61032061079f36600461453a565b6123f3565b3480156107b057600080fd5b506103206107bf366004613eed565b612482565b3480156107d057600080fd5b506103206107df366004614022565b6125ee565b3480156107f057600080fd5b506104f86107ff366004613eed565b612613565b34801561081057600080fd5b5061091e61081f366004613eed565b60036020818152600092835260409283902080546001820154600283015494830154865161012081018852600485015461ffff80821683526201000080830482169884019890985264010000000080830482169a84019a909a5266010000000000008204811660608401526801000000000000000090910481166080830152600586015460a0830152600686015460c0830152600786015460e08301526008909501546101008083019190915260ff8086169991860416979685049095169594840467ffffffffffffffff16946c0100000000000000000000000090940473ffffffffffffffffffffffffffffffffffffffff90811694931692919089565b6040516102f79998979695949392919061456f565b34801561093f57600080fd5b5061095361094e366004613f69565b61265e565b60408051941515855267ffffffffffffffff90931660208501529183015260608201526080016102f7565b34801561098a57600080fd5b50610320610999366004613f69565b612812565b3480156109aa57600080fd5b506103206109b9366004613f69565b612ad4565b3480156109ca57600080fd5b506103856109d9366004613eed565b612bd0565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610a345750610a34826130e3565b92915050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260409020600781015460088201546004909201918115610aa75760006003840155610aa77f0000000000000000000000000000000000000000000000000000000000000000858461317a565b8015610add5760006004840155600254610add90610100900473ffffffffffffffffffffffffffffffffffffffff16858361317a565b81151580610aea57508015155b15610b4257604080518381526020810183905273ffffffffffffffffffffffffffffffffffffffff8616917f0146f1701c23c89f761280798d36d6c4e3acb349438456f5da8f83a2f5dd8cdc91015b60405180910390a25b50505050565b6000610b53816131c0565b73ffffffffffffffffffffffffffffffffffffffff8216610ba0576040517f1a479e8200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010073ffffffffffffffffffffffffffffffffffffffff8581168202929092179283905560405192041681527fc6a5dd316fe9d0339f2769deab7e31f64c8f5b101ffd85dfc9a83dbeaf2e69da906020015b60405180910390a15050565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88610c4f816131c0565b610c5984836131cd565b610c6485858561317a565b8373ffffffffffffffffffffffffffffffffffffffff167f634235fcf5af0adbca1a405ec65f6f6c08f55e1f379c2c45cd10f23cb29e0e31610ca586612bd0565b6040805191825260208201879052015b60405180910390a25050505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260036020526040812054829062010000900461ffff16610cff85612bd0565b610d099190614618565b610d13919061462f565b9392505050565b6000610d25816131c0565b6000838584610d34898b61466a565b610d3e919061466a565b610d48919061466a565b610d52919061466a565b90508061ffff1661271014610d9e576040517f6104384400000000000000000000000000000000000000000000000000000000815261ffff821660048201526024015b60405180910390fd5b6000600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004019050878160000160006101000a81548161ffff021916908361ffff160217905550868160000160026101000a81548161ffff021916908361ffff160217905550858160000160046101000a81548161ffff021916908361ffff160217905550848160000160066101000a81548161ffff021916908361ffff160217905550838160000160086101000a81548161ffff021916908361ffff1602179055508873ffffffffffffffffffffffffffffffffffffffff167f87512489f5b5226512d8f1bfede20d9e809ff4042f028da79c833ed04baa83978989898989604051610ef595949392919061ffff95861681529385166020850152918416604084015283166060830152909116608082015260a00190565b60405180910390a2505050505050505050565b600082815260208190526040902060010154610f23816131c0565b610f2d83836133b2565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610fd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610d95565b610fe182826133d4565b5050565b73ffffffffffffffffffffffffffffffffffffffff808216600090815260036020526040902060068101548154919290916c01000000000000000000000000900416811580159061104b575073ffffffffffffffffffffffffffffffffffffffff811615155b15610b42576000600684015561106281858461317a565b8373ffffffffffffffffffffffffffffffffffffffff167f1aa0fc6b9bc54a055d93b640b2c7313e0bd2944482e0b6b5fec7048bbdaacd8183604051610b3991815260200190565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806110fa576110f583336133f6565b611149565b3373ffffffffffffffffffffffffffffffffffffffff821614611149576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612710841015611189576040517f9b4f63970000000000000000000000000000000000000000000000000000000081526127106004820152602401610d95565b73ffffffffffffffffffffffffffffffffffffffff851660008181526003602052604090819020600201869055517f8b4a07860448b613116df3f175c837980eceaca7d1dc5143c46a20ab31ec00f990610cb59087815260200190565b73ffffffffffffffffffffffffffffffffffffffff818116600090815260036020526040902060010154163314611249576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81811660008181526003602090815260409182902060018101805482546bffffffffffffffffffffffff168188166c0100000000000000000000000090810291909117938490557fffffffffffffffffffffffff000000000000000000000000000000000000000090911690915583519485529004909316928201929092527fd556ad74793ef80ac055082ae24e62ab61a3667dc98ed8c2b2191fa6df242e3c910160405180910390a150565b60008061131a83850185614685565b73ffffffffffffffffffffffffffffffffffffffff818116600090815260036020818152604080842081516101208082018452825460ff808216151584526101008083049091161515848801526201000080830461ffff9081168689015264010000000080850467ffffffffffffffff166060808901919091526c010000000000000000000000009095048d166080808901919091526001808a0154909e1660a0808a019190915260028a015460c0808b01919091529c8a015460e0808b01919091528b519889018c5260048b01548086168a5295860485169c89019c909c529184048316998701999099526601000000000000830482169486019490945268010000000000000000909104169583019590955260058401549082015260068301549581019590955260078201549385019390935260080154838201528101919091529395509193508490811115611474576114746146a7565b14801561148d57508060e0015181610100015160c00151115b156114a05761149b82610fe5565b6114f0565b60018360018111156114b4576114b46146a7565b1480156114e257508060e00151816101000151610100015182610100015160e001516114e091906146d6565b115b156114f0576114f082610a3a565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806115475761154283336133f6565b611596565b3373ffffffffffffffffffffffffffffffffffffffff821614611596576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff85166115b9573493506115db565b6115db73ffffffffffffffffffffffffffffffffffffffff86163330876134ae565b8473ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c85604051610cb591815260200190565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806116735761166e83336133f6565b6116c2565b3373ffffffffffffffffffffffffffffffffffffffff8216146116c2576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffff166201000061ffff8a169081029190911790915591519182527f68288b0936dd994d19323ee940b2703e7bf46fae2552319d60dc1239ba52ec689101610cb5565b600061175a816131c0565b73ffffffffffffffffffffffffffffffffffffffff831660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffff1664010000000067ffffffffffffffff88169081029190911790915591519182527fae367543cf47ca7e51a9f3f92711553aa33777847f719f7e2821ea8d846ed0e191015b60405180910390a2505050565b60006060818061180a85870187614685565b73ffffffffffffffffffffffffffffffffffffffff818116600090815260036020818152604080842081516101208082018452825460ff808216151584526101008083049091161515848801526201000080830461ffff9081168689015264010000000080850467ffffffffffffffff166060808901919091526c010000000000000000000000009095048d166080808901919091526001808a0154909e1660a0808a019190915260028a015460c0808b01919091529c8a015460e0808b01919091528b519889018c5260048b01548086168a5295860485169c89019c909c529184048316998701999099526601000000000000830482169486019490945268010000000000000000909104169583019590955260058401549082015260068301549581019590955260078201549385019390935260080154838201528101919091529395509193508490811115611964576119646146a7565b14801561197d57508060e0015181610100015160c00151115b806119c557506001836001811115611997576119976146a7565b1480156119c557508060e00151816101000151610100015182610100015160e001516119c391906146d6565b115b156119f3576001945082826040516020016119e19291906146e9565b60405160208183030381529060405293505b5050509250929050565b7f3fc733b4d20d27a28452ddf0e9351aced28242fe03389a653cdb783955316b9b611a27816131c0565b60005b60025460ff9081169082161015610fe15760ff8116600090815260046020526040902054611a6d9073ffffffffffffffffffffffffffffffffffffffff1661233f565b80611a7781614749565b915050611a2a565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c0100000000000000000000000090041680611acf57611aca83336133f6565b611b1e565b3373ffffffffffffffffffffffffffffffffffffffff821614611b1e576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff85811660008181526003602090815260409182902060010180547fffffffffffffffffffffffff000000000000000000000000000000000000000016948916948517905581519283528201929092527fb1ed6fc729e8adfc638bf55bc5e1eec1007a278ed53ba2d95e3e900dd6a8e35e910160405180910390a15050505050565b6000611bbf816131c0565b73ffffffffffffffffffffffffffffffffffffffff831660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527fe589eb036e62c07e307aa4d441bd39c81e8bd86f349eaacb0caa06b1477f7f9a91016117eb565b6000828152600160205260408120610d13908361358a565b60025460609060009060ff1667ffffffffffffffff811115611c7e57611c7e614768565b604051908082528060200260200182016040528015611cb757816020015b611ca4613d57565b815260200190600190039081611c9c5790505b50905060005b60025460ff90811690821610156121055760ff81811660009081526004602081815260408084205473ffffffffffffffffffffffffffffffffffffffff908116808652600380855295839020835161012080820186528254808b1615158352610100808204909b161515838901526201000080820461ffff908116858a015264010000000080840467ffffffffffffffff166060808801919091526c010000000000000000000000009094048916608080880191909152600188015490991660a080880191909152600288015460c0808901919091529d88015460e0808901919091528b519687018c529c880154808416875293840483169b86019b909b528204811698840198909852660100000000000081048816918301919091526801000000000000000090049095169385019390935260058101549484019490945260068401549583019590955260078301549382019390935260089091015481850152928101929092529081611efb576040518060a00160405280601260ff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600381526020017f455448000000000000000000000000000000000000000000000000000000000081525081526020016040518060400160405280600381526020017f4554480000000000000000000000000000000000000000000000000000000000815250815260200182815250848460ff1681518110611eeb57611eeb614797565b60200260200101819052506120f0565b60008290506040518060a001604052808273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f7a91906147c6565b60ff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015611fe9573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261202f91908101906147e9565b81526020018273ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561207f573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526120c591908101906147e9565b815260200183815250858560ff16815181106120e3576120e3614797565b6020026020010181905250505b505080806120fd90614749565b915050611cbd565b50919050565b60608167ffffffffffffffff81111561212657612126614768565b60405190808252806020026020018201604052801561215957816020015b60608152602001906001900390816121445790505b50905060005b828110156121f9576121c93085858481811061217d5761217d614797565b905060200281019061218f91906148a9565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061359692505050565b8282815181106121db576121db614797565b602002602001018190525080806121f190614915565b91505061215f565b5092915050565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806122505761224b83336133f6565b61229f565b3373ffffffffffffffffffffffffffffffffffffffff82161461229f576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8516600081815260036020526040908190208054871515610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909116179055517f624dd6809915867c3c11279c2699633040681f0e4efb0fa9a193217a11903c6090610cb590871515815260200190565b6000818152600160205260408120610a34906135bb565b7f3fc733b4d20d27a28452ddf0e9351aced28242fe03389a653cdb783955316b9b612369816131c0565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260036020526040902060058101548015610b4257600060058301556123ab33858361317a565b8373ffffffffffffffffffffffffffffffffffffffff167fca64dbcaf91abfb066e7a5163f1d135f8f48f2cbdb0395e3b35cc278ebbd340b82604051610b3991815260200190565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8861241d816131c0565b811561242d5761242d84836131cd565b8373ffffffffffffffffffffffffffffffffffffffff167f812b76b477469edc716929cbf7ed54e3d9c1a68d8b9f8290dbabcda54d96fcbe61246e86612bd0565b604080519182526020820187905201610b39565b600061248d816131c0565b60025460ff16156125245760005b60025460ff90811690821610156125225760ff811660009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff808516911603612510576040517f55c7e8ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061251a81614749565b91505061249b565b505b6002805460ff908116600090815260046020526040812080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff871617905582546001939261258b9185911661494d565b92506101000a81548160ff021916908360ff1602179055507fe473c74f34be27c1464d6624f14a0d7fd4e301cbfa29c3eba425d378c8a7ebe082604051610c19919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600082815260208190526040902060010154612609816131c0565b610f2d83836133d4565b73ffffffffffffffffffffffffffffffffffffffff80821660009081526003602052604081205490916c010000000000000000000000009091041680610a3457610d13600080611c42565b73ffffffffffffffffffffffffffffffffffffffff828116600090815260036020818152604080842081516101208082018452825460ff808216151584526101008083049091161515848801526201000080830461ffff9081168689015264010000000080850467ffffffffffffffff166060808901919091526c010000000000000000000000009095048d166080808901919091526001890154909d1660a080890191909152600289015460c0808a01919091529b89015460e0808a01919091528a519788018b5260048a0154808516895294850484169b88019b909b52908304821698860198909852660100000000000082048116938501939093526801000000000000000090049091169882019890985260058301549381019390935260068201549483019490945260078101549282019290925260089091015481850152928101929092528151909182918291829180156127bf57508060200151155b9450806060015193508060c0015192506127108310156127df5761271092505b85816040015161ffff166127f289612bd0565b6127fc9190614618565b612806919061462f565b91505092959194509250565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806128625761285d83336133f6565b6128b1565b3373ffffffffffffffffffffffffffffffffffffffff8216146128b1576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006128bc86612bd0565b90508015612acc5773ffffffffffffffffffffffffffffffffffffffff8616600090815260036020526040902054610100900460ff16612928576040517f93b3a85d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006129537f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88612328565b905060005b81811015612a655761298a7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8882611c42565b6040517f594043fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152919091169063594043fd90602401602060405180830381865afa1580156129f8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a1c9190614966565b15612a53576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80612a5d81614915565b915050612958565b5081861115612a72578195505b612a7d33888861317a565b604051868152339073ffffffffffffffffffffffffffffffffffffffff8916907f56c54ba9bd38d8fd62012e42c7ee564519b09763c426d331b3661b537ead19b29060200160405180910390a3505b505050505050565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c0100000000000000000000000090041680612b2457612b1f83336133f6565b612b73565b3373ffffffffffffffffffffffffffffffffffffffff821614612b73576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526003602081905260409182902001869055517f2c799d8bd0ce047a73ee6661740b3e780a2a13dd04c1201fca543f181bdff5ff90610cb59087815260200190565b60008073ffffffffffffffffffffffffffffffffffffffff8316612bf5575047612c86565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015612c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c839190614983565b90505b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020908152604091829020825161012081018452600482015461ffff808216835262010000820481169483019490945264010000000081048416948201949094526601000000000000840483166060820152680100000000000000009093049091166080830152600581015460a08301819052600682015460c08401819052600783015460e0850181905260089093015461010085018190529291612d49908661499c565b612d53919061499c565b612d5d919061499c565b612d67919061499c565b949350505050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610fe15760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055612e013390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610d138373ffffffffffffffffffffffffffffffffffffffff84166135c5565b6060610a3473ffffffffffffffffffffffffffffffffffffffff831660145b60606000612eaf836002614618565b612eba9060026146d6565b67ffffffffffffffff811115612ed257612ed2614768565b6040519080825280601f01601f191660200182016040528015612efc576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612f3357612f33614797565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612f9657612f96614797565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612fd2846002614618565b612fdd9060016146d6565b90505b600181111561307a577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061301e5761301e614797565b1a60f81b82828151811061303457613034614797565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613073816149af565b9050612fe0565b508315610d13576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d95565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610a3457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610a34565b73ffffffffffffffffffffffffffffffffffffffff821661319f57610f2d8382613614565b610f2d73ffffffffffffffffffffffffffffffffffffffff8316848361376e565b6131ca81336133f6565b50565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081206004018054909190640100000000900461ffff161561324d5781546127109061322790640100000000900461ffff1685614618565b613231919061462f565b90508082600201600082825461324791906146d6565b90915550505b81546000906127109061326a9062010000900461ffff1686614618565b613274919061462f565b90508083600101600082825461328a91906146d6565b90915550508254600090612710906132a69061ffff1687614618565b6132b0919061462f565b8454909150600090612710906132d4906601000000000000900461ffff1688614618565b6132de919061462f565b9050808560030160008282546132f491906146d6565b909155505084546000906127109061331c9068010000000000000000900461ffff1689614618565b613326919061462f565b90508086600401600082825461333c91906146d6565b90915550506040805184815260208101869052908101869052606081018390526080810182905273ffffffffffffffffffffffffffffffffffffffff8916907fc73e6f5bcd4395126567ead7e4c14b7c52a5f0b9eabd3335a05e631646a127e39060a00160405180910390a25050505050505050565b6133bc8282612d6f565b6000828152600160205260409020610f2d9082612e5f565b6133de82826137c4565b6000828152600160205260409020610f2d908261387b565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610fe15761343481612e81565b61343f836020612ea0565b6040516020016134509291906149e4565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610d9591600401614a65565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052610b429085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261389d565b6000610d1383836139a9565b6060610d138383604051806060016040528060278152602001614ac4602791396139d3565b6000610a34825490565b600081815260018301602052604081205461360c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a34565b506000610a34565b8047101561367e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d95565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146136d8576040519150601f19603f3d011682016040523d82523d6000602084013e6136dd565b606091505b5050905080610f2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d95565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610f2d9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401613508565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615610fe15760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610d138373ffffffffffffffffffffffffffffffffffffffff8416613a58565b60006138ff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b4b9092919063ffffffff16565b805190915015610f2d578080602001905181019061391d9190614966565b610f2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610d95565b60008260000182815481106139c0576139c0614797565b9060005260206000200154905092915050565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516139fd9190614a78565b600060405180830381855af49150503d8060008114613a38576040519150601f19603f3d011682016040523d82523d6000602084013e613a3d565b606091505b5091509150613a4e86838387613b5a565b9695505050505050565b60008181526001830160205260408120548015613b41576000613a7c60018361499c565b8554909150600090613a909060019061499c565b9050818114613af5576000866000018281548110613ab057613ab0614797565b9060005260206000200154905080876000018481548110613ad357613ad3614797565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613b0657613b06614a94565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a34565b6000915050610a34565b6060612d678484600085613bfa565b60608315613bf0578251600003613be95773ffffffffffffffffffffffffffffffffffffffff85163b613be9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d95565b5081612d67565b612d678383613d13565b606082471015613c8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610d95565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613cb59190614a78565b60006040518083038185875af1925050503d8060008114613cf2576040519150601f19603f3d011682016040523d82523d6000602084013e613cf7565b606091505b5091509150613d0887838387613b5a565b979650505050505050565b815115613d235781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d959190614a65565b6040518060a00160405280600060ff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001613d9f613da4565b905290565b604051806101200160405280600015158152602001600015158152602001600061ffff168152602001600067ffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001613d9f604051806101200160405280600061ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600081526020016000815260200160008152602001600081525090565b600060208284031215613e9b57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d1357600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146131ca57600080fd5b600060208284031215613eff57600080fd5b8135610d1381613ecb565b60008060008060808587031215613f2057600080fd5b8435613f2b81613ecb565b93506020850135613f3b81613ecb565b93969395505050506040820135916060013590565b600060208284031215613f6257600080fd5b5035919050565b60008060408385031215613f7c57600080fd5b8235613f8781613ecb565b946020939093013593505050565b803561ffff81168114613fa757600080fd5b919050565b60008060008060008060c08789031215613fc557600080fd5b8635613fd081613ecb565b9550613fde60208801613f95565b9450613fec60408801613f95565b9350613ffa60608801613f95565b925061400860808801613f95565b915061401660a08801613f95565b90509295509295509295565b6000806040838503121561403557600080fd5b82359150602083013561404781613ecb565b809150509250929050565b6000806020838503121561406557600080fd5b823567ffffffffffffffff8082111561407d57600080fd5b818501915085601f83011261409157600080fd5b8135818111156140a057600080fd5b8660208285010111156140b257600080fd5b60209290920196919550909350505050565b600080604083850312156140d757600080fd5b82356140e281613ecb565b91506140f060208401613f95565b90509250929050565b6000806040838503121561410c57600080fd5b823561411781613ecb565b9150602083013567ffffffffffffffff8116811461404757600080fd5b60005b8381101561414f578181015183820152602001614137565b50506000910152565b60008151808452614170816020860160208601614134565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8215158152604060208201526000612d676040830184614158565b600080604083850312156141d057600080fd5b82356141db81613ecb565b9150602083013561404781613ecb565b80151581146131ca57600080fd5b6000806040838503121561420c57600080fd5b823561421781613ecb565b91506020830135614047816141eb565b6000806040838503121561423a57600080fd5b50508035926020909101359150565b61ffff808251168352806020830151166020840152806040830151166040840152506060810151614280606084018261ffff169052565b506080810151614296608084018261ffff169052565b5060a0818101519083015260c0808201519083015260e0808201519083015261010090810151910152565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015614449577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc089840301855281516102a060ff825116855273ffffffffffffffffffffffffffffffffffffffff89830151168986015287820151818987015261435682870182614158565b915050606080830151868303828801526143708382614158565b925050608080840151935083511515818801528a84015160a0811515818a01528b860151915060c06143a7818b018461ffff169052565b938601519360e092506143c58a84018667ffffffffffffffff169052565b928601519350610100926143f08a85018673ffffffffffffffffffffffffffffffffffffffff169052565b9086015173ffffffffffffffffffffffffffffffffffffffff166101208a0152850151610140890152840151610160880152909201519150614436610180860183614249565b95880195935050908601906001016142e8565b509098975050505050505050565b6000806020838503121561446a57600080fd5b823567ffffffffffffffff8082111561448257600080fd5b818501915085601f83011261449657600080fd5b8135818111156144a557600080fd5b8660208260051b85010111156140b257600080fd5b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561452d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261451b858351614158565b945092850192908501906001016144e1565b5092979650505050505050565b60008060006060848603121561454f57600080fd5b833561455a81613ecb565b95602085013595506040909401359392505050565b8915158152881515602082015261ffff8816604082015267ffffffffffffffff8716606082015273ffffffffffffffffffffffffffffffffffffffff8681166080830152851660a082015260c0810184905260e0810183905261022081016145db610100830184614249565b9a9950505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417610a3457610a346145e9565b600082614665577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b61ffff8181168382160190808211156121f9576121f96145e9565b6000806040838503121561469857600080fd5b8235600281106141db57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80820180821115610a3457610a346145e9565b6040810160028410614724577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b92815273ffffffffffffffffffffffffffffffffffffffff9190911660209091015290565b600060ff821660ff810361475f5761475f6145e9565b60010192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156147d857600080fd5b815160ff81168114610d1357600080fd5b6000602082840312156147fb57600080fd5b815167ffffffffffffffff8082111561481357600080fd5b818401915084601f83011261482757600080fd5b81518181111561483957614839614768565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561487f5761487f614768565b8160405282815287602084870101111561489857600080fd5b613d08836020830160208801614134565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126148de57600080fd5b83018035915067ffffffffffffffff8211156148f957600080fd5b60200191503681900382131561490e57600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614946576149466145e9565b5060010190565b60ff8181168382160190811115610a3457610a346145e9565b60006020828403121561497857600080fd5b8151610d13816141eb565b60006020828403121561499557600080fd5b5051919050565b81810381811115610a3457610a346145e9565b6000816149be576149be6145e9565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614a1c816017850160208801614134565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614a59816028840160208801614134565b01602801949350505050565b602081526000610d136020830184614158565b60008251614a8a818460208701614134565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209fd0df87b418483d834981f177104824f1bd5f1fff754d87c88c09e9b7142c4e64736f6c63430008110033000000000000000000000000f14c79a7fa22c1f97c779f573c9bf39b6b43381c0000000000000000000000000f51800952859d5af7bf6f8bcec096c2310f3746
Deployed Bytecode
0x6080604052600436106102c65760003560e01c8063802ad8fb11610179578063ca15c873116100d6578063dc17c9ca1161008a578063f3fef3a311610064578063f3fef3a31461097e578063f743b84c1461099e578063f8b2cb4f146109be57600080fd5b8063dc17c9ca146107e4578063e486033914610804578063f2e0afbb1461093357600080fd5b8063d41b8c6f116100bb578063d41b8c6f14610791578063d48bfca7146107a4578063d547741f146107c457600080fd5b8063ca15c87314610751578063cfee03771461077157600080fd5b8063a217fddf1161012d578063ab40070611610112578063ab400706146106d0578063ac9650d814610704578063c437afde1461073157600080fd5b8063a217fddf14610699578063aa6ca808146106ae57600080fd5b80638aaa22841161015e5780638aaa2284146106085780639010d07c1461062857806391d148541461064857600080fd5b8063802ad8fb146105d3578063814a15b2146105e857600080fd5b80634297dcbe1161022757806359927044116101db57806363a560ec116101c057806363a560ec146105515780636dfa8e52146105855780636e04ff0d146105a557600080fd5b806359927044146104c657806361d027b31461051d57600080fd5b80634585e33b1161020c5780634585e33b1461047357806347e7ef241461049357806356f0406d146104a657600080fd5b80634297dcbe146104335780634511e1851461045357600080fd5b8063278b39de1161027e5780632f2ff15d116102635780632f2ff15d146103d357806336568abe146103f357806338c64d2f1461041357600080fd5b8063278b39de146103935780632ee99d3e146103b357600080fd5b80631525ff7d116102af5780631525ff7d146103225780631f61502314610342578063248a9ca31461035557600080fd5b806301ffc9a7146102cb5780630ae30cb014610300575b600080fd5b3480156102d757600080fd5b506102eb6102e6366004613e89565b6109de565b60405190151581526020015b60405180910390f35b34801561030c57600080fd5b5061032061031b366004613eed565b610a3a565b005b34801561032e57600080fd5b5061032061033d366004613eed565b610b48565b610320610350366004613f0a565b610c25565b34801561036157600080fd5b50610385610370366004613f50565b60009081526020819052604090206001015490565b6040519081526020016102f7565b34801561039f57600080fd5b506103856103ae366004613f69565b610cc4565b3480156103bf57600080fd5b506103206103ce366004613fac565b610d1a565b3480156103df57600080fd5b506103206103ee366004614022565b610f08565b3480156103ff57600080fd5b5061032061040e366004614022565b610f32565b34801561041f57600080fd5b5061032061042e366004613eed565b610fe5565b34801561043f57600080fd5b5061032061044e366004613f69565b6110aa565b34801561045f57600080fd5b5061032061046e366004613eed565b6111e6565b34801561047f57600080fd5b5061032061048e366004614052565b61130b565b6103206104a1366004613f69565b6114f7565b3480156104b257600080fd5b506103206104c13660046140c4565b611623565b3480156104d257600080fd5b506002546104f890610100900473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102f7565b34801561052957600080fd5b506104f87f000000000000000000000000f14c79a7fa22c1f97c779f573c9bf39b6b43381c81565b34801561055d57600080fd5b506103857f3fc733b4d20d27a28452ddf0e9351aced28242fe03389a653cdb783955316b9b81565b34801561059157600080fd5b506103206105a03660046140f9565b61174f565b3480156105b157600080fd5b506105c56105c0366004614052565b6117f8565b6040516102f79291906141a2565b3480156105df57600080fd5b506103206119fd565b3480156105f457600080fd5b506103206106033660046141bd565b611a7f565b34801561061457600080fd5b506103206106233660046141f9565b611bb4565b34801561063457600080fd5b506104f8610643366004614227565b611c42565b34801561065457600080fd5b506102eb610663366004614022565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156106a557600080fd5b50610385600081565b3480156106ba57600080fd5b506106c3611c5a565b6040516102f791906142c1565b3480156106dc57600080fd5b506103857f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8881565b34801561071057600080fd5b5061072461071f366004614457565b61210b565b6040516102f791906144ba565b34801561073d57600080fd5b5061032061074c3660046141f9565b612200565b34801561075d57600080fd5b5061038561076c366004613f50565b612328565b34801561077d57600080fd5b5061032061078c366004613eed565b61233f565b61032061079f36600461453a565b6123f3565b3480156107b057600080fd5b506103206107bf366004613eed565b612482565b3480156107d057600080fd5b506103206107df366004614022565b6125ee565b3480156107f057600080fd5b506104f86107ff366004613eed565b612613565b34801561081057600080fd5b5061091e61081f366004613eed565b60036020818152600092835260409283902080546001820154600283015494830154865161012081018852600485015461ffff80821683526201000080830482169884019890985264010000000080830482169a84019a909a5266010000000000008204811660608401526801000000000000000090910481166080830152600586015460a0830152600686015460c0830152600786015460e08301526008909501546101008083019190915260ff8086169991860416979685049095169594840467ffffffffffffffff16946c0100000000000000000000000090940473ffffffffffffffffffffffffffffffffffffffff90811694931692919089565b6040516102f79998979695949392919061456f565b34801561093f57600080fd5b5061095361094e366004613f69565b61265e565b60408051941515855267ffffffffffffffff90931660208501529183015260608201526080016102f7565b34801561098a57600080fd5b50610320610999366004613f69565b612812565b3480156109aa57600080fd5b506103206109b9366004613f69565b612ad4565b3480156109ca57600080fd5b506103856109d9366004613eed565b612bd0565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610a345750610a34826130e3565b92915050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260409020600781015460088201546004909201918115610aa75760006003840155610aa77f000000000000000000000000f14c79a7fa22c1f97c779f573c9bf39b6b43381c858461317a565b8015610add5760006004840155600254610add90610100900473ffffffffffffffffffffffffffffffffffffffff16858361317a565b81151580610aea57508015155b15610b4257604080518381526020810183905273ffffffffffffffffffffffffffffffffffffffff8616917f0146f1701c23c89f761280798d36d6c4e3acb349438456f5da8f83a2f5dd8cdc91015b60405180910390a25b50505050565b6000610b53816131c0565b73ffffffffffffffffffffffffffffffffffffffff8216610ba0576040517f1a479e8200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010073ffffffffffffffffffffffffffffffffffffffff8581168202929092179283905560405192041681527fc6a5dd316fe9d0339f2769deab7e31f64c8f5b101ffd85dfc9a83dbeaf2e69da906020015b60405180910390a15050565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88610c4f816131c0565b610c5984836131cd565b610c6485858561317a565b8373ffffffffffffffffffffffffffffffffffffffff167f634235fcf5af0adbca1a405ec65f6f6c08f55e1f379c2c45cd10f23cb29e0e31610ca586612bd0565b6040805191825260208201879052015b60405180910390a25050505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260036020526040812054829062010000900461ffff16610cff85612bd0565b610d099190614618565b610d13919061462f565b9392505050565b6000610d25816131c0565b6000838584610d34898b61466a565b610d3e919061466a565b610d48919061466a565b610d52919061466a565b90508061ffff1661271014610d9e576040517f6104384400000000000000000000000000000000000000000000000000000000815261ffff821660048201526024015b60405180910390fd5b6000600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004019050878160000160006101000a81548161ffff021916908361ffff160217905550868160000160026101000a81548161ffff021916908361ffff160217905550858160000160046101000a81548161ffff021916908361ffff160217905550848160000160066101000a81548161ffff021916908361ffff160217905550838160000160086101000a81548161ffff021916908361ffff1602179055508873ffffffffffffffffffffffffffffffffffffffff167f87512489f5b5226512d8f1bfede20d9e809ff4042f028da79c833ed04baa83978989898989604051610ef595949392919061ffff95861681529385166020850152918416604084015283166060830152909116608082015260a00190565b60405180910390a2505050505050505050565b600082815260208190526040902060010154610f23816131c0565b610f2d83836133b2565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610fd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610d95565b610fe182826133d4565b5050565b73ffffffffffffffffffffffffffffffffffffffff808216600090815260036020526040902060068101548154919290916c01000000000000000000000000900416811580159061104b575073ffffffffffffffffffffffffffffffffffffffff811615155b15610b42576000600684015561106281858461317a565b8373ffffffffffffffffffffffffffffffffffffffff167f1aa0fc6b9bc54a055d93b640b2c7313e0bd2944482e0b6b5fec7048bbdaacd8183604051610b3991815260200190565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806110fa576110f583336133f6565b611149565b3373ffffffffffffffffffffffffffffffffffffffff821614611149576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612710841015611189576040517f9b4f63970000000000000000000000000000000000000000000000000000000081526127106004820152602401610d95565b73ffffffffffffffffffffffffffffffffffffffff851660008181526003602052604090819020600201869055517f8b4a07860448b613116df3f175c837980eceaca7d1dc5143c46a20ab31ec00f990610cb59087815260200190565b73ffffffffffffffffffffffffffffffffffffffff818116600090815260036020526040902060010154163314611249576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81811660008181526003602090815260409182902060018101805482546bffffffffffffffffffffffff168188166c0100000000000000000000000090810291909117938490557fffffffffffffffffffffffff000000000000000000000000000000000000000090911690915583519485529004909316928201929092527fd556ad74793ef80ac055082ae24e62ab61a3667dc98ed8c2b2191fa6df242e3c910160405180910390a150565b60008061131a83850185614685565b73ffffffffffffffffffffffffffffffffffffffff818116600090815260036020818152604080842081516101208082018452825460ff808216151584526101008083049091161515848801526201000080830461ffff9081168689015264010000000080850467ffffffffffffffff166060808901919091526c010000000000000000000000009095048d166080808901919091526001808a0154909e1660a0808a019190915260028a015460c0808b01919091529c8a015460e0808b01919091528b519889018c5260048b01548086168a5295860485169c89019c909c529184048316998701999099526601000000000000830482169486019490945268010000000000000000909104169583019590955260058401549082015260068301549581019590955260078201549385019390935260080154838201528101919091529395509193508490811115611474576114746146a7565b14801561148d57508060e0015181610100015160c00151115b156114a05761149b82610fe5565b6114f0565b60018360018111156114b4576114b46146a7565b1480156114e257508060e00151816101000151610100015182610100015160e001516114e091906146d6565b115b156114f0576114f082610a3a565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806115475761154283336133f6565b611596565b3373ffffffffffffffffffffffffffffffffffffffff821614611596576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff85166115b9573493506115db565b6115db73ffffffffffffffffffffffffffffffffffffffff86163330876134ae565b8473ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c85604051610cb591815260200190565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806116735761166e83336133f6565b6116c2565b3373ffffffffffffffffffffffffffffffffffffffff8216146116c2576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffff166201000061ffff8a169081029190911790915591519182527f68288b0936dd994d19323ee940b2703e7bf46fae2552319d60dc1239ba52ec689101610cb5565b600061175a816131c0565b73ffffffffffffffffffffffffffffffffffffffff831660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffff1664010000000067ffffffffffffffff88169081029190911790915591519182527fae367543cf47ca7e51a9f3f92711553aa33777847f719f7e2821ea8d846ed0e191015b60405180910390a2505050565b60006060818061180a85870187614685565b73ffffffffffffffffffffffffffffffffffffffff818116600090815260036020818152604080842081516101208082018452825460ff808216151584526101008083049091161515848801526201000080830461ffff9081168689015264010000000080850467ffffffffffffffff166060808901919091526c010000000000000000000000009095048d166080808901919091526001808a0154909e1660a0808a019190915260028a015460c0808b01919091529c8a015460e0808b01919091528b519889018c5260048b01548086168a5295860485169c89019c909c529184048316998701999099526601000000000000830482169486019490945268010000000000000000909104169583019590955260058401549082015260068301549581019590955260078201549385019390935260080154838201528101919091529395509193508490811115611964576119646146a7565b14801561197d57508060e0015181610100015160c00151115b806119c557506001836001811115611997576119976146a7565b1480156119c557508060e00151816101000151610100015182610100015160e001516119c391906146d6565b115b156119f3576001945082826040516020016119e19291906146e9565b60405160208183030381529060405293505b5050509250929050565b7f3fc733b4d20d27a28452ddf0e9351aced28242fe03389a653cdb783955316b9b611a27816131c0565b60005b60025460ff9081169082161015610fe15760ff8116600090815260046020526040902054611a6d9073ffffffffffffffffffffffffffffffffffffffff1661233f565b80611a7781614749565b915050611a2a565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c0100000000000000000000000090041680611acf57611aca83336133f6565b611b1e565b3373ffffffffffffffffffffffffffffffffffffffff821614611b1e576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff85811660008181526003602090815260409182902060010180547fffffffffffffffffffffffff000000000000000000000000000000000000000016948916948517905581519283528201929092527fb1ed6fc729e8adfc638bf55bc5e1eec1007a278ed53ba2d95e3e900dd6a8e35e910160405180910390a15050505050565b6000611bbf816131c0565b73ffffffffffffffffffffffffffffffffffffffff831660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527fe589eb036e62c07e307aa4d441bd39c81e8bd86f349eaacb0caa06b1477f7f9a91016117eb565b6000828152600160205260408120610d13908361358a565b60025460609060009060ff1667ffffffffffffffff811115611c7e57611c7e614768565b604051908082528060200260200182016040528015611cb757816020015b611ca4613d57565b815260200190600190039081611c9c5790505b50905060005b60025460ff90811690821610156121055760ff81811660009081526004602081815260408084205473ffffffffffffffffffffffffffffffffffffffff908116808652600380855295839020835161012080820186528254808b1615158352610100808204909b161515838901526201000080820461ffff908116858a015264010000000080840467ffffffffffffffff166060808801919091526c010000000000000000000000009094048916608080880191909152600188015490991660a080880191909152600288015460c0808901919091529d88015460e0808901919091528b519687018c529c880154808416875293840483169b86019b909b528204811698840198909852660100000000000081048816918301919091526801000000000000000090049095169385019390935260058101549484019490945260068401549583019590955260078301549382019390935260089091015481850152928101929092529081611efb576040518060a00160405280601260ff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600381526020017f455448000000000000000000000000000000000000000000000000000000000081525081526020016040518060400160405280600381526020017f4554480000000000000000000000000000000000000000000000000000000000815250815260200182815250848460ff1681518110611eeb57611eeb614797565b60200260200101819052506120f0565b60008290506040518060a001604052808273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f7a91906147c6565b60ff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015611fe9573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261202f91908101906147e9565b81526020018273ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561207f573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526120c591908101906147e9565b815260200183815250858560ff16815181106120e3576120e3614797565b6020026020010181905250505b505080806120fd90614749565b915050611cbd565b50919050565b60608167ffffffffffffffff81111561212657612126614768565b60405190808252806020026020018201604052801561215957816020015b60608152602001906001900390816121445790505b50905060005b828110156121f9576121c93085858481811061217d5761217d614797565b905060200281019061218f91906148a9565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061359692505050565b8282815181106121db576121db614797565b602002602001018190525080806121f190614915565b91505061215f565b5092915050565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806122505761224b83336133f6565b61229f565b3373ffffffffffffffffffffffffffffffffffffffff82161461229f576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8516600081815260036020526040908190208054871515610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909116179055517f624dd6809915867c3c11279c2699633040681f0e4efb0fa9a193217a11903c6090610cb590871515815260200190565b6000818152600160205260408120610a34906135bb565b7f3fc733b4d20d27a28452ddf0e9351aced28242fe03389a653cdb783955316b9b612369816131c0565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260036020526040902060058101548015610b4257600060058301556123ab33858361317a565b8373ffffffffffffffffffffffffffffffffffffffff167fca64dbcaf91abfb066e7a5163f1d135f8f48f2cbdb0395e3b35cc278ebbd340b82604051610b3991815260200190565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8861241d816131c0565b811561242d5761242d84836131cd565b8373ffffffffffffffffffffffffffffffffffffffff167f812b76b477469edc716929cbf7ed54e3d9c1a68d8b9f8290dbabcda54d96fcbe61246e86612bd0565b604080519182526020820187905201610b39565b600061248d816131c0565b60025460ff16156125245760005b60025460ff90811690821610156125225760ff811660009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff808516911603612510576040517f55c7e8ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8061251a81614749565b91505061249b565b505b6002805460ff908116600090815260046020526040812080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff871617905582546001939261258b9185911661494d565b92506101000a81548160ff021916908360ff1602179055507fe473c74f34be27c1464d6624f14a0d7fd4e301cbfa29c3eba425d378c8a7ebe082604051610c19919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600082815260208190526040902060010154612609816131c0565b610f2d83836133d4565b73ffffffffffffffffffffffffffffffffffffffff80821660009081526003602052604081205490916c010000000000000000000000009091041680610a3457610d13600080611c42565b73ffffffffffffffffffffffffffffffffffffffff828116600090815260036020818152604080842081516101208082018452825460ff808216151584526101008083049091161515848801526201000080830461ffff9081168689015264010000000080850467ffffffffffffffff166060808901919091526c010000000000000000000000009095048d166080808901919091526001890154909d1660a080890191909152600289015460c0808a01919091529b89015460e0808a01919091528a519788018b5260048a0154808516895294850484169b88019b909b52908304821698860198909852660100000000000082048116938501939093526801000000000000000090049091169882019890985260058301549381019390935260068201549483019490945260078101549282019290925260089091015481850152928101929092528151909182918291829180156127bf57508060200151155b9450806060015193508060c0015192506127108310156127df5761271092505b85816040015161ffff166127f289612bd0565b6127fc9190614618565b612806919061462f565b91505092959194509250565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c01000000000000000000000000900416806128625761285d83336133f6565b6128b1565b3373ffffffffffffffffffffffffffffffffffffffff8216146128b1576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006128bc86612bd0565b90508015612acc5773ffffffffffffffffffffffffffffffffffffffff8616600090815260036020526040902054610100900460ff16612928576040517f93b3a85d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006129537f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88612328565b905060005b81811015612a655761298a7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8882611c42565b6040517f594043fd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152919091169063594043fd90602401602060405180830381865afa1580156129f8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a1c9190614966565b15612a53576040517faa4256e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80612a5d81614915565b915050612958565b5081861115612a72578195505b612a7d33888861317a565b604051868152339073ffffffffffffffffffffffffffffffffffffffff8916907f56c54ba9bd38d8fd62012e42c7ee564519b09763c426d331b3661b537ead19b29060200160405180910390a3505b505050505050565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260036020526040812054909184916c0100000000000000000000000090041680612b2457612b1f83336133f6565b612b73565b3373ffffffffffffffffffffffffffffffffffffffff821614612b73576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526003602081905260409182902001869055517f2c799d8bd0ce047a73ee6661740b3e780a2a13dd04c1201fca543f181bdff5ff90610cb59087815260200190565b60008073ffffffffffffffffffffffffffffffffffffffff8316612bf5575047612c86565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015612c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c839190614983565b90505b73ffffffffffffffffffffffffffffffffffffffff8316600090815260036020908152604091829020825161012081018452600482015461ffff808216835262010000820481169483019490945264010000000081048416948201949094526601000000000000840483166060820152680100000000000000009093049091166080830152600581015460a08301819052600682015460c08401819052600783015460e0850181905260089093015461010085018190529291612d49908661499c565b612d53919061499c565b612d5d919061499c565b612d67919061499c565b949350505050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610fe15760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055612e013390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610d138373ffffffffffffffffffffffffffffffffffffffff84166135c5565b6060610a3473ffffffffffffffffffffffffffffffffffffffff831660145b60606000612eaf836002614618565b612eba9060026146d6565b67ffffffffffffffff811115612ed257612ed2614768565b6040519080825280601f01601f191660200182016040528015612efc576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612f3357612f33614797565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612f9657612f96614797565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612fd2846002614618565b612fdd9060016146d6565b90505b600181111561307a577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061301e5761301e614797565b1a60f81b82828151811061303457613034614797565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613073816149af565b9050612fe0565b508315610d13576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d95565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610a3457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610a34565b73ffffffffffffffffffffffffffffffffffffffff821661319f57610f2d8382613614565b610f2d73ffffffffffffffffffffffffffffffffffffffff8316848361376e565b6131ca81336133f6565b50565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081206004018054909190640100000000900461ffff161561324d5781546127109061322790640100000000900461ffff1685614618565b613231919061462f565b90508082600201600082825461324791906146d6565b90915550505b81546000906127109061326a9062010000900461ffff1686614618565b613274919061462f565b90508083600101600082825461328a91906146d6565b90915550508254600090612710906132a69061ffff1687614618565b6132b0919061462f565b8454909150600090612710906132d4906601000000000000900461ffff1688614618565b6132de919061462f565b9050808560030160008282546132f491906146d6565b909155505084546000906127109061331c9068010000000000000000900461ffff1689614618565b613326919061462f565b90508086600401600082825461333c91906146d6565b90915550506040805184815260208101869052908101869052606081018390526080810182905273ffffffffffffffffffffffffffffffffffffffff8916907fc73e6f5bcd4395126567ead7e4c14b7c52a5f0b9eabd3335a05e631646a127e39060a00160405180910390a25050505050505050565b6133bc8282612d6f565b6000828152600160205260409020610f2d9082612e5f565b6133de82826137c4565b6000828152600160205260409020610f2d908261387b565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610fe15761343481612e81565b61343f836020612ea0565b6040516020016134509291906149e4565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610d9591600401614a65565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052610b429085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261389d565b6000610d1383836139a9565b6060610d138383604051806060016040528060278152602001614ac4602791396139d3565b6000610a34825490565b600081815260018301602052604081205461360c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a34565b506000610a34565b8047101561367e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d95565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146136d8576040519150601f19603f3d011682016040523d82523d6000602084013e6136dd565b606091505b5050905080610f2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d95565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610f2d9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401613508565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615610fe15760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610d138373ffffffffffffffffffffffffffffffffffffffff8416613a58565b60006138ff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b4b9092919063ffffffff16565b805190915015610f2d578080602001905181019061391d9190614966565b610f2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610d95565b60008260000182815481106139c0576139c0614797565b9060005260206000200154905092915050565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516139fd9190614a78565b600060405180830381855af49150503d8060008114613a38576040519150601f19603f3d011682016040523d82523d6000602084013e613a3d565b606091505b5091509150613a4e86838387613b5a565b9695505050505050565b60008181526001830160205260408120548015613b41576000613a7c60018361499c565b8554909150600090613a909060019061499c565b9050818114613af5576000866000018281548110613ab057613ab0614797565b9060005260206000200154905080876000018481548110613ad357613ad3614797565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613b0657613b06614a94565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a34565b6000915050610a34565b6060612d678484600085613bfa565b60608315613bf0578251600003613be95773ffffffffffffffffffffffffffffffffffffffff85163b613be9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d95565b5081612d67565b612d678383613d13565b606082471015613c8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610d95565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613cb59190614a78565b60006040518083038185875af1925050503d8060008114613cf2576040519150601f19603f3d011682016040523d82523d6000602084013e613cf7565b606091505b5091509150613d0887838387613b5a565b979650505050505050565b815115613d235781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d959190614a65565b6040518060a00160405280600060ff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001613d9f613da4565b905290565b604051806101200160405280600015158152602001600015158152602001600061ffff168152602001600067ffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001613d9f604051806101200160405280600061ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600081526020016000815260200160008152602001600081525090565b600060208284031215613e9b57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d1357600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146131ca57600080fd5b600060208284031215613eff57600080fd5b8135610d1381613ecb565b60008060008060808587031215613f2057600080fd5b8435613f2b81613ecb565b93506020850135613f3b81613ecb565b93969395505050506040820135916060013590565b600060208284031215613f6257600080fd5b5035919050565b60008060408385031215613f7c57600080fd5b8235613f8781613ecb565b946020939093013593505050565b803561ffff81168114613fa757600080fd5b919050565b60008060008060008060c08789031215613fc557600080fd5b8635613fd081613ecb565b9550613fde60208801613f95565b9450613fec60408801613f95565b9350613ffa60608801613f95565b925061400860808801613f95565b915061401660a08801613f95565b90509295509295509295565b6000806040838503121561403557600080fd5b82359150602083013561404781613ecb565b809150509250929050565b6000806020838503121561406557600080fd5b823567ffffffffffffffff8082111561407d57600080fd5b818501915085601f83011261409157600080fd5b8135818111156140a057600080fd5b8660208285010111156140b257600080fd5b60209290920196919550909350505050565b600080604083850312156140d757600080fd5b82356140e281613ecb565b91506140f060208401613f95565b90509250929050565b6000806040838503121561410c57600080fd5b823561411781613ecb565b9150602083013567ffffffffffffffff8116811461404757600080fd5b60005b8381101561414f578181015183820152602001614137565b50506000910152565b60008151808452614170816020860160208601614134565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8215158152604060208201526000612d676040830184614158565b600080604083850312156141d057600080fd5b82356141db81613ecb565b9150602083013561404781613ecb565b80151581146131ca57600080fd5b6000806040838503121561420c57600080fd5b823561421781613ecb565b91506020830135614047816141eb565b6000806040838503121561423a57600080fd5b50508035926020909101359150565b61ffff808251168352806020830151166020840152806040830151166040840152506060810151614280606084018261ffff169052565b506080810151614296608084018261ffff169052565b5060a0818101519083015260c0808201519083015260e0808201519083015261010090810151910152565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015614449577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc089840301855281516102a060ff825116855273ffffffffffffffffffffffffffffffffffffffff89830151168986015287820151818987015261435682870182614158565b915050606080830151868303828801526143708382614158565b925050608080840151935083511515818801528a84015160a0811515818a01528b860151915060c06143a7818b018461ffff169052565b938601519360e092506143c58a84018667ffffffffffffffff169052565b928601519350610100926143f08a85018673ffffffffffffffffffffffffffffffffffffffff169052565b9086015173ffffffffffffffffffffffffffffffffffffffff166101208a0152850151610140890152840151610160880152909201519150614436610180860183614249565b95880195935050908601906001016142e8565b509098975050505050505050565b6000806020838503121561446a57600080fd5b823567ffffffffffffffff8082111561448257600080fd5b818501915085601f83011261449657600080fd5b8135818111156144a557600080fd5b8660208260051b85010111156140b257600080fd5b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561452d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261451b858351614158565b945092850192908501906001016144e1565b5092979650505050505050565b60008060006060848603121561454f57600080fd5b833561455a81613ecb565b95602085013595506040909401359392505050565b8915158152881515602082015261ffff8816604082015267ffffffffffffffff8716606082015273ffffffffffffffffffffffffffffffffffffffff8681166080830152851660a082015260c0810184905260e0810183905261022081016145db610100830184614249565b9a9950505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417610a3457610a346145e9565b600082614665577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b61ffff8181168382160190808211156121f9576121f96145e9565b6000806040838503121561469857600080fd5b8235600281106141db57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b80820180821115610a3457610a346145e9565b6040810160028410614724577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b92815273ffffffffffffffffffffffffffffffffffffffff9190911660209091015290565b600060ff821660ff810361475f5761475f6145e9565b60010192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156147d857600080fd5b815160ff81168114610d1357600080fd5b6000602082840312156147fb57600080fd5b815167ffffffffffffffff8082111561481357600080fd5b818401915084601f83011261482757600080fd5b81518181111561483957614839614768565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561487f5761487f614768565b8160405282815287602084870101111561489857600080fd5b613d08836020830160208801614134565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126148de57600080fd5b83018035915067ffffffffffffffff8211156148f957600080fd5b60200191503681900382131561490e57600080fd5b9250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614946576149466145e9565b5060010190565b60ff8181168382160190811115610a3457610a346145e9565b60006020828403121561497857600080fd5b8151610d13816141eb565b60006020828403121561499557600080fd5b5051919050565b81810381811115610a3457610a346145e9565b6000816149be576149be6145e9565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614a1c816017850160208801614134565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614a59816028840160208801614134565b01602801949350505050565b602081526000610d136020830184614158565b60008251614a8a818460208701614134565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209fd0df87b418483d834981f177104824f1bd5f1fff754d87c88c09e9b7142c4e64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f14c79a7fa22c1f97c779f573c9bf39b6b43381c0000000000000000000000000f51800952859d5af7bf6f8bcec096c2310f3746
-----Decoded View---------------
Arg [0] : treasuryAddress (address): 0xf14C79a7fA22c1f97C779F573c9bF39b6b43381c
Arg [1] : teamWalletAddress (address): 0x0F51800952859d5af7bf6f8bCeC096C2310F3746
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000f14c79a7fa22c1f97c779f573c9bf39b6b43381c
Arg [1] : 0000000000000000000000000f51800952859d5af7bf6f8bcec096c2310f3746
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$5,543.65
Net Worth in ETH
1.936206
Token Allocations
FUSDC
94.74%
USDâ‚®0
5.26%
ARB
0.00%
Multichain Portfolio | 35 Chains
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.