@azuro-protocol/sdk
Advanced tools
Comparing version 0.1.1 to 0.1.3
declare type FormattedIpfsData = { | ||
id: number; | ||
league: string; | ||
@@ -4,0 +3,0 @@ country: string; |
@@ -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=[{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:"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:!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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"allConditionsStoped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"conditionStoped",type:"event"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"decimals",type:"uint256"}],name:"addMargin",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"allConditionStopped",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:"address",name:"affiliate",type:"address"},{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:"outcomeWin",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionID",type:"uint256"}],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"},{internalType:"uint256",name:"decimals",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"}],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:"decimals",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",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"},{internalType:"address",name:"affiliate",type:"address"}],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:"uint64[2]",name:"outcomes",type:"uint64[2]"},{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:"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:"marginality_",type:"uint256"},{internalType:"uint256",name:"decimals_",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:"oracleWallet",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",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:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],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:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"},{internalType:"address",name:"affiliate",type:"address"}],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:"lpAddress_",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:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"}],LpABI=[{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:"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:!1,internalType:"uint128",name:"newFrontFee",type:"uint128"}],name:"FrontRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],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:!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:!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:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"azuroBetChanged",type:"event"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"profitReserve",type:"uint128"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"affiliates",outputs:[{internalType:"uint128",name:"claimed",type:"uint128"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint128",name:"totalFrontRewards",type:"uint128"}],stateMutability:"view",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:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],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:"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"},{internalType:"address",name:"affiliate_",type:"address"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"bettingLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr",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:"newFrontFee",type:"uint128"}],name:"changeFrontReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"changePeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDAOReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",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:[{internalType:"address",name:"",type:"address"}],name:"freezings",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"frontFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"frozen",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getFeeDecimals",outputs:[{internalType:"uint256",name:"feeDecimals",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"getLiquidityRequests",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"},{internalType:"uint256[3]",name:"personal",type:"uint256[3]"},{internalType:"uint256",name:"total",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getOracleFee",outputs:[{internalType:"uint256",name:"fee",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPeriodsDates",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcementAmount",type:"uint256"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint256",name:"reserve",type:"uint256"}],stateMutability:"view",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:[],name:"initStartDate",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"},{internalType:"uint64",name:"_periodLen",type:"uint64"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"valueLP",type:"uint256"}],name:"liquidityRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"oracleFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"affiliate_",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint128",name:"reward",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"periodLen",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase2end",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"uint256",name:"",type:"uint256"}],name:"requests",outputs:[{internalType:"uint256",name:"totalValue",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"savedPeriods",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_oracle",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"sendOracleReward",outputs:[],stateMutability:"nonpayable",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:[],name:"totalBetsAmount",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDAORewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalFrontRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalReserve",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:[],name:"unfreezeLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"updateDateRatio",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:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawRatio",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"workingReserve",outputs:[{internalType:"uint256",name:"available",type:"uint256"}],stateMutability:"view",type:"function"}],BetABI=[{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:!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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"lpChanged",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:"id",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:"getCoreByTokenId",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastTokenId",outputs:[{internalType:"uint256",name:"tokenId",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:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOfToken",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:"lpAddress_",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"}],ERC20ABI=[{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:"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"},{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:"uint256",name:"newPrice",type:"uint256"}],name:"changePrice",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:"ethBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTokens",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:"price",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],CONTRACTS={core:{address:"0x0410557D9A6364E36A8C876d2bf748CF73B7782a",abi:CoreABI,decimals:18},lp:{address:"0x83cbbBAa1F22faD2e46310C5580624eaCecE5a3b",abi:LpABI,decimals:18},bet:{address:"0x1cCF59e3336bB99831870d6c1ebdC046aF342E73",abi:BetABI,decimals:18},usdt:{address:"0xe5b51cb429edB62b29cECEBACB574074cd276283",abi:ERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new Contract(n,e,t)},state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{}},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},__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 __awaiter(e,p,s,r){return new(s=s||Promise)(function(n,t){function a(e){try{u(r.next(e))}catch(e){t(e)}}function i(e){try{u(r.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(a,i)}u((r=r.apply(e,p||[])).next())})}function __generator(a,i){var u,p,s,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[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(;r;)try{if(u=1,p&&(s=2&t[0]?p.return:t[0]?p.throw||((s=p.return)&&s.call(p),0):p.next)&&!(s=s.call(p,t[1])).done)return s;switch(p=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return r.label++,{value:t[1],done:!1};case 5:r.label++,p=t[1],t=[0];continue;case 7:t=r.ops.pop(),r.trys.pop();continue;default:if(!(s=0<(s=r.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){r=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){r.label=t[1];break}if(6===t[0]&&r.label<s[1]){r.label=s[1],s=t;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(t);break}s[2]&&r.ops.pop(),r.trys.pop();continue}t=i.call(a,r)}catch(e){t=[6,e],p=0}finally{u=s=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),p=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)p.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 p}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)},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)]},fetchGameIpfsData=function(r){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p,s;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios.get(""+config.ipfsGateway+r)];case 1:return p=e.sent().data,s=p.gameId,t=p.entity1Name,n=p.entity1Image,a=p.entity2Name,i=p.entity2Image,u=p.titleCountry,p=p.titleLeague,[2,{id:s,country:u,league:p,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return s=e.sent(),console.error(s),[2,null];case 3:return[2]}})})},_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 void 0===a&&(a={}),__awaiter(void 0,void 0,void 0,function(){var r,o,y,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=a.filters,n=(t=void 0===t?{}:t).resolved,r=void 0===n||n,n=t.canceled,o=void 0===n||n,y=getContract("core"),t=y.filters.ConditionCreated(),[4,y.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,p;return __generator(this,function(e){switch(e.label){case 0:return t=s.toNumber(),[4,y.getCondition(s)];case 1:return(p=e.sent(),n=p.state,r||n!==ConditionStatus.RESOLVED)?o||n!==ConditionStatus.CANCELED?(a=_calculateInitialOdds(p.fundBank,p.margin),i=p.outcomes.map(function(e){return e.toNumber()}),u=1e3*p.timestamp.toNumber(),p=utils.arrayify(p.ipfsHash),p=utils.base58.encode(__spread([18,32],p)),[4,fetchGameIpfsData(p)]):[2]:[2];case 2:return p=e.sent(),[2,{id:t,outcomes:i,odds:a,gameInfo:__assign(__assign({},p),{state:n,startsAt:u})}]}})})}))];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 p=e.gameId,s=e.conditionId,t=e.outcomes,r=e.odds;return t.map(function(e,t){var t=r[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=p+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:p,marketRegistryId:i,betVariants:[]}),{conditionId:s,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(t){return void 0===t&&(t={}),__awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(t)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameInfo;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),[2,groupGames().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.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(r){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p,s;return __generator(this,function(e){return t=r.conditionId,n=r.outcomeId,u=r.amount,s=r.betRate,p=r.slippage,a=r.affiliate,a=void 0===a?"0x0000000000000000000000000000000000000000":a,i=getContract("lp",!0),u=parseUnits(String(u),USDT_DECIMALS),s=(1+(s-1)*(100-p)/100).toFixed(8),p=parseUnits(s,RATE_DECIMALS),s=Math.floor(Date.now()/1e3)+2e3,[2,i.bet(t,u,n,s,p,a)]})})},fetchBet=function(w){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,i,T,u,b,p,f,I,s,v,r,g,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(w)];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(),i=u.state,p=u.ipfsHash,T=u.timestamp,u=u.outcomeWin,b=n.toNumber(),p=utils.arrayify(p),p=utils.base58.encode(__spread([18,32],p)),[4,fetchGameIpfsData(p)];case 4:return p=e.sent(),f=1e3*T.toNumber(),y=l.toNumber(),o=u.toNumber(),s=betTypeOdd[y],I=s.outcomeRegistryId,s=s.paramId,v=parseFloat(formatUnits(m,RATE_DECIMALS)),r=parseFloat(formatUnits(d,USDT_DECIMALS)),g=void 0,g=i===ConditionStatus.CANCELED?r:0===o?null:o===y?(r*v).toFixed(6):-1*r,o=__assign(__assign({},p),{startsAt:f,state:i}),[2,{nftId:w,conditionId:b,paramId:s,outcomeRegistryId:I,rate:v,amount:r,result:g,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}];case 5:return y=e.sent(),console.error(y),[3,6];case 6:return[2]}})})},fetchUserBets=function(e){var p=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(p,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,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=[{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:"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:!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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"allConditionsStoped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"conditionStoped",type:"event"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"decimals",type:"uint256"}],name:"addMargin",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"allConditionStopped",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:"address",name:"affiliate",type:"address"},{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:"outcomeWin",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionID",type:"uint256"}],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"},{internalType:"uint256",name:"decimals",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"}],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:"decimals",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",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"},{internalType:"address",name:"affiliate",type:"address"}],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:"uint64[2]",name:"outcomes",type:"uint64[2]"},{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:"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:"marginality_",type:"uint256"},{internalType:"uint256",name:"decimals_",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:"oracleWallet",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",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:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],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:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"},{internalType:"address",name:"affiliate",type:"address"}],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:"lpAddress_",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:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"}],LpABI=[{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:"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:!1,internalType:"uint128",name:"newFrontFee",type:"uint128"}],name:"FrontRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],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:!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:!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:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"azuroBetChanged",type:"event"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"profitReserve",type:"uint128"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"affiliates",outputs:[{internalType:"uint128",name:"claimed",type:"uint128"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint128",name:"totalFrontRewards",type:"uint128"}],stateMutability:"view",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:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],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:"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"},{internalType:"address",name:"affiliate_",type:"address"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"bettingLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr",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:"newFrontFee",type:"uint128"}],name:"changeFrontReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"changePeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDAOReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",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:[{internalType:"address",name:"",type:"address"}],name:"freezings",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"frontFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"frozen",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getFeeDecimals",outputs:[{internalType:"uint256",name:"feeDecimals",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"getLiquidityRequests",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"},{internalType:"uint256[3]",name:"personal",type:"uint256[3]"},{internalType:"uint256",name:"total",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getOracleFee",outputs:[{internalType:"uint256",name:"fee",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPeriodsDates",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcementAmount",type:"uint256"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint256",name:"reserve",type:"uint256"}],stateMutability:"view",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:[],name:"initStartDate",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"},{internalType:"uint64",name:"_periodLen",type:"uint64"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"valueLP",type:"uint256"}],name:"liquidityRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"oracleFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"affiliate_",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint128",name:"reward",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"periodLen",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase2end",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"uint256",name:"",type:"uint256"}],name:"requests",outputs:[{internalType:"uint256",name:"totalValue",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"savedPeriods",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_oracle",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"sendOracleReward",outputs:[],stateMutability:"nonpayable",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:[],name:"totalBetsAmount",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDAORewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalFrontRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalReserve",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:[],name:"unfreezeLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"updateDateRatio",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:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawRatio",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"workingReserve",outputs:[{internalType:"uint256",name:"available",type:"uint256"}],stateMutability:"view",type:"function"}],BetABI=[{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:!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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"lpChanged",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:"id",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:"getCoreByTokenId",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastTokenId",outputs:[{internalType:"uint256",name:"tokenId",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:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOfToken",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:"lpAddress_",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"}],ERC20ABI=[{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:"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"},{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:"uint256",name:"newPrice",type:"uint256"}],name:"changePrice",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:"ethBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTokens",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:"price",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],CONTRACTS={core:{address:"0x0410557D9A6364E36A8C876d2bf748CF73B7782a",abi:CoreABI,decimals:18},lp:{address:"0x83cbbBAa1F22faD2e46310C5580624eaCecE5a3b",abi:LpABI,decimals:18},bet:{address:"0x1cCF59e3336bB99831870d6c1ebdC046aF342E73",abi:BetABI,decimals:18},usdt:{address:"0xe5b51cb429edB62b29cECEBACB574074cd276283",abi:ERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new Contract(n,e,t)},state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{}},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},__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 __awaiter(e,p,s,r){return new(s=s||Promise)(function(n,t){function a(e){try{u(r.next(e))}catch(e){t(e)}}function i(e){try{u(r.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(a,i)}u((r=r.apply(e,p||[])).next())})}function __generator(a,i){var u,p,s,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[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(;r;)try{if(u=1,p&&(s=2&t[0]?p.return:t[0]?p.throw||((s=p.return)&&s.call(p),0):p.next)&&!(s=s.call(p,t[1])).done)return s;switch(p=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return r.label++,{value:t[1],done:!1};case 5:r.label++,p=t[1],t=[0];continue;case 7:t=r.ops.pop(),r.trys.pop();continue;default:if(!(s=0<(s=r.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){r=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){r.label=t[1];break}if(6===t[0]&&r.label<s[1]){r.label=s[1],s=t;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(t);break}s[2]&&r.ops.pop(),r.trys.pop();continue}t=i.call(a,r)}catch(e){t=[6,e],p=0}finally{u=s=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),p=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)p.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 p}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)},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)]},fetchGameIpfsData=function(s){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios.get(""+config.ipfsGateway+s,{timeout:1500})];case 1:return u=e.sent().data,t=u.entity1Name,n=u.entity1Image,a=u.entity2Name,i=u.entity2Image,p=u.titleCountry,u=u.titleLeague,[2,{country:p,league:u,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})},_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 void 0===a&&(a={}),__awaiter(void 0,void 0,void 0,function(){var y,d,l,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=a.filters,n=(t=void 0===t?{}:t).resolved,y=void 0===n||n,n=t.canceled,d=void 0===n||n,l=getContract("core"),t=l.filters.ConditionCreated(),[4,l.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var o=e.args.conditionID;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p,s,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),t=o.toNumber(),[4,l.getCondition(o)];case 1:return(s=e.sent(),n=s.state,a=s.scopeID.toNumber(),y||n!==ConditionStatus.RESOLVED)?d||n!==ConditionStatus.CANCELED?(i=_calculateInitialOdds(s.fundBank,s.margin),u=s.outcomes.map(function(e){return e.toNumber()}),p=1e3*s.timestamp.toNumber(),s=utils.arrayify(s.ipfsHash),s=utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)]):[2]:[2];case 2:return s=e.sent(),[2,{id:t,outcomes:u,odds:i,gameInfo:__assign(__assign({id:a},s),{state:n,startsAt:p})}];case 3:return r=e.sent(),console.error(r),[2,null];case 4: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 p=e.gameId,s=e.conditionId,t=e.outcomes,r=e.odds;return t.map(function(e,t){var t=r[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=p+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:p,marketRegistryId:i,betVariants:[]}),{conditionId:s,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(t){return void 0===t&&(t={}),__awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(t)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameInfo;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),[2,groupGames().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.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(r){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p,s;return __generator(this,function(e){return t=r.conditionId,n=r.outcomeId,u=r.amount,s=r.betRate,p=r.slippage,a=r.affiliate,a=void 0===a?"0x0000000000000000000000000000000000000000":a,i=getContract("lp",!0),u=parseUnits(String(u),USDT_DECIMALS),s=(1+(s-1)*(100-p)/100).toFixed(8),p=parseUnits(s,RATE_DECIMALS),s=Math.floor(Date.now()/1e3)+2e3,[2,i.bet(t,u,n,s,p,a)]})})},fetchBet=function(M){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,T,b,i,u,f,p,I,v,s,g,r,w,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(M)];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,p=i.ipfsHash,b=i.timestamp,i=i.outcomeWin,u=u.toNumber(),f=n.toNumber(),p=utils.arrayify(p),p=utils.base58.encode(__spread([18,32],p)),[4,fetchGameIpfsData(p)];case 4:return p=e.sent(),I=1e3*b.toNumber(),y=l.toNumber(),o=i.toNumber(),s=betTypeOdd[y],v=s.outcomeRegistryId,s=s.paramId,g=parseFloat(formatUnits(m,RATE_DECIMALS)),r=parseFloat(formatUnits(d,USDT_DECIMALS)),w=void 0,w=T===ConditionStatus.CANCELED?r:0===o?null:o===y?(r*g).toFixed(6):-1*r,o=__assign(__assign({id:u},p),{startsAt:I,state:T}),[2,{nftId:M,conditionId:f,paramId:s,outcomeRegistryId:v,rate:g,amount:r,result:w,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}];case 5:return y=e.sent(),console.error(y),[3,6];case 6:return[2]}})})},fetchUserBets=function(e){var p=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(p,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,setSelectedChainId,setWallerProvider}; |
declare type FormattedIpfsData = { | ||
id: number; | ||
league: string; | ||
@@ -4,0 +3,0 @@ country: string; |
@@ -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=[{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:"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:!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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"allConditionsStoped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"conditionStoped",type:"event"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"decimals",type:"uint256"}],name:"addMargin",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"allConditionStopped",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:"address",name:"affiliate",type:"address"},{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:"outcomeWin",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionID",type:"uint256"}],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"},{internalType:"uint256",name:"decimals",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"}],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:"decimals",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",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"},{internalType:"address",name:"affiliate",type:"address"}],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:"uint64[2]",name:"outcomes",type:"uint64[2]"},{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:"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:"marginality_",type:"uint256"},{internalType:"uint256",name:"decimals_",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:"oracleWallet",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",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:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],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:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"},{internalType:"address",name:"affiliate",type:"address"}],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:"lpAddress_",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:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"}],LpABI=[{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:"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:!1,internalType:"uint128",name:"newFrontFee",type:"uint128"}],name:"FrontRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],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:!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:!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:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"azuroBetChanged",type:"event"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"profitReserve",type:"uint128"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"affiliates",outputs:[{internalType:"uint128",name:"claimed",type:"uint128"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint128",name:"totalFrontRewards",type:"uint128"}],stateMutability:"view",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:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],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:"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"},{internalType:"address",name:"affiliate_",type:"address"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"bettingLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr",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:"newFrontFee",type:"uint128"}],name:"changeFrontReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"changePeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDAOReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",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:[{internalType:"address",name:"",type:"address"}],name:"freezings",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"frontFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"frozen",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getFeeDecimals",outputs:[{internalType:"uint256",name:"feeDecimals",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"getLiquidityRequests",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"},{internalType:"uint256[3]",name:"personal",type:"uint256[3]"},{internalType:"uint256",name:"total",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getOracleFee",outputs:[{internalType:"uint256",name:"fee",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPeriodsDates",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcementAmount",type:"uint256"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint256",name:"reserve",type:"uint256"}],stateMutability:"view",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:[],name:"initStartDate",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"},{internalType:"uint64",name:"_periodLen",type:"uint64"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"valueLP",type:"uint256"}],name:"liquidityRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"oracleFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"affiliate_",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint128",name:"reward",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"periodLen",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase2end",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"uint256",name:"",type:"uint256"}],name:"requests",outputs:[{internalType:"uint256",name:"totalValue",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"savedPeriods",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_oracle",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"sendOracleReward",outputs:[],stateMutability:"nonpayable",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:[],name:"totalBetsAmount",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDAORewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalFrontRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalReserve",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:[],name:"unfreezeLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"updateDateRatio",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:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawRatio",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"workingReserve",outputs:[{internalType:"uint256",name:"available",type:"uint256"}],stateMutability:"view",type:"function"}],BetABI=[{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:!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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"lpChanged",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:"id",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:"getCoreByTokenId",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastTokenId",outputs:[{internalType:"uint256",name:"tokenId",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:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOfToken",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:"lpAddress_",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"}],ERC20ABI=[{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:"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"},{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:"uint256",name:"newPrice",type:"uint256"}],name:"changePrice",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:"ethBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTokens",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:"price",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],CONTRACTS={core:{address:"0x0410557D9A6364E36A8C876d2bf748CF73B7782a",abi:CoreABI,decimals:18},lp:{address:"0x83cbbBAa1F22faD2e46310C5580624eaCecE5a3b",abi:LpABI,decimals:18},bet:{address:"0x1cCF59e3336bB99831870d6c1ebdC046aF342E73",abi:BetABI,decimals:18},usdt:{address:"0xe5b51cb429edB62b29cECEBACB574074cd276283",abi:ERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new contracts.Contract(n,e,t)},state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{}},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},__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 __awaiter(e,p,s,r){return new(s=s||Promise)(function(n,t){function a(e){try{u(r.next(e))}catch(e){t(e)}}function i(e){try{u(r.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(a,i)}u((r=r.apply(e,p||[])).next())})}function __generator(a,i){var u,p,s,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[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(;r;)try{if(u=1,p&&(s=2&t[0]?p.return:t[0]?p.throw||((s=p.return)&&s.call(p),0):p.next)&&!(s=s.call(p,t[1])).done)return s;switch(p=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return r.label++,{value:t[1],done:!1};case 5:r.label++,p=t[1],t=[0];continue;case 7:t=r.ops.pop(),r.trys.pop();continue;default:if(!(s=0<(s=r.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){r=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){r.label=t[1];break}if(6===t[0]&&r.label<s[1]){r.label=s[1],s=t;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(t);break}s[2]&&r.ops.pop(),r.trys.pop();continue}t=i.call(a,r)}catch(e){t=[6,e],p=0}finally{u=s=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),p=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)p.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 p}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)},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)]},fetchGameIpfsData=function(r){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p,s;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios__default.default.get(""+config.ipfsGateway+r)];case 1:return p=e.sent().data,s=p.gameId,t=p.entity1Name,n=p.entity1Image,a=p.entity2Name,i=p.entity2Image,u=p.titleCountry,p=p.titleLeague,[2,{id:s,country:u,league:p,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return s=e.sent(),console.error(s),[2,null];case 3:return[2]}})})},_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 void 0===a&&(a={}),__awaiter(void 0,void 0,void 0,function(){var r,o,y,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=a.filters,n=(t=void 0===t?{}:t).resolved,r=void 0===n||n,n=t.canceled,o=void 0===n||n,y=getContract("core"),t=y.filters.ConditionCreated(),[4,y.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,p;return __generator(this,function(e){switch(e.label){case 0:return t=s.toNumber(),[4,y.getCondition(s)];case 1:return(p=e.sent(),n=p.state,r||n!==ConditionStatus.RESOLVED)?o||n!==ConditionStatus.CANCELED?(a=_calculateInitialOdds(p.fundBank,p.margin),i=p.outcomes.map(function(e){return e.toNumber()}),u=1e3*p.timestamp.toNumber(),p=ethers.utils.arrayify(p.ipfsHash),p=ethers.utils.base58.encode(__spread([18,32],p)),[4,fetchGameIpfsData(p)]):[2]:[2];case 2:return p=e.sent(),[2,{id:t,outcomes:i,odds:a,gameInfo:__assign(__assign({},p),{state:n,startsAt:u})}]}})})}))];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 p=e.gameId,s=e.conditionId,t=e.outcomes,r=e.odds;return t.map(function(e,t){var t=r[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=p+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:p,marketRegistryId:i,betVariants:[]}),{conditionId:s,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(t){return void 0===t&&(t={}),__awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(t)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameInfo;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),[2,groupGames().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.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(r){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p,s;return __generator(this,function(e){return t=r.conditionId,n=r.outcomeId,u=r.amount,s=r.betRate,p=r.slippage,a=r.affiliate,a=void 0===a?"0x0000000000000000000000000000000000000000":a,i=getContract("lp",!0),u=units.parseUnits(String(u),USDT_DECIMALS),s=(1+(s-1)*(100-p)/100).toFixed(8),p=units.parseUnits(s,RATE_DECIMALS),s=Math.floor(Date.now()/1e3)+2e3,[2,i.bet(t,u,n,s,p,a)]})})},fetchBet=function(w){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,i,T,u,b,p,f,I,s,v,r,g,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(w)];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(),i=u.state,p=u.ipfsHash,T=u.timestamp,u=u.outcomeWin,b=n.toNumber(),p=ethers.utils.arrayify(p),p=ethers.utils.base58.encode(__spread([18,32],p)),[4,fetchGameIpfsData(p)];case 4:return p=e.sent(),f=1e3*T.toNumber(),y=l.toNumber(),o=u.toNumber(),s=betTypeOdd[y],I=s.outcomeRegistryId,s=s.paramId,v=parseFloat(units.formatUnits(m,RATE_DECIMALS)),r=parseFloat(units.formatUnits(d,USDT_DECIMALS)),g=void 0,g=i===ConditionStatus.CANCELED?r:0===o?null:o===y?(r*v).toFixed(6):-1*r,o=__assign(__assign({},p),{startsAt:f,state:i}),[2,{nftId:w,conditionId:b,paramId:s,outcomeRegistryId:I,rate:v,amount:r,result:g,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}];case 5:return y=e.sent(),console.error(y),[3,6];case 6:return[2]}})})},fetchUserBets=function(e){var p=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(p,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.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=[{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:"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:!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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"allConditionsStoped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionID",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"conditionStoped",type:"event"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"decimals",type:"uint256"}],name:"addMargin",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"allConditionStopped",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:"address",name:"affiliate",type:"address"},{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:"outcomeWin",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionID",type:"uint256"}],name:"cancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"},{internalType:"uint256",name:"decimals",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"}],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:"decimals",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",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"},{internalType:"address",name:"affiliate",type:"address"}],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:"uint64[2]",name:"outcomes",type:"uint64[2]"},{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:"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:"marginality_",type:"uint256"},{internalType:"uint256",name:"decimals_",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:"oracleWallet",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionID",type:"uint256"},{internalType:"uint256",name:"outcomeWin",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:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],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:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"},{internalType:"address",name:"affiliate",type:"address"}],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:"lpAddress_",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:"uint256",name:"amount",type:"uint256"}],stateMutability:"view",type:"function"}],LpABI=[{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:"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:!1,internalType:"uint128",name:"newFrontFee",type:"uint128"}],name:"FrontRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],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:!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:!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:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"azuroBetChanged",type:"event"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"profitReserve",type:"uint128"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"affiliates",outputs:[{internalType:"uint128",name:"claimed",type:"uint128"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint128",name:"totalFrontRewards",type:"uint128"}],stateMutability:"view",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:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],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:"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"},{internalType:"address",name:"affiliate_",type:"address"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"bettingLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr",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:"newFrontFee",type:"uint128"}],name:"changeFrontReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"changePeriod",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDAOReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",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:[{internalType:"address",name:"",type:"address"}],name:"freezings",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"frontFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"frozen",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getFeeDecimals",outputs:[{internalType:"uint256",name:"feeDecimals",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"wallet",type:"address"}],name:"getLiquidityRequests",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"},{internalType:"uint256[3]",name:"personal",type:"uint256[3]"},{internalType:"uint256",name:"total",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getOracleFee",outputs:[{internalType:"uint256",name:"fee",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPeriodsDates",outputs:[{internalType:"uint256[3]",name:"beginDates",type:"uint256[3]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"reinforcementAmount",type:"uint256"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint256",name:"reserve",type:"uint256"}],stateMutability:"view",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:[],name:"initStartDate",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"},{internalType:"uint64",name:"_periodLen",type:"uint64"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"valueLP",type:"uint256"}],name:"liquidityRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"oracleFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"affiliate_",type:"address"}],name:"pendingReward",outputs:[{internalType:"uint128",name:"reward",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"periodLen",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase2end",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"uint256",name:"",type:"uint256"}],name:"requests",outputs:[{internalType:"uint256",name:"totalValue",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"savedPeriods",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_oracle",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"sendOracleReward",outputs:[],stateMutability:"nonpayable",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:[],name:"totalBetsAmount",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDAORewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalFrontRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalReserve",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:[],name:"unfreezeLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"updateDateRatio",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:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawRatio",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"workingReserve",outputs:[{internalType:"uint256",name:"available",type:"uint256"}],stateMutability:"view",type:"function"}],BetABI=[{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:!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"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"lpChanged",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:"id",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:"getCoreByTokenId",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastTokenId",outputs:[{internalType:"uint256",name:"tokenId",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:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOfToken",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:"lpAddress_",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"}],ERC20ABI=[{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:"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"},{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:"uint256",name:"newPrice",type:"uint256"}],name:"changePrice",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:"ethBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTokens",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:"price",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],CONTRACTS={core:{address:"0x0410557D9A6364E36A8C876d2bf748CF73B7782a",abi:CoreABI,decimals:18},lp:{address:"0x83cbbBAa1F22faD2e46310C5580624eaCecE5a3b",abi:LpABI,decimals:18},bet:{address:"0x1cCF59e3336bB99831870d6c1ebdC046aF342E73",abi:BetABI,decimals:18},usdt:{address:"0xe5b51cb429edB62b29cECEBACB574074cd276283",abi:ERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new contracts.Contract(n,e,t)},state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{}},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},__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 __awaiter(e,p,s,r){return new(s=s||Promise)(function(n,t){function a(e){try{u(r.next(e))}catch(e){t(e)}}function i(e){try{u(r.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(a,i)}u((r=r.apply(e,p||[])).next())})}function __generator(a,i){var u,p,s,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[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(;r;)try{if(u=1,p&&(s=2&t[0]?p.return:t[0]?p.throw||((s=p.return)&&s.call(p),0):p.next)&&!(s=s.call(p,t[1])).done)return s;switch(p=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return r.label++,{value:t[1],done:!1};case 5:r.label++,p=t[1],t=[0];continue;case 7:t=r.ops.pop(),r.trys.pop();continue;default:if(!(s=0<(s=r.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){r=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){r.label=t[1];break}if(6===t[0]&&r.label<s[1]){r.label=s[1],s=t;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(t);break}s[2]&&r.ops.pop(),r.trys.pop();continue}t=i.call(a,r)}catch(e){t=[6,e],p=0}finally{u=s=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),p=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)p.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 p}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)},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)]},fetchGameIpfsData=function(s){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios__default.default.get(""+config.ipfsGateway+s,{timeout:1500})];case 1:return u=e.sent().data,t=u.entity1Name,n=u.entity1Image,a=u.entity2Name,i=u.entity2Image,p=u.titleCountry,u=u.titleLeague,[2,{country:p,league:u,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})},_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 void 0===a&&(a={}),__awaiter(void 0,void 0,void 0,function(){var y,d,l,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=a.filters,n=(t=void 0===t?{}:t).resolved,y=void 0===n||n,n=t.canceled,d=void 0===n||n,l=getContract("core"),t=l.filters.ConditionCreated(),[4,l.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var o=e.args.conditionID;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p,s,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),t=o.toNumber(),[4,l.getCondition(o)];case 1:return(s=e.sent(),n=s.state,a=s.scopeID.toNumber(),y||n!==ConditionStatus.RESOLVED)?d||n!==ConditionStatus.CANCELED?(i=_calculateInitialOdds(s.fundBank,s.margin),u=s.outcomes.map(function(e){return e.toNumber()}),p=1e3*s.timestamp.toNumber(),s=ethers.utils.arrayify(s.ipfsHash),s=ethers.utils.base58.encode(__spread([18,32],s)),[4,fetchGameIpfsData(s)]):[2]:[2];case 2:return s=e.sent(),[2,{id:t,outcomes:u,odds:i,gameInfo:__assign(__assign({id:a},s),{state:n,startsAt:p})}];case 3:return r=e.sent(),console.error(r),[2,null];case 4: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 p=e.gameId,s=e.conditionId,t=e.outcomes,r=e.odds;return t.map(function(e,t){var t=r[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=p+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:p,marketRegistryId:i,betVariants:[]}),{conditionId:s,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(t){return void 0===t&&(t={}),__awaiter(void 0,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(t)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameInfo;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),[2,groupGames().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.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(r){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,p,s;return __generator(this,function(e){return t=r.conditionId,n=r.outcomeId,u=r.amount,s=r.betRate,p=r.slippage,a=r.affiliate,a=void 0===a?"0x0000000000000000000000000000000000000000":a,i=getContract("lp",!0),u=units.parseUnits(String(u),USDT_DECIMALS),s=(1+(s-1)*(100-p)/100).toFixed(8),p=units.parseUnits(s,RATE_DECIMALS),s=Math.floor(Date.now()/1e3)+2e3,[2,i.bet(t,u,n,s,p,a)]})})},fetchBet=function(M){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,T,b,i,u,f,p,I,v,s,g,r,w,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(M)];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,p=i.ipfsHash,b=i.timestamp,i=i.outcomeWin,u=u.toNumber(),f=n.toNumber(),p=ethers.utils.arrayify(p),p=ethers.utils.base58.encode(__spread([18,32],p)),[4,fetchGameIpfsData(p)];case 4:return p=e.sent(),I=1e3*b.toNumber(),y=l.toNumber(),o=i.toNumber(),s=betTypeOdd[y],v=s.outcomeRegistryId,s=s.paramId,g=parseFloat(units.formatUnits(m,RATE_DECIMALS)),r=parseFloat(units.formatUnits(d,USDT_DECIMALS)),w=void 0,w=T===ConditionStatus.CANCELED?r:0===o?null:o===y?(r*g).toFixed(6):-1*r,o=__assign(__assign({id:u},p),{startsAt:I,state:T}),[2,{nftId:M,conditionId:f,paramId:s,outcomeRegistryId:v,rate:g,amount:r,result:w,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}];case 5:return y=e.sent(),console.error(y),[3,6];case 6:return[2]}})})},fetchUserBets=function(e){var p=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(p,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.setSelectedChainId=setSelectedChainId,exports.setWallerProvider=setWallerProvider; |
{ | ||
"name": "@azuro-protocol/sdk", | ||
"version": "0.1.1", | ||
"version": "0.1.3", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": "=14.17.4", |
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
789088
5788