Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azuro-protocol/sdk

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azuro-protocol/sdk - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

dist/index.es.js

@@ -1,1 +0,1 @@

import{Contract}from"@ethersproject/contracts";import{JsonRpcProvider}from"@ethersproject/providers";import{utils}from"ethers";import axios from"axios";import{formatUnits,parseUnits}from"@ethersproject/units";var CoreABI=[{inputs:[],name:"BetNotAllowed",type:"error"},{inputs:[],name:"BigDifference",type:"error"},{inputs:[],name:"CantAcceptBet",type:"error"},{inputs:[],name:"CantChangeFlag",type:"error"},{inputs:[],name:"ConditionAlreadyCreated",type:"error"},{inputs:[],name:"ConditionAlreadyResolved",type:"error"},{inputs:[],name:"ConditionNotExists",type:"error"},{inputs:[],name:"ConditionNotStarted",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"FlagAlreadySet",type:"error"},{inputs:[],name:"IncorrectTimestamp",type:"error"},{inputs:[],name:"NotEnoughLiquidity",type:"error"},{inputs:[],name:"OnlyLp",type:"error"},{inputs:[],name:"OnlyMaintainer",type:"error"},{inputs:[],name:"OnlyOracle",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"ResolveTooEarly",type:"error"},{inputs:[],name:"SameOutcomes",type:"error"},{inputs:[],name:"SmallBet",type:"error"},{inputs:[],name:"SmallOdds",type:"error"},{inputs:[],name:"WrongDataFormat",type:"error"},{inputs:[],name:"WrongOutcome",type:"error"},{inputs:[],name:"ZeroOdds",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"AllConditionsStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"timestamp",type:"uint64"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeWin",type:"uint64"},{indexed:!1,internalType:"uint8",name:"state",type:"uint8"},{indexed:!1,internalType:"uint256",name:"amountForLp",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"ConditionStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newLp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maintainer",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"MaintainerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newRatio",type:"uint64"}],name:"MaxBanksRatioChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOracle",type:"address"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oracle",type:"address"}],name:"OracleRenounced",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"LP",outputs:[{internalType:"contract ILP",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"allConditionsStopped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"bool",name:"payed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionId",type:"uint256"}],name:"cancelByOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"}],name:"ceil",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"newRatio",type:"uint64"}],name:"changeMaxBanksRatio",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64[2]",name:"odds",type:"uint64[2]"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"},{internalType:"uint128[2]",name:"payouts",type:"uint128[2]"},{internalType:"uint128[2]",name:"totalNetBets",type:"uint128[2]"},{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],internalType:"struct ICore.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionReinforcement",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"fund1Bank",type:"uint256"},{internalType:"uint256",name:"fund2Bank",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeIndex",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"getOddsFromBanks",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"address",name:"oracle",type:"address"},{internalType:"uint128",name:"margin",type:"uint128"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastConditionId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"marginAdjustedOdds",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"oracleConditionIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"putBet",outputs:[{internalType:"uint64",name:"",type:"uint64"},{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint64",name:"outcomeWin",type:"uint64"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"sqrt",outputs:[{internalType:"uint256",name:"y",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bool",name:"flag",type:"bool"}],name:"stopAllConditions",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"bool",name:"flag",type:"bool"}],name:"stopCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateMargins",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateReinforcements",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"}],LpABI=[{inputs:[],name:"AmountMustNotBeZero",type:"error"},{inputs:[],name:"AmountNotSufficient",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"IncorrectPercent",type:"error"},{inputs:[],name:"LeafNotExist",type:"error"},{inputs:[],name:"LiquidityIsLocked",type:"error"},{inputs:[],name:"LiquidityNotOwned",type:"error"},{inputs:[],name:"NoDaoReward",type:"error"},{inputs:[],name:"NoLiquidity",type:"error"},{inputs:[],name:"NoWinNoPrize",type:"error"},{inputs:[],name:"NotEnoughReserves",type:"error"},{inputs:[],name:"OnlyBetOwner",type:"error"},{inputs:[],name:"OnlyCore",type:"error"},{inputs:[],name:"PaymentLocked",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"WithdrawalTimeout",type:"error"},{inputs:[],name:"WrongToken",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"AzuroBetChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"DaoRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint48",name:"leaf",type:"uint48"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLp",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"MinDepoChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeId",type:"uint64"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint128",name:"fund1",type:"uint128"},{indexed:!1,internalType:"uint128",name:"fund2",type:"uint128"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"OracleRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"PeriodChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"ReinforcementAbilityChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"WithdrawTimeoutChanged",type:"event"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"addLiquidityNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"finalReserve",type:"uint128"},{internalType:"uint48",name:"leaf",type:"uint48"},{internalType:"address",name:"oracle",type:"address"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"betNative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAzuroBet",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newCore",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"changeDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"changeMinDepo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"changeReinforcementAbility",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"changeWithdrawTimeout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLeaf",outputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"node",type:"uint48"},{internalType:"uint48",name:"begin",type:"uint48"},{internalType:"uint48",name:"end",type:"uint48"},{internalType:"uint48",name:"l",type:"uint48"},{internalType:"uint48",name:"r",type:"uint48"}],name:"getLeavesAmount",outputs:[{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"fromNumber",type:"uint48"}],name:"getParent",outputs:[{internalType:"uint48",name:"parentNumber",type:"uint48"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcementAmount",type:"uint128"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint128",name:"reserve",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"minDepo",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextNode",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],name:"nodeWithdrawView",outputs:[{internalType:"uint128",name:"withdrawAmount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracleFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDaoRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"treeNode",outputs:[{internalType:"uint64",name:"updateId",type:"uint64"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateId",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidityNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayoutNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawTimeout",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"withdrawals",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],AzuroBetABI=[{inputs:[],name:"OnlyLp",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getCoreByToken",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"getTokensByOwner",outputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"core",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"uri",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],TestERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"dst",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"src",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wad",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{},contractAddresses:{}},setContractAddresses=function(e){state.contractAddresses=e},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},CONTRACTS={core:{get address(){return state.contractAddresses.core},abi:CoreABI,decimals:18},lp:{get address(){return state.contractAddresses.lp},abi:LpABI,decimals:18},bet:{get address(){return state.contractAddresses.bet},abi:AzuroBetABI,decimals:18},usdt:{get address(){return state.contractAddresses.usdt},abi:TestERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new Contract(n,e,t)},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}function __awaiter(e,r,p,s){return new(p=p||Promise)(function(n,t){function a(e){try{u(s.next(e))}catch(e){t(e)}}function i(e){try{u(s.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof p?t:new p(function(e){e(t)})).then(a,i)}u((s=s.apply(e,r||[])).next())})}function __generator(a,i){var u,r,p,s={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,r&&(p=2&t[0]?r.return:t[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,t[1])).done)return p;switch(r=0,(t=p?[2&t[0],p.value]:t)[0]){case 0:case 1:p=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(p=0<(p=s.trys).length&&p[p.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!p||t[1]>p[0]&&t[1]<p[3])){s.label=t[1];break}if(6===t[0]&&s.label<p[1]){s.label=p[1],p=t;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(t);break}p[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(a,s)}catch(e){t=[6,e],r=0}finally{u=p=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)r.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return r}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={rpcUrl:null,ipfsGateway:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:new JsonRpcProvider(config.rpcUrl)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios.get(""+config.ipfsGateway+p,{timeout:1e4})];case 1:return u=e.sent().data,t=u.entity1Name,n=u.entity1Image,a=u.entity2Name,i=u.entity2Image,r=u.titleCountry,u=u.titleLeague,[2,{country:r,league:u,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return __awaiter(void 0,void 0,void 0,function(){var o,y,d,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=(null==a?void 0:a.filters)||{},n=t.resolved,o=void 0===n||n,n=t.canceled,y=void 0===n||n,d=getContract("core"),t=d.filters.ConditionCreated(),[4,d.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var s=e.args.conditionId;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=s.toNumber(),[4,d.getCondition(s)];case 1:return(n=e.sent(),a=n.state,i=n.scopeId.toNumber(),(u=1e3*n.timestamp.toNumber())<=Date.now())?[2]:(o||a!==ConditionStatus.RESOLVED)&&(y||a!==ConditionStatus.CANCELED)?(r=_calculateInitialOdds(n.fundBank,n.margin),p=n.outcomes.map(function(e){return e.toNumber()}),[2,{id:t,outcomes:p,odds:r,gameData:{id:i,state:a,startsAt:u,ipfsHashHex:n.ipfsHash}}]):[2];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var r=e.gameId,p=e.conditionId,t=e.outcomes,s=e.odds;return t.map(function(e,t){var t=s[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=r+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:r,marketRegistryId:i,betVariants:[]}),{conditionId:p,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(n){return void 0===n&&(n={}),__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(n)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameData;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),t=groupGames(),[4,Promise.all(t.map(function(i){return __awaiter(void 0,void 0,void 0,function(){var t,n,a;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=i.ipfsHashHex,t=__rest(i,["ipfsHashHex"]),n=utils.arrayify(n),n=utils.base58.encode(__spread([18,32],n)),[4,fetchGameIpfsData(n)];case 1:return(n=e.sent())?[2,__assign(__assign({},n),t)]:[2,null];case 2:return a=e.sent(),console.error(a),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean).sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,i=p.amount,r=p.betRate,u=p.slippage,a=getContract("lp",!0),i=parseUnits(String(i),USDT_DECIMALS),r=(1+(r-1)*(100-u)/100).toFixed(8),u=parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,a.bet(t,i,n,r,u)]})})},fetchBet=function(R){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,T,f,i,u,b,r,I,v,w,p,g,s,M,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(R)];case 2:return a=e.sent(),n=a.conditionId,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return i=e.sent(),u=i.scopeId,T=i.state,r=i.ipfsHash,f=i.timestamp,i=i.outcomeWin,u=u.toNumber(),b=n.toNumber(),r=utils.arrayify(r),r=utils.base58.encode(__spread([18,32],r)),[4,fetchGameIpfsData(r)];case 4:return(r=e.sent())?(I=1e3*f.toNumber(),y=l.toNumber(),o=i.toNumber(),p=betTypeOdd[y],v=p.marketRegistryId,w=p.outcomeRegistryId,p=p.paramId,g=parseFloat(formatUnits(m,RATE_DECIMALS)),s=parseFloat(formatUnits(d,USDT_DECIMALS)),M=void 0,M=T===ConditionStatus.CANCELED?s:0===o?null:o===y?(s*g).toFixed(6):-1*s,o=__assign(__assign({id:u},r),{startsAt:I,state:T}),[2,{nftId:R,conditionId:b,paramId:p,marketRegistryId:v,outcomeRegistryId:w,rate:g,amount:s,result:M,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}]):[2];case 5:return y=e.sent(),console.error(y),[2,null];case 6:return[2]}})})},fetchUserBets=function(e){var r=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(r,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};export{RATE_DECIMALS,USDT_DECIMALS,approve,calculateActualOdds,checkTestTokensClaimable,claimTestTokens,configure,fetchAllowance,fetchBalance,fetchGames,fetchUserBets,placeBet,redeemBetPrize as redeemPrize,setContractAddresses,setSelectedChainId,setWallerProvider};
import{Contract}from"@ethersproject/contracts";import{JsonRpcProvider}from"@ethersproject/providers";import{utils}from"ethers";import axios from"axios";import{formatUnits,parseUnits}from"@ethersproject/units";var CoreABI=[{inputs:[],name:"BetNotAllowed",type:"error"},{inputs:[],name:"BigDifference",type:"error"},{inputs:[],name:"CantAcceptBet",type:"error"},{inputs:[],name:"CantChangeFlag",type:"error"},{inputs:[],name:"ConditionAlreadyCreated",type:"error"},{inputs:[],name:"ConditionAlreadyResolved",type:"error"},{inputs:[],name:"ConditionNotExists",type:"error"},{inputs:[],name:"ConditionNotStarted",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"FlagAlreadySet",type:"error"},{inputs:[],name:"IncorrectTimestamp",type:"error"},{inputs:[],name:"NotEnoughLiquidity",type:"error"},{inputs:[],name:"OnlyLp",type:"error"},{inputs:[],name:"OnlyMaintainer",type:"error"},{inputs:[],name:"OnlyOracle",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"ResolveTooEarly",type:"error"},{inputs:[],name:"SameOutcomes",type:"error"},{inputs:[],name:"SmallBet",type:"error"},{inputs:[],name:"SmallOdds",type:"error"},{inputs:[],name:"WrongDataFormat",type:"error"},{inputs:[],name:"WrongOutcome",type:"error"},{inputs:[],name:"ZeroOdds",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"AllConditionsStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"timestamp",type:"uint64"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeWin",type:"uint64"},{indexed:!1,internalType:"uint8",name:"state",type:"uint8"},{indexed:!1,internalType:"uint256",name:"amountForLp",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"ConditionStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newLp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maintainer",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"MaintainerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newRatio",type:"uint64"}],name:"MaxBanksRatioChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOracle",type:"address"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oracle",type:"address"}],name:"OracleRenounced",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"LP",outputs:[{internalType:"contract ILP",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"allConditionsStopped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"bool",name:"payed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionId",type:"uint256"}],name:"cancelByOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"}],name:"ceil",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"newRatio",type:"uint64"}],name:"changeMaxBanksRatio",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64[2]",name:"odds",type:"uint64[2]"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"},{internalType:"uint128[2]",name:"payouts",type:"uint128[2]"},{internalType:"uint128[2]",name:"totalNetBets",type:"uint128[2]"},{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],internalType:"struct ICore.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionReinforcement",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"fund1Bank",type:"uint256"},{internalType:"uint256",name:"fund2Bank",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeIndex",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"getOddsFromBanks",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"address",name:"oracle",type:"address"},{internalType:"uint128",name:"margin",type:"uint128"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastConditionId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"marginAdjustedOdds",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"oracleConditionIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"putBet",outputs:[{internalType:"uint64",name:"",type:"uint64"},{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint64",name:"outcomeWin",type:"uint64"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"sqrt",outputs:[{internalType:"uint256",name:"y",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bool",name:"flag",type:"bool"}],name:"stopAllConditions",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"bool",name:"flag",type:"bool"}],name:"stopCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateMargins",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateReinforcements",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"}],LpABI=[{inputs:[],name:"AmountMustNotBeZero",type:"error"},{inputs:[],name:"AmountNotSufficient",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"IncorrectPercent",type:"error"},{inputs:[],name:"LeafNotExist",type:"error"},{inputs:[],name:"LiquidityIsLocked",type:"error"},{inputs:[],name:"LiquidityNotOwned",type:"error"},{inputs:[],name:"NoDaoReward",type:"error"},{inputs:[],name:"NoLiquidity",type:"error"},{inputs:[],name:"NoWinNoPrize",type:"error"},{inputs:[],name:"NotEnoughReserves",type:"error"},{inputs:[],name:"OnlyBetOwner",type:"error"},{inputs:[],name:"OnlyCore",type:"error"},{inputs:[],name:"PaymentLocked",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"WithdrawalTimeout",type:"error"},{inputs:[],name:"WrongToken",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"AzuroBetChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"DaoRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint48",name:"leaf",type:"uint48"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLp",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"MinDepoChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeId",type:"uint64"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint128",name:"fund1",type:"uint128"},{indexed:!1,internalType:"uint128",name:"fund2",type:"uint128"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"OracleRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"PeriodChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"ReinforcementAbilityChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"WithdrawTimeoutChanged",type:"event"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"addLiquidityNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"finalReserve",type:"uint128"},{internalType:"uint48",name:"leaf",type:"uint48"},{internalType:"address",name:"oracle",type:"address"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"betNative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAzuroBet",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newCore",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"changeDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"changeMinDepo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"changeReinforcementAbility",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"changeWithdrawTimeout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLeaf",outputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"node",type:"uint48"},{internalType:"uint48",name:"begin",type:"uint48"},{internalType:"uint48",name:"end",type:"uint48"},{internalType:"uint48",name:"l",type:"uint48"},{internalType:"uint48",name:"r",type:"uint48"}],name:"getLeavesAmount",outputs:[{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"fromNumber",type:"uint48"}],name:"getParent",outputs:[{internalType:"uint48",name:"parentNumber",type:"uint48"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcementAmount",type:"uint128"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint128",name:"reserve",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"minDepo",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextNode",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],name:"nodeWithdrawView",outputs:[{internalType:"uint128",name:"withdrawAmount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracleFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDaoRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"treeNode",outputs:[{internalType:"uint64",name:"updateId",type:"uint64"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateId",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidityNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayoutNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawTimeout",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"withdrawals",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],AzuroBetABI=[{inputs:[],name:"OnlyLp",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getCoreByToken",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"getTokensByOwner",outputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"core",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"uri",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],TestERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"dst",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"src",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wad",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{},contractAddresses:{}},setContractAddresses=function(e){state.contractAddresses=e,state.writeContracts={},state.readContracts={}},setWallerProvider=function(e){state.walletProvider=e,state.writeContracts={},state.readContracts={}},setSelectedChainId=function(e){state.selectedChainId=e},CONTRACTS={core:{get address(){return state.contractAddresses.core},abi:CoreABI,decimals:18},lp:{get address(){return state.contractAddresses.lp},abi:LpABI,decimals:18},bet:{get address(){return state.contractAddresses.bet},abi:AzuroBetABI,decimals:18},usdt:{get address(){return state.contractAddresses.usdt},abi:TestERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new Contract(n,e,t)},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}function __awaiter(e,r,p,s){return new(p=p||Promise)(function(n,t){function a(e){try{u(s.next(e))}catch(e){t(e)}}function i(e){try{u(s.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof p?t:new p(function(e){e(t)})).then(a,i)}u((s=s.apply(e,r||[])).next())})}function __generator(a,i){var u,r,p,s={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,r&&(p=2&t[0]?r.return:t[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,t[1])).done)return p;switch(r=0,(t=p?[2&t[0],p.value]:t)[0]){case 0:case 1:p=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(p=0<(p=s.trys).length&&p[p.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!p||t[1]>p[0]&&t[1]<p[3])){s.label=t[1];break}if(6===t[0]&&s.label<p[1]){s.label=p[1],p=t;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(t);break}p[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(a,s)}catch(e){t=[6,e],r=0}finally{u=p=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)r.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return r}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={rpcUrl:null,ipfsGateway:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:new JsonRpcProvider(config.rpcUrl)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios.get(""+config.ipfsGateway+p,{timeout:1e4})];case 1:return u=e.sent().data,t=u.entity1Name,n=u.entity1Image,a=u.entity2Name,i=u.entity2Image,r=u.titleCountry,u=u.titleLeague,[2,{country:r,league:u,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return __awaiter(void 0,void 0,void 0,function(){var o,y,d,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=(null==a?void 0:a.filters)||{},n=t.resolved,o=void 0===n||n,n=t.canceled,y=void 0===n||n,d=getContract("core"),t=d.filters.ConditionCreated(),[4,d.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var s=e.args.conditionId;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=s.toNumber(),[4,d.getCondition(s)];case 1:return(n=e.sent(),a=n.state,i=n.scopeId.toNumber(),(u=1e3*n.timestamp.toNumber())<=Date.now())?[2]:(o||a!==ConditionStatus.RESOLVED)&&(y||a!==ConditionStatus.CANCELED)?(r=_calculateInitialOdds(n.fundBank,n.margin),p=n.outcomes.map(function(e){return e.toNumber()}),[2,{id:t,outcomes:p,odds:r,gameData:{id:i,state:a,startsAt:u,ipfsHashHex:n.ipfsHash}}]):[2];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var r=e.gameId,p=e.conditionId,t=e.outcomes,s=e.odds;return t.map(function(e,t){var t=s[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=r+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:r,marketRegistryId:i,betVariants:[]}),{conditionId:p,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(n){return void 0===n&&(n={}),__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return gamesInfo={},gameBets={},[4,fetchConditions(n)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameData;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),t=groupGames(),[4,Promise.all(t.map(function(i){return __awaiter(void 0,void 0,void 0,function(){var t,n,a;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=i.ipfsHashHex,t=__rest(i,["ipfsHashHex"]),n=utils.arrayify(n),n=utils.base58.encode(__spread([18,32],n)),[4,fetchGameIpfsData(n)];case 1:return(n=e.sent())?[2,__assign(__assign({},n),t)]:[2,null];case 2:return a=e.sent(),console.error(a),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean).sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.lp.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.lp.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,i=p.amount,r=p.betRate,u=p.slippage,a=getContract("lp",!0),i=parseUnits(String(i),USDT_DECIMALS),r=(1+(r-1)*(100-u)/100).toFixed(8),u=parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,a.bet(t,i,n,r,u)]})})},fetchBet=function(R){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,T,f,i,u,b,r,I,v,w,p,g,s,M,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(R)];case 2:return a=e.sent(),n=a.conditionId,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return i=e.sent(),u=i.scopeId,T=i.state,r=i.ipfsHash,f=i.timestamp,i=i.outcomeWin,u=u.toNumber(),b=n.toNumber(),r=utils.arrayify(r),r=utils.base58.encode(__spread([18,32],r)),[4,fetchGameIpfsData(r)];case 4:return(r=e.sent())?(I=1e3*f.toNumber(),y=l.toNumber(),o=i.toNumber(),p=betTypeOdd[y],v=p.marketRegistryId,w=p.outcomeRegistryId,p=p.paramId,g=parseFloat(formatUnits(m,RATE_DECIMALS)),s=parseFloat(formatUnits(d,USDT_DECIMALS)),M=void 0,M=T===ConditionStatus.CANCELED?s:0===o?null:o===y?(s*g).toFixed(6):-1*s,o=__assign(__assign({id:u},r),{startsAt:I,state:T}),[2,{nftId:R,conditionId:b,paramId:p,marketRegistryId:v,outcomeRegistryId:w,rate:g,amount:s,result:M,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}]):[2];case 5:return y=e.sent(),console.error(y),[2,null];case 6:return[2]}})})},fetchUserBets=function(e){var r=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(r,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};export{RATE_DECIMALS,USDT_DECIMALS,approve,calculateActualOdds,checkTestTokensClaimable,claimTestTokens,configure,fetchAllowance,fetchBalance,fetchGames,fetchUserBets,placeBet,redeemBetPrize as redeemPrize,setContractAddresses,setSelectedChainId,setWallerProvider};

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var contracts=require("@ethersproject/contracts"),providers=require("@ethersproject/providers"),ethers=require("ethers"),axios=require("axios"),units=require("@ethersproject/units");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var axios__default=_interopDefaultLegacy(axios),CoreABI=[{inputs:[],name:"BetNotAllowed",type:"error"},{inputs:[],name:"BigDifference",type:"error"},{inputs:[],name:"CantAcceptBet",type:"error"},{inputs:[],name:"CantChangeFlag",type:"error"},{inputs:[],name:"ConditionAlreadyCreated",type:"error"},{inputs:[],name:"ConditionAlreadyResolved",type:"error"},{inputs:[],name:"ConditionNotExists",type:"error"},{inputs:[],name:"ConditionNotStarted",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"FlagAlreadySet",type:"error"},{inputs:[],name:"IncorrectTimestamp",type:"error"},{inputs:[],name:"NotEnoughLiquidity",type:"error"},{inputs:[],name:"OnlyLp",type:"error"},{inputs:[],name:"OnlyMaintainer",type:"error"},{inputs:[],name:"OnlyOracle",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"ResolveTooEarly",type:"error"},{inputs:[],name:"SameOutcomes",type:"error"},{inputs:[],name:"SmallBet",type:"error"},{inputs:[],name:"SmallOdds",type:"error"},{inputs:[],name:"WrongDataFormat",type:"error"},{inputs:[],name:"WrongOutcome",type:"error"},{inputs:[],name:"ZeroOdds",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"AllConditionsStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"timestamp",type:"uint64"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeWin",type:"uint64"},{indexed:!1,internalType:"uint8",name:"state",type:"uint8"},{indexed:!1,internalType:"uint256",name:"amountForLp",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"ConditionStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newLp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maintainer",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"MaintainerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newRatio",type:"uint64"}],name:"MaxBanksRatioChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOracle",type:"address"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oracle",type:"address"}],name:"OracleRenounced",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"LP",outputs:[{internalType:"contract ILP",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"allConditionsStopped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"bool",name:"payed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionId",type:"uint256"}],name:"cancelByOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"}],name:"ceil",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"newRatio",type:"uint64"}],name:"changeMaxBanksRatio",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64[2]",name:"odds",type:"uint64[2]"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"},{internalType:"uint128[2]",name:"payouts",type:"uint128[2]"},{internalType:"uint128[2]",name:"totalNetBets",type:"uint128[2]"},{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],internalType:"struct ICore.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionReinforcement",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"fund1Bank",type:"uint256"},{internalType:"uint256",name:"fund2Bank",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeIndex",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"getOddsFromBanks",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"address",name:"oracle",type:"address"},{internalType:"uint128",name:"margin",type:"uint128"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastConditionId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"marginAdjustedOdds",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"oracleConditionIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"putBet",outputs:[{internalType:"uint64",name:"",type:"uint64"},{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint64",name:"outcomeWin",type:"uint64"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"sqrt",outputs:[{internalType:"uint256",name:"y",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bool",name:"flag",type:"bool"}],name:"stopAllConditions",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"bool",name:"flag",type:"bool"}],name:"stopCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateMargins",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateReinforcements",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"}],LpABI=[{inputs:[],name:"AmountMustNotBeZero",type:"error"},{inputs:[],name:"AmountNotSufficient",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"IncorrectPercent",type:"error"},{inputs:[],name:"LeafNotExist",type:"error"},{inputs:[],name:"LiquidityIsLocked",type:"error"},{inputs:[],name:"LiquidityNotOwned",type:"error"},{inputs:[],name:"NoDaoReward",type:"error"},{inputs:[],name:"NoLiquidity",type:"error"},{inputs:[],name:"NoWinNoPrize",type:"error"},{inputs:[],name:"NotEnoughReserves",type:"error"},{inputs:[],name:"OnlyBetOwner",type:"error"},{inputs:[],name:"OnlyCore",type:"error"},{inputs:[],name:"PaymentLocked",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"WithdrawalTimeout",type:"error"},{inputs:[],name:"WrongToken",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"AzuroBetChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"DaoRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint48",name:"leaf",type:"uint48"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLp",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"MinDepoChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeId",type:"uint64"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint128",name:"fund1",type:"uint128"},{indexed:!1,internalType:"uint128",name:"fund2",type:"uint128"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"OracleRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"PeriodChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"ReinforcementAbilityChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"WithdrawTimeoutChanged",type:"event"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"addLiquidityNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"finalReserve",type:"uint128"},{internalType:"uint48",name:"leaf",type:"uint48"},{internalType:"address",name:"oracle",type:"address"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"betNative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAzuroBet",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newCore",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"changeDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"changeMinDepo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"changeReinforcementAbility",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"changeWithdrawTimeout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLeaf",outputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"node",type:"uint48"},{internalType:"uint48",name:"begin",type:"uint48"},{internalType:"uint48",name:"end",type:"uint48"},{internalType:"uint48",name:"l",type:"uint48"},{internalType:"uint48",name:"r",type:"uint48"}],name:"getLeavesAmount",outputs:[{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"fromNumber",type:"uint48"}],name:"getParent",outputs:[{internalType:"uint48",name:"parentNumber",type:"uint48"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcementAmount",type:"uint128"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint128",name:"reserve",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"minDepo",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextNode",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],name:"nodeWithdrawView",outputs:[{internalType:"uint128",name:"withdrawAmount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracleFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDaoRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"treeNode",outputs:[{internalType:"uint64",name:"updateId",type:"uint64"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateId",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidityNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayoutNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawTimeout",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"withdrawals",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],AzuroBetABI=[{inputs:[],name:"OnlyLp",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getCoreByToken",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"getTokensByOwner",outputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"core",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"uri",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],TestERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"dst",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"src",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wad",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{},contractAddresses:{}},setContractAddresses=function(e){state.contractAddresses=e},setWallerProvider=function(e){state.walletProvider=e},setSelectedChainId=function(e){state.selectedChainId=e},CONTRACTS={core:{get address(){return state.contractAddresses.core},abi:CoreABI,decimals:18},lp:{get address(){return state.contractAddresses.lp},abi:LpABI,decimals:18},bet:{get address(){return state.contractAddresses.bet},abi:AzuroBetABI,decimals:18},usdt:{get address(){return state.contractAddresses.usdt},abi:TestERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new contracts.Contract(n,e,t)},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}function __awaiter(e,r,p,s){return new(p=p||Promise)(function(n,t){function a(e){try{u(s.next(e))}catch(e){t(e)}}function i(e){try{u(s.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof p?t:new p(function(e){e(t)})).then(a,i)}u((s=s.apply(e,r||[])).next())})}function __generator(a,i){var u,r,p,s={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,r&&(p=2&t[0]?r.return:t[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,t[1])).done)return p;switch(r=0,(t=p?[2&t[0],p.value]:t)[0]){case 0:case 1:p=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(p=0<(p=s.trys).length&&p[p.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!p||t[1]>p[0]&&t[1]<p[3])){s.label=t[1];break}if(6===t[0]&&s.label<p[1]){s.label=p[1],p=t;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(t);break}p[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(a,s)}catch(e){t=[6,e],r=0}finally{u=p=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)r.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return r}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={rpcUrl:null,ipfsGateway:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new providers.JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:new providers.JsonRpcProvider(config.rpcUrl)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios__default.default.get(""+config.ipfsGateway+p,{timeout:1e4})];case 1:return u=e.sent().data,t=u.entity1Name,n=u.entity1Image,a=u.entity2Name,i=u.entity2Image,r=u.titleCountry,u=u.titleLeague,[2,{country:r,league:u,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return __awaiter(void 0,void 0,void 0,function(){var o,y,d,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=(null==a?void 0:a.filters)||{},n=t.resolved,o=void 0===n||n,n=t.canceled,y=void 0===n||n,d=getContract("core"),t=d.filters.ConditionCreated(),[4,d.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var s=e.args.conditionId;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=s.toNumber(),[4,d.getCondition(s)];case 1:return(n=e.sent(),a=n.state,i=n.scopeId.toNumber(),(u=1e3*n.timestamp.toNumber())<=Date.now())?[2]:(o||a!==ConditionStatus.RESOLVED)&&(y||a!==ConditionStatus.CANCELED)?(r=_calculateInitialOdds(n.fundBank,n.margin),p=n.outcomes.map(function(e){return e.toNumber()}),[2,{id:t,outcomes:p,odds:r,gameData:{id:i,state:a,startsAt:u,ipfsHashHex:n.ipfsHash}}]):[2];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var r=e.gameId,p=e.conditionId,t=e.outcomes,s=e.odds;return t.map(function(e,t){var t=s[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=r+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:r,marketRegistryId:i,betVariants:[]}),{conditionId:p,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(n){return void 0===n&&(n={}),__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return[4,fetchConditions(n)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameData;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),t=groupGames(),[4,Promise.all(t.map(function(i){return __awaiter(void 0,void 0,void 0,function(){var t,n,a;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=i.ipfsHashHex,t=__rest(i,["ipfsHashHex"]),n=ethers.utils.arrayify(n),n=ethers.utils.base58.encode(__spread([18,32],n)),[4,fetchGameIpfsData(n)];case 1:return(n=e.sent())?[2,__assign(__assign({},n),t)]:[2,null];case 2:return a=e.sent(),console.error(a),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean).sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=units.parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=units.formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.usdt.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.usdt.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,i=p.amount,r=p.betRate,u=p.slippage,a=getContract("lp",!0),i=units.parseUnits(String(i),USDT_DECIMALS),r=(1+(r-1)*(100-u)/100).toFixed(8),u=units.parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,a.bet(t,i,n,r,u)]})})},fetchBet=function(h){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,T,f,i,u,b,r,I,v,g,p,w,s,M,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(h)];case 2:return a=e.sent(),n=a.conditionId,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return i=e.sent(),u=i.scopeId,T=i.state,r=i.ipfsHash,f=i.timestamp,i=i.outcomeWin,u=u.toNumber(),b=n.toNumber(),r=ethers.utils.arrayify(r),r=ethers.utils.base58.encode(__spread([18,32],r)),[4,fetchGameIpfsData(r)];case 4:return(r=e.sent())?(I=1e3*f.toNumber(),y=l.toNumber(),o=i.toNumber(),p=betTypeOdd[y],v=p.marketRegistryId,g=p.outcomeRegistryId,p=p.paramId,w=parseFloat(units.formatUnits(m,RATE_DECIMALS)),s=parseFloat(units.formatUnits(d,USDT_DECIMALS)),M=void 0,M=T===ConditionStatus.CANCELED?s:0===o?null:o===y?(s*w).toFixed(6):-1*s,o=__assign(__assign({id:u},r),{startsAt:I,state:T}),[2,{nftId:h,conditionId:b,paramId:p,marketRegistryId:v,outcomeRegistryId:g,rate:w,amount:s,result:M,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}]):[2];case 5:return y=e.sent(),console.error(y),[2,null];case 6:return[2]}})})},fetchUserBets=function(e){var r=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(r,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};exports.RATE_DECIMALS=RATE_DECIMALS,exports.USDT_DECIMALS=USDT_DECIMALS,exports.approve=approve,exports.calculateActualOdds=calculateActualOdds,exports.checkTestTokensClaimable=checkTestTokensClaimable,exports.claimTestTokens=claimTestTokens,exports.configure=configure,exports.fetchAllowance=fetchAllowance,exports.fetchBalance=fetchBalance,exports.fetchGames=fetchGames,exports.fetchUserBets=fetchUserBets,exports.placeBet=placeBet,exports.redeemPrize=redeemBetPrize,exports.setContractAddresses=setContractAddresses,exports.setSelectedChainId=setSelectedChainId,exports.setWallerProvider=setWallerProvider;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var contracts=require("@ethersproject/contracts"),providers=require("@ethersproject/providers"),ethers=require("ethers"),axios=require("axios"),units=require("@ethersproject/units");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var axios__default=_interopDefaultLegacy(axios),CoreABI=[{inputs:[],name:"BetNotAllowed",type:"error"},{inputs:[],name:"BigDifference",type:"error"},{inputs:[],name:"CantAcceptBet",type:"error"},{inputs:[],name:"CantChangeFlag",type:"error"},{inputs:[],name:"ConditionAlreadyCreated",type:"error"},{inputs:[],name:"ConditionAlreadyResolved",type:"error"},{inputs:[],name:"ConditionNotExists",type:"error"},{inputs:[],name:"ConditionNotStarted",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"FlagAlreadySet",type:"error"},{inputs:[],name:"IncorrectTimestamp",type:"error"},{inputs:[],name:"NotEnoughLiquidity",type:"error"},{inputs:[],name:"OnlyLp",type:"error"},{inputs:[],name:"OnlyMaintainer",type:"error"},{inputs:[],name:"OnlyOracle",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"ResolveTooEarly",type:"error"},{inputs:[],name:"SameOutcomes",type:"error"},{inputs:[],name:"SmallBet",type:"error"},{inputs:[],name:"SmallOdds",type:"error"},{inputs:[],name:"WrongDataFormat",type:"error"},{inputs:[],name:"WrongOutcome",type:"error"},{inputs:[],name:"ZeroOdds",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"AllConditionsStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"timestamp",type:"uint64"}],name:"ConditionCreated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oracleConditionId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeWin",type:"uint64"},{indexed:!1,internalType:"uint8",name:"state",type:"uint8"},{indexed:!1,internalType:"uint256",name:"amountForLp",type:"uint256"}],name:"ConditionResolved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"ConditionShifted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"bool",name:"flag",type:"bool"}],name:"ConditionStopped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newLp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maintainer",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"MaintainerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newRatio",type:"uint64"}],name:"MaxBanksRatioChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newOracle",type:"address"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oracle",type:"address"}],name:"OracleRenounced",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"LP",outputs:[{internalType:"contract ILP",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maintainer",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"allConditionsStopped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"bets",outputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"bool",name:"payed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"}],name:"calculateOdds",outputs:[{internalType:"uint64",name:"odds",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"cancelByMaintainer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleConditionId",type:"uint256"}],name:"cancelByOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"a",type:"uint256"},{internalType:"uint256",name:"m",type:"uint256"}],name:"ceil",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"newRatio",type:"uint64"}],name:"changeMaxBanksRatio",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"conditions",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64[2]",name:"odds",type:"uint64[2]"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"}],name:"createCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"betId",type:"uint256"}],name:"getBetInfo",outputs:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"odds",type:"uint64"},{internalType:"uint64",name:"createdAt",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getCondition",outputs:[{components:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"},{internalType:"uint128[2]",name:"payouts",type:"uint128[2]"},{internalType:"uint128[2]",name:"totalNetBets",type:"uint128[2]"},{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"uint128",name:"margin",type:"uint128"},{internalType:"bytes32",name:"ipfsHash",type:"bytes32"},{internalType:"uint64[2]",name:"outcomes",type:"uint64[2]"},{internalType:"uint128",name:"scopeId",type:"uint128"},{internalType:"uint64",name:"outcomeWin",type:"uint64"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"enum ICore.ConditionState",name:"state",type:"uint8"},{internalType:"uint48",name:"leaf",type:"uint48"}],internalType:"struct ICore.Condition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionFunds",outputs:[{internalType:"uint128[2]",name:"fundBank",type:"uint128[2]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"}],name:"getConditionReinforcement",outputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockedPayout",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getMargin",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"fund1Bank",type:"uint256"},{internalType:"uint256",name:"fund2Bank",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"outcomeIndex",type:"uint256"},{internalType:"uint256",name:"margin",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"getOddsFromBanks",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint64",name:"outcomeId",type:"uint64"}],name:"getReinforcement",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcement",type:"uint128"},{internalType:"address",name:"oracle",type:"address"},{internalType:"uint128",name:"margin",type:"uint128"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"isOracle",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"outcome",type:"uint256"}],name:"isOutComeCorrect",outputs:[{internalType:"bool",name:"correct",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lastConditionId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"maintainers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"odds",type:"uint256"},{internalType:"uint256",name:"marginality",type:"uint256"},{internalType:"uint256",name:"multiplier",type:"uint256"}],name:"marginAdjustedOdds",outputs:[{internalType:"uint256",name:"newOdds",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"maxBanksRatio",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"oracleConditionIds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"oracles",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcome",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"putBet",outputs:[{internalType:"uint64",name:"",type:"uint64"},{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"renounceOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"oracleCondId",type:"uint256"},{internalType:"uint64",name:"outcomeWin",type:"uint64"}],name:"resolveCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolvePayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oracle",type:"address"}],name:"setOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"newTimestamp",type:"uint64"}],name:"shift",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"x",type:"uint256"}],name:"sqrt",outputs:[{internalType:"uint256",name:"y",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bool",name:"flag",type:"bool"}],name:"stopAllConditions",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"bool",name:"flag",type:"bool"}],name:"stopCondition",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalLockedPayout",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateMargins",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128[]",name:"data",type:"uint128[]"}],name:"updateReinforcements",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"}],LpABI=[{inputs:[],name:"AmountMustNotBeZero",type:"error"},{inputs:[],name:"AmountNotSufficient",type:"error"},{inputs:[],name:"ConditionStarted",type:"error"},{inputs:[],name:"IncorrectPercent",type:"error"},{inputs:[],name:"LeafNotExist",type:"error"},{inputs:[],name:"LiquidityIsLocked",type:"error"},{inputs:[],name:"LiquidityNotOwned",type:"error"},{inputs:[],name:"NoDaoReward",type:"error"},{inputs:[],name:"NoLiquidity",type:"error"},{inputs:[],name:"NoWinNoPrize",type:"error"},{inputs:[],name:"NotEnoughReserves",type:"error"},{inputs:[],name:"OnlyBetOwner",type:"error"},{inputs:[],name:"OnlyCore",type:"error"},{inputs:[],name:"PaymentLocked",type:"error"},{inputs:[{internalType:"uint64",name:"waitTime",type:"uint64"}],name:"WithdrawalTimeout",type:"error"},{inputs:[],name:"WrongToken",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newAzuroBet",type:"address"}],name:"AzuroBetChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"better",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"BetterWin",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"DaoRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint48",name:"leaf",type:"uint48"}],name:"LiquidityAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LiquidityRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"requestWallet",type:"address"},{indexed:!1,internalType:"uint256",name:"requestedValueLp",type:"uint256"}],name:"LiquidityRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"MinDepoChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"uint256",name:"betId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"conditionId",type:"uint256"},{indexed:!1,internalType:"uint64",name:"outcomeId",type:"uint64"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"odds",type:"uint256"},{indexed:!1,internalType:"uint128",name:"fund1",type:"uint128"},{indexed:!1,internalType:"uint128",name:"fund2",type:"uint128"}],name:"NewBet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"OracleRewardChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newPeriod",type:"uint64"}],name:"PeriodChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"ReinforcementAbilityChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"WithdrawTimeoutChanged",type:"event"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"addLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"addLiquidityNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint128",name:"initReserve",type:"uint128"},{internalType:"uint128",name:"finalReserve",type:"uint128"},{internalType:"uint48",name:"leaf",type:"uint48"},{internalType:"address",name:"oracle",type:"address"}],name:"addReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"azuroBet",outputs:[{internalType:"contract IAzuroBet",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"bet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"conditionId",type:"uint256"},{internalType:"uint64",name:"outcomeId",type:"uint64"},{internalType:"uint64",name:"deadline",type:"uint64"},{internalType:"uint64",name:"minOdds",type:"uint64"}],name:"betNative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"newAzuroBet",type:"address"}],name:"changeAzuroBet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newCore",type:"address"}],name:"changeCore",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newDaoFee",type:"uint128"}],name:"changeDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newMinDepo",type:"uint128"}],name:"changeMinDepo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newOracleFee",type:"uint128"}],name:"changeOracleReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"newReinforcementAbility",type:"uint128"}],name:"changeReinforcementAbility",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newWithdrawTimeout",type:"uint64"}],name:"changeWithdrawTimeout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimDaoReward",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"core",outputs:[{internalType:"contract ICore",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"daoFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLeaf",outputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"node",type:"uint48"},{internalType:"uint48",name:"begin",type:"uint48"},{internalType:"uint48",name:"end",type:"uint48"},{internalType:"uint48",name:"l",type:"uint48"},{internalType:"uint48",name:"r",type:"uint48"}],name:"getLeavesAmount",outputs:[{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"fromNumber",type:"uint48"}],name:"getParent",outputs:[{internalType:"uint48",name:"parentNumber",type:"uint48"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint128",name:"reinforcementAmount",type:"uint128"}],name:"getPossibilityOfReinforcement",outputs:[{internalType:"bool",name:"status",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"getReserve",outputs:[{internalType:"uint128",name:"reserve",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token_",type:"address"},{internalType:"address",name:"azuroBetAddress",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint128",name:"amount",type:"uint128"}],name:"lockReserve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockedLiquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"minDepo",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiplier",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextNode",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"leaf",type:"uint48"}],name:"nodeWithdrawView",outputs:[{internalType:"uint128",name:"withdrawAmount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracleFee",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"reinforcementAbility",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"token",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalDaoRewards",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"treeNode",outputs:[{internalType:"uint64",name:"updateId",type:"uint64"},{internalType:"uint128",name:"amount",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"updateId",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"viewPayout",outputs:[{internalType:"bool",name:"",type:"bool"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidity",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"depNum",type:"uint48"},{internalType:"uint40",name:"percent",type:"uint40"}],name:"withdrawLiquidityNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayout",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawPayoutNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawTimeout",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint48",name:"",type:"uint48"}],name:"withdrawals",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],AzuroBetABI=[{inputs:[],name:"OnlyLp",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"lp",type:"address"}],name:"LpChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getCoreByToken",outputs:[{internalType:"address",name:"core",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"getTokensByOwner",outputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lpAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"core",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"uri",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"lp",type:"address"}],name:"setLp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],TestERC20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"dst",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"src",type:"address"},{indexed:!1,internalType:"uint256",name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"addPrivilegedAccounts",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"availableToClaim",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"claim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contestsDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"contestsStartDate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_contestsDuration",type:"uint256"}],name:"setContestDuration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"startDate",type:"uint256"}],name:"setContestStartDate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wad",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],state={walletProvider:null,selectedChainId:null,readContracts:{},writeContracts:{},contractAddresses:{}},setContractAddresses=function(e){state.contractAddresses=e,state.writeContracts={},state.readContracts={}},setWallerProvider=function(e){state.walletProvider=e,state.writeContracts={},state.readContracts={}},setSelectedChainId=function(e){state.selectedChainId=e},CONTRACTS={core:{get address(){return state.contractAddresses.core},abi:CoreABI,decimals:18},lp:{get address(){return state.contractAddresses.lp},abi:LpABI,decimals:18},bet:{get address(){return state.contractAddresses.bet},abi:AzuroBetABI,decimals:18},usdt:{get address(){return state.contractAddresses.usdt},abi:TestERC20ABI,decimals:18}},createContract=function(e,t){var e=CONTRACTS[e.toLowerCase()],n=e.address,e=e.abi;return new contracts.Contract(n,e,t)},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function __rest(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}function __awaiter(e,r,p,s){return new(p=p||Promise)(function(n,t){function a(e){try{u(s.next(e))}catch(e){t(e)}}function i(e){try{u(s.throw(e))}catch(e){t(e)}}function u(e){var t;e.done?n(e.value):((t=e.value)instanceof p?t:new p(function(e){e(t)})).then(a,i)}u((s=s.apply(e,r||[])).next())})}function __generator(a,i){var u,r,p,s={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,r&&(p=2&t[0]?r.return:t[0]?r.throw||((p=r.return)&&p.call(r),0):r.next)&&!(p=p.call(r,t[1])).done)return p;switch(r=0,(t=p?[2&t[0],p.value]:t)[0]){case 0:case 1:p=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(p=0<(p=s.trys).length&&p[p.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!p||t[1]>p[0]&&t[1]<p[3])){s.label=t[1];break}if(6===t[0]&&s.label<p[1]){s.label=p[1],p=t;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(t);break}p[2]&&s.ops.pop(),s.trys.pop();continue}t=i.call(a,s)}catch(e){t=[6,e],r=0}finally{u=p=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,u=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(a=u.next()).done;)r.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return r}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}var ConditionStatus,config={rpcUrl:null,ipfsGateway:null},configure=function(e){Object.entries(e).forEach(function(e){var e=__read(e,2),t=e[0],e=e[1];config[t]=e})},getProvider=function(e){return 1337===state.selectedChainId?new providers.JsonRpcProvider:state.walletProvider?e?state.walletProvider.getSigner():state.walletProvider:new providers.JsonRpcProvider(config.rpcUrl)},getContract=function(e,t){var n=t?state.writeContracts:state.readContracts;return n[e]||(t=getProvider(t),t=createContract(e,t),n[e]=t),n[e]},checkTestTokensClaimable=function(e){return getContract("usdt").availableToClaim(e)},claimTestTokens=function(e){return getContract("usdt",!0).claim(e)},fetchBalance=function(e){return getContract("usdt").balanceOf(e)},fetchGameIpfsData=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,axios__default.default.get(""+config.ipfsGateway+p,{timeout:1e4})];case 1:return u=e.sent().data,t=u.entity1Name,n=u.entity1Image,a=u.entity2Name,i=u.entity2Image,r=u.titleCountry,u=u.titleLeague,[2,{country:r,league:u,participants:[{name:t,image:n},{name:a,image:i}]}];case 2:return r=e.sent(),console.error(r),[2,null];case 3:return[2]}})})},calculateOdd=function(e,t){var n=1/(1-1/e),t=1+t,a=t*(n-1)/(e-1),n=((n-1)/(e-1)+1)*(t-1),e=2-t;return(-1*n+Math.pow(Math.pow(n,2)+4*a*e,.5))/(2*a)+1},calculateInitialOdds=function(e,t){return[calculateOdd(e[0],t),calculateOdd(e[1],t)]},_calculateInitialOdds=(!function(e){e[e.CREATED=0]="CREATED",e[e.RESOLVED=1]="RESOLVED",e[e.CANCELED=2]="CANCELED"}(ConditionStatus=ConditionStatus||{}),function(e,t){var n=e[0].add(e[1]).toString(),e=e.map(function(e){return n/e.toString()}),t=t.toString()/1e9;return calculateInitialOdds(e,t)}),fetchConditions=function(a){return __awaiter(void 0,void 0,void 0,function(){var o,y,d,t,n;return __generator(this,function(e){switch(e.label){case 0:return t=(null==a?void 0:a.filters)||{},n=t.resolved,o=void 0===n||n,n=t.canceled,y=void 0===n||n,d=getContract("core"),t=d.filters.ConditionCreated(),[4,d.queryFilter(t)];case 1:return n=e.sent(),[4,Promise.all(n.map(function(e){var s=e.args.conditionId;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r,p;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=s.toNumber(),[4,d.getCondition(s)];case 1:return(n=e.sent(),a=n.state,i=n.scopeId.toNumber(),(u=1e3*n.timestamp.toNumber())<=Date.now())?[2]:(o||a!==ConditionStatus.RESOLVED)&&(y||a!==ConditionStatus.CANCELED)?(r=_calculateInitialOdds(n.fundBank,n.margin),p=n.outcomes.map(function(e){return e.toNumber()}),[2,{id:t,outcomes:p,odds:r,gameData:{id:i,state:a,startsAt:u,ipfsHashHex:n.ipfsHash}}]):[2];case 2:return p=e.sent(),console.error(p),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean)]}})})},betTypeOdd={1:{outcomeRegistryId:180,marketRegistryId:9,paramId:1},2:{outcomeRegistryId:181,marketRegistryId:9,paramId:1},3:{outcomeRegistryId:7,marketRegistryId:3,paramId:96},4:{outcomeRegistryId:8,marketRegistryId:3,paramId:32},5:{outcomeRegistryId:7,marketRegistryId:3,paramId:94},6:{outcomeRegistryId:8,marketRegistryId:3,paramId:6},7:{outcomeRegistryId:7,marketRegistryId:3,paramId:36},8:{outcomeRegistryId:8,marketRegistryId:3,paramId:5},9:{outcomeRegistryId:7,marketRegistryId:3,paramId:7},10:{outcomeRegistryId:8,marketRegistryId:3,paramId:4},11:{outcomeRegistryId:7,marketRegistryId:3,paramId:1},12:{outcomeRegistryId:8,marketRegistryId:3,paramId:1},13:{outcomeRegistryId:7,marketRegistryId:3,paramId:4},14:{outcomeRegistryId:8,marketRegistryId:3,paramId:7},15:{outcomeRegistryId:7,marketRegistryId:3,paramId:5},16:{outcomeRegistryId:8,marketRegistryId:3,paramId:36},17:{outcomeRegistryId:7,marketRegistryId:3,paramId:6},18:{outcomeRegistryId:8,marketRegistryId:3,paramId:94},19:{outcomeRegistryId:7,marketRegistryId:3,paramId:32},20:{outcomeRegistryId:8,marketRegistryId:3,paramId:96},21:{outcomeRegistryId:9,marketRegistryId:4,paramId:4},22:{outcomeRegistryId:10,marketRegistryId:4,paramId:4},23:{outcomeRegistryId:9,marketRegistryId:4,paramId:5},24:{outcomeRegistryId:10,marketRegistryId:4,paramId:5},25:{outcomeRegistryId:9,marketRegistryId:4,paramId:6},26:{outcomeRegistryId:10,marketRegistryId:4,paramId:6},27:{outcomeRegistryId:9,marketRegistryId:4,paramId:32},28:{outcomeRegistryId:10,marketRegistryId:4,paramId:32},29:{outcomeRegistryId:1,marketRegistryId:1,paramId:1},30:{outcomeRegistryId:2,marketRegistryId:1,paramId:1},31:{outcomeRegistryId:3,marketRegistryId:1,paramId:1},32:{outcomeRegistryId:10009,marketRegistryId:19,paramId:1},33:{outcomeRegistryId:10010,marketRegistryId:19,paramId:1},34:{outcomeRegistryId:10009,marketRegistryId:20,paramId:1},35:{outcomeRegistryId:10010,marketRegistryId:20,paramId:1},36:{outcomeRegistryId:10009,marketRegistryId:21,paramId:1},37:{outcomeRegistryId:10010,marketRegistryId:21,paramId:1},38:{outcomeRegistryId:4,marketRegistryId:2,paramId:1},39:{outcomeRegistryId:5,marketRegistryId:2,paramId:1},40:{outcomeRegistryId:6,marketRegistryId:2,paramId:1}},gamesInfo={},gameBets={},groupBetVariants=function(e){var t={};return e.forEach(function(e){t[e.paramId]||(t[e.paramId]=[]),t[e.paramId].push(e)}),t},groupGames=function(){return Object.keys(gameBets).map(function(e){var e=gameBets[e],t=e.gameId,n=e.marketRegistryId,e=e.betVariants,a=groupBetVariants(e),e=Object.keys(a);return e=1===e.length?[{paramId:null,odds:a[e[0]].sort(function(e,t){return e.outcomeId-t.outcomeId})}]:Object.keys(a).map(function(e){return{paramId:parseInt(e),odds:a[e].sort(function(e,t){return t.outcomeId-e.outcomeId})}}),__assign(__assign({},gamesInfo[t]),{conditions:e,marketRegistryId:n})})},groupOddsByOutcomes=function(e){var r=e.gameId,p=e.conditionId,t=e.outcomes,s=e.odds;return t.map(function(e,t){var t=s[t],n=betTypeOdd[e],a=n.outcomeRegistryId,i=n.marketRegistryId,n=n.paramId,u=r+"-"+i,i=(gameBets[u]||(gameBets[u]={gameId:r,marketRegistryId:i,betVariants:[]}),{conditionId:p,outcomeId:e,outcomeRegistryId:a,paramId:n,value:t});gameBets[u].betVariants.push(i)})},fetchGames=function(n){return void 0===n&&(n={}),__awaiter(void 0,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return gamesInfo={},gameBets={},[4,fetchConditions(n)];case 1:return e.sent().forEach(function(e){var t=e.id,n=e.outcomes,a=e.odds,e=e.gameData;gamesInfo[e.id]=e,groupOddsByOutcomes({gameId:e.id,conditionId:t,outcomes:n,odds:a})}),t=groupGames(),[4,Promise.all(t.map(function(i){return __awaiter(void 0,void 0,void 0,function(){var t,n,a;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=i.ipfsHashHex,t=__rest(i,["ipfsHashHex"]),n=ethers.utils.arrayify(n),n=ethers.utils.base58.encode(__spread([18,32],n)),[4,fetchGameIpfsData(n)];case 1:return(n=e.sent())?[2,__assign(__assign({},n),t)]:[2,null];case 2:return a=e.sent(),console.error(a),[2,null];case 3:return[2]}})})}))];case 2:return[2,e.sent().filter(Boolean).sort(function(e,t){return e.startsAt-t.startsAt})]}})})},RATE_DECIMALS=9,USDT_DECIMALS=18,calculateActualOdds=function(e){var a=e.conditionId,i=e.outcomeId,u=e.betAmount;return __awaiter(void 0,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return t=units.parseUnits(String(u),USDT_DECIMALS),[4,getContract("core").calculateOdds(a,t,i)];case 1:return t=e.sent(),n=units.formatUnits(t,RATE_DECIMALS),[2,parseFloat(n)]}})})},fetchAllowance=function(e){return getContract("usdt").allowance(e,CONTRACTS.lp.address)},approve=function(e){return getContract("usdt",!0).approve(CONTRACTS.lp.address,e)},placeBet=function(p){return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u,r;return __generator(this,function(e){return t=p.conditionId,n=p.outcomeId,i=p.amount,r=p.betRate,u=p.slippage,a=getContract("lp",!0),i=units.parseUnits(String(i),USDT_DECIMALS),r=(1+(r-1)*(100-u)/100).toFixed(8),u=units.parseUnits(r,RATE_DECIMALS),r=Math.floor(Date.now()/1e3)+2e3,[2,a.bet(t,i,n,r,u)]})})},fetchBet=function(h){return __awaiter(void 0,void 0,void 0,function(){var t,n,d,l,m,c,a,T,f,i,u,b,r,I,v,g,p,w,s,M,o,y;return __generator(this,function(e){switch(e.label){case 0:t=getContract("core"),e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.bets(h)];case 2:return a=e.sent(),n=a.conditionId,d=a.amount,l=a.outcome,m=a.odds,c=a.payed,a=a.createdAt,[4,t.getCondition(n)];case 3:return i=e.sent(),u=i.scopeId,T=i.state,r=i.ipfsHash,f=i.timestamp,i=i.outcomeWin,u=u.toNumber(),b=n.toNumber(),r=ethers.utils.arrayify(r),r=ethers.utils.base58.encode(__spread([18,32],r)),[4,fetchGameIpfsData(r)];case 4:return(r=e.sent())?(I=1e3*f.toNumber(),y=l.toNumber(),o=i.toNumber(),p=betTypeOdd[y],v=p.marketRegistryId,g=p.outcomeRegistryId,p=p.paramId,w=parseFloat(units.formatUnits(m,RATE_DECIMALS)),s=parseFloat(units.formatUnits(d,USDT_DECIMALS)),M=void 0,M=T===ConditionStatus.CANCELED?s:0===o?null:o===y?(s*w).toFixed(6):-1*s,o=__assign(__assign({id:u},r),{startsAt:I,state:T}),[2,{nftId:h,conditionId:b,paramId:p,marketRegistryId:v,outcomeRegistryId:g,rate:w,amount:s,result:M,createdAt:1e3*a.toNumber(),isRedeemed:c,gameInfo:o}]):[2];case 5:return y=e.sent(),console.error(y),[2,null];case 6:return[2]}})})},fetchUserBets=function(e){var r=e.account;return __awaiter(void 0,void 0,void 0,function(){var t,n,a,i,u;return __generator(this,function(e){switch(e.label){case 0:e.trys.push([0,8,,9]),n=void(t=0),a=[],i=getContract("bet"),e.label=1;case 1:if(0!==t&&!n)return[3,6];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,i.tokenOfOwnerByIndex(r,t++)];case 3:return n=e.sent(),a.push(n.toNumber()),[3,5];case 4:return e.sent(),n=null,[3,5];case 5:return[3,1];case 6:return[4,Promise.all(a.map(fetchBet))];case 7:return[2,e.sent().filter(Boolean).sort(function(e,t){return t.createdAt-e.createdAt})];case 8:return u=e.sent(),console.error(u),[2,[]];case 9:return[2]}})})},redeemBetPrize=function(e){return getContract("lp",!0).withdrawPayout(e)};exports.RATE_DECIMALS=RATE_DECIMALS,exports.USDT_DECIMALS=USDT_DECIMALS,exports.approve=approve,exports.calculateActualOdds=calculateActualOdds,exports.checkTestTokensClaimable=checkTestTokensClaimable,exports.claimTestTokens=claimTestTokens,exports.configure=configure,exports.fetchAllowance=fetchAllowance,exports.fetchBalance=fetchBalance,exports.fetchGames=fetchGames,exports.fetchUserBets=fetchUserBets,exports.placeBet=placeBet,exports.redeemPrize=redeemBetPrize,exports.setContractAddresses=setContractAddresses,exports.setSelectedChainId=setSelectedChainId,exports.setWallerProvider=setWallerProvider;
{
"name": "@azuro-protocol/sdk",
"version": "0.3.0",
"version": "0.3.1",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc