@azuro-protocol/sdk
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -8,2 +8,5 @@ export declare type FormattedIpfsData = { | ||
}[]; | ||
leagueId: number; | ||
countryId: number; | ||
sportTypeId: number; | ||
}; | ||
@@ -10,0 +13,0 @@ declare const fetchGameIpfsData: (ipfsHash: string) => Promise<FormattedIpfsData | null>; |
@@ -0,1 +1,2 @@ | ||
import { FormattedIpfsData } from './fetchGameIpfsData'; | ||
import type { FetchConditionsProps, ConditionGameData } from './fetchConditions'; | ||
@@ -16,12 +17,5 @@ declare type Odds = { | ||
declare type FetchGamesProps = FetchConditionsProps; | ||
export declare type Game = Omit<GroupGamesResult, 'ipfsHashHex'> & { | ||
league: string; | ||
country: string; | ||
participants: { | ||
name: string; | ||
image: string; | ||
}[]; | ||
}; | ||
export declare type Game = Omit<GroupGamesResult, 'ipfsHashHex'> & FormattedIpfsData; | ||
declare const fetchGames: (props?: FetchGamesProps) => Promise<Game[]>; | ||
export default fetchGames; | ||
//# sourceMappingURL=fetchGames.d.ts.map |
import type { ContractsABI } from './contracts'; | ||
declare const createContract: <Name extends "core" | "lp" | "bet" | "usdt">(name: Name, provider: any) => ContractsABI[Name]; | ||
declare const createContract: <Name extends "core" | "lp" | "bet" | "token">(name: Name, provider: any) => ContractsABI[Name]; | ||
export default createContract; | ||
//# sourceMappingURL=createContract.d.ts.map |
import type { Contracts } from './contracts'; | ||
declare const getContract: <Name extends "core" | "lp" | "bet" | "usdt">(name: Name, withWalletProvider?: boolean) => Contracts[Name]; | ||
declare const getContract: <Name extends "core" | "lp" | "bet" | "token">(name: Name, withWalletProvider?: boolean) => Contracts[Name]; | ||
export default getContract; | ||
//# sourceMappingURL=getContract.d.ts.map |
export type { Contracts, ContractsABI, ContractName } from './contracts'; | ||
export { default as getContract } from './getContract'; | ||
export { CONTRACTS } from './config'; | ||
export { default as state } from './state'; | ||
export { default as getTokenDecimals } from './getTokenDecimals'; | ||
export { default as getRateDecimals } from './getRateDecimals'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,8 +9,10 @@ import type { Web3Provider } from '@ethersproject/providers'; | ||
contractAddresses: ContractsAddresses; | ||
tokenDecimals: number | Promise<number>; | ||
rateDecimals: number | Promise<number>; | ||
}; | ||
declare const state: State; | ||
export declare const setContractAddresses: (contractAddresses: ContractsAddresses) => void; | ||
export declare const setWallerProvider: (walletProvider: Web3Provider) => void; | ||
export declare const setWalletProvider: (walletProvider: Web3Provider) => void; | ||
export declare const setSelectedChainId: (selectedChainId: number) => void; | ||
export default state; | ||
//# sourceMappingURL=state.d.ts.map |
export type { Game as AzuroGame } from './api/fetchGames'; | ||
export * from './api'; | ||
export * from './helpers/constants'; | ||
export { setSelectedChainId, setWallerProvider, setContractAddresses } from './contracts/state'; | ||
export { setSelectedChainId, setWalletProvider, setContractAddresses, } from './contracts/state'; | ||
export { configure } from './config'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
import{Contract}from"@ethersproject/contracts";import{JsonRpcProvider}from"@ethersproject/providers";import{utils}from"ethers";import axios from"axios";import{formatUnits,parseUnits}from"@ethersproject/units";var CoreABI=[{inputs:[],name:"BetNotAllowed",type:"error"},{inputs:[],name:"BigDifference",type:"error"},{inputs:[],name:"CantAcceptBet",type:"error"},{inputs:[],name:"CantChangeFlag",type:"error"},{inputs:[],name:"ConditionAlreadyCreated",type:"error"},{inputs:[],name:"ConditionAlreadyResolved",type:"error"},{inputs:[],name:"ConditionNotExists",type:"error"},{inputs:[],name:"ConditionNotStarted",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"FlagAlreadySet",type:"error"},{inputs:[],name:"IncorrectTimestamp",type:"error"},{inputs:[],name:"NotEnoughLiquidity",type:"error"},{inputs:[],name:"OnlyLp",type:"error"},{inputs:[],name:"OnlyMaintainer",type:"error"},{inputs:[],name:"OnlyOracle",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"ResolveTooEarly",type:"error"},{inputs:[],name:"SameOutcomes",type:"error"},{inputs:[],name:"SmallBet",type:"error"},{inputs:[],name:"SmallOdds",type:"error"},{inputs:[],name:"WrongDataFormat",type:"error"},{inputs:[],name:"WrongOutcome",type:"error"},{inputs:[],name:"ZeroOdds",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"AllConditionsStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"timestamp",type:"uint64"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeWin",type:"uint64"},{indexed:!1,internalType:"uint8",name:"state",type:"uint8"},{indexed:!1,internalType:"uint256",name:"amountForLp",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"ConditionStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newLp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maintainer",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"MaintainerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newRatio",type:"uint64"}],name:"MaxBanksRatioChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOracle",type:"address"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oracle",type:"address"}],name:"OracleRenounced",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"LP",outputs:[{internalType:"contract ILP",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"allConditionsStopped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"bool",name:"payed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionId",type:"uint256"}],name:"cancelByOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"}],name:"ceil",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"newRatio",type:"uint64"}],name:"changeMaxBanksRatio",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64[2]",name:"odds",type:"uint64[2]"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"},{internalType:"uint128[2]",name:"payouts",type:"uint128[2]"},{internalType:"uint128[2]",name:"totalNetBets",type:"uint128[2]"},{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],internalType:"struct ICore.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionReinforcement",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"fund1Bank",type:"uint256"},{internalType:"uint256",name:"fund2Bank",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeIndex",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"getOddsFromBanks",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"address",name:"oracle",type:"address"},{internalType:"uint128",name:"margin",type:"uint128"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastConditionId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"marginAdjustedOdds",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"oracleConditionIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"putBet",outputs:[{internalType:"uint64",name:"",type:"uint64"},{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint64",name:"outcomeWin",type:"uint64"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"sqrt",outputs:[{internalType:"uint256",name:"y",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bool",name:"flag",type:"bool"}],name:"stopAllConditions",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"bool",name:"flag",type:"bool"}],name:"stopCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateMargins",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateReinforcements",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"}],LpABI=[{inputs:[],name:"AmountMustNotBeZero",type:"error"},{inputs:[],name:"AmountNotSufficient",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"IncorrectPercent",type:"error"},{inputs:[],name:"LeafNotExist",type:"error"},{inputs:[],name:"LiquidityIsLocked",type:"error"},{inputs:[],name:"LiquidityNotOwned",type:"error"},{inputs:[],name:"NoDaoReward",type:"error"},{inputs:[],name:"NoLiquidity",type:"error"},{inputs:[],name:"NoWinNoPrize",type:"error"},{inputs:[],name:"NotEnoughReserves",type:"error"},{inputs:[],name:"OnlyBetOwner",type:"error"},{inputs:[],name:"OnlyCore",type:"error"},{inputs:[],name:"PaymentLocked",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"WithdrawalTimeout",type:"error"},{inputs:[],name:"WrongToken",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"AzuroBetChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"DaoRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint48",name:"leaf",type:"uint48"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLp",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"MinDepoChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeId",type:"uint64"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint128",name:"fund1",type:"uint128"},{indexed:!1,internalType:"uint128",name:"fund2",type:"uint128"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"OracleRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"PeriodChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"ReinforcementAbilityChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"WithdrawTimeoutChanged",type:"event"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"addLiquidityNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"finalReserve",type:"uint128"},{internalType:"uint48",name:"leaf",type:"uint48"},{internalType:"address",name:"oracle",type:"address"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"betNative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAzuroBet",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newCore",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"changeDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"changeMinDepo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"changeReinforcementAbility",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"changeWithdrawTimeout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLeaf",outputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"node",type:"uint48"},{internalType:"uint48",name:"begin",type:"uint48"},{internalType:"uint48",name:"end",type:"uint48"},{internalType:"uint48",name:"l",type:"uint48"},{internalType:"uint48",name:"r",type:"uint48"}],name:"getLeavesAmount",outputs:[{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"fromNumber",type:"uint48"}],name:"getParent",outputs:[{internalType:"uint48",name:"parentNumber",type:"uint48"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcementAmount",type:"uint128"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint128",name:"reserve",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"minDepo",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextNode",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],name:"nodeWithdrawView",outputs:[{internalType:"uint128",name:"withdrawAmount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracleFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",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:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDaoRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"treeNode",outputs:[{internalType:"uint64",name:"updateId",type:"uint64"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateId",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidityNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayoutNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawTimeout",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"withdrawals",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],AzuroBetABI=[{inputs:[],name:"OnlyLp",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getCoreByToken",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"getTokensByOwner",outputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"core",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"uri",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",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:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],TestERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"dst",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"src",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wad",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{},contractAddresses:{}},setContractAddresses=function(e){state.contractAddresses=e,state.writeContracts={},state.readContracts={}},setWallerProvider=function(e){state.walletProvider=e,state.writeContracts={},state.readContracts={}},setSelectedChainId=function(e){state.selectedChainId=e},CONTRACTS={core:{get address(){return state.contractAddresses.core},abi:CoreABI,decimals:18},lp:{get address(){return state.contractAddresses.lp},abi:LpABI,decimals:18},bet:{get address(){return state.contractAddresses.bet},abi:AzuroBetABI,decimals:18},usdt:{get address(){return state.contractAddresses.usdt},abi:TestERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new Contract(n,e,t)},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}function __awaiter(e,r,p,s){return new(p=p||Promise)(function(n,t){function a(e){try{u(s.next(e))}catch(e){t(e)}}function i(e){try{u(s.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof p?t:new p(function(e){e(t)})).then(a,i)}u((s=s.apply(e,r||[])).next())})}function __generator(a,i){var u,r,p,s={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,r&&(p=2&t[0]?r.return:t[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,t[1])).done)return p;switch(r=0,(t=p?[2&t[0],p.value]:t)[0]){case 0:case 1:p=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(p=0<(p=s.trys).length&&p[p.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!p||t[1]>p[0]&&t[1]<p[3])){s.label=t[1];break}if(6===t[0]&&s.label<p[1]){s.label=p[1],p=t;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(t);break}p[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(a,s)}catch(e){t=[6,e],r=0}finally{u=p=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)r.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return r}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={rpcUrl:null,ipfsGateway:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:new JsonRpcProvider(config.rpcUrl)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios.get(""+config.ipfsGateway+p,{timeout:1e4})];case 1:return u=e.sent().data,t=u.entity1Name,n=u.entity1Image,a=u.entity2Name,i=u.entity2Image,r=u.titleCountry,u=u.titleLeague,[2,{country:r,league:u,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return __awaiter(void 0,void 0,void 0,function(){var o,y,d,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=(null==a?void 0:a.filters)||{},n=t.resolved,o=void 0===n||n,n=t.canceled,y=void 0===n||n,d=getContract("core"),t=d.filters.ConditionCreated(),[4,d.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var s=e.args.conditionId;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=s.toNumber(),[4,d.getCondition(s)];case 1:return(n=e.sent(),a=n.state,i=n.scopeId.toNumber(),(u=1e3*n.timestamp.toNumber())<=Date.now())?[2]:(o||a!==ConditionStatus.RESOLVED)&&(y||a!==ConditionStatus.CANCELED)?(r=_calculateInitialOdds(n.fundBank,n.margin),p=n.outcomes.map(function(e){return e.toNumber()}),[2,{id:t,outcomes:p,odds:r,gameData:{id:i,state:a,startsAt:u,ipfsHashHex:n.ipfsHash}}]):[2];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var r=e.gameId,p=e.conditionId,t=e.outcomes,s=e.odds;return t.map(function(e,t){var t=s[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=r+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:r,marketRegistryId:i,betVariants:[]}),{conditionId:p,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(n){return void 0===n&&(n={}),__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return gamesInfo={},gameBets={},[4,fetchConditions(n)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameData;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),t=groupGames(),[4,Promise.all(t.map(function(i){return __awaiter(void 0,void 0,void 0,function(){var t,n,a;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=i.ipfsHashHex,t=__rest(i,["ipfsHashHex"]),n=utils.arrayify(n),n=utils.base58.encode(__spread([18,32],n)),[4,fetchGameIpfsData(n)];case 1:return(n=e.sent())?[2,__assign(__assign({},n),t)]:[2,null];case 2:return a=e.sent(),console.error(a),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean).sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.lp.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.lp.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,i=p.amount,r=p.betRate,u=p.slippage,a=getContract("lp",!0),i=parseUnits(String(i),USDT_DECIMALS),r=(1+(r-1)*(100-u)/100).toFixed(8),u=parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,a.bet(t,i,n,r,u)]})})},fetchBet=function(R){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,T,f,i,u,b,r,I,v,w,p,g,s,M,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(R)];case 2:return a=e.sent(),n=a.conditionId,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return i=e.sent(),u=i.scopeId,T=i.state,r=i.ipfsHash,f=i.timestamp,i=i.outcomeWin,u=u.toNumber(),b=n.toNumber(),r=utils.arrayify(r),r=utils.base58.encode(__spread([18,32],r)),[4,fetchGameIpfsData(r)];case 4:return(r=e.sent())?(I=1e3*f.toNumber(),y=l.toNumber(),o=i.toNumber(),p=betTypeOdd[y],v=p.marketRegistryId,w=p.outcomeRegistryId,p=p.paramId,g=parseFloat(formatUnits(m,RATE_DECIMALS)),s=parseFloat(formatUnits(d,USDT_DECIMALS)),M=void 0,M=T===ConditionStatus.CANCELED?s:0===o?null:o===y?(s*g).toFixed(6):-1*s,o=__assign(__assign({id:u},r),{startsAt:I,state:T}),[2,{nftId:R,conditionId:b,paramId:p,marketRegistryId:v,outcomeRegistryId:w,rate:g,amount:s,result:M,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}]):[2];case 5:return y=e.sent(),console.error(y),[2,null];case 6:return[2]}})})},fetchUserBets=function(e){var r=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(r,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};export{RATE_DECIMALS,USDT_DECIMALS,approve,calculateActualOdds,checkTestTokensClaimable,claimTestTokens,configure,fetchAllowance,fetchBalance,fetchGames,fetchUserBets,placeBet,redeemBetPrize as redeemPrize,setContractAddresses,setSelectedChainId,setWallerProvider}; | ||
import{Contract}from"@ethersproject/contracts";import{JsonRpcProvider}from"@ethersproject/providers";import{utils}from"ethers";import axios from"axios";import{formatUnits,parseUnits}from"@ethersproject/units";var CoreABI=[{inputs:[],name:"BetNotAllowed",type:"error"},{inputs:[],name:"BigDifference",type:"error"},{inputs:[],name:"CantAcceptBet",type:"error"},{inputs:[],name:"CantChangeFlag",type:"error"},{inputs:[],name:"ConditionAlreadyCreated",type:"error"},{inputs:[],name:"ConditionAlreadyResolved",type:"error"},{inputs:[],name:"ConditionNotExists",type:"error"},{inputs:[],name:"ConditionNotStarted",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"FlagAlreadySet",type:"error"},{inputs:[],name:"IncorrectTimestamp",type:"error"},{inputs:[],name:"NotEnoughLiquidity",type:"error"},{inputs:[],name:"OnlyLp",type:"error"},{inputs:[],name:"OnlyMaintainer",type:"error"},{inputs:[],name:"OnlyOracle",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"ResolveTooEarly",type:"error"},{inputs:[],name:"SameOutcomes",type:"error"},{inputs:[],name:"SmallBet",type:"error"},{inputs:[],name:"SmallOdds",type:"error"},{inputs:[],name:"WrongDataFormat",type:"error"},{inputs:[],name:"WrongOutcome",type:"error"},{inputs:[],name:"ZeroOdds",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"AllConditionsStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"timestamp",type:"uint64"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeWin",type:"uint64"},{indexed:!1,internalType:"uint8",name:"state",type:"uint8"},{indexed:!1,internalType:"uint256",name:"amountForLp",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"ConditionStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newLp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maintainer",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"MaintainerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newRatio",type:"uint64"}],name:"MaxBanksRatioChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOracle",type:"address"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oracle",type:"address"}],name:"OracleRenounced",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"LP",outputs:[{internalType:"contract ILP",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"allConditionsStopped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"bool",name:"payed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionId",type:"uint256"}],name:"cancelByOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"}],name:"ceil",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"newRatio",type:"uint64"}],name:"changeMaxBanksRatio",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64[2]",name:"odds",type:"uint64[2]"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"},{internalType:"uint128[2]",name:"payouts",type:"uint128[2]"},{internalType:"uint128[2]",name:"totalNetBets",type:"uint128[2]"},{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],internalType:"struct ICore.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionReinforcement",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"fund1Bank",type:"uint256"},{internalType:"uint256",name:"fund2Bank",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeIndex",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"getOddsFromBanks",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"address",name:"oracle",type:"address"},{internalType:"uint128",name:"margin",type:"uint128"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastConditionId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"marginAdjustedOdds",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"oracleConditionIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"putBet",outputs:[{internalType:"uint64",name:"",type:"uint64"},{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint64",name:"outcomeWin",type:"uint64"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"sqrt",outputs:[{internalType:"uint256",name:"y",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bool",name:"flag",type:"bool"}],name:"stopAllConditions",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"bool",name:"flag",type:"bool"}],name:"stopCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateMargins",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateReinforcements",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"}],LpABI=[{inputs:[],name:"AmountMustNotBeZero",type:"error"},{inputs:[],name:"AmountNotSufficient",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"IncorrectPercent",type:"error"},{inputs:[],name:"LeafNotExist",type:"error"},{inputs:[],name:"LiquidityIsLocked",type:"error"},{inputs:[],name:"LiquidityNotOwned",type:"error"},{inputs:[],name:"NoDaoReward",type:"error"},{inputs:[],name:"NoLiquidity",type:"error"},{inputs:[],name:"NoWinNoPrize",type:"error"},{inputs:[],name:"NotEnoughReserves",type:"error"},{inputs:[],name:"OnlyBetOwner",type:"error"},{inputs:[],name:"OnlyCore",type:"error"},{inputs:[],name:"PaymentLocked",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"WithdrawalTimeout",type:"error"},{inputs:[],name:"WrongToken",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"AzuroBetChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"DaoRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint48",name:"leaf",type:"uint48"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLp",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"MinDepoChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeId",type:"uint64"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint128",name:"fund1",type:"uint128"},{indexed:!1,internalType:"uint128",name:"fund2",type:"uint128"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"OracleRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"PeriodChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"ReinforcementAbilityChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"WithdrawTimeoutChanged",type:"event"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"addLiquidityNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"finalReserve",type:"uint128"},{internalType:"uint48",name:"leaf",type:"uint48"},{internalType:"address",name:"oracle",type:"address"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"betNative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAzuroBet",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newCore",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"changeDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"changeMinDepo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"changeReinforcementAbility",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"changeWithdrawTimeout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLeaf",outputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"node",type:"uint48"},{internalType:"uint48",name:"begin",type:"uint48"},{internalType:"uint48",name:"end",type:"uint48"},{internalType:"uint48",name:"l",type:"uint48"},{internalType:"uint48",name:"r",type:"uint48"}],name:"getLeavesAmount",outputs:[{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"fromNumber",type:"uint48"}],name:"getParent",outputs:[{internalType:"uint48",name:"parentNumber",type:"uint48"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcementAmount",type:"uint128"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint128",name:"reserve",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"minDepo",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextNode",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],name:"nodeWithdrawView",outputs:[{internalType:"uint128",name:"withdrawAmount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracleFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",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:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDaoRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"treeNode",outputs:[{internalType:"uint64",name:"updateId",type:"uint64"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateId",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidityNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayoutNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawTimeout",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"withdrawals",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],AzuroBetABI=[{inputs:[],name:"OnlyLp",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getCoreByToken",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"getTokensByOwner",outputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"core",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"uri",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",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:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],TestERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"dst",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"src",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wad",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{},contractAddresses:{},tokenDecimals:null,rateDecimals:null},flushState=function(){state.writeContracts={},state.readContracts={},state.tokenDecimals=null,state.rateDecimals=null},setContractAddresses=function(e){state.contractAddresses=e,flushState()},setWalletProvider=function(e){state.walletProvider=e,flushState()},setSelectedChainId=function(e){state.selectedChainId=e},CONTRACTS={core:{get address(){return state.contractAddresses.core},abi:CoreABI,decimals:18},lp:{get address(){return state.contractAddresses.lp},abi:LpABI,decimals:18},bet:{get address(){return state.contractAddresses.bet},abi:AzuroBetABI,decimals:18},token:{get address(){return state.contractAddresses.token},abi:TestERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new Contract(n,e,t)},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}function __awaiter(e,r,p,s){return new(p=p||Promise)(function(n,t){function a(e){try{u(s.next(e))}catch(e){t(e)}}function i(e){try{u(s.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof p?t:new p(function(e){e(t)})).then(a,i)}u((s=s.apply(e,r||[])).next())})}function __generator(a,i){var u,r,p,s={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,r&&(p=2&t[0]?r.return:t[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,t[1])).done)return p;switch(r=0,(t=p?[2&t[0],p.value]:t)[0]){case 0:case 1:p=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(p=0<(p=s.trys).length&&p[p.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!p||t[1]>p[0]&&t[1]<p[3])){s.label=t[1];break}if(6===t[0]&&s.label<p[1]){s.label=p[1],p=t;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(t);break}p[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(a,s)}catch(e){t=[6,e],r=0}finally{u=p=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)r.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return r}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={rpcUrl:null,ipfsGateway:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:new JsonRpcProvider(config.rpcUrl)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},getTokenDecimals=function(){return __awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){return null===state.tokenDecimals&&(t=getContract("token"),state.tokenDecimals=t.decimals()),[2,state.tokenDecimals]})})},getRateDecimals=function(){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){return null===state.rateDecimals&&(state.rateDecimals=9),[2,state.rateDecimals]})})},checkTestTokensClaimable=function(e){return getContract("token").availableToClaim(e)},claimTestTokens=function(e){return getContract("token",!0).claim(e)},fetchBalance=function(e){return getContract("token").balanceOf(e)},fetchGameIpfsData=function(y){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p,s,o;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios.get(""+config.ipfsGateway+y,{timeout:1e4})];case 1:return s=e.sent().data,t=s.entity1Name,n=s.entity1Image,a=s.entity2Name,i=s.entity2Image,o=s.titleCountry,u=s.titleLeague,r=s.sportTypeId,p=s.leagueId,s=s.countryId,[2,{country:o,league:u,participants:[{name:t,image:n},{name:a,image:i}],leagueId:p,countryId:s,sportTypeId:r}];case 2:return o=e.sent(),console.error(o),[2,null];case 3:return[2]}})})},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return __awaiter(void 0,void 0,void 0,function(){var o,y,d,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=(null==a?void 0:a.filters)||{},n=t.resolved,o=void 0===n||n,n=t.canceled,y=void 0===n||n,d=getContract("core"),t=d.filters.ConditionCreated(),[4,d.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var s=e.args.conditionId;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=s.toNumber(),[4,d.getCondition(s)];case 1:return(n=e.sent(),a=n.state,i=n.scopeId.toNumber(),(u=1e3*n.timestamp.toNumber())<=Date.now())?[2]:(o||a!==ConditionStatus.RESOLVED)&&(y||a!==ConditionStatus.CANCELED)?(r=_calculateInitialOdds(n.fundBank,n.margin),p=n.outcomes.map(function(e){return e.toNumber()}),[2,{id:t,outcomes:p,odds:r,gameData:{id:i,state:a,startsAt:u,ipfsHashHex:n.ipfsHash}}]):[2];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1},41:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},42:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var r=e.gameId,p=e.conditionId,t=e.outcomes,s=e.odds;return t.map(function(e,t){var n,a,i,u,t=s[t];betTypeOdd[e]?(n=(a=betTypeOdd[e]).outcomeRegistryId,u=a.marketRegistryId,a=a.paramId,gameBets[i=r+"-"+u]||(gameBets[i]={gameId:r,marketRegistryId:u,betVariants:[]}),u={conditionId:p,outcomeId:e,outcomeRegistryId:n,paramId:a,value:t},gameBets[i].betVariants.push(u)):console.warn("Unknown outcomeId "+e+". Please update the Azuro SDK version")})},fetchGames=function(n){return void 0===n&&(n={}),__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return gamesInfo={},gameBets={},[4,fetchConditions(n)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameData;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),t=groupGames(),[4,Promise.all(t.map(function(i){return __awaiter(void 0,void 0,void 0,function(){var t,n,a;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=i.ipfsHashHex,t=__rest(i,["ipfsHashHex"]),n=utils.arrayify(n),n=utils.base58.encode(__spread([18,32],n)),[4,fetchGameIpfsData(n)];case 1:return(n=e.sent())?[2,__assign(__assign({},n),t)]:[2,null];case 2:return a=e.sent(),console.error(a),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean).sort(function(e,t){return e.startsAt-t.startsAt})]}})})},calculateActualOdds=function(e){var p=e.conditionId,s=e.outcomeId,o=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){switch(e.label){case 0:return t=parseUnits,n=[String(o)],[4,getTokenDecimals()];case 1:return a=t.apply(void 0,n.concat([e.sent()])),[4,getContract("core").calculateOdds(p,a,s)];case 2:return a=e.sent(),u=formatUnits,r=[a],[4,getRateDecimals()];case 3:return i=u.apply(void 0,r.concat([e.sent()])),[2,parseFloat(i)]}})})},fetchAllowance=function(e){return getContract("token").allowance(e,CONTRACTS.lp.address)},approve=function(e){return getContract("token",!0).approve(CONTRACTS.lp.address,e)},placeBet=function(m){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p,s,o,d,y,l;return __generator(this,function(e){switch(e.label){case 0:return t=m.conditionId,n=m.outcomeId,s=m.amount,a=m.betRate,i=m.slippage,u=getContract("lp",!0),p=parseUnits,s=[String(s)],[4,getTokenDecimals()];case 1:return r=p.apply(void 0,s.concat([e.sent()])),y=(1+(a-1)*(100-i)/100).toFixed(8),d=parseUnits,y=[y],[4,getRateDecimals()];case 2:return o=d.apply(void 0,y.concat([e.sent()])),l=Math.floor(Date.now()/1e3)+2e3,[2,u.bet(t,r,n,l,o)]}})})},fetchBet=function(B){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,i,T,u,r,f,b,I,p,s,o,v,g,w,M,R,h,k,C,x,O,A,_,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,7,,8]),[4,t.bets(B)];case 2:return a=e.sent(),n=a.conditionId,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return u=e.sent(),r=u.scopeId,i=u.state,o=u.ipfsHash,T=u.timestamp,u=u.outcomeWin,r=r.toNumber(),f=n.toNumber(),o=utils.arrayify(o),o=utils.base58.encode(__spread([18,32],o)),[4,fetchGameIpfsData(o)];case 4:return(b=e.sent())?(I=1e3*T.toNumber(),p=l.toNumber(),s=u.toNumber(),o=betTypeOdd[p],v=o.marketRegistryId,g=o.outcomeRegistryId,w=o.paramId,R=parseFloat,h=formatUnits,k=[m],[4,getRateDecimals()]):[2];case 5:return M=R.apply(void 0,[h.apply(void 0,k.concat([e.sent()]))]),C=parseFloat,x=formatUnits,O=[d],[4,getTokenDecimals()];case 6:return y=C.apply(void 0,[x.apply(void 0,O.concat([e.sent()]))]),A=void 0,A=i===ConditionStatus.CANCELED?y:0===s?null:s===p?(y*M).toFixed(6):-1*y,_=__assign(__assign({id:r},b),{startsAt:I,state:i}),[2,{nftId:B,conditionId:f,paramId:w,marketRegistryId:v,outcomeRegistryId:g,rate:M,amount:y,result:A,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:_}];case 7:return y=e.sent(),console.error(y),[2,null];case 8:return[2]}})})},fetchUserBets=function(e){var r=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(r,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};export{approve,calculateActualOdds,checkTestTokensClaimable,claimTestTokens,configure,fetchAllowance,fetchBalance,fetchGames,fetchUserBets,placeBet,redeemBetPrize as redeemPrize,setContractAddresses,setSelectedChainId,setWalletProvider}; |
@@ -8,2 +8,5 @@ export declare type FormattedIpfsData = { | ||
}[]; | ||
leagueId: number; | ||
countryId: number; | ||
sportTypeId: number; | ||
}; | ||
@@ -10,0 +13,0 @@ declare const fetchGameIpfsData: (ipfsHash: string) => Promise<FormattedIpfsData | null>; |
@@ -0,1 +1,2 @@ | ||
import { FormattedIpfsData } from './fetchGameIpfsData'; | ||
import type { FetchConditionsProps, ConditionGameData } from './fetchConditions'; | ||
@@ -16,12 +17,5 @@ declare type Odds = { | ||
declare type FetchGamesProps = FetchConditionsProps; | ||
export declare type Game = Omit<GroupGamesResult, 'ipfsHashHex'> & { | ||
league: string; | ||
country: string; | ||
participants: { | ||
name: string; | ||
image: string; | ||
}[]; | ||
}; | ||
export declare type Game = Omit<GroupGamesResult, 'ipfsHashHex'> & FormattedIpfsData; | ||
declare const fetchGames: (props?: FetchGamesProps) => Promise<Game[]>; | ||
export default fetchGames; | ||
//# sourceMappingURL=fetchGames.d.ts.map |
import type { ContractsABI } from './contracts'; | ||
declare const createContract: <Name extends "core" | "lp" | "bet" | "usdt">(name: Name, provider: any) => ContractsABI[Name]; | ||
declare const createContract: <Name extends "core" | "lp" | "bet" | "token">(name: Name, provider: any) => ContractsABI[Name]; | ||
export default createContract; | ||
//# sourceMappingURL=createContract.d.ts.map |
import type { Contracts } from './contracts'; | ||
declare const getContract: <Name extends "core" | "lp" | "bet" | "usdt">(name: Name, withWalletProvider?: boolean) => Contracts[Name]; | ||
declare const getContract: <Name extends "core" | "lp" | "bet" | "token">(name: Name, withWalletProvider?: boolean) => Contracts[Name]; | ||
export default getContract; | ||
//# sourceMappingURL=getContract.d.ts.map |
export type { Contracts, ContractsABI, ContractName } from './contracts'; | ||
export { default as getContract } from './getContract'; | ||
export { CONTRACTS } from './config'; | ||
export { default as state } from './state'; | ||
export { default as getTokenDecimals } from './getTokenDecimals'; | ||
export { default as getRateDecimals } from './getRateDecimals'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,8 +9,10 @@ import type { Web3Provider } from '@ethersproject/providers'; | ||
contractAddresses: ContractsAddresses; | ||
tokenDecimals: number | Promise<number>; | ||
rateDecimals: number | Promise<number>; | ||
}; | ||
declare const state: State; | ||
export declare const setContractAddresses: (contractAddresses: ContractsAddresses) => void; | ||
export declare const setWallerProvider: (walletProvider: Web3Provider) => void; | ||
export declare const setWalletProvider: (walletProvider: Web3Provider) => void; | ||
export declare const setSelectedChainId: (selectedChainId: number) => void; | ||
export default state; | ||
//# sourceMappingURL=state.d.ts.map |
export type { Game as AzuroGame } from './api/fetchGames'; | ||
export * from './api'; | ||
export * from './helpers/constants'; | ||
export { setSelectedChainId, setWallerProvider, setContractAddresses } from './contracts/state'; | ||
export { setSelectedChainId, setWalletProvider, setContractAddresses, } from './contracts/state'; | ||
export { configure } from './config'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var contracts=require("@ethersproject/contracts"),providers=require("@ethersproject/providers"),ethers=require("ethers"),axios=require("axios"),units=require("@ethersproject/units");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var axios__default=_interopDefaultLegacy(axios),CoreABI=[{inputs:[],name:"BetNotAllowed",type:"error"},{inputs:[],name:"BigDifference",type:"error"},{inputs:[],name:"CantAcceptBet",type:"error"},{inputs:[],name:"CantChangeFlag",type:"error"},{inputs:[],name:"ConditionAlreadyCreated",type:"error"},{inputs:[],name:"ConditionAlreadyResolved",type:"error"},{inputs:[],name:"ConditionNotExists",type:"error"},{inputs:[],name:"ConditionNotStarted",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"FlagAlreadySet",type:"error"},{inputs:[],name:"IncorrectTimestamp",type:"error"},{inputs:[],name:"NotEnoughLiquidity",type:"error"},{inputs:[],name:"OnlyLp",type:"error"},{inputs:[],name:"OnlyMaintainer",type:"error"},{inputs:[],name:"OnlyOracle",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"ResolveTooEarly",type:"error"},{inputs:[],name:"SameOutcomes",type:"error"},{inputs:[],name:"SmallBet",type:"error"},{inputs:[],name:"SmallOdds",type:"error"},{inputs:[],name:"WrongDataFormat",type:"error"},{inputs:[],name:"WrongOutcome",type:"error"},{inputs:[],name:"ZeroOdds",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"AllConditionsStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"timestamp",type:"uint64"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeWin",type:"uint64"},{indexed:!1,internalType:"uint8",name:"state",type:"uint8"},{indexed:!1,internalType:"uint256",name:"amountForLp",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"ConditionStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newLp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maintainer",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"MaintainerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newRatio",type:"uint64"}],name:"MaxBanksRatioChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOracle",type:"address"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oracle",type:"address"}],name:"OracleRenounced",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"LP",outputs:[{internalType:"contract ILP",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"allConditionsStopped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"bool",name:"payed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionId",type:"uint256"}],name:"cancelByOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"}],name:"ceil",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"newRatio",type:"uint64"}],name:"changeMaxBanksRatio",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64[2]",name:"odds",type:"uint64[2]"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"},{internalType:"uint128[2]",name:"payouts",type:"uint128[2]"},{internalType:"uint128[2]",name:"totalNetBets",type:"uint128[2]"},{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],internalType:"struct ICore.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionReinforcement",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"fund1Bank",type:"uint256"},{internalType:"uint256",name:"fund2Bank",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeIndex",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"getOddsFromBanks",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"address",name:"oracle",type:"address"},{internalType:"uint128",name:"margin",type:"uint128"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastConditionId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"marginAdjustedOdds",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"oracleConditionIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"putBet",outputs:[{internalType:"uint64",name:"",type:"uint64"},{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint64",name:"outcomeWin",type:"uint64"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"sqrt",outputs:[{internalType:"uint256",name:"y",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bool",name:"flag",type:"bool"}],name:"stopAllConditions",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"bool",name:"flag",type:"bool"}],name:"stopCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateMargins",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateReinforcements",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"}],LpABI=[{inputs:[],name:"AmountMustNotBeZero",type:"error"},{inputs:[],name:"AmountNotSufficient",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"IncorrectPercent",type:"error"},{inputs:[],name:"LeafNotExist",type:"error"},{inputs:[],name:"LiquidityIsLocked",type:"error"},{inputs:[],name:"LiquidityNotOwned",type:"error"},{inputs:[],name:"NoDaoReward",type:"error"},{inputs:[],name:"NoLiquidity",type:"error"},{inputs:[],name:"NoWinNoPrize",type:"error"},{inputs:[],name:"NotEnoughReserves",type:"error"},{inputs:[],name:"OnlyBetOwner",type:"error"},{inputs:[],name:"OnlyCore",type:"error"},{inputs:[],name:"PaymentLocked",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"WithdrawalTimeout",type:"error"},{inputs:[],name:"WrongToken",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"AzuroBetChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"DaoRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint48",name:"leaf",type:"uint48"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLp",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"MinDepoChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeId",type:"uint64"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint128",name:"fund1",type:"uint128"},{indexed:!1,internalType:"uint128",name:"fund2",type:"uint128"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"OracleRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"PeriodChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"ReinforcementAbilityChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"WithdrawTimeoutChanged",type:"event"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"addLiquidityNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"finalReserve",type:"uint128"},{internalType:"uint48",name:"leaf",type:"uint48"},{internalType:"address",name:"oracle",type:"address"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"betNative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAzuroBet",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newCore",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"changeDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"changeMinDepo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"changeReinforcementAbility",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"changeWithdrawTimeout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLeaf",outputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"node",type:"uint48"},{internalType:"uint48",name:"begin",type:"uint48"},{internalType:"uint48",name:"end",type:"uint48"},{internalType:"uint48",name:"l",type:"uint48"},{internalType:"uint48",name:"r",type:"uint48"}],name:"getLeavesAmount",outputs:[{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"fromNumber",type:"uint48"}],name:"getParent",outputs:[{internalType:"uint48",name:"parentNumber",type:"uint48"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcementAmount",type:"uint128"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint128",name:"reserve",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"minDepo",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextNode",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],name:"nodeWithdrawView",outputs:[{internalType:"uint128",name:"withdrawAmount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracleFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",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:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDaoRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"treeNode",outputs:[{internalType:"uint64",name:"updateId",type:"uint64"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateId",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidityNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayoutNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawTimeout",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"withdrawals",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],AzuroBetABI=[{inputs:[],name:"OnlyLp",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getCoreByToken",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"getTokensByOwner",outputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"core",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"uri",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",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:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],TestERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"dst",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"src",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wad",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{},contractAddresses:{}},setContractAddresses=function(e){state.contractAddresses=e,state.writeContracts={},state.readContracts={}},setWallerProvider=function(e){state.walletProvider=e,state.writeContracts={},state.readContracts={}},setSelectedChainId=function(e){state.selectedChainId=e},CONTRACTS={core:{get address(){return state.contractAddresses.core},abi:CoreABI,decimals:18},lp:{get address(){return state.contractAddresses.lp},abi:LpABI,decimals:18},bet:{get address(){return state.contractAddresses.bet},abi:AzuroBetABI,decimals:18},usdt:{get address(){return state.contractAddresses.usdt},abi:TestERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new contracts.Contract(n,e,t)},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}function __awaiter(e,r,p,s){return new(p=p||Promise)(function(n,t){function a(e){try{u(s.next(e))}catch(e){t(e)}}function i(e){try{u(s.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof p?t:new p(function(e){e(t)})).then(a,i)}u((s=s.apply(e,r||[])).next())})}function __generator(a,i){var u,r,p,s={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,r&&(p=2&t[0]?r.return:t[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,t[1])).done)return p;switch(r=0,(t=p?[2&t[0],p.value]:t)[0]){case 0:case 1:p=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(p=0<(p=s.trys).length&&p[p.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!p||t[1]>p[0]&&t[1]<p[3])){s.label=t[1];break}if(6===t[0]&&s.label<p[1]){s.label=p[1],p=t;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(t);break}p[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(a,s)}catch(e){t=[6,e],r=0}finally{u=p=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)r.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return r}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={rpcUrl:null,ipfsGateway:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new providers.JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:new providers.JsonRpcProvider(config.rpcUrl)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios__default.default.get(""+config.ipfsGateway+p,{timeout:1e4})];case 1:return u=e.sent().data,t=u.entity1Name,n=u.entity1Image,a=u.entity2Name,i=u.entity2Image,r=u.titleCountry,u=u.titleLeague,[2,{country:r,league:u,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return __awaiter(void 0,void 0,void 0,function(){var o,y,d,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=(null==a?void 0:a.filters)||{},n=t.resolved,o=void 0===n||n,n=t.canceled,y=void 0===n||n,d=getContract("core"),t=d.filters.ConditionCreated(),[4,d.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var s=e.args.conditionId;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=s.toNumber(),[4,d.getCondition(s)];case 1:return(n=e.sent(),a=n.state,i=n.scopeId.toNumber(),(u=1e3*n.timestamp.toNumber())<=Date.now())?[2]:(o||a!==ConditionStatus.RESOLVED)&&(y||a!==ConditionStatus.CANCELED)?(r=_calculateInitialOdds(n.fundBank,n.margin),p=n.outcomes.map(function(e){return e.toNumber()}),[2,{id:t,outcomes:p,odds:r,gameData:{id:i,state:a,startsAt:u,ipfsHashHex:n.ipfsHash}}]):[2];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var r=e.gameId,p=e.conditionId,t=e.outcomes,s=e.odds;return t.map(function(e,t){var t=s[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=r+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:r,marketRegistryId:i,betVariants:[]}),{conditionId:p,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(n){return void 0===n&&(n={}),__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return gamesInfo={},gameBets={},[4,fetchConditions(n)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameData;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),t=groupGames(),[4,Promise.all(t.map(function(i){return __awaiter(void 0,void 0,void 0,function(){var t,n,a;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=i.ipfsHashHex,t=__rest(i,["ipfsHashHex"]),n=ethers.utils.arrayify(n),n=ethers.utils.base58.encode(__spread([18,32],n)),[4,fetchGameIpfsData(n)];case 1:return(n=e.sent())?[2,__assign(__assign({},n),t)]:[2,null];case 2:return a=e.sent(),console.error(a),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean).sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=units.parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=units.formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.lp.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.lp.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,i=p.amount,r=p.betRate,u=p.slippage,a=getContract("lp",!0),i=units.parseUnits(String(i),USDT_DECIMALS),r=(1+(r-1)*(100-u)/100).toFixed(8),u=units.parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,a.bet(t,i,n,r,u)]})})},fetchBet=function(h){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,T,f,i,u,b,r,I,v,g,p,w,s,M,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(h)];case 2:return a=e.sent(),n=a.conditionId,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return i=e.sent(),u=i.scopeId,T=i.state,r=i.ipfsHash,f=i.timestamp,i=i.outcomeWin,u=u.toNumber(),b=n.toNumber(),r=ethers.utils.arrayify(r),r=ethers.utils.base58.encode(__spread([18,32],r)),[4,fetchGameIpfsData(r)];case 4:return(r=e.sent())?(I=1e3*f.toNumber(),y=l.toNumber(),o=i.toNumber(),p=betTypeOdd[y],v=p.marketRegistryId,g=p.outcomeRegistryId,p=p.paramId,w=parseFloat(units.formatUnits(m,RATE_DECIMALS)),s=parseFloat(units.formatUnits(d,USDT_DECIMALS)),M=void 0,M=T===ConditionStatus.CANCELED?s:0===o?null:o===y?(s*w).toFixed(6):-1*s,o=__assign(__assign({id:u},r),{startsAt:I,state:T}),[2,{nftId:h,conditionId:b,paramId:p,marketRegistryId:v,outcomeRegistryId:g,rate:w,amount:s,result:M,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}]):[2];case 5:return y=e.sent(),console.error(y),[2,null];case 6:return[2]}})})},fetchUserBets=function(e){var r=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(r,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};exports.RATE_DECIMALS=RATE_DECIMALS,exports.USDT_DECIMALS=USDT_DECIMALS,exports.approve=approve,exports.calculateActualOdds=calculateActualOdds,exports.checkTestTokensClaimable=checkTestTokensClaimable,exports.claimTestTokens=claimTestTokens,exports.configure=configure,exports.fetchAllowance=fetchAllowance,exports.fetchBalance=fetchBalance,exports.fetchGames=fetchGames,exports.fetchUserBets=fetchUserBets,exports.placeBet=placeBet,exports.redeemPrize=redeemBetPrize,exports.setContractAddresses=setContractAddresses,exports.setSelectedChainId=setSelectedChainId,exports.setWallerProvider=setWallerProvider; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var contracts=require("@ethersproject/contracts"),providers=require("@ethersproject/providers"),ethers=require("ethers"),axios=require("axios"),units=require("@ethersproject/units");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var axios__default=_interopDefaultLegacy(axios),CoreABI=[{inputs:[],name:"BetNotAllowed",type:"error"},{inputs:[],name:"BigDifference",type:"error"},{inputs:[],name:"CantAcceptBet",type:"error"},{inputs:[],name:"CantChangeFlag",type:"error"},{inputs:[],name:"ConditionAlreadyCreated",type:"error"},{inputs:[],name:"ConditionAlreadyResolved",type:"error"},{inputs:[],name:"ConditionNotExists",type:"error"},{inputs:[],name:"ConditionNotStarted",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"FlagAlreadySet",type:"error"},{inputs:[],name:"IncorrectTimestamp",type:"error"},{inputs:[],name:"NotEnoughLiquidity",type:"error"},{inputs:[],name:"OnlyLp",type:"error"},{inputs:[],name:"OnlyMaintainer",type:"error"},{inputs:[],name:"OnlyOracle",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"ResolveTooEarly",type:"error"},{inputs:[],name:"SameOutcomes",type:"error"},{inputs:[],name:"SmallBet",type:"error"},{inputs:[],name:"SmallOdds",type:"error"},{inputs:[],name:"WrongDataFormat",type:"error"},{inputs:[],name:"WrongOutcome",type:"error"},{inputs:[],name:"ZeroOdds",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"AllConditionsStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"timestamp",type:"uint64"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeWin",type:"uint64"},{indexed:!1,internalType:"uint8",name:"state",type:"uint8"},{indexed:!1,internalType:"uint256",name:"amountForLp",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"ConditionStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newLp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maintainer",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"MaintainerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newRatio",type:"uint64"}],name:"MaxBanksRatioChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOracle",type:"address"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oracle",type:"address"}],name:"OracleRenounced",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"LP",outputs:[{internalType:"contract ILP",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"allConditionsStopped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"bool",name:"payed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionId",type:"uint256"}],name:"cancelByOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"}],name:"ceil",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"newRatio",type:"uint64"}],name:"changeMaxBanksRatio",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64[2]",name:"odds",type:"uint64[2]"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"},{internalType:"uint128[2]",name:"payouts",type:"uint128[2]"},{internalType:"uint128[2]",name:"totalNetBets",type:"uint128[2]"},{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],internalType:"struct ICore.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionReinforcement",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"fund1Bank",type:"uint256"},{internalType:"uint256",name:"fund2Bank",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeIndex",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"getOddsFromBanks",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"address",name:"oracle",type:"address"},{internalType:"uint128",name:"margin",type:"uint128"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastConditionId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"marginAdjustedOdds",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"oracleConditionIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"putBet",outputs:[{internalType:"uint64",name:"",type:"uint64"},{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint64",name:"outcomeWin",type:"uint64"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"sqrt",outputs:[{internalType:"uint256",name:"y",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bool",name:"flag",type:"bool"}],name:"stopAllConditions",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"bool",name:"flag",type:"bool"}],name:"stopCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateMargins",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateReinforcements",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"}],LpABI=[{inputs:[],name:"AmountMustNotBeZero",type:"error"},{inputs:[],name:"AmountNotSufficient",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"IncorrectPercent",type:"error"},{inputs:[],name:"LeafNotExist",type:"error"},{inputs:[],name:"LiquidityIsLocked",type:"error"},{inputs:[],name:"LiquidityNotOwned",type:"error"},{inputs:[],name:"NoDaoReward",type:"error"},{inputs:[],name:"NoLiquidity",type:"error"},{inputs:[],name:"NoWinNoPrize",type:"error"},{inputs:[],name:"NotEnoughReserves",type:"error"},{inputs:[],name:"OnlyBetOwner",type:"error"},{inputs:[],name:"OnlyCore",type:"error"},{inputs:[],name:"PaymentLocked",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"WithdrawalTimeout",type:"error"},{inputs:[],name:"WrongToken",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"AzuroBetChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"DaoRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint48",name:"leaf",type:"uint48"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLp",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"MinDepoChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeId",type:"uint64"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint128",name:"fund1",type:"uint128"},{indexed:!1,internalType:"uint128",name:"fund2",type:"uint128"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"OracleRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"PeriodChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"ReinforcementAbilityChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"WithdrawTimeoutChanged",type:"event"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"addLiquidityNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"finalReserve",type:"uint128"},{internalType:"uint48",name:"leaf",type:"uint48"},{internalType:"address",name:"oracle",type:"address"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"betNative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAzuroBet",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newCore",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"changeDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"changeMinDepo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"changeReinforcementAbility",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"changeWithdrawTimeout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLeaf",outputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"node",type:"uint48"},{internalType:"uint48",name:"begin",type:"uint48"},{internalType:"uint48",name:"end",type:"uint48"},{internalType:"uint48",name:"l",type:"uint48"},{internalType:"uint48",name:"r",type:"uint48"}],name:"getLeavesAmount",outputs:[{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"fromNumber",type:"uint48"}],name:"getParent",outputs:[{internalType:"uint48",name:"parentNumber",type:"uint48"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcementAmount",type:"uint128"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint128",name:"reserve",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"minDepo",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextNode",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],name:"nodeWithdrawView",outputs:[{internalType:"uint128",name:"withdrawAmount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracleFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",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:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDaoRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"treeNode",outputs:[{internalType:"uint64",name:"updateId",type:"uint64"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateId",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidityNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayoutNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawTimeout",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"withdrawals",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],AzuroBetABI=[{inputs:[],name:"OnlyLp",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getCoreByToken",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"getTokensByOwner",outputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"core",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"uri",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",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:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],TestERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"dst",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"src",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wad",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{},contractAddresses:{},tokenDecimals:null,rateDecimals:null},flushState=function(){state.writeContracts={},state.readContracts={},state.tokenDecimals=null,state.rateDecimals=null},setContractAddresses=function(e){state.contractAddresses=e,flushState()},setWalletProvider=function(e){state.walletProvider=e,flushState()},setSelectedChainId=function(e){state.selectedChainId=e},CONTRACTS={core:{get address(){return state.contractAddresses.core},abi:CoreABI,decimals:18},lp:{get address(){return state.contractAddresses.lp},abi:LpABI,decimals:18},bet:{get address(){return state.contractAddresses.bet},abi:AzuroBetABI,decimals:18},token:{get address(){return state.contractAddresses.token},abi:TestERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new contracts.Contract(n,e,t)},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}function __awaiter(e,r,p,s){return new(p=p||Promise)(function(n,t){function a(e){try{u(s.next(e))}catch(e){t(e)}}function i(e){try{u(s.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof p?t:new p(function(e){e(t)})).then(a,i)}u((s=s.apply(e,r||[])).next())})}function __generator(a,i){var u,r,p,s={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,r&&(p=2&t[0]?r.return:t[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,t[1])).done)return p;switch(r=0,(t=p?[2&t[0],p.value]:t)[0]){case 0:case 1:p=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(p=0<(p=s.trys).length&&p[p.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!p||t[1]>p[0]&&t[1]<p[3])){s.label=t[1];break}if(6===t[0]&&s.label<p[1]){s.label=p[1],p=t;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(t);break}p[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(a,s)}catch(e){t=[6,e],r=0}finally{u=p=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)r.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return r}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={rpcUrl:null,ipfsGateway:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new providers.JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:new providers.JsonRpcProvider(config.rpcUrl)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},getTokenDecimals=function(){return __awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){return null===state.tokenDecimals&&(t=getContract("token"),state.tokenDecimals=t.decimals()),[2,state.tokenDecimals]})})},getRateDecimals=function(){return __awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){return null===state.rateDecimals&&(state.rateDecimals=9),[2,state.rateDecimals]})})},checkTestTokensClaimable=function(e){return getContract("token").availableToClaim(e)},claimTestTokens=function(e){return getContract("token",!0).claim(e)},fetchBalance=function(e){return getContract("token").balanceOf(e)},fetchGameIpfsData=function(y){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p,s,o;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios__default.default.get(""+config.ipfsGateway+y,{timeout:1e4})];case 1:return s=e.sent().data,t=s.entity1Name,n=s.entity1Image,a=s.entity2Name,i=s.entity2Image,o=s.titleCountry,u=s.titleLeague,r=s.sportTypeId,p=s.leagueId,s=s.countryId,[2,{country:o,league:u,participants:[{name:t,image:n},{name:a,image:i}],leagueId:p,countryId:s,sportTypeId:r}];case 2:return o=e.sent(),console.error(o),[2,null];case 3:return[2]}})})},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return __awaiter(void 0,void 0,void 0,function(){var o,y,d,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=(null==a?void 0:a.filters)||{},n=t.resolved,o=void 0===n||n,n=t.canceled,y=void 0===n||n,d=getContract("core"),t=d.filters.ConditionCreated(),[4,d.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var s=e.args.conditionId;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=s.toNumber(),[4,d.getCondition(s)];case 1:return(n=e.sent(),a=n.state,i=n.scopeId.toNumber(),(u=1e3*n.timestamp.toNumber())<=Date.now())?[2]:(o||a!==ConditionStatus.RESOLVED)&&(y||a!==ConditionStatus.CANCELED)?(r=_calculateInitialOdds(n.fundBank,n.margin),p=n.outcomes.map(function(e){return e.toNumber()}),[2,{id:t,outcomes:p,odds:r,gameData:{id:i,state:a,startsAt:u,ipfsHashHex:n.ipfsHash}}]):[2];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1},41:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},42:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var r=e.gameId,p=e.conditionId,t=e.outcomes,s=e.odds;return t.map(function(e,t){var n,a,i,u,t=s[t];betTypeOdd[e]?(n=(a=betTypeOdd[e]).outcomeRegistryId,u=a.marketRegistryId,a=a.paramId,gameBets[i=r+"-"+u]||(gameBets[i]={gameId:r,marketRegistryId:u,betVariants:[]}),u={conditionId:p,outcomeId:e,outcomeRegistryId:n,paramId:a,value:t},gameBets[i].betVariants.push(u)):console.warn("Unknown outcomeId "+e+". Please update the Azuro SDK version")})},fetchGames=function(n){return void 0===n&&(n={}),__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return gamesInfo={},gameBets={},[4,fetchConditions(n)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameData;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),t=groupGames(),[4,Promise.all(t.map(function(i){return __awaiter(void 0,void 0,void 0,function(){var t,n,a;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=i.ipfsHashHex,t=__rest(i,["ipfsHashHex"]),n=ethers.utils.arrayify(n),n=ethers.utils.base58.encode(__spread([18,32],n)),[4,fetchGameIpfsData(n)];case 1:return(n=e.sent())?[2,__assign(__assign({},n),t)]:[2,null];case 2:return a=e.sent(),console.error(a),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean).sort(function(e,t){return e.startsAt-t.startsAt})]}})})},calculateActualOdds=function(e){var p=e.conditionId,s=e.outcomeId,o=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){switch(e.label){case 0:return t=units.parseUnits,n=[String(o)],[4,getTokenDecimals()];case 1:return a=t.apply(void 0,n.concat([e.sent()])),[4,getContract("core").calculateOdds(p,a,s)];case 2:return a=e.sent(),u=units.formatUnits,r=[a],[4,getRateDecimals()];case 3:return i=u.apply(void 0,r.concat([e.sent()])),[2,parseFloat(i)]}})})},fetchAllowance=function(e){return getContract("token").allowance(e,CONTRACTS.lp.address)},approve=function(e){return getContract("token",!0).approve(CONTRACTS.lp.address,e)},placeBet=function(m){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p,s,o,d,y,l;return __generator(this,function(e){switch(e.label){case 0:return t=m.conditionId,n=m.outcomeId,s=m.amount,a=m.betRate,i=m.slippage,u=getContract("lp",!0),p=units.parseUnits,s=[String(s)],[4,getTokenDecimals()];case 1:return r=p.apply(void 0,s.concat([e.sent()])),y=(1+(a-1)*(100-i)/100).toFixed(8),d=units.parseUnits,y=[y],[4,getRateDecimals()];case 2:return o=d.apply(void 0,y.concat([e.sent()])),l=Math.floor(Date.now()/1e3)+2e3,[2,u.bet(t,r,n,l,o)]}})})},fetchBet=function(B){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,i,T,u,r,f,b,I,p,s,o,v,g,w,M,h,R,k,x,C,O,A,_,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,7,,8]),[4,t.bets(B)];case 2:return a=e.sent(),n=a.conditionId,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return u=e.sent(),r=u.scopeId,i=u.state,o=u.ipfsHash,T=u.timestamp,u=u.outcomeWin,r=r.toNumber(),f=n.toNumber(),o=ethers.utils.arrayify(o),o=ethers.utils.base58.encode(__spread([18,32],o)),[4,fetchGameIpfsData(o)];case 4:return(b=e.sent())?(I=1e3*T.toNumber(),p=l.toNumber(),s=u.toNumber(),o=betTypeOdd[p],v=o.marketRegistryId,g=o.outcomeRegistryId,w=o.paramId,h=parseFloat,R=units.formatUnits,k=[m],[4,getRateDecimals()]):[2];case 5:return M=h.apply(void 0,[R.apply(void 0,k.concat([e.sent()]))]),x=parseFloat,C=units.formatUnits,O=[d],[4,getTokenDecimals()];case 6:return y=x.apply(void 0,[C.apply(void 0,O.concat([e.sent()]))]),A=void 0,A=i===ConditionStatus.CANCELED?y:0===s?null:s===p?(y*M).toFixed(6):-1*y,_=__assign(__assign({id:r},b),{startsAt:I,state:i}),[2,{nftId:B,conditionId:f,paramId:w,marketRegistryId:v,outcomeRegistryId:g,rate:M,amount:y,result:A,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:_}];case 7:return y=e.sent(),console.error(y),[2,null];case 8:return[2]}})})},fetchUserBets=function(e){var r=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(r,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};exports.approve=approve,exports.calculateActualOdds=calculateActualOdds,exports.checkTestTokensClaimable=checkTestTokensClaimable,exports.claimTestTokens=claimTestTokens,exports.configure=configure,exports.fetchAllowance=fetchAllowance,exports.fetchBalance=fetchBalance,exports.fetchGames=fetchGames,exports.fetchUserBets=fetchUserBets,exports.placeBet=placeBet,exports.redeemPrize=redeemBetPrize,exports.setContractAddresses=setContractAddresses,exports.setSelectedChainId=setSelectedChainId,exports.setWalletProvider=setWalletProvider; |
{ | ||
"name": "@azuro-protocol/sdk", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"engines": { | ||
"node": "=14.17.4", | ||
"npm": "=6.14.14" | ||
"node": ">=14.17.4", | ||
"npm": ">=6.14.14" | ||
}, | ||
@@ -38,2 +38,4 @@ "azuro": { | ||
"typechain": "typechain --target ethers-v5 --out-dir ./src/contracts/types './src/contracts/abis/*.json'", | ||
"eslint": "eslint --color --cache --ext ts --ext tsx ./src", | ||
"eslint-fix": "npm run eslint -- --fix", | ||
"dev": "rollup -cw", | ||
@@ -54,3 +56,8 @@ "build": "rimraf ./dist && rimraf ./lib && npm run typechain && rollup -c --compact", | ||
"@types/node": "^17.0.14", | ||
"@typescript-eslint/eslint-plugin": "^5.29.0", | ||
"@typescript-eslint/parser": "^5.29.0", | ||
"builtin-modules": "^3.2.0", | ||
"eslint": "^8.18.0", | ||
"eslint-plugin-es5": "^1.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"rimraf": "^3.0.2", | ||
@@ -57,0 +64,0 @@ "rollup": "^2.67.0", |
334
README.md
# @azuro-protocol/sdk | ||
[Documentation](https://sdk-docs-eta.vercel.app/get-started) | ||
Is an SDK that will help you create better decentralized solutions in prediction markets. | ||
Table of contents | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [API](#api) | ||
- [fetchGames](#fetchgames) | ||
- [setSelectedChainId](#setSelectedChainId) | ||
- [setContractAddresses](#setContractAddresses) | ||
- [configure](#configure) | ||
- [setWalletProvider](#setWalletProvider) | ||
- [fetchAllowance](#fetchAllowance) | ||
- [calculateActualOdds](#calculateActualOdds) | ||
- [approve](#approve) | ||
- [placeBet](#placeBet) | ||
- [fetchUserBets](#fetchUserBets) | ||
- [redeemPrize](#redeemPrize) | ||
- [Dictionary](#dictionary) | ||
## Installation | ||
- Install [NodeJS](https://nodejs.org/en/) >= 14 | ||
- Run `npm install @azuro-protocol/sdk` command to install | ||
## Usage | ||
```javascript | ||
import { fetchGames } from '@azuro-protocol/sdk' | ||
// Or if you're stuck with CommonJS | ||
const azuro = require('@azuro-protocol/sdk') | ||
``` | ||
An example of how to get started with the SDK | ||
```javascript | ||
import { | ||
setContractAddresses, | ||
configure, | ||
setWalletProvider, | ||
setSelectedChainId | ||
} from '@azuro-protocol/sdk' | ||
import { Web3Provider } from '@ethersproject/providers' | ||
import Web3 from 'web3' | ||
const library = new Web3Provider(Web3.currentProvider) | ||
setSelectedChainId(100) | ||
setContractAddresses({ | ||
core: '0x4fE6A9e47db94a9b2a4FfeDE8db1602FD1fdd37d', | ||
lp: '0xac004b512c33D029cf23ABf04513f1f380B3FD0a', | ||
bet: '0xFd9E5A2A1bfc8B57A288A3e12E2c601b0Cc7e476', | ||
token: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', | ||
}) | ||
configure({ | ||
rpcUrl: 'https://rpc.xdaichain.com/', | ||
ipfsGateway: 'https://ipfs-gateway.azuro.org/ipfs/', | ||
}) | ||
setWalletProvider(library) | ||
``` | ||
## API | ||
#### fetchGames | ||
This function synchronizes with the blockchain and gives you all the matches that are currently recorded in the blockchain. You also have the option to filter out these matches if you don't want to receive past matches or cancelled matches. | ||
```javascript | ||
import { fetchGames } from '@azuro-protocol/sdk' | ||
await fetchGames({ | ||
filters : { | ||
resolved: false, | ||
canceled: false, | ||
} | ||
}) | ||
``` | ||
An example of what you get when you use this function. | ||
```json | ||
[ | ||
{ | ||
"country": "International Tournaments", | ||
"league": "Dota 2. DPC NA 2021/2022 Tour 3: Division I - Group Stage", | ||
"participants": [ | ||
{ | ||
"name": "Wildcard Gaming", | ||
"image": "https://cdn.sfp.odds.ru/img/234655.png" | ||
}, | ||
{ | ||
"name": "Nouns", | ||
"image": "https://cdn.sfp.odds.ru/img/243075.png" | ||
} | ||
], | ||
"scopeId": 1854, | ||
"leagueId": 700, | ||
"countryId": 258, | ||
"sportTypeId": 1000, | ||
"id": 1854, | ||
"state": 0, | ||
"startsAt": 1655841600000, | ||
"conditions": [ | ||
{ | ||
"paramId": null, | ||
"odds": [ | ||
{ | ||
"conditionId": 642, | ||
"outcomeId": 32, | ||
"outcomeRegistryId": 10009, | ||
"paramId": 1, | ||
"value": 2.9613596003664573 | ||
}, | ||
{ | ||
"conditionId": 642, | ||
"outcomeId": 33, | ||
"outcomeRegistryId": 10010, | ||
"paramId": 1, | ||
"value": 1.3562682487845052 | ||
} | ||
] | ||
} | ||
], | ||
"marketRegistryId": 19 | ||
}, | ||
...] | ||
``` | ||
To understand what identifiers to outcomeId and other parameters mean, see our IPFS list, where we store [dictionary](#dictionary) and descriptions. | ||
| Property | Type | Description | | ||
| :--- | :--- | :--- | | ||
| id | Number | Game ID | | ||
| state | Number | Game status. 0 - Active. 1 - Resolved. 2 - Canceled | | ||
| league | String | Contains info about league and round | | ||
| country | String | League country | | ||
| participants | Array | List of participants. Each participant has "name" and "image" | | ||
| startsAt | Number | Timestamp. Date when this game starts | | ||
| marketRegistryId | Number | Dictionary from this [QmPWps8adamqZfnie6MutAsrYUQynQ8ckwFb3bggz2T4aU](https://ipfs-gateway.azuro.org/ipfs/QmPWps8adamqZfnie6MutAsrYUQynQ8ckwFb3bggz2T4aU) | | ||
| conditions | Array | Dictionary from OutcomeID [QmQ34UYPPtpxJiWcVj4buh4HzFo4Z9gwGt5KRiprQN3fkT](https://ipfs-gateway.azuro.org/ipfs/QmQ34UYPPtpxJiWcVj4buh4HzFo4Z9gwGt5KRiprQN3fkT) | | ||
### setSelectedChainId | ||
A function to set the chain id you will use for blockchain transactions. | ||
```javascript | ||
import { setSelectedChainId } from '@azuro-protocol/sdk' | ||
setSelectedChainId(100) | ||
``` | ||
### setContractAddresses | ||
The function sets the contracts with which you will interact. These are the contracts of our protocol. | ||
```javascript | ||
import { setContractAddresses } from '@azuro-protocol/sdk' | ||
setContractAddresses({ | ||
core: '0x4fE6A9e47db94a9b2a4FfeDE8db1602FD1fdd37d', | ||
lp: '0xac004b512c33D029cf23ABf04513f1f380B3FD0a', | ||
bet: '0xFd9E5A2A1bfc8B57A288A3e12E2c601b0Cc7e476', | ||
token: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', | ||
}) | ||
``` | ||
### configure | ||
The function sets the rpcUrl and ipfs that you will interact with. | ||
```javascript | ||
import { configure } from '@azuro-protocol/sdk' | ||
configure({ | ||
rpcUrl: 'https://rpc.xdaichain.com/', | ||
ipfsGateway: 'https://ipfs-gateway.azuro.org/ipfs/', | ||
}) | ||
``` | ||
## setWalletProvider | ||
The function allows you to set your wallet provider for further interaction. | ||
```javascript | ||
import { setWalletProvider } from '@azuro-protocol/sdk' | ||
import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers' | ||
//library: Web3Provider | ||
setWalletProvider(library); | ||
``` | ||
## fetchAllowance | ||
```javascript | ||
import { fetchAllowance } from '@azuro-protocol/sdk' | ||
fetchAllowance(account) //account as string | ||
``` | ||
## calculateActualOdds | ||
The odds of events change over time, so in order to always know the actual odds we have a method. | ||
```javascript | ||
import { calculateActualOdds } from '@azuro-protocol/sdk' | ||
await calculateActualOdds({ | ||
conditionId, | ||
betAmount, | ||
outcomeId, | ||
}) | ||
``` | ||
## approve | ||
This method allows you to set the amount you allow our smart contract to use. | ||
```javascript | ||
import { approve } from '@azuro-protocol/sdk' | ||
import { constants } from 'ethers' | ||
approve(constants.MaxUint256) | ||
``` | ||
## placeBet | ||
This method allows you to bet on an event. | ||
```javascript | ||
import { placeBet } from '@azuro-protocol/sdk' | ||
await placeBet({ | ||
conditionId, | ||
outcomeId, | ||
betAmount, | ||
betRate, | ||
slippage, | ||
}) | ||
``` | ||
## fetchUserBets | ||
This method gives a list of your bets. | ||
```javascript | ||
import { fetchUserBets } from '@azuro-protocol/sdk' | ||
await fetchUserBets(account) | ||
``` | ||
An example of what you get when you use this function. | ||
```json | ||
{ | ||
"bets": [ | ||
{ | ||
"nftId": 145, | ||
"conditionId": 720, | ||
"paramId": 1, | ||
"marketRegistryId": 1, | ||
"outcomeRegistryId": 1, | ||
"rate": 2.062164217, | ||
"amount": 1, | ||
"result": -1, | ||
"createdAt": 1655913670000, | ||
"isRedeemed": false, | ||
"gameInfo": { | ||
"id": 1832, | ||
"country": "Brazil", | ||
"league": "Brasileiro Serie A - Round 14", | ||
"participants": [ | ||
{ | ||
"name": "Corinthians Paulista", | ||
"image": "https://content.bookieratings.net/images/8e/o3/8eo376_20181001112205_100x100.png" | ||
}, | ||
{ | ||
"name": "Santos", | ||
"image": "https://content.bookieratings.net/images/et/z8/etz8q7_20181001112207_100x100.png" | ||
} | ||
], | ||
"scopeId": 1832, | ||
"leagueId": 329, | ||
"countryId": 31, | ||
"sportTypeId": 33, | ||
"startsAt": 1656194400000, | ||
"state": 1 | ||
} | ||
}, | ||
] | ||
} | ||
``` | ||
## redeemPrize | ||
This method allows you to get your reward for a winning bet. | ||
```javascript | ||
import { redeemPrize } from '@azuro-protocol/sdk' | ||
redeemPrize(nftId) | ||
``` | ||
## Dictionary | ||
This is a dictionary that allows you to understand the parameters we give in the fetchGames method and others. | ||
1. betTypeOdd.marketRegistry | ||
IPFS hash: [QmPWps8adamqZfnie6MutAsrYUQynQ8ckwFb3bggz2T4aU](https://ipfs-gateway.azuro.org/ipfs/QmPWps8adamqZfnie6MutAsrYUQynQ8ckwFb3bggz2T4aU) | ||
2. betTypeOdd.gamePeriod | ||
IPFS hash: [QmTPaf3Vu1wuVH3CNagHmmvj7A9x4A4YHtm5jDzomLD2XP](https://ipfs-gateway.azuro.org/ipfs/QmTPaf3Vu1wuVH3CNagHmmvj7A9x4A4YHtm5jDzomLD2XP) | ||
3. betTypeOdd.gameType | ||
IPFS hash: [QmcxH3srMCPmaqCnSEtTE8PfhF5ykjEgUVgg9vYehmUc8v](https://ipfs-gateway.azuro.org/ipfs/QmcxH3srMCPmaqCnSEtTE8PfhF5ykjEgUVgg9vYehmUc8v) | ||
4. betTypeOdd.gameVariety | ||
IPFS hash: [QmUAPb5un7FCbXRJJLaSwGv8iH8yoEj4AQb1B8jbm1sAYg](https://ipfs-gateway.azuro.org/ipfs/QmUAPb5un7FCbXRJJLaSwGv8iH8yoEj4AQb1B8jbm1sAYg) | ||
5. betTypeOdd.outcomeRegistry | ||
IPFS hash: [QmQ34UYPPtpxJiWcVj4buh4HzFo4Z9gwGt5KRiprQN3fkT](https://ipfs-gateway.azuro.org/ipfs/QmQ34UYPPtpxJiWcVj4buh4HzFo4Z9gwGt5KRiprQN3fkT) | ||
6. betTypeOdd.param | ||
IPFS hash: [QmYsGGCbNrwcUpTCbVbKM7NrMZNg1coFpJDu9ZBrsVqL9H](https://ipfs-gateway.azuro.org/ipfs/QmYsGGCbNrwcUpTCbVbKM7NrMZNg1coFpJDu9ZBrsVqL9H) | ||
7. betTypeOdd.teamPlayer | ||
IPFS hash: [QmUbip5C5XhyW7mwHkRcdUYFb5jGaD4K7AmmKUNLuaMDi7](https://ipfs-gateway.azuro.org/ipfs/QmUbip5C5XhyW7mwHkRcdUYFb5jGaD4K7AmmKUNLuaMDi7) | ||
8. sportTypeId | ||
IPFS hash: [QmZ3UGFQreUNNtnW2v5uoQZLKPv5kJxWvZhr87kDSm6vyJ](https://ipfs-gateway.azuro.org/ipfs/QmZ3UGFQreUNNtnW2v5uoQZLKPv5kJxWvZhr87kDSm6vyJ) | ||
9. betTypeOdd | ||
IPFS hash: [QmZL7mcGKYnbhcWAxQShKtwn9nwZcimaeRFKgAnKm4mcsH](https://ipfs-gateway.azuro.org/ipfs/QmZL7mcGKYnbhcWAxQShKtwn9nwZcimaeRFKgAnKm4mcsH) | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
812892
144
5818
336
23