diff --git a/.openzeppelin/unknown-10.json b/.openzeppelin/unknown-10.json index 4c801f3bc..09cf78f53 100644 --- a/.openzeppelin/unknown-10.json +++ b/.openzeppelin/unknown-10.json @@ -361,8 +361,13 @@ "kind": "transparent" }, { - "address": "0x8285047F33c26c1Bf5B387f2b07F21A2aF29Ace2", - "txHash": "0x54b36804f013357f61b55270c77faeaa20b658c0cf7fae2bd9e00086904edb7e", + "address": "0x842e89b7a7eF8Ce099540b3613264C933cE0eBa5", + "txHash": "0x82c0af90f1dd384e2cbfd2518a7ca59cdd93f62011c44062938f3639e9fe6d79", + "kind": "transparent" + }, + { + "address": "0x0565B1aB5CEe7075B32C2D6a5B9dA44b708fB898", + "txHash": "0x1c7b2bd2c4e37a170f8ce5ab6b5b723d671c316a817ffb66c63ceadb94b30c75", "kind": "transparent" } ], @@ -46297,37 +46302,37 @@ { "contract": "StakingThales", "label": "iEscrowThales", - "type": "t_contract(IEscrowThales)16673", + "type": "t_contract(IEscrowThales)6518", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:30" }, { "contract": "StakingThales", "label": "stakingToken", - "type": "t_contract(IERC20)20091", + "type": "t_contract(IERC20)9080", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:31" }, { "contract": "StakingThales", "label": "feeToken", - "type": "t_contract(IERC20)20091", + "type": "t_contract(IERC20)9080", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:32" }, { "contract": "StakingThales", "label": "SNXRewards", - "type": "t_contract(ISNXRewards)17060", + "type": "t_contract(ISNXRewards)6612", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:33" }, { "contract": "StakingThales", "label": "thalesRoyale", - "type": "t_contract(IThalesRoyale)17238", + "type": "t_contract(IThalesRoyale)6758", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:34" }, { "contract": "StakingThales", "label": "priceFeed", - "type": "t_contract(IPriceFeed)16998", + "type": "t_contract(IPriceFeed)6574", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:35" }, { @@ -46501,7 +46506,7 @@ { "contract": "StakingThales", "label": "stakerAMMVolume", - "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)12600_storage)4_storage)", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3105_storage)4_storage)", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:76" }, { @@ -46513,7 +46518,7 @@ { "contract": "StakingThales", "label": "ThalesStakingRewardsPool", - "type": "t_contract(IThalesStakingRewardsPool)17248", + "type": "t_contract(IThalesStakingRewardsPool)6768", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:79" }, { @@ -46573,7 +46578,7 @@ { "contract": "StakingThales", "label": "addressResolver", - "type": "t_contract(IAddressResolver)16553", + "type": "t_contract(IAddressResolver)6425", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:97" }, { @@ -46597,7 +46602,7 @@ { "contract": "StakingThales", "label": "thalesAMMVolume", - "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)12600_storage)4_storage)", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3105_storage)4_storage)", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:103" }, { @@ -46609,7 +46614,7 @@ { "contract": "StakingThales", "label": "thalesRangedAMMVolume", - "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)12600_storage)4_storage)", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3105_storage)4_storage)", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:105" }, { @@ -46621,7 +46626,7 @@ { "contract": "StakingThales", "label": "exoticMarketsVolume", - "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)12600_storage)4_storage)", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3105_storage)4_storage)", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:107" }, { @@ -46633,7 +46638,7 @@ { "contract": "StakingThales", "label": "sportsAMMVolume", - "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)12600_storage)4_storage)", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3105_storage)4_storage)", "src": "contracts\\EscrowAndStaking\\StakingThales.sol:109" }, { @@ -46668,19 +46673,19 @@ } ], "types": { - "t_contract(IEscrowThales)16673": { + "t_contract(IEscrowThales)6518": { "label": "contract IEscrowThales" }, - "t_contract(IERC20)20091": { + "t_contract(IERC20)9080": { "label": "contract IERC20" }, - "t_contract(ISNXRewards)17060": { + "t_contract(ISNXRewards)6612": { "label": "contract ISNXRewards" }, - "t_contract(IThalesRoyale)17238": { + "t_contract(IThalesRoyale)6758": { "label": "contract IThalesRoyale" }, - "t_contract(IPriceFeed)16998": { + "t_contract(IPriceFeed)6574": { "label": "contract IPriceFeed" }, "t_uint256": { @@ -46698,13 +46703,13 @@ "t_mapping(t_address,t_bool)": { "label": "mapping(address => bool)" }, - "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)12600_storage)4_storage)": { + "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3105_storage)4_storage)": { "label": "mapping(address => struct StakingThales.AMMVolumeEntry[4])" }, - "t_array(t_struct(AMMVolumeEntry)12600_storage)4_storage": { + "t_array(t_struct(AMMVolumeEntry)3105_storage)4_storage": { "label": "struct StakingThales.AMMVolumeEntry[4]" }, - "t_struct(AMMVolumeEntry)12600_storage": { + "t_struct(AMMVolumeEntry)3105_storage": { "label": "struct StakingThales.AMMVolumeEntry", "members": [ { @@ -46717,10 +46722,10 @@ } ] }, - "t_contract(IThalesStakingRewardsPool)17248": { + "t_contract(IThalesStakingRewardsPool)6768": { "label": "contract IThalesStakingRewardsPool" }, - "t_contract(IAddressResolver)16553": { + "t_contract(IAddressResolver)6425": { "label": "contract IAddressResolver" }, "t_mapping(t_address,t_mapping(t_address,t_bool))": { @@ -57873,425 +57878,425 @@ "2af7cfc4acf754b53ec029ba705c15408c3bd0a48c4101759b3f8bd8e185c3d4": { "address": "0x7EdaDd097402aab262B7886640bb020aB0aFDBC6", "txHash": "0x96edaffb372c57dff5cb176d3047163546a57ecb3f6ccfc806e7ad6015f6f907", - "layout": { - "storage": [ - { - "contract": "Initializable", - "label": "_initialized", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" - }, - { - "contract": "Initializable", - "label": "_initializing", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" - }, - { - "contract": "ProxyOwned", - "label": "owner", - "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" - }, - { - "contract": "ProxyOwned", - "label": "nominatedOwner", - "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" - }, - { - "contract": "ProxyOwned", - "label": "_initialized", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" - }, - { - "contract": "ProxyOwned", - "label": "_transferredAtInit", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" - }, - { - "contract": "ProxyPausable", - "label": "lastPauseTime", - "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:11" - }, - { - "contract": "ProxyPausable", - "label": "paused", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:12" - }, - { - "contract": "TherundownConsumer", - "label": "wrapperAddress", - "type": "t_address", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:59" - }, - { - "contract": "TherundownConsumer", - "label": "whitelistedAddresses", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:60" - }, - { - "contract": "TherundownConsumer", - "label": "requestIdGamesCreated", - "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:63" - }, - { - "contract": "TherundownConsumer", - "label": "requestIdGamesResolved", - "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:64" - }, - { - "contract": "TherundownConsumer", - "label": "requestIdGamesOdds", - "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:65" - }, - { - "contract": "TherundownConsumer", - "label": "gameCreated", - "type": "t_mapping(t_bytes32,t_struct(GameCreate)35580_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:68" - }, - { - "contract": "TherundownConsumer", - "label": "gameResolved", - "type": "t_mapping(t_bytes32,t_struct(GameResolve)35591_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:69" - }, - { - "contract": "TherundownConsumer", - "label": "gameOdds", - "type": "t_mapping(t_bytes32,t_struct(GameOdds)35600_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:70" - }, - { - "contract": "TherundownConsumer", - "label": "sportsIdPerGame", - "type": "t_mapping(t_bytes32,t_uint256)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:71" - }, - { - "contract": "TherundownConsumer", - "label": "gameFulfilledCreated", - "type": "t_mapping(t_bytes32,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:72" - }, - { - "contract": "TherundownConsumer", - "label": "gameFulfilledResolved", - "type": "t_mapping(t_bytes32,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:73" - }, - { - "contract": "TherundownConsumer", - "label": "supportedSport", - "type": "t_mapping(t_uint256,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:76" - }, - { - "contract": "TherundownConsumer", - "label": "twoPositionSport", - "type": "t_mapping(t_uint256,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:77" - }, - { - "contract": "TherundownConsumer", - "label": "supportResolveGameStatuses", - "type": "t_mapping(t_uint256,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:78" - }, - { - "contract": "TherundownConsumer", - "label": "cancelGameStatuses", - "type": "t_mapping(t_uint256,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:79" - }, - { - "contract": "TherundownConsumer", - "label": "sportsManager", - "type": "t_contract(ISportPositionalMarketManager)54005", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:82" - }, - { - "contract": "TherundownConsumer", - "label": "marketPerGameId", - "type": "t_mapping(t_bytes32,t_address)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:83" - }, - { - "contract": "TherundownConsumer", - "label": "gameIdPerMarket", - "type": "t_mapping(t_address,t_bytes32)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:84" - }, - { - "contract": "TherundownConsumer", - "label": "marketResolved", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:85" - }, - { - "contract": "TherundownConsumer", - "label": "marketCanceled", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:86" - }, - { - "contract": "TherundownConsumer", - "label": "queues", - "type": "t_contract(GamesQueue)35532", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:89" - }, - { - "contract": "TherundownConsumer", - "label": "oddsLastPulledForGame", - "type": "t_mapping(t_bytes32,t_uint256)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:90" - }, - { - "contract": "TherundownConsumer", - "label": "gamesPerDate", - "type": "t_mapping(t_uint256,t_array(t_bytes32)dyn_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:91" - }, - { - "contract": "TherundownConsumer", - "label": "isSportOnADate", - "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:92" - }, - { - "contract": "TherundownConsumer", - "label": "invalidOdds", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:93" - }, - { - "contract": "TherundownConsumer", - "label": "marketCreated", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:94" - }, - { - "contract": "TherundownConsumer", - "label": "gamesPerDatePerSport", - "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_array(t_bytes32)dyn_storage))", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:95" - }, - { - "contract": "TherundownConsumer", - "label": "isPausedByCanceledStatus", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:96" - }, - { - "contract": "TherundownConsumer", - "label": "canMarketBeUpdated", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:97" - }, - { - "contract": "TherundownConsumer", - "label": "gameOnADate", - "type": "t_mapping(t_bytes32,t_uint256)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:98" - }, - { - "contract": "TherundownConsumer", - "label": "verifier", - "type": "t_contract(ITherundownConsumerVerifier)54844", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:100" - }, - { - "contract": "TherundownConsumer", - "label": "backupOdds", - "type": "t_mapping(t_bytes32,t_struct(GameOdds)35600_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:101" - }, - { - "contract": "TherundownConsumer", - "label": "oddsObtainer", - "type": "t_contract(IGamesOddsObtainer)53078", - "src": "contracts/SportMarkets/Rundown/TherundownConsumer.sol:102" - } - ], - "types": { - "t_address": { - "label": "address" - }, - "t_mapping(t_address,t_bool)": { - "label": "mapping(address => bool)" - }, - "t_bool": { - "label": "bool" - }, - "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)": { - "label": "mapping(bytes32 => bytes[])" - }, - "t_bytes32": { - "label": "bytes32" - }, - "t_array(t_bytes_storage)dyn_storage": { - "label": "bytes[]" - }, - "t_bytes_storage": { - "label": "bytes" - }, - "t_mapping(t_bytes32,t_struct(GameCreate)35580_storage)": { - "label": "mapping(bytes32 => struct TherundownConsumer.GameCreate)" - }, - "t_struct(GameCreate)35580_storage": { - "label": "struct TherundownConsumer.GameCreate", - "members": [ - { - "label": "gameId", - "type": "t_bytes32" - }, - { - "label": "startTime", - "type": "t_uint256" - }, - { - "label": "homeOdds", - "type": "t_int24" - }, - { - "label": "awayOdds", - "type": "t_int24" - }, - { - "label": "drawOdds", - "type": "t_int24" - }, - { - "label": "homeTeam", - "type": "t_string_storage" - }, - { - "label": "awayTeam", - "type": "t_string_storage" - } - ] - }, - "t_uint256": { - "label": "uint256" - }, - "t_int24": { - "label": "int24" - }, - "t_string_storage": { - "label": "string" - }, - "t_mapping(t_bytes32,t_struct(GameResolve)35591_storage)": { - "label": "mapping(bytes32 => struct TherundownConsumer.GameResolve)" - }, - "t_struct(GameResolve)35591_storage": { - "label": "struct TherundownConsumer.GameResolve", - "members": [ - { - "label": "gameId", - "type": "t_bytes32" - }, - { - "label": "homeScore", - "type": "t_uint8" - }, - { - "label": "awayScore", - "type": "t_uint8" - }, - { - "label": "statusId", - "type": "t_uint8" - }, - { - "label": "lastUpdated", - "type": "t_uint40" - } - ] - }, - "t_uint8": { - "label": "uint8" - }, - "t_uint40": { - "label": "uint40" - }, - "t_mapping(t_bytes32,t_struct(GameOdds)35600_storage)": { - "label": "mapping(bytes32 => struct TherundownConsumer.GameOdds)" - }, - "t_struct(GameOdds)35600_storage": { - "label": "struct TherundownConsumer.GameOdds", - "members": [ - { - "label": "gameId", - "type": "t_bytes32" - }, - { - "label": "homeOdds", - "type": "t_int24" - }, - { - "label": "awayOdds", - "type": "t_int24" - }, - { - "label": "drawOdds", - "type": "t_int24" - } - ] - }, - "t_mapping(t_bytes32,t_uint256)": { - "label": "mapping(bytes32 => uint256)" - }, - "t_mapping(t_bytes32,t_bool)": { - "label": "mapping(bytes32 => bool)" - }, - "t_mapping(t_uint256,t_bool)": { - "label": "mapping(uint256 => bool)" - }, - "t_contract(ISportPositionalMarketManager)54005": { - "label": "contract ISportPositionalMarketManager" - }, - "t_mapping(t_bytes32,t_address)": { - "label": "mapping(bytes32 => address)" - }, - "t_mapping(t_address,t_bytes32)": { - "label": "mapping(address => bytes32)" - }, - "t_contract(GamesQueue)35532": { - "label": "contract GamesQueue" - }, - "t_mapping(t_uint256,t_array(t_bytes32)dyn_storage)": { - "label": "mapping(uint256 => bytes32[])" - }, - "t_array(t_bytes32)dyn_storage": { - "label": "bytes32[]" - }, - "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))": { - "label": "mapping(uint256 => mapping(uint256 => bool))" - }, - "t_mapping(t_uint256,t_mapping(t_uint256,t_array(t_bytes32)dyn_storage))": { - "label": "mapping(uint256 => mapping(uint256 => bytes32[]))" - }, - "t_contract(ITherundownConsumerVerifier)54844": { - "label": "contract ITherundownConsumerVerifier" - }, - "t_contract(IGamesOddsObtainer)53078": { - "label": "contract IGamesOddsObtainer" - } - } - } - }, - "c070dbc3849fd0cfc29b8b52b5a1e3f0ee50f1d6fa27eea172b74bc0942c2dd7": { - "address": "0x519579c64cA400C5c38750c21e6573DF16D01dDe", - "txHash": "0x7a922fee6cb54b4cf386f72467f883ce9cd7a159fb0cd29c2e93b8fbc391af58", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ProxyPausable", + "label": "lastPauseTime", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyPausable.sol:11" + }, + { + "contract": "ProxyPausable", + "label": "paused", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyPausable.sol:12" + }, + { + "contract": "TherundownConsumer", + "label": "wrapperAddress", + "type": "t_address", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:59" + }, + { + "contract": "TherundownConsumer", + "label": "whitelistedAddresses", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:60" + }, + { + "contract": "TherundownConsumer", + "label": "requestIdGamesCreated", + "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:63" + }, + { + "contract": "TherundownConsumer", + "label": "requestIdGamesResolved", + "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:64" + }, + { + "contract": "TherundownConsumer", + "label": "requestIdGamesOdds", + "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:65" + }, + { + "contract": "TherundownConsumer", + "label": "gameCreated", + "type": "t_mapping(t_bytes32,t_struct(GameCreate)40188_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:68" + }, + { + "contract": "TherundownConsumer", + "label": "gameResolved", + "type": "t_mapping(t_bytes32,t_struct(GameResolve)40199_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:69" + }, + { + "contract": "TherundownConsumer", + "label": "gameOdds", + "type": "t_mapping(t_bytes32,t_struct(GameOdds)40208_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:70" + }, + { + "contract": "TherundownConsumer", + "label": "sportsIdPerGame", + "type": "t_mapping(t_bytes32,t_uint256)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:71" + }, + { + "contract": "TherundownConsumer", + "label": "gameFulfilledCreated", + "type": "t_mapping(t_bytes32,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:72" + }, + { + "contract": "TherundownConsumer", + "label": "gameFulfilledResolved", + "type": "t_mapping(t_bytes32,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:73" + }, + { + "contract": "TherundownConsumer", + "label": "supportedSport", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:76" + }, + { + "contract": "TherundownConsumer", + "label": "twoPositionSport", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:77" + }, + { + "contract": "TherundownConsumer", + "label": "supportResolveGameStatuses", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:78" + }, + { + "contract": "TherundownConsumer", + "label": "cancelGameStatuses", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:79" + }, + { + "contract": "TherundownConsumer", + "label": "sportsManager", + "type": "t_contract(ISportPositionalMarketManager)60844", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:82" + }, + { + "contract": "TherundownConsumer", + "label": "marketPerGameId", + "type": "t_mapping(t_bytes32,t_address)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:83" + }, + { + "contract": "TherundownConsumer", + "label": "gameIdPerMarket", + "type": "t_mapping(t_address,t_bytes32)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:84" + }, + { + "contract": "TherundownConsumer", + "label": "marketResolved", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:85" + }, + { + "contract": "TherundownConsumer", + "label": "marketCanceled", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:86" + }, + { + "contract": "TherundownConsumer", + "label": "queues", + "type": "t_contract(GamesQueue)40140", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:89" + }, + { + "contract": "TherundownConsumer", + "label": "oddsLastPulledForGame", + "type": "t_mapping(t_bytes32,t_uint256)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:90" + }, + { + "contract": "TherundownConsumer", + "label": "gamesPerDate", + "type": "t_mapping(t_uint256,t_array(t_bytes32)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:91" + }, + { + "contract": "TherundownConsumer", + "label": "isSportOnADate", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:92" + }, + { + "contract": "TherundownConsumer", + "label": "invalidOdds", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:93" + }, + { + "contract": "TherundownConsumer", + "label": "marketCreated", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:94" + }, + { + "contract": "TherundownConsumer", + "label": "gamesPerDatePerSport", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_array(t_bytes32)dyn_storage))", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:95" + }, + { + "contract": "TherundownConsumer", + "label": "isPausedByCanceledStatus", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:96" + }, + { + "contract": "TherundownConsumer", + "label": "canMarketBeUpdated", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:97" + }, + { + "contract": "TherundownConsumer", + "label": "gameOnADate", + "type": "t_mapping(t_bytes32,t_uint256)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:98" + }, + { + "contract": "TherundownConsumer", + "label": "verifier", + "type": "t_contract(ITherundownConsumerVerifier)61678", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:100" + }, + { + "contract": "TherundownConsumer", + "label": "backupOdds", + "type": "t_mapping(t_bytes32,t_struct(GameOdds)40208_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:101" + }, + { + "contract": "TherundownConsumer", + "label": "oddsObtainer", + "type": "t_contract(IGamesOddsObtainer)59855", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:102" + } + ], + "types": { + "t_address": { + "label": "address" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)": { + "label": "mapping(bytes32 => bytes[])" + }, + "t_bytes32": { + "label": "bytes32" + }, + "t_array(t_bytes_storage)dyn_storage": { + "label": "bytes[]" + }, + "t_bytes_storage": { + "label": "bytes" + }, + "t_mapping(t_bytes32,t_struct(GameCreate)40188_storage)": { + "label": "mapping(bytes32 => struct TherundownConsumer.GameCreate)" + }, + "t_struct(GameCreate)40188_storage": { + "label": "struct TherundownConsumer.GameCreate", + "members": [ + { + "label": "gameId", + "type": "t_bytes32" + }, + { + "label": "startTime", + "type": "t_uint256" + }, + { + "label": "homeOdds", + "type": "t_int24" + }, + { + "label": "awayOdds", + "type": "t_int24" + }, + { + "label": "drawOdds", + "type": "t_int24" + }, + { + "label": "homeTeam", + "type": "t_string_storage" + }, + { + "label": "awayTeam", + "type": "t_string_storage" + } + ] + }, + "t_uint256": { + "label": "uint256" + }, + "t_int24": { + "label": "int24" + }, + "t_string_storage": { + "label": "string" + }, + "t_mapping(t_bytes32,t_struct(GameResolve)40199_storage)": { + "label": "mapping(bytes32 => struct TherundownConsumer.GameResolve)" + }, + "t_struct(GameResolve)40199_storage": { + "label": "struct TherundownConsumer.GameResolve", + "members": [ + { + "label": "gameId", + "type": "t_bytes32" + }, + { + "label": "homeScore", + "type": "t_uint8" + }, + { + "label": "awayScore", + "type": "t_uint8" + }, + { + "label": "statusId", + "type": "t_uint8" + }, + { + "label": "lastUpdated", + "type": "t_uint40" + } + ] + }, + "t_uint8": { + "label": "uint8" + }, + "t_uint40": { + "label": "uint40" + }, + "t_mapping(t_bytes32,t_struct(GameOdds)40208_storage)": { + "label": "mapping(bytes32 => struct TherundownConsumer.GameOdds)" + }, + "t_struct(GameOdds)40208_storage": { + "label": "struct TherundownConsumer.GameOdds", + "members": [ + { + "label": "gameId", + "type": "t_bytes32" + }, + { + "label": "homeOdds", + "type": "t_int24" + }, + { + "label": "awayOdds", + "type": "t_int24" + }, + { + "label": "drawOdds", + "type": "t_int24" + } + ] + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)" + }, + "t_mapping(t_bytes32,t_bool)": { + "label": "mapping(bytes32 => bool)" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)" + }, + "t_contract(ISportPositionalMarketManager)60844": { + "label": "contract ISportPositionalMarketManager" + }, + "t_mapping(t_bytes32,t_address)": { + "label": "mapping(bytes32 => address)" + }, + "t_mapping(t_address,t_bytes32)": { + "label": "mapping(address => bytes32)" + }, + "t_contract(GamesQueue)40140": { + "label": "contract GamesQueue" + }, + "t_mapping(t_uint256,t_array(t_bytes32)dyn_storage)": { + "label": "mapping(uint256 => bytes32[])" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))": { + "label": "mapping(uint256 => mapping(uint256 => bool))" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_array(t_bytes32)dyn_storage))": { + "label": "mapping(uint256 => mapping(uint256 => bytes32[]))" + }, + "t_contract(ITherundownConsumerVerifier)61678": { + "label": "contract ITherundownConsumerVerifier" + }, + "t_contract(IGamesOddsObtainer)59855": { + "label": "contract IGamesOddsObtainer" + } + } + } + }, + "c070dbc3849fd0cfc29b8b52b5a1e3f0ee50f1d6fa27eea172b74bc0942c2dd7": { + "address": "0x519579c64cA400C5c38750c21e6573DF16D01dDe", + "txHash": "0x7a922fee6cb54b4cf386f72467f883ce9cd7a159fb0cd29c2e93b8fbc391af58", "layout": { "storage": [ { @@ -58964,13 +58969,13 @@ { "contract": "ParlayMarketsAMM", "label": "sportsAmm", - "type": "t_contract(ISportsAMM)57254", + "type": "t_contract(ISportsAMM)54184", "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:38" }, { "contract": "ParlayMarketsAMM", "label": "sportManager", - "type": "t_contract(ISportPositionalMarketManager)57087", + "type": "t_contract(ISportPositionalMarketManager)54005", "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:39" }, { @@ -58982,13 +58987,13 @@ { "contract": "ParlayMarketsAMM", "label": "stakingThales", - "type": "t_contract(IStakingThales)57324", + "type": "t_contract(IStakingThales)54254", "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:42" }, { "contract": "ParlayMarketsAMM", "label": "curveSUSD", - "type": "t_contract(ICurveSUSD)55791", + "type": "t_contract(ICurveSUSD)52771", "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:43" }, { @@ -59084,7 +59089,7 @@ { "contract": "ParlayMarketsAMM", "label": "_knownMarkets", - "type": "t_struct(AddressSet)62120_storage", + "type": "t_struct(AddressSet)59050_storage", "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:64" }, { @@ -59102,7 +59107,7 @@ { "contract": "ParlayMarketsAMM", "label": "parlayVerifier", - "type": "t_contract(ParlayVerifier)35236", + "type": "t_contract(ParlayVerifier)32814", "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:67" }, { @@ -59131,19 +59136,19 @@ } ], "types": { - "t_contract(ISportsAMM)57254": { + "t_contract(ISportsAMM)54184": { "label": "contract ISportsAMM" }, - "t_contract(ISportPositionalMarketManager)57087": { + "t_contract(ISportPositionalMarketManager)54005": { "label": "contract ISportPositionalMarketManager" }, "t_contract(IERC20Upgradeable)6764": { "label": "contract IERC20Upgradeable" }, - "t_contract(IStakingThales)57324": { + "t_contract(IStakingThales)54254": { "label": "contract IStakingThales" }, - "t_contract(ICurveSUSD)55791": { + "t_contract(ICurveSUSD)52771": { "label": "contract ICurveSUSD" }, "t_address": { @@ -59155,7 +59160,7 @@ "t_bool": { "label": "bool" }, - "t_struct(AddressSet)62120_storage": { + "t_struct(AddressSet)59050_storage": { "label": "struct AddressSetLib.AddressSet", "members": [ { @@ -59177,7 +59182,7 @@ "t_mapping(t_address,t_bool)": { "label": "mapping(address => bool)" }, - "t_contract(ParlayVerifier)35236": { + "t_contract(ParlayVerifier)32814": { "label": "contract ParlayVerifier" }, "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))))))": { @@ -62337,257 +62342,257 @@ "contract": "Initializable", "label": "_initialized", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" }, { "contract": "Initializable", "label": "_initializing", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" }, { "contract": "ProxyOwned", "label": "owner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" }, { "contract": "ProxyOwned", "label": "nominatedOwner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" }, { "contract": "ProxyOwned", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" }, { "contract": "ProxyOwned", "label": "_transferredAtInit", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" }, { "contract": "ContextUpgradeable", "label": "__gap", "type": "t_array(t_uint256)50_storage", - "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:31" + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" }, { "contract": "PausableUpgradeable", "label": "_paused", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" }, { "contract": "PausableUpgradeable", "label": "__gap", "type": "t_array(t_uint256)49_storage", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:97" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" }, { "contract": "ProxyReentrancyGuard", "label": "_guardCounter", "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" }, { "contract": "ProxyReentrancyGuard", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" }, { "contract": "SportsAMM", "label": "sUSD", - "type": "t_contract(IERC20Upgradeable)7480", - "src": "contracts/SportMarkets/SportsAMM.sol:37" + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\SportsAMM.sol:37" }, { "contract": "SportsAMM", "label": "manager", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:40" + "src": "contracts\\SportMarkets\\SportsAMM.sol:40" }, { "contract": "SportsAMM", "label": "defaultCapPerGame", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:44" + "src": "contracts\\SportMarkets\\SportsAMM.sol:44" }, { "contract": "SportsAMM", "label": "min_spread", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:47" + "src": "contracts\\SportMarkets\\SportsAMM.sol:47" }, { "contract": "SportsAMM", "label": "max_spread", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:50" + "src": "contracts\\SportMarkets\\SportsAMM.sol:50" }, { "contract": "SportsAMM", "label": "minimalTimeLeftToMaturity", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:54" + "src": "contracts\\SportMarkets\\SportsAMM.sol:54" }, { "contract": "SportsAMM", "label": "spentOnGame", "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/SportsAMM.sol:63" + "src": "contracts\\SportMarkets\\SportsAMM.sol:63" }, { "contract": "SportsAMM", "label": "safeBox", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:66" + "src": "contracts\\SportMarkets\\SportsAMM.sol:66" }, { "contract": "SportsAMM", "label": "theRundownConsumer", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:69" + "src": "contracts\\SportMarkets\\SportsAMM.sol:69" }, { "contract": "SportsAMM", "label": "safeBoxImpact", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:72" + "src": "contracts\\SportMarkets\\SportsAMM.sol:72" }, { "contract": "SportsAMM", "label": "stakingThales", - "type": "t_contract(IStakingThales)58193", - "src": "contracts/SportMarkets/SportsAMM.sol:75" + "type": "t_contract(IStakingThales)61088", + "src": "contracts\\SportMarkets\\SportsAMM.sol:75" }, { "contract": "SportsAMM", "label": "minSupportedOdds", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:78" + "src": "contracts\\SportMarkets\\SportsAMM.sol:78" }, { "contract": "SportsAMM", "label": "maxSupportedOdds", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:81" + "src": "contracts\\SportMarkets\\SportsAMM.sol:81" }, { "contract": "SportsAMM", "label": "curveSUSD", - "type": "t_contract(ICurveSUSD)56715", - "src": "contracts/SportMarkets/SportsAMM.sol:84" + "type": "t_contract(ICurveSUSD)59548", + "src": "contracts\\SportMarkets\\SportsAMM.sol:84" }, { "contract": "SportsAMM", "label": "usdc", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:87" + "src": "contracts\\SportMarkets\\SportsAMM.sol:87" }, { "contract": "SportsAMM", "label": "usdt", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:90" + "src": "contracts\\SportMarkets\\SportsAMM.sol:90" }, { "contract": "SportsAMM", "label": "dai", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:93" + "src": "contracts\\SportMarkets\\SportsAMM.sol:93" }, { "contract": "SportsAMM", "label": "curveOnrampEnabled", "type": "t_bool", - "src": "contracts/SportMarkets/SportsAMM.sol:96" + "src": "contracts\\SportMarkets\\SportsAMM.sol:96" }, { "contract": "SportsAMM", "label": "referrals", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:99" + "src": "contracts\\SportMarkets\\SportsAMM.sol:99" }, { "contract": "SportsAMM", "label": "referrerFee", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:102" + "src": "contracts\\SportMarkets\\SportsAMM.sol:102" }, { "contract": "SportsAMM", "label": "parlayAMM", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:105" + "src": "contracts\\SportMarkets\\SportsAMM.sol:105" }, { "contract": "SportsAMM", "label": "apexConsumer", "type": "t_address", - "src": "contracts/SportMarkets/SportsAMM.sol:108" + "src": "contracts\\SportMarkets\\SportsAMM.sol:108" }, { "contract": "SportsAMM", "label": "maxAllowedPegSlippagePercentage", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:111" + "src": "contracts\\SportMarkets\\SportsAMM.sol:111" }, { "contract": "SportsAMM", "label": "capPerSport", "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/SportMarkets/SportsAMM.sol:114" + "src": "contracts\\SportMarkets\\SportsAMM.sol:114" }, { "contract": "SportsAMM", "label": "sportAmmUtils", - "type": "t_contract(SportsAMMUtils)53062", - "src": "contracts/SportMarkets/SportsAMM.sol:116" + "type": "t_contract(SportsAMMUtils)55895", + "src": "contracts\\SportMarkets\\SportsAMM.sol:116" }, { "contract": "SportsAMM", "label": "capPerMarket", "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/SportsAMM.sol:119" + "src": "contracts\\SportMarkets\\SportsAMM.sol:119" }, { "contract": "SportsAMM", "label": "thresholdForOddsUpdate", "type": "t_uint256", - "src": "contracts/SportMarkets/SportsAMM.sol:123" + "src": "contracts\\SportMarkets\\SportsAMM.sol:123" }, { "contract": "SportsAMM", "label": "wrapper", - "type": "t_contract(ITherundownConsumerWrapper)58791", - "src": "contracts/SportMarkets/SportsAMM.sol:126" + "type": "t_contract(ITherundownConsumerWrapper)61686", + "src": "contracts\\SportMarkets\\SportsAMM.sol:126" }, { "contract": "SportsAMM", "label": "safeBoxFeePerAddress", "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/SportsAMM.sol:129" + "src": "contracts\\SportMarkets\\SportsAMM.sol:129" }, { "contract": "SportsAMM", "label": "min_spreadPerAddress", "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/SportsAMM.sol:132" + "src": "contracts\\SportMarkets\\SportsAMM.sol:132" }, { "contract": "SportsAMM", "label": "capPerSportAndChild", "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))", - "src": "contracts/SportMarkets/SportsAMM.sol:135" + "src": "contracts\\SportMarkets\\SportsAMM.sol:135" } ], "types": { - "t_contract(IERC20Upgradeable)7480": { + "t_contract(IERC20Upgradeable)8234": { "label": "contract IERC20Upgradeable" }, "t_address": { @@ -62599,10 +62604,10 @@ "t_mapping(t_address,t_uint256)": { "label": "mapping(address => uint256)" }, - "t_contract(IStakingThales)58193": { + "t_contract(IStakingThales)61088": { "label": "contract IStakingThales" }, - "t_contract(ICurveSUSD)56715": { + "t_contract(ICurveSUSD)59548": { "label": "contract ICurveSUSD" }, "t_bool": { @@ -62611,10 +62616,10 @@ "t_mapping(t_uint256,t_uint256)": { "label": "mapping(uint256 => uint256)" }, - "t_contract(SportsAMMUtils)53062": { + "t_contract(SportsAMMUtils)55895": { "label": "contract SportsAMMUtils" }, - "t_contract(ITherundownConsumerWrapper)58791": { + "t_contract(ITherundownConsumerWrapper)61686": { "label": "contract ITherundownConsumerWrapper" }, "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))": { @@ -62638,188 +62643,188 @@ "contract": "Initializable", "label": "_initialized", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" }, { "contract": "Initializable", "label": "_initializing", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" }, { "contract": "ProxyOwned", "label": "owner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" }, { "contract": "ProxyOwned", "label": "nominatedOwner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" }, { "contract": "ProxyOwned", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" }, { "contract": "ProxyOwned", "label": "_transferredAtInit", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" }, { "contract": "ProxyPausable", "label": "lastPauseTime", "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:11" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyPausable.sol:11" }, { "contract": "ProxyPausable", "label": "paused", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:12" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyPausable.sol:12" }, { "contract": "GamesOddsObtainer", "label": "consumer", - "type": "t_contract(ITherundownConsumer)59439", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:32" + "type": "t_contract(ITherundownConsumer)61550", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:32" }, { "contract": "GamesOddsObtainer", "label": "verifier", - "type": "t_contract(ITherundownConsumerVerifier)59567", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:33" + "type": "t_contract(ITherundownConsumerVerifier)61678", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:33" }, { "contract": "GamesOddsObtainer", "label": "sportsManager", - "type": "t_contract(ISportPositionalMarketManager)58733", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:34" + "type": "t_contract(ISportPositionalMarketManager)60844", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:34" }, { "contract": "GamesOddsObtainer", "label": "gameOdds", - "type": "t_mapping(t_bytes32,t_struct(GameOdds)57619_storage)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:37" + "type": "t_mapping(t_bytes32,t_struct(GameOdds)59668_storage)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:37" }, { "contract": "GamesOddsObtainer", "label": "backupOdds", - "type": "t_mapping(t_bytes32,t_struct(GameOdds)57619_storage)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:38" + "type": "t_mapping(t_bytes32,t_struct(GameOdds)59668_storage)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:38" }, { "contract": "GamesOddsObtainer", "label": "invalidOdds", "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:39" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:39" }, { "contract": "GamesOddsObtainer", "label": "oddsLastPulledForGame", "type": "t_mapping(t_bytes32,t_uint256)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:40" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:40" }, { "contract": "GamesOddsObtainer", "label": "gameIdPerChildMarket", "type": "t_mapping(t_address,t_bytes32)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:41" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:41" }, { "contract": "GamesOddsObtainer", "label": "doesSportSupportSpreadAndTotal", "type": "t_mapping(t_uint256,t_bool)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:42" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:42" }, { "contract": "GamesOddsObtainer", "label": "mainMarketChildMarketIndex", "type": "t_mapping(t_address,t_mapping(t_uint256,t_address))", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:45" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:45" }, { "contract": "GamesOddsObtainer", "label": "numberOfChildMarkets", "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:46" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:46" }, { "contract": "GamesOddsObtainer", "label": "mainMarketSpreadChildMarket", "type": "t_mapping(t_address,t_mapping(t_int16,t_address))", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:47" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:47" }, { "contract": "GamesOddsObtainer", "label": "mainMarketTotalChildMarket", "type": "t_mapping(t_address,t_mapping(t_uint24,t_address))", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:48" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:48" }, { "contract": "GamesOddsObtainer", "label": "childMarketMainMarket", "type": "t_mapping(t_address,t_address)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:49" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:49" }, { "contract": "GamesOddsObtainer", "label": "childMarketSread", "type": "t_mapping(t_address,t_int16)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:50" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:50" }, { "contract": "GamesOddsObtainer", "label": "childMarketTotal", "type": "t_mapping(t_address,t_uint24)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:51" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:51" }, { "contract": "GamesOddsObtainer", "label": "currentActiveTotalChildMarket", "type": "t_mapping(t_address,t_address)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:52" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:52" }, { "contract": "GamesOddsObtainer", "label": "currentActiveSpreadChildMarket", "type": "t_mapping(t_address,t_address)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:53" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:53" }, { "contract": "GamesOddsObtainer", "label": "isSpreadChildMarket", "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:54" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:54" }, { "contract": "GamesOddsObtainer", "label": "childMarketCreated", "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/GamesOddsObtainer.sol:55" + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:55" } ], "types": { - "t_contract(ITherundownConsumer)59439": { + "t_contract(ITherundownConsumer)61550": { "label": "contract ITherundownConsumer" }, - "t_contract(ITherundownConsumerVerifier)59567": { + "t_contract(ITherundownConsumerVerifier)61678": { "label": "contract ITherundownConsumerVerifier" }, - "t_contract(ISportPositionalMarketManager)58733": { + "t_contract(ISportPositionalMarketManager)60844": { "label": "contract ISportPositionalMarketManager" }, - "t_mapping(t_bytes32,t_struct(GameOdds)57619_storage)": { + "t_mapping(t_bytes32,t_struct(GameOdds)59668_storage)": { "label": "mapping(bytes32 => struct IGamesOddsObtainer.GameOdds)" }, "t_bytes32": { "label": "bytes32" }, - "t_struct(GameOdds)57619_storage": { + "t_struct(GameOdds)59668_storage": { "label": "struct IGamesOddsObtainer.GameOdds", "members": [ { @@ -63267,9 +63272,9 @@ } } }, - "1f6237f3cb3c177485233f1a07f1ecf7695a7f5dea4aadb0118a1f3a70d35431": { - "address": "0x024148079617fe41ADd3FaaDBb9ccb208B78aaC1", - "txHash": "0xc4fabf38ef73fe70f10a43df80b046f3bfbbfd86099992eae4e3245964f7b018", + "b1eeb3cf07e51fe00cba183d5a94400cee317a32a6862104b1b2163fac43e895": { + "address": "0xA7Fb4A668Baa9D287f7Ce0454366DAdf87018AC8", + "txHash": "0x83ccb4a4163a9592e117cb0c611788cd3568b8ab2627ad9c0f42aa9a05807ab5", "layout": { "storage": [ { @@ -63284,6 +63289,18 @@ "type": "t_bool", "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" + }, { "contract": "ProxyOwned", "label": "owner", @@ -63321,299 +63338,91 @@ "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:12" }, { - "contract": "ProxyReentrancyGuard", - "label": "_guardCounter", - "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" - }, - { - "contract": "ProxyReentrancyGuard", - "label": "_initialized", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" - }, - { - "contract": "ParlayMarketsAMM", - "label": "sportsAmm", - "type": "t_contract(ISportsAMM)60838", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:38" - }, - { - "contract": "ParlayMarketsAMM", - "label": "sportManager", - "type": "t_contract(ISportPositionalMarketManager)60671", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:39" - }, - { - "contract": "ParlayMarketsAMM", - "label": "sUSD", - "type": "t_contract(IERC20Upgradeable)8234", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:40" - }, - { - "contract": "ParlayMarketsAMM", - "label": "stakingThales", - "type": "t_contract(IStakingThales)60915", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:42" - }, - { - "contract": "ParlayMarketsAMM", - "label": "curveSUSD", - "type": "t_contract(ICurveSUSD)59375", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:43" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlayMarketMastercopy", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:45" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlayMarketData", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:46" - }, - { - "contract": "ParlayMarketsAMM", - "label": "safeBox", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:47" - }, - { - "contract": "ParlayMarketsAMM", - "label": "referrals", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:48" - }, - { - "contract": "ParlayMarketsAMM", - "label": "usdc", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:49" - }, - { - "contract": "ParlayMarketsAMM", - "label": "usdt", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:50" - }, - { - "contract": "ParlayMarketsAMM", - "label": "dai", + "contract": "VestingEscrowCC", + "label": "token", "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:51" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlayAmmFee", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:53" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlaySize", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:54" - }, - { - "contract": "ParlayMarketsAMM", - "label": "maxSupportedAmount", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:56" - }, - { - "contract": "ParlayMarketsAMM", - "label": "maxSupportedOdds", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:57" - }, - { - "contract": "ParlayMarketsAMM", - "label": "safeBoxImpact", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:58" + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:24" }, { - "contract": "ParlayMarketsAMM", - "label": "referrerFee", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:59" + "contract": "VestingEscrowCC", + "label": "startTime", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:25" }, { - "contract": "ParlayMarketsAMM", - "label": "curveOnrampEnabled", - "type": "t_bool", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:61" + "contract": "VestingEscrowCC", + "label": "endTime", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:26" }, { - "contract": "ParlayMarketsAMM", - "label": "reducedFeesEnabled", - "type": "t_bool", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:62" + "contract": "VestingEscrowCC", + "label": "initialLocked", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:27" }, { - "contract": "ParlayMarketsAMM", - "label": "_knownMarkets", - "type": "t_struct(AddressSet)65769_storage", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:64" + "contract": "VestingEscrowCC", + "label": "totalClaimed", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:28" }, { - "contract": "ParlayMarketsAMM", - "label": "resolvedParlay", + "contract": "VestingEscrowCC", + "label": "disabled", "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:65" - }, - { - "contract": "ParlayMarketsAMM", - "label": "maxAllowedPegSlippagePercentage", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:66" + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:29" }, { - "contract": "ParlayMarketsAMM", - "label": "parlayVerifier", - "type": "t_contract(ParlayVerifier)37209", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:67" + "contract": "VestingEscrowCC", + "label": "pausedAt", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:30" }, { - "contract": "ParlayMarketsAMM", - "label": "minUSDAmount", + "contract": "VestingEscrowCC", + "label": "initialLockedSupply", "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:68" + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:32" }, { - "contract": "ParlayMarketsAMM", - "label": "maxAllowedRiskPerCombination", + "contract": "VestingEscrowCC", + "label": "vestingPeriod", "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:70" - }, - { - "contract": "ParlayMarketsAMM", - "label": "riskPerCombination", - "type": "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))))))", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:71" - }, - { - "contract": "ParlayMarketsAMM", - "label": "riskPerGameCombination", - "type": "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256))))))))", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:74" - }, - { - "contract": "ParlayMarketsAMM", - "label": "safeBoxFeePerAddress", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:78" + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:33" }, { - "contract": "ParlayMarketsAMM", - "label": "parlayAmmFeePerAddress", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:80" + "contract": "VestingEscrowCC", + "label": "recipients", + "type": "t_array(t_address)dyn_storage", + "src": "contracts/RetroDistribution/VestingEscrowCC.sol:34" } ], "types": { - "t_contract(ISportsAMM)60838": { - "label": "contract ISportsAMM" - }, - "t_contract(ISportPositionalMarketManager)60671": { - "label": "contract ISportPositionalMarketManager" - }, - "t_contract(IERC20Upgradeable)8234": { - "label": "contract IERC20Upgradeable" - }, - "t_contract(IStakingThales)60915": { - "label": "contract IStakingThales" - }, - "t_contract(ICurveSUSD)59375": { - "label": "contract ICurveSUSD" - }, "t_address": { "label": "address" }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, "t_uint256": { "label": "uint256" }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, "t_bool": { "label": "bool" }, - "t_struct(AddressSet)65769_storage": { - "label": "struct AddressSetLib.AddressSet", - "members": [ - { - "label": "elements", - "type": "t_array(t_address)dyn_storage" - }, - { - "label": "indices", - "type": "t_mapping(t_address,t_uint256)" - } - ] - }, "t_array(t_address)dyn_storage": { "label": "address[]" - }, - "t_mapping(t_address,t_uint256)": { - "label": "mapping(address => uint256)" - }, - "t_mapping(t_address,t_bool)": { - "label": "mapping(address => bool)" - }, - "t_contract(ParlayVerifier)37209": { - "label": "contract ParlayVerifier" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))))))": { - "label": "mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256))))))))" - }, - "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256)))))))": { - "label": "mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256)))))))" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))))": { - "label": "mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256))))))" - }, - "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256)))))": { - "label": "mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256)))))" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))": { - "label": "mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256))))" - }, - "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256)))": { - "label": "mapping(uint256 => mapping(address => mapping(uint256 => uint256)))" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { - "label": "mapping(address => mapping(uint256 => uint256))" - }, - "t_mapping(t_uint256,t_uint256)": { - "label": "mapping(uint256 => uint256)" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256))))))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint256))))))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256)))))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint256)))))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256))))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint256))))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256)))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint256)))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => uint256))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256)))": { - "label": "mapping(address => mapping(address => mapping(address => uint256)))" - }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "label": "mapping(address => mapping(address => uint256))" } } } }, - "34a8978b91cc4435a3648523530701363d132e5cd69f229936e6424b0581980e": { - "address": "0xFfC72be6dAF9072664D4bF9b8dD90562CE20ACA5", - "txHash": "0xee4e48572ed53c9dc7ea369b0298b98b4c347ca79f7fa34a14c1158fbc05dbca", + "9bea07eafdf5df46fa5fed3d879b9899a736adeb2eee3dc047f4365d1295eba3": { + "address": "0x86089DAaB2444560Fd774307B5D0D854d7e9279d", + "txHash": "0x5453afd41ef8e3bcf3ec7e4c79d9203595f90703ca93fa79d51b5768edf20b98", "layout": { "storage": [ { @@ -63652,278 +63461,1683 @@ "type": "t_bool", "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" }, + { + "contract": "ProxyPausable", + "label": "lastPauseTime", + "type": "t_uint256", + "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:11" + }, + { + "contract": "ProxyPausable", + "label": "paused", + "type": "t_bool", + "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:12" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "consumer", + "type": "t_contract(ITherundownConsumer)3358", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:26" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "invalidName", + "type": "t_mapping(t_bytes32,t_bool)", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:27" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "supportedMarketType", + "type": "t_mapping(t_bytes32,t_bool)", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:28" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "defaultOddsThreshold", + "type": "t_uint256", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:29" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "oddsThresholdForSport", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:30" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "defaultBookmakerIds", + "type": "t_array(t_uint256)dyn_storage", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:32" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "sportIdToBookmakerIds", + "type": "t_mapping(t_uint256,t_array(t_uint256)dyn_storage)", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:33" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "obtainer", + "type": "t_contract(IGamesOddsObtainer)2426", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:34" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "sportsManager", + "type": "t_contract(ISportPositionalMarketManager)3112", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:35" + }, + { + "contract": "TherundownConsumerVerifier", + "label": "whitelistedAddresses", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:36" + } + ], + "types": { + "t_contract(ITherundownConsumer)3358": { + "label": "contract ITherundownConsumer" + }, + "t_mapping(t_bytes32,t_bool)": { + "label": "mapping(bytes32 => bool)" + }, + "t_bytes32": { + "label": "bytes32" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_array(t_uint256)dyn_storage": { + "label": "uint256[]" + }, + "t_mapping(t_uint256,t_array(t_uint256)dyn_storage)": { + "label": "mapping(uint256 => uint256[])" + }, + "t_contract(IGamesOddsObtainer)2426": { + "label": "contract IGamesOddsObtainer" + }, + "t_contract(ISportPositionalMarketManager)3112": { + "label": "contract ISportPositionalMarketManager" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_address": { + "label": "address" + } + } + } + }, + "93c1bcac52f1ddeb97f4bace5aa03f2782c946d4b7d58ef508484c5c6e9b285b": { + "address": "0xc647AB2caB7D6da6081703382ECf2814D8b7C03c", + "txHash": "0xf228347b38a8ee1aec1637a4c14279ac8fc3683b91287e5b46d9336c606a80e5", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ProxyPausable", + "label": "lastPauseTime", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyPausable.sol:11" + }, + { + "contract": "ProxyPausable", + "label": "paused", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyPausable.sol:12" + }, + { + "contract": "GamesOddsObtainer", + "label": "consumer", + "type": "t_contract(ITherundownConsumer)62529", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:32" + }, + { + "contract": "GamesOddsObtainer", + "label": "verifier", + "type": "t_contract(ITherundownConsumerVerifier)62657", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:33" + }, + { + "contract": "GamesOddsObtainer", + "label": "sportsManager", + "type": "t_contract(ISportPositionalMarketManager)61808", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:34" + }, + { + "contract": "GamesOddsObtainer", + "label": "gameOdds", + "type": "t_mapping(t_bytes32,t_struct(GameOdds)60687_storage)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:37" + }, + { + "contract": "GamesOddsObtainer", + "label": "backupOdds", + "type": "t_mapping(t_bytes32,t_struct(GameOdds)60687_storage)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:38" + }, + { + "contract": "GamesOddsObtainer", + "label": "invalidOdds", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:39" + }, + { + "contract": "GamesOddsObtainer", + "label": "oddsLastPulledForGame", + "type": "t_mapping(t_bytes32,t_uint256)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:40" + }, + { + "contract": "GamesOddsObtainer", + "label": "gameIdPerChildMarket", + "type": "t_mapping(t_address,t_bytes32)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:41" + }, + { + "contract": "GamesOddsObtainer", + "label": "doesSportSupportSpreadAndTotal", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:42" + }, + { + "contract": "GamesOddsObtainer", + "label": "mainMarketChildMarketIndex", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_address))", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:45" + }, + { + "contract": "GamesOddsObtainer", + "label": "numberOfChildMarkets", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:46" + }, + { + "contract": "GamesOddsObtainer", + "label": "mainMarketSpreadChildMarket", + "type": "t_mapping(t_address,t_mapping(t_int16,t_address))", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:47" + }, + { + "contract": "GamesOddsObtainer", + "label": "mainMarketTotalChildMarket", + "type": "t_mapping(t_address,t_mapping(t_uint24,t_address))", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:48" + }, + { + "contract": "GamesOddsObtainer", + "label": "childMarketMainMarket", + "type": "t_mapping(t_address,t_address)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:49" + }, + { + "contract": "GamesOddsObtainer", + "label": "childMarketSread", + "type": "t_mapping(t_address,t_int16)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:50" + }, + { + "contract": "GamesOddsObtainer", + "label": "childMarketTotal", + "type": "t_mapping(t_address,t_uint24)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:51" + }, + { + "contract": "GamesOddsObtainer", + "label": "currentActiveTotalChildMarket", + "type": "t_mapping(t_address,t_address)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:52" + }, + { + "contract": "GamesOddsObtainer", + "label": "currentActiveSpreadChildMarket", + "type": "t_mapping(t_address,t_address)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:53" + }, + { + "contract": "GamesOddsObtainer", + "label": "isSpreadChildMarket", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:54" + }, + { + "contract": "GamesOddsObtainer", + "label": "childMarketCreated", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:55" + }, + { + "contract": "GamesOddsObtainer", + "label": "normalizedOddsForMarketFulfilled", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:56" + }, + { + "contract": "GamesOddsObtainer", + "label": "normalizedOddsForMarket", + "type": "t_mapping(t_address,t_array(t_uint256)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\GamesOddsObtainer.sol:57" + } + ], + "types": { + "t_contract(ITherundownConsumer)62529": { + "label": "contract ITherundownConsumer" + }, + "t_contract(ITherundownConsumerVerifier)62657": { + "label": "contract ITherundownConsumerVerifier" + }, + "t_contract(ISportPositionalMarketManager)61808": { + "label": "contract ISportPositionalMarketManager" + }, + "t_mapping(t_bytes32,t_struct(GameOdds)60687_storage)": { + "label": "mapping(bytes32 => struct IGamesOddsObtainer.GameOdds)" + }, + "t_bytes32": { + "label": "bytes32" + }, + "t_struct(GameOdds)60687_storage": { + "label": "struct IGamesOddsObtainer.GameOdds", + "members": [ + { + "label": "gameId", + "type": "t_bytes32" + }, + { + "label": "homeOdds", + "type": "t_int24" + }, + { + "label": "awayOdds", + "type": "t_int24" + }, + { + "label": "drawOdds", + "type": "t_int24" + }, + { + "label": "spreadHome", + "type": "t_int16" + }, + { + "label": "spreadHomeOdds", + "type": "t_int24" + }, + { + "label": "spreadAway", + "type": "t_int16" + }, + { + "label": "spreadAwayOdds", + "type": "t_int24" + }, + { + "label": "totalOver", + "type": "t_uint24" + }, + { + "label": "totalOverOdds", + "type": "t_int24" + }, + { + "label": "totalUnder", + "type": "t_uint24" + }, + { + "label": "totalUnderOdds", + "type": "t_int24" + } + ] + }, + "t_int24": { + "label": "int24" + }, + "t_int16": { + "label": "int16" + }, + "t_uint24": { + "label": "uint24" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_address": { + "label": "address" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_address,t_bytes32)": { + "label": "mapping(address => bytes32)" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_address))": { + "label": "mapping(address => mapping(uint256 => address))" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_address,t_mapping(t_int16,t_address))": { + "label": "mapping(address => mapping(int16 => address))" + }, + "t_mapping(t_int16,t_address)": { + "label": "mapping(int16 => address)" + }, + "t_mapping(t_address,t_mapping(t_uint24,t_address))": { + "label": "mapping(address => mapping(uint24 => address))" + }, + "t_mapping(t_uint24,t_address)": { + "label": "mapping(uint24 => address)" + }, + "t_mapping(t_address,t_address)": { + "label": "mapping(address => address)" + }, + "t_mapping(t_address,t_int16)": { + "label": "mapping(address => int16)" + }, + "t_mapping(t_address,t_uint24)": { + "label": "mapping(address => uint24)" + }, + "t_mapping(t_address,t_array(t_uint256)dyn_storage)": { + "label": "mapping(address => uint256[])" + }, + "t_array(t_uint256)dyn_storage": { + "label": "uint256[]" + } + } + } + }, + "c710a2e60d06d9faca8837cd1c1785781eb8f4cdb582abad8e0af7ea690d418f": { + "address": "0xbC4BBD7Adb2f1dd79e40dD4029bcFf97BE9bb1F7", + "txHash": "0x539506cc3e4531a56de1a21631bd9cbca15008838f01ef5ada634e13f27f6696", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ProxyPausable", + "label": "lastPauseTime", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyPausable.sol:11" + }, + { + "contract": "ProxyPausable", + "label": "paused", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyPausable.sol:12" + }, + { + "contract": "TherundownConsumer", + "label": "wrapperAddress", + "type": "t_address", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:59" + }, + { + "contract": "TherundownConsumer", + "label": "whitelistedAddresses", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:60" + }, + { + "contract": "TherundownConsumer", + "label": "requestIdGamesCreated", + "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:63" + }, + { + "contract": "TherundownConsumer", + "label": "requestIdGamesResolved", + "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:64" + }, + { + "contract": "TherundownConsumer", + "label": "requestIdGamesOdds", + "type": "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:65" + }, + { + "contract": "TherundownConsumer", + "label": "gameCreated", + "type": "t_mapping(t_bytes32,t_struct(GameCreate)40857_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:68" + }, + { + "contract": "TherundownConsumer", + "label": "gameResolved", + "type": "t_mapping(t_bytes32,t_struct(GameResolve)40868_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:69" + }, + { + "contract": "TherundownConsumer", + "label": "gameOdds", + "type": "t_mapping(t_bytes32,t_struct(GameOdds)40877_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:70" + }, + { + "contract": "TherundownConsumer", + "label": "sportsIdPerGame", + "type": "t_mapping(t_bytes32,t_uint256)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:71" + }, + { + "contract": "TherundownConsumer", + "label": "gameFulfilledCreated", + "type": "t_mapping(t_bytes32,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:72" + }, + { + "contract": "TherundownConsumer", + "label": "gameFulfilledResolved", + "type": "t_mapping(t_bytes32,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:73" + }, + { + "contract": "TherundownConsumer", + "label": "supportedSport", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:76" + }, + { + "contract": "TherundownConsumer", + "label": "twoPositionSport", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:77" + }, + { + "contract": "TherundownConsumer", + "label": "supportResolveGameStatuses", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:78" + }, + { + "contract": "TherundownConsumer", + "label": "cancelGameStatuses", + "type": "t_mapping(t_uint256,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:79" + }, + { + "contract": "TherundownConsumer", + "label": "sportsManager", + "type": "t_contract(ISportPositionalMarketManager)61808", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:82" + }, + { + "contract": "TherundownConsumer", + "label": "marketPerGameId", + "type": "t_mapping(t_bytes32,t_address)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:83" + }, + { + "contract": "TherundownConsumer", + "label": "gameIdPerMarket", + "type": "t_mapping(t_address,t_bytes32)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:84" + }, + { + "contract": "TherundownConsumer", + "label": "marketResolved", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:85" + }, + { + "contract": "TherundownConsumer", + "label": "marketCanceled", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:86" + }, + { + "contract": "TherundownConsumer", + "label": "queues", + "type": "t_contract(GamesQueue)40809", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:89" + }, + { + "contract": "TherundownConsumer", + "label": "oddsLastPulledForGame", + "type": "t_mapping(t_bytes32,t_uint256)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:90" + }, + { + "contract": "TherundownConsumer", + "label": "gamesPerDate", + "type": "t_mapping(t_uint256,t_array(t_bytes32)dyn_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:91" + }, + { + "contract": "TherundownConsumer", + "label": "isSportOnADate", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:92" + }, + { + "contract": "TherundownConsumer", + "label": "invalidOdds", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:93" + }, + { + "contract": "TherundownConsumer", + "label": "marketCreated", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:94" + }, + { + "contract": "TherundownConsumer", + "label": "gamesPerDatePerSport", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_array(t_bytes32)dyn_storage))", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:95" + }, + { + "contract": "TherundownConsumer", + "label": "isPausedByCanceledStatus", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:96" + }, + { + "contract": "TherundownConsumer", + "label": "canMarketBeUpdated", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:97" + }, + { + "contract": "TherundownConsumer", + "label": "gameOnADate", + "type": "t_mapping(t_bytes32,t_uint256)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:98" + }, + { + "contract": "TherundownConsumer", + "label": "verifier", + "type": "t_contract(ITherundownConsumerVerifier)62657", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:100" + }, + { + "contract": "TherundownConsumer", + "label": "backupOdds", + "type": "t_mapping(t_bytes32,t_struct(GameOdds)40877_storage)", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:101" + }, + { + "contract": "TherundownConsumer", + "label": "oddsObtainer", + "type": "t_contract(IGamesOddsObtainer)60881", + "src": "contracts\\SportMarkets\\Rundown\\TherundownConsumer.sol:102" + } + ], + "types": { + "t_address": { + "label": "address" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_bytes32,t_array(t_bytes_storage)dyn_storage)": { + "label": "mapping(bytes32 => bytes[])" + }, + "t_bytes32": { + "label": "bytes32" + }, + "t_array(t_bytes_storage)dyn_storage": { + "label": "bytes[]" + }, + "t_bytes_storage": { + "label": "bytes" + }, + "t_mapping(t_bytes32,t_struct(GameCreate)40857_storage)": { + "label": "mapping(bytes32 => struct TherundownConsumer.GameCreate)" + }, + "t_struct(GameCreate)40857_storage": { + "label": "struct TherundownConsumer.GameCreate", + "members": [ + { + "label": "gameId", + "type": "t_bytes32" + }, + { + "label": "startTime", + "type": "t_uint256" + }, + { + "label": "homeOdds", + "type": "t_int24" + }, + { + "label": "awayOdds", + "type": "t_int24" + }, + { + "label": "drawOdds", + "type": "t_int24" + }, + { + "label": "homeTeam", + "type": "t_string_storage" + }, + { + "label": "awayTeam", + "type": "t_string_storage" + } + ] + }, + "t_uint256": { + "label": "uint256" + }, + "t_int24": { + "label": "int24" + }, + "t_string_storage": { + "label": "string" + }, + "t_mapping(t_bytes32,t_struct(GameResolve)40868_storage)": { + "label": "mapping(bytes32 => struct TherundownConsumer.GameResolve)" + }, + "t_struct(GameResolve)40868_storage": { + "label": "struct TherundownConsumer.GameResolve", + "members": [ + { + "label": "gameId", + "type": "t_bytes32" + }, + { + "label": "homeScore", + "type": "t_uint8" + }, + { + "label": "awayScore", + "type": "t_uint8" + }, + { + "label": "statusId", + "type": "t_uint8" + }, + { + "label": "lastUpdated", + "type": "t_uint40" + } + ] + }, + "t_uint8": { + "label": "uint8" + }, + "t_uint40": { + "label": "uint40" + }, + "t_mapping(t_bytes32,t_struct(GameOdds)40877_storage)": { + "label": "mapping(bytes32 => struct TherundownConsumer.GameOdds)" + }, + "t_struct(GameOdds)40877_storage": { + "label": "struct TherundownConsumer.GameOdds", + "members": [ + { + "label": "gameId", + "type": "t_bytes32" + }, + { + "label": "homeOdds", + "type": "t_int24" + }, + { + "label": "awayOdds", + "type": "t_int24" + }, + { + "label": "drawOdds", + "type": "t_int24" + } + ] + }, + "t_mapping(t_bytes32,t_uint256)": { + "label": "mapping(bytes32 => uint256)" + }, + "t_mapping(t_bytes32,t_bool)": { + "label": "mapping(bytes32 => bool)" + }, + "t_mapping(t_uint256,t_bool)": { + "label": "mapping(uint256 => bool)" + }, + "t_contract(ISportPositionalMarketManager)61808": { + "label": "contract ISportPositionalMarketManager" + }, + "t_mapping(t_bytes32,t_address)": { + "label": "mapping(bytes32 => address)" + }, + "t_mapping(t_address,t_bytes32)": { + "label": "mapping(address => bytes32)" + }, + "t_contract(GamesQueue)40809": { + "label": "contract GamesQueue" + }, + "t_mapping(t_uint256,t_array(t_bytes32)dyn_storage)": { + "label": "mapping(uint256 => bytes32[])" + }, + "t_array(t_bytes32)dyn_storage": { + "label": "bytes32[]" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_bool))": { + "label": "mapping(uint256 => mapping(uint256 => bool))" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_array(t_bytes32)dyn_storage))": { + "label": "mapping(uint256 => mapping(uint256 => bytes32[]))" + }, + "t_contract(ITherundownConsumerVerifier)62657": { + "label": "contract ITherundownConsumerVerifier" + }, + "t_contract(IGamesOddsObtainer)60881": { + "label": "contract IGamesOddsObtainer" + } + } + } + }, + "1724fdf59a19004397ac46691b3a9eff70e782dd4fd73273df107dfe82ffb08f": { + "address": "0x2113a7d5d203Be717083746Bc6040c3fB8673389", + "txHash": "0x9aa87b8359ef29d1d1c859d9f9bf3a95af9b7faa81cfe4006bc2c9006c12016f", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "initialized", + "type": "t_bool", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:23" + }, + { + "contract": "Initializable", + "label": "initializing", + "type": "t_bool", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:28" + }, + { + "contract": "Initializable", + "label": "______gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:63" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:10" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "ProxyPausable", + "label": "lastPauseTime", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\ProxyPausable.sol:11" + }, + { + "contract": "ProxyPausable", + "label": "paused", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyPausable.sol:12" + }, + { + "contract": "StakingThales", + "label": "iEscrowThales", + "type": "t_contract(IEscrowThales)6517", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:33" + }, + { + "contract": "StakingThales", + "label": "stakingToken", + "type": "t_contract(IERC20)9486", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:34" + }, + { + "contract": "StakingThales", + "label": "feeToken", + "type": "t_contract(IERC20)9486", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:35" + }, + { + "contract": "StakingThales", + "label": "SNXRewards", + "type": "t_contract(ISNXRewards)6887", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:36" + }, + { + "contract": "StakingThales", + "label": "thalesRoyale", + "type": "t_contract(IThalesRoyale)7164", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:37" + }, + { + "contract": "StakingThales", + "label": "priceFeed", + "type": "t_contract(IPriceFeed)6849", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:38" + }, + { + "contract": "StakingThales", + "label": "periodsOfStaking", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:40" + }, + { + "contract": "StakingThales", + "label": "lastPeriodTimeStamp", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:41" + }, + { + "contract": "StakingThales", + "label": "durationPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:42" + }, + { + "contract": "StakingThales", + "label": "unstakeDurationPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:43" + }, + { + "contract": "StakingThales", + "label": "startTimeStamp", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:44" + }, + { + "contract": "StakingThales", + "label": "currentPeriodRewards", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:45" + }, + { + "contract": "StakingThales", + "label": "currentPeriodFees", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:46" + }, + { + "contract": "StakingThales", + "label": "distributeFeesEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:47" + }, + { + "contract": "StakingThales", + "label": "fixedPeriodReward", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:48" + }, + { + "contract": "StakingThales", + "label": "periodExtraReward", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:49" + }, + { + "contract": "StakingThales", + "label": "totalSNXRewardsInPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:50" + }, + { + "contract": "StakingThales", + "label": "totalSNXFeesInPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:51" + }, + { + "contract": "StakingThales", + "label": "claimEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:52" + }, + { + "contract": "StakingThales", + "label": "stakerLifetimeRewardsClaimed", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:54" + }, + { + "contract": "StakingThales", + "label": "stakerFeesClaimed", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:55" + }, + { + "contract": "StakingThales", + "label": "_totalStakedAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:57" + }, + { + "contract": "StakingThales", + "label": "_totalEscrowedAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:58" + }, + { + "contract": "StakingThales", + "label": "_totalPendingStakeAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:59" + }, + { + "contract": "StakingThales", + "label": "_totalUnclaimedRewards", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:60" + }, + { + "contract": "StakingThales", + "label": "_totalRewardsClaimed", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:61" + }, + { + "contract": "StakingThales", + "label": "_totalRewardFeesClaimed", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:62" + }, + { + "contract": "StakingThales", + "label": "lastUnstakeTime", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:64" + }, + { + "contract": "StakingThales", + "label": "unstaking", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:65" + }, + { + "contract": "StakingThales", + "label": "unstakingAmount", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:66" + }, + { + "contract": "StakingThales", + "label": "_stakedBalances", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:67" + }, + { + "contract": "StakingThales", + "label": "_lastRewardsClaimedPeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:68" + }, + { + "contract": "StakingThales", + "label": "thalesAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:69" + }, + { + "contract": "StakingThales", + "label": "lastAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:78" + }, + { + "contract": "StakingThales", + "label": "stakerAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:79" + }, + { + "contract": "StakingThales", + "label": "extraRewardsActive", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:81" + }, + { + "contract": "StakingThales", + "label": "ThalesStakingRewardsPool", + "type": "t_contract(IThalesStakingRewardsPool)7174", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:82" + }, + { + "contract": "StakingThales", + "label": "maxSNXRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:84" + }, + { + "contract": "StakingThales", + "label": "maxAMMVolumeRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:85" + }, + { + "contract": "StakingThales", + "label": "AMMVolumeRewardsMultiplier", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:86" + }, + { + "contract": "StakingThales", + "label": "maxThalesRoyaleRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:87" + }, + { + "contract": "StakingThales", + "label": "SNXVolumeRewardsMultiplier", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:92" + }, + { + "contract": "StakingThales", + "label": "_lastStakingPeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:94" + }, + { + "contract": "StakingThales", + "label": "totalStakedLastPeriodEnd", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:96" + }, + { + "contract": "StakingThales", + "label": "totalEscrowedLastPeriodEnd", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:97" + }, + { + "contract": "StakingThales", + "label": "exoticBonds", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:98" + }, + { + "contract": "StakingThales", + "label": "addressResolver", + "type": "t_contract(IAddressResolver)6424", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:100" + }, + { + "contract": "StakingThales", + "label": "thalesRangedAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:102" + }, + { + "contract": "StakingThales", + "label": "sportsAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:103" + }, + { + "contract": "StakingThales", + "label": "lastThalesAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:105" + }, + { + "contract": "StakingThales", + "label": "thalesAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:106" + }, + { + "contract": "StakingThales", + "label": "lastThalesRangedAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:107" + }, + { + "contract": "StakingThales", + "label": "thalesRangedAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:108" + }, + { + "contract": "StakingThales", + "label": "lastExoticMarketsUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:109" + }, + { + "contract": "StakingThales", + "label": "exoticMarketsVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:110" + }, + { + "contract": "StakingThales", + "label": "lastSportsAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:111" + }, + { + "contract": "StakingThales", + "label": "sportsAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:112" + }, + { + "contract": "StakingThales", + "label": "canClaimOnBehalf", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:114" + }, + { + "contract": "StakingThales", + "label": "mergeAccountEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:116" + }, + { + "contract": "StakingThales", + "label": "delegatedVolume", + "type": "t_mapping(t_address,t_address)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:118" + }, + { + "contract": "StakingThales", + "label": "supportedSportVault", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:119" + }, + { + "contract": "StakingThales", + "label": "supportedAMMVault", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:120" + }, + { + "contract": "StakingThales", + "label": "sportsAMMLiquidityPool", + "type": "t_contract(ISportsAMMLiquidityPool)6897", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:122" + } + ], + "types": { + "t_contract(IEscrowThales)6517": { + "label": "contract IEscrowThales" + }, + "t_contract(IERC20)9486": { + "label": "contract IERC20" + }, + "t_contract(ISNXRewards)6887": { + "label": "contract ISNXRewards" + }, + "t_contract(IThalesRoyale)7164": { + "label": "contract IThalesRoyale" + }, + "t_contract(IPriceFeed)6849": { + "label": "contract IPriceFeed" + }, + "t_uint256": { + "label": "uint256" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)": { + "label": "mapping(address => struct StakingThales.AMMVolumeEntry[4])" + }, + "t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage": { + "label": "struct StakingThales.AMMVolumeEntry[4]" + }, + "t_struct(AMMVolumeEntry)3107_storage": { + "label": "struct StakingThales.AMMVolumeEntry", + "members": [ + { + "label": "amount", + "type": "t_uint256" + }, + { + "label": "period", + "type": "t_uint256" + } + ] + }, + "t_contract(IThalesStakingRewardsPool)7174": { + "label": "contract IThalesStakingRewardsPool" + }, + "t_contract(IAddressResolver)6424": { + "label": "contract IAddressResolver" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "label": "mapping(address => mapping(address => bool))" + }, + "t_mapping(t_address,t_address)": { + "label": "mapping(address => address)" + }, + "t_contract(ISportsAMMLiquidityPool)6897": { + "label": "contract ISportsAMMLiquidityPool" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "b69137d40579b83705fec017789bf997ce530d55beddaf2ea4c6d9868e19712e": { + "address": "0x7aD35a998847fEcf33fb1F23c27D3159a9c59D3C", + "txHash": "0xb1b2bfe41690c4135d6f7a0fee96b9dd31dcef6407f51a50e113ff765ea6e36b", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, { "contract": "ContextUpgradeable", "label": "__gap", "type": "t_array(t_uint256)50_storage", - "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:31" + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" }, { "contract": "PausableUpgradeable", "label": "_paused", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" }, { "contract": "PausableUpgradeable", "label": "__gap", "type": "t_array(t_uint256)49_storage", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:97" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" }, { "contract": "ProxyReentrancyGuard", "label": "_guardCounter", "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" }, { "contract": "ProxyReentrancyGuard", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" - }, - { - "contract": "ParlayVault", - "label": "parlayAMM", - "type": "t_contract(IParlayMarketsAMM)59916", - "src": "contracts/OvertimeVaults/ParlayVault.sol:50" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" }, { - "contract": "ParlayVault", + "contract": "SportsAMM", "label": "sUSD", "type": "t_contract(IERC20Upgradeable)8234", - "src": "contracts/OvertimeVaults/ParlayVault.sol:51" + "src": "contracts\\SportMarkets\\SportsAMM.sol:39" }, { - "contract": "ParlayVault", - "label": "vaultStarted", - "type": "t_bool", - "src": "contracts/OvertimeVaults/ParlayVault.sol:53" + "contract": "SportsAMM", + "label": "manager", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:42" }, { - "contract": "ParlayVault", - "label": "round", + "contract": "SportsAMM", + "label": "defaultCapPerGame", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:55" + "src": "contracts\\SportMarkets\\SportsAMM.sol:46" }, { - "contract": "ParlayVault", - "label": "roundLength", + "contract": "SportsAMM", + "label": "min_spread", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:56" + "src": "contracts\\SportMarkets\\SportsAMM.sol:49" }, { - "contract": "ParlayVault", - "label": "roundStartTime", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:57" + "contract": "SportsAMM", + "label": "max_spread", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:52" + }, + { + "contract": "SportsAMM", + "label": "minimalTimeLeftToMaturity", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:56" + }, + { + "contract": "SportsAMM", + "label": "spentOnGame", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:65" + }, + { + "contract": "SportsAMM", + "label": "safeBox", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:68" + }, + { + "contract": "SportsAMM", + "label": "theRundownConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:71" + }, + { + "contract": "SportsAMM", + "label": "safeBoxImpact", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:74" }, { - "contract": "ParlayVault", - "label": "usersPerRound", - "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:59" + "contract": "SportsAMM", + "label": "stakingThales", + "type": "t_contract(IStakingThales)62067", + "src": "contracts\\SportMarkets\\SportsAMM.sol:77" }, { - "contract": "ParlayVault", - "label": "userInRound", - "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:60" + "contract": "SportsAMM", + "label": "minSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:80" }, { - "contract": "ParlayVault", - "label": "balancesPerRound", - "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:62" + "contract": "SportsAMM", + "label": "maxSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:83" }, { - "contract": "ParlayVault", - "label": "withdrawalRequested", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:63" + "contract": "SportsAMM", + "label": "curveSUSD", + "type": "t_contract(ICurveSUSD)60567", + "src": "contracts\\SportMarkets\\SportsAMM.sol:86" }, { - "contract": "ParlayVault", - "label": "depositReceipts", - "type": "t_mapping(t_address,t_struct(DepositReceipt)15429_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:64" + "contract": "SportsAMM", + "label": "usdc", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:89" }, { - "contract": "ParlayVault", - "label": "allocationPerRound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:66" + "contract": "SportsAMM", + "label": "usdt", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:92" }, { - "contract": "ParlayVault", - "label": "tradingParlayMarketsPerRound", - "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:68" + "contract": "SportsAMM", + "label": "dai", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:95" }, { - "contract": "ParlayVault", - "label": "isTradingParlayMarketInARound", - "type": "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:69" + "contract": "SportsAMM", + "label": "curveOnrampEnabled", + "type": "t_bool", + "src": "contracts\\SportMarkets\\SportsAMM.sol:98" }, { - "contract": "ParlayVault", - "label": "profitAndLossPerRound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:71" + "contract": "SportsAMM", + "label": "referrals", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:101" }, { - "contract": "ParlayVault", - "label": "cumulativeProfitAndLoss", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:72" + "contract": "SportsAMM", + "label": "referrerFee", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:104" }, { - "contract": "ParlayVault", - "label": "maxAllowedDeposit", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:74" + "contract": "SportsAMM", + "label": "parlayAMM", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:107" }, { - "contract": "ParlayVault", - "label": "utilizationRate", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:75" + "contract": "SportsAMM", + "label": "apexConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:110" }, { - "contract": "ParlayVault", - "label": "maxTradeRate", + "contract": "SportsAMM", + "label": "maxAllowedPegSlippagePercentage", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:76" + "src": "contracts\\SportMarkets\\SportsAMM.sol:113" }, { - "contract": "ParlayVault", - "label": "capPerRound", + "contract": "SportsAMM", + "label": "capPerSport", "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:78" - }, - { - "contract": "ParlayVault", - "label": "minDepositAmount", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:80" + "src": "contracts\\SportMarkets\\SportsAMM.sol:116" }, { - "contract": "ParlayVault", - "label": "maxAllowedUsers", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:82" + "contract": "SportsAMM", + "label": "sportAmmUtils", + "type": "t_contract(SportsAMMUtils)56906", + "src": "contracts\\SportMarkets\\SportsAMM.sol:118" }, { - "contract": "ParlayVault", - "label": "usersCurrentlyInVault", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:83" + "contract": "SportsAMM", + "label": "capPerMarket", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:121" }, { - "contract": "ParlayVault", - "label": "priceLowerLimit", + "contract": "SportsAMM", + "label": "thresholdForOddsUpdate", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:85" + "src": "contracts\\SportMarkets\\SportsAMM.sol:125" }, { - "contract": "ParlayVault", - "label": "priceUpperLimit", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:86" + "contract": "SportsAMM", + "label": "wrapper", + "type": "t_contract(ITherundownConsumerWrapper)62665", + "src": "contracts\\SportMarkets\\SportsAMM.sol:128" }, { - "contract": "ParlayVault", - "label": "skewImpactLimit", - "type": "t_int256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:87" + "contract": "SportsAMM", + "label": "safeBoxFeePerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:131" }, { - "contract": "ParlayVault", - "label": "minTradeAmount", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:89" + "contract": "SportsAMM", + "label": "min_spreadPerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:134" }, { - "contract": "ParlayVault", - "label": "stakingThales", - "type": "t_contract(IStakingThales)60916", - "src": "contracts/OvertimeVaults/ParlayVault.sol:92" + "contract": "SportsAMM", + "label": "capPerSportAndChild", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))", + "src": "contracts\\SportMarkets\\SportsAMM.sol:137" }, { - "contract": "ParlayVault", - "label": "allocationSpentInARound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:94" + "contract": "SportsAMM", + "label": "liquidityPool", + "type": "t_contract(SportAMMLiquidityPool)31132", + "src": "contracts\\SportMarkets\\SportsAMM.sol:157" } ], "types": { - "t_contract(IParlayMarketsAMM)59916": { - "label": "contract IParlayMarketsAMM" - }, "t_contract(IERC20Upgradeable)8234": { "label": "contract IERC20Upgradeable" }, - "t_bool": { - "label": "bool" - }, - "t_uint256": { - "label": "uint256" - }, - "t_mapping(t_uint256,t_uint256)": { - "label": "mapping(uint256 => uint256)" - }, - "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { - "label": "mapping(uint256 => address[])" - }, - "t_array(t_address)dyn_storage": { - "label": "address[]" - }, "t_address": { "label": "address" }, - "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { - "label": "mapping(uint256 => mapping(address => bool))" - }, - "t_mapping(t_address,t_bool)": { - "label": "mapping(address => bool)" - }, - "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { - "label": "mapping(uint256 => mapping(address => uint256))" + "t_uint256": { + "label": "uint256" }, "t_mapping(t_address,t_uint256)": { "label": "mapping(address => uint256)" }, - "t_mapping(t_address,t_struct(DepositReceipt)15429_storage)": { - "label": "mapping(address => struct ParlayVault.DepositReceipt)" + "t_contract(IStakingThales)62067": { + "label": "contract IStakingThales" }, - "t_struct(DepositReceipt)15429_storage": { - "label": "struct ParlayVault.DepositReceipt", - "members": [ - { - "label": "round", - "type": "t_uint256" - }, - { - "label": "amount", - "type": "t_uint256" - } - ] + "t_contract(ICurveSUSD)60567": { + "label": "contract ICurveSUSD" }, - "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))": { - "label": "mapping(uint256 => mapping(bytes32 => bool))" + "t_bool": { + "label": "bool" }, - "t_mapping(t_bytes32,t_bool)": { - "label": "mapping(bytes32 => bool)" + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" }, - "t_bytes32": { - "label": "bytes32" + "t_contract(SportsAMMUtils)56906": { + "label": "contract SportsAMMUtils" }, - "t_int256": { - "label": "int256" + "t_contract(ITherundownConsumerWrapper)62665": { + "label": "contract ITherundownConsumerWrapper" }, - "t_contract(IStakingThales)60916": { - "label": "contract IStakingThales" + "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))": { + "label": "mapping(uint256 => mapping(uint256 => uint256))" + }, + "t_contract(SportAMMLiquidityPool)31132": { + "label": "contract SportAMMLiquidityPool" }, "t_array(t_uint256)49_storage": { "label": "uint256[49]" @@ -63934,277 +65148,258 @@ } } }, - "b1eeb3cf07e51fe00cba183d5a94400cee317a32a6862104b1b2163fac43e895": { - "address": "0xA7Fb4A668Baa9D287f7Ce0454366DAdf87018AC8", - "txHash": "0x83ccb4a4163a9592e117cb0c611788cd3568b8ab2627ad9c0f42aa9a05807ab5", + "4fa047ca4ce3007d3e9e6ecbb4a1885fc3d2b94ad06f53ee57d573ddcc6f58f6": { + "address": "0x6C2e0015b431f8c5F6b40138aF803504E601D91c", + "txHash": "0xeafdbb14fb02be17297b1b871adceb56b2f643db5d471e3d0f8dc6fca2cfe983", "layout": { "storage": [ { "contract": "Initializable", "label": "_initialized", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" }, { "contract": "Initializable", "label": "_initializing", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" - }, - { - "contract": "ProxyReentrancyGuard", - "label": "_guardCounter", - "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" - }, - { - "contract": "ProxyReentrancyGuard", - "label": "_initialized", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" }, { "contract": "ProxyOwned", "label": "owner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" }, { "contract": "ProxyOwned", "label": "nominatedOwner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" }, { "contract": "ProxyOwned", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" }, { "contract": "ProxyOwned", "label": "_transferredAtInit", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" }, { - "contract": "ProxyPausable", - "label": "lastPauseTime", - "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:11" + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" }, { - "contract": "ProxyPausable", - "label": "paused", + "contract": "PausableUpgradeable", + "label": "_paused", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:12" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" }, { - "contract": "VestingEscrowCC", - "label": "token", - "type": "t_address", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:24" + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" }, { - "contract": "VestingEscrowCC", - "label": "startTime", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:25" + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" }, { - "contract": "VestingEscrowCC", - "label": "endTime", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:26" + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" }, { - "contract": "VestingEscrowCC", - "label": "initialLocked", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:27" + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)6279", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" }, { - "contract": "VestingEscrowCC", - "label": "totalClaimed", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:28" + "contract": "SportAMMLiquidityPool", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)548", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" }, { - "contract": "VestingEscrowCC", - "label": "disabled", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:29" + "contract": "SportAMMLiquidityPool", + "label": "started", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" }, { - "contract": "VestingEscrowCC", - "label": "pausedAt", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:30" + "contract": "SportAMMLiquidityPool", + "label": "round", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" }, { - "contract": "VestingEscrowCC", - "label": "initialLockedSupply", + "contract": "SportAMMLiquidityPool", + "label": "roundLength", "type": "t_uint256", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:32" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" }, { - "contract": "VestingEscrowCC", - "label": "vestingPeriod", + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", "type": "t_uint256", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:33" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" }, { - "contract": "VestingEscrowCC", - "label": "recipients", - "type": "t_array(t_address)dyn_storage", - "src": "contracts/RetroDistribution/VestingEscrowCC.sol:34" - } - ], - "types": { - "t_address": { - "label": "address" + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" }, - "t_mapping(t_address,t_uint256)": { - "label": "mapping(address => uint256)" + { + "contract": "SportAMMLiquidityPool", + "label": "usersPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" }, - "t_uint256": { - "label": "uint256" + { + "contract": "SportAMMLiquidityPool", + "label": "userInRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" }, - "t_mapping(t_address,t_bool)": { - "label": "mapping(address => bool)" + { + "contract": "SportAMMLiquidityPool", + "label": "balancesPerRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" }, - "t_bool": { - "label": "bool" + { + "contract": "SportAMMLiquidityPool", + "label": "allocationPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" }, - "t_array(t_address)dyn_storage": { - "label": "address[]" - } - } - } - }, - "9bea07eafdf5df46fa5fed3d879b9899a736adeb2eee3dc047f4365d1295eba3": { - "address": "0x86089DAaB2444560Fd774307B5D0D854d7e9279d", - "txHash": "0x5453afd41ef8e3bcf3ec7e4c79d9203595f90703ca93fa79d51b5768edf20b98", - "layout": { - "storage": [ { - "contract": "Initializable", - "label": "_initialized", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" }, { - "contract": "Initializable", - "label": "_initializing", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" }, { - "contract": "ProxyOwned", - "label": "owner", - "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" }, { - "contract": "ProxyOwned", - "label": "nominatedOwner", - "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" + "contract": "SportAMMLiquidityPool", + "label": "profitAndLossPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" }, { - "contract": "ProxyOwned", - "label": "_initialized", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" + "contract": "SportAMMLiquidityPool", + "label": "cumulativeProfitAndLoss", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" }, { - "contract": "ProxyOwned", - "label": "_transferredAtInit", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedDeposit", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" }, { - "contract": "ProxyPausable", - "label": "lastPauseTime", + "contract": "SportAMMLiquidityPool", + "label": "minDepositAmount", "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:11" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" }, { - "contract": "ProxyPausable", - "label": "paused", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:12" + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedUsers", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" }, { - "contract": "TherundownConsumerVerifier", - "label": "consumer", - "type": "t_contract(ITherundownConsumer)3358", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:26" + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" }, { - "contract": "TherundownConsumerVerifier", - "label": "invalidName", - "type": "t_mapping(t_bytes32,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:27" + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" }, { - "contract": "TherundownConsumerVerifier", - "label": "supportedMarketType", - "type": "t_mapping(t_bytes32,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:28" + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)6356", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:71" }, { - "contract": "TherundownConsumerVerifier", - "label": "defaultOddsThreshold", + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", "type": "t_uint256", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:29" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:73" }, { - "contract": "TherundownConsumerVerifier", - "label": "oddsThresholdForSport", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:30" + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:75" }, { - "contract": "TherundownConsumerVerifier", - "label": "defaultBookmakerIds", - "type": "t_array(t_uint256)dyn_storage", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:32" + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:77" }, { - "contract": "TherundownConsumerVerifier", - "label": "sportIdToBookmakerIds", - "type": "t_mapping(t_uint256,t_array(t_uint256)dyn_storage)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:33" + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:79" }, { - "contract": "TherundownConsumerVerifier", - "label": "obtainer", - "type": "t_contract(IGamesOddsObtainer)2426", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:34" + "contract": "SportAMMLiquidityPool", + "label": "onlyWhitelistedStakersAllowed", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:81" }, { - "contract": "TherundownConsumerVerifier", - "label": "sportsManager", - "type": "t_contract(ISportPositionalMarketManager)3112", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:35" + "contract": "SportAMMLiquidityPool", + "label": "whitelistedStakers", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:83" }, { - "contract": "TherundownConsumerVerifier", - "label": "whitelistedAddresses", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Rundown/TherundownConsumerVerifier.sol:36" + "contract": "SportAMMLiquidityPool", + "label": "needsTransformingCollateral", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:85" } ], "types": { - "t_contract(ITherundownConsumer)3358": { - "label": "contract ITherundownConsumer" - }, - "t_mapping(t_bytes32,t_bool)": { - "label": "mapping(bytes32 => bool)" + "t_contract(ISportsAMM)6279": { + "label": "contract ISportsAMM" }, - "t_bytes32": { - "label": "bytes32" + "t_contract(IERC20Upgradeable)548": { + "label": "contract IERC20Upgradeable" }, "t_bool": { "label": "bool" @@ -64212,26 +65407,123 @@ "t_uint256": { "label": "uint256" }, - "t_mapping(t_uint256,t_uint256)": { - "label": "mapping(uint256 => uint256)" + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" }, - "t_array(t_uint256)dyn_storage": { - "label": "uint256[]" + "t_address": { + "label": "address" }, - "t_mapping(t_uint256,t_array(t_uint256)dyn_storage)": { - "label": "mapping(uint256 => uint256[])" + "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { + "label": "mapping(uint256 => address[])" }, - "t_contract(IGamesOddsObtainer)2426": { - "label": "contract IGamesOddsObtainer" + "t_array(t_address)dyn_storage": { + "label": "address[]" }, - "t_contract(ISportPositionalMarketManager)3112": { - "label": "contract ISportPositionalMarketManager" + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))" }, "t_mapping(t_address,t_bool)": { "label": "mapping(address => bool)" }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(IStakingThales)6356": { + "label": "contract IStakingThales" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "00d048b7b847fe0255033349ce7b7fcb61eed2bbc1bd3eee149dac6db22a8014": { + "address": "0x0bAc9eC4126cE5b62BEE2e99823c2b2e96c396b5", + "txHash": "0x1a0101f9fb95b802d23231e76f6a7fcc63b963dfb65f13e44c76c315816bd6d5", + "layout": { + "storage": [ + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "DefaultLiquidityProvider", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\LiquidityPool\\DefaultLiquidityProvider.sol:14" + }, + { + "contract": "DefaultLiquidityProvider", + "label": "liquidityPool", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\DefaultLiquidityProvider.sol:19" + } + ], + "types": { + "t_contract(IERC20Upgradeable)8234": { + "label": "contract IERC20Upgradeable" + }, "t_address": { "label": "address" + }, + "t_uint256": { + "label": "uint256" + }, + "t_bool": { + "label": "bool" } } } diff --git a/.openzeppelin/unknown-420.json b/.openzeppelin/unknown-420.json index 1ce26b086..ff1e5200e 100644 --- a/.openzeppelin/unknown-420.json +++ b/.openzeppelin/unknown-420.json @@ -251,23 +251,23 @@ "kind": "transparent" }, { - "address": "0xd22bFdF5A386b183890b6B0072d55D92D83702f1", - "txHash": "0xc41e3460bef1480ebbb80998d3ca497d44020d5af359618e72e1ad52b941ab8d", + "address": "0x5A17bB0394dD25f21fd11aC6202561B04f126065", + "txHash": "0x908cb174baf76017e8684bed4f6abb40a67e21f16676dea5b6903d45fd6f4525", "kind": "transparent" }, { - "address": "0xc20531a6482903EaCe22eBeA911c3699FBf2dBaB", - "txHash": "0xbbb94bfe5a886701f6808260e829e217428c7ad586646d4cd3ba890d90dac1b0", + "address": "0x1dBc8eF4c551feb01C693e2c064aA66900D0f103", + "txHash": "0x09fb9fcd3458d0a78e6db09ab91ad9c284182bd87a91b98ab43589268c5ddc93", "kind": "transparent" }, { - "address": "0xbAdB27CC3A10582987B97513CcC4cF21b1Fb56e9", - "txHash": "0xf42962c71ae40165b9511377ad9cedfee2c3ceab35112896c8a83a7e54b9c7f7", + "address": "0xdd0879AB819287637f33A29d1ee91d5a76c890Af", + "txHash": "0x12226d41bda43238239bf28ab8dab9fa54b2119b72173b69deca76f1779dfacc", "kind": "transparent" }, { - "address": "0x7e415D74eb5B01531B2059D1901aCe751c6B26B3", - "txHash": "0x71057e4b5435a2541ffa8ba2fddc4faa8ad656bc7be60863be541beaa7e3802d", + "address": "0x05C191f8Df6bFb72EFfc865550cF23982cafD753", + "txHash": "0xba2d080d45999674e85e8f463dd1a5367722699c0d54959722e75236de143b48", "kind": "transparent" } ], @@ -34095,251 +34095,239 @@ } } }, - "efc02574d72b7d63f49041c09fc83e33411f8aeb84e36c2333f4f6c21bc85958": { - "address": "0xab411282DBA1cC152688AeC9a2325605F6D6d581", - "txHash": "0x1419726f41be3f85633346c6594ea7d43702420741fc1daa7a7087851a471ea6", + "aadb466e7407efec4fb542ba32b0f5d6a4388935c25bb3a808c6e65a8bcb00c4": { + "address": "0x8c774afF7aC5353035744CdEee3e885ba63C259F", + "txHash": "0x371f9c88ece4cba5ad39baa865ed9a7040e4ee98e4811cc958b273d8c5c55cf3", "layout": { "storage": [ { "contract": "Initializable", "label": "_initialized", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" }, { "contract": "Initializable", "label": "_initializing", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" }, { "contract": "ProxyOwned", "label": "owner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" }, { "contract": "ProxyOwned", "label": "nominatedOwner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" }, { "contract": "ProxyOwned", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" }, { "contract": "ProxyOwned", "label": "_transferredAtInit", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" }, { "contract": "ContextUpgradeable", "label": "__gap", "type": "t_array(t_uint256)50_storage", - "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:31" + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" }, { "contract": "PausableUpgradeable", "label": "_paused", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" }, { "contract": "PausableUpgradeable", "label": "__gap", "type": "t_array(t_uint256)49_storage", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:97" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" }, { "contract": "ProxyReentrancyGuard", "label": "_guardCounter", "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" }, { "contract": "ProxyReentrancyGuard", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" }, { - "contract": "ParlayVault", - "label": "parlayAMM", - "type": "t_contract(IParlayMarketsAMM)11713", - "src": "contracts/OvertimeVaults/ParlayVault.sol:49" + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)3687", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "sUSD", - "type": "t_contract(IERC20Upgradeable)1472", - "src": "contracts/OvertimeVaults/ParlayVault.sol:50" + "type": "t_contract(IERC20Upgradeable)470", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" }, { - "contract": "ParlayVault", - "label": "vaultStarted", + "contract": "SportAMMLiquidityPool", + "label": "started", "type": "t_bool", - "src": "contracts/OvertimeVaults/ParlayVault.sol:52" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "round", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:54" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "roundLength", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:55" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" }, { - "contract": "ParlayVault", - "label": "roundStartTime", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:56" + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", "label": "usersPerRound", "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:58" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "userInRound", "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:59" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "balancesPerRound", "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:61" - }, - { - "contract": "ParlayVault", - "label": "withdrawalRequested", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:62" - }, - { - "contract": "ParlayVault", - "label": "depositReceipts", - "type": "t_mapping(t_address,t_struct(DepositReceipt)2015_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:63" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "allocationPerRound", "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:65" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" }, { - "contract": "ParlayVault", - "label": "tradingParlaysPerRound", + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:67" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" }, { - "contract": "ParlayVault", - "label": "isTradingParlayInARound", - "type": "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:68" + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "profitAndLossPerRound", "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:70" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "cumulativeProfitAndLoss", "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:71" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "maxAllowedDeposit", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:73" - }, - { - "contract": "ParlayVault", - "label": "utilizationRate", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:74" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" }, { - "contract": "ParlayVault", - "label": "capPerRound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:76" - }, - { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "minDepositAmount", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:78" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "maxAllowedUsers", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:80" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" }, { - "contract": "ParlayVault", - "label": "usersCurrentlyInVault", + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:81" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" }, { - "contract": "ParlayVault", - "label": "priceLowerLimit", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:83" + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" }, { - "contract": "ParlayVault", - "label": "priceUpperLimit", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:84" + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)3764", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:72" }, { - "contract": "ParlayVault", - "label": "skewImpactLimit", - "type": "t_int256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:85" + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:74" }, { - "contract": "ParlayVault", - "label": "minTradeAmount", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:87" + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:76" }, { - "contract": "ParlayVault", - "label": "stakingThales", - "type": "t_contract(IStakingThales)12660", - "src": "contracts/OvertimeVaults/ParlayVault.sol:90" + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:78" }, { - "contract": "ParlayVault", - "label": "allocationSpentInARound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:92" + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:80" } ], "types": { - "t_contract(IParlayMarketsAMM)11713": { - "label": "contract IParlayMarketsAMM" + "t_contract(ISportsAMM)3687": { + "label": "contract ISportsAMM" }, - "t_contract(IERC20Upgradeable)1472": { + "t_contract(IERC20Upgradeable)470": { "label": "contract IERC20Upgradeable" }, "t_bool": { @@ -34348,8 +34336,11 @@ "t_uint256": { "label": "uint256" }, - "t_mapping(t_uint256,t_uint256)": { - "label": "mapping(uint256 => uint256)" + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" }, "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { "label": "mapping(uint256 => address[])" @@ -34357,9 +34348,6 @@ "t_array(t_address)dyn_storage": { "label": "address[]" }, - "t_address": { - "label": "address" - }, "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { "label": "mapping(uint256 => mapping(address => bool))" }, @@ -34372,35 +34360,10 @@ "t_mapping(t_address,t_uint256)": { "label": "mapping(address => uint256)" }, - "t_mapping(t_address,t_struct(DepositReceipt)2015_storage)": { - "label": "mapping(address => struct ParlayVault.DepositReceipt)" - }, - "t_struct(DepositReceipt)2015_storage": { - "label": "struct ParlayVault.DepositReceipt", - "members": [ - { - "label": "round", - "type": "t_uint256" - }, - { - "label": "amount", - "type": "t_uint256" - } - ] - }, - "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))": { - "label": "mapping(uint256 => mapping(bytes32 => bool))" - }, - "t_mapping(t_bytes32,t_bool)": { - "label": "mapping(bytes32 => bool)" - }, - "t_bytes32": { - "label": "bytes32" - }, - "t_int256": { - "label": "int256" + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" }, - "t_contract(IStakingThales)12660": { + "t_contract(IStakingThales)3764": { "label": "contract IStakingThales" }, "t_array(t_uint256)49_storage": { @@ -34412,313 +34375,306 @@ } } }, - "6e7f8c7ab8d22ea869cb73fc3d366115479ada6318fe5bddf49917c4ea9ecb7f": { - "address": "0xd387BEAF6714312eb46896ED4415cA601DEACB05", - "txHash": "0x1c00f761a915f812d6aed7f9561ab8dbebeb6d12709af3db0adf18a04b0c58b1", + "d61656b3870f510fa06e86e1b492b5700dafa6260c57f5551be7d1534481ada5": { + "address": "0x6beA034b352570D1504AF7c0E7F9c25c9877e645", + "txHash": "0xa0b97f78d2c37bc950066c21b4c2e59edca48d0a3fe37acf48aef43529696feb", "layout": { "storage": [ { "contract": "Initializable", "label": "_initialized", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" }, { "contract": "Initializable", "label": "_initializing", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" }, { "contract": "ProxyOwned", "label": "owner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" }, { "contract": "ProxyOwned", "label": "nominatedOwner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" }, { "contract": "ProxyOwned", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" }, { "contract": "ProxyOwned", "label": "_transferredAtInit", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" }, { "contract": "ContextUpgradeable", "label": "__gap", "type": "t_array(t_uint256)50_storage", - "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:31" + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" }, { "contract": "PausableUpgradeable", "label": "_paused", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" }, { "contract": "PausableUpgradeable", "label": "__gap", "type": "t_array(t_uint256)49_storage", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:97" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" }, { "contract": "ProxyReentrancyGuard", "label": "_guardCounter", "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" }, { "contract": "ProxyReentrancyGuard", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" }, { - "contract": "ParlayVault", - "label": "parlayAMM", - "type": "t_contract(IParlayMarketsAMM)56314", - "src": "contracts/OvertimeVaults/ParlayVault.sol:49" + "contract": "SportsAMM", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\SportsAMM.sol:45" }, { - "contract": "ParlayVault", - "label": "sUSD", - "type": "t_contract(IERC20Upgradeable)6764", - "src": "contracts/OvertimeVaults/ParlayVault.sol:50" + "contract": "SportsAMM", + "label": "manager", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:48" }, { - "contract": "ParlayVault", - "label": "vaultStarted", - "type": "t_bool", - "src": "contracts/OvertimeVaults/ParlayVault.sol:52" + "contract": "SportsAMM", + "label": "defaultCapPerGame", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:52" }, { - "contract": "ParlayVault", - "label": "round", + "contract": "SportsAMM", + "label": "min_spread", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:54" + "src": "contracts\\SportMarkets\\SportsAMM.sol:55" }, { - "contract": "ParlayVault", - "label": "roundLength", + "contract": "SportsAMM", + "label": "max_spread", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:55" + "src": "contracts\\SportMarkets\\SportsAMM.sol:58" }, { - "contract": "ParlayVault", - "label": "roundStartTime", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:56" + "contract": "SportsAMM", + "label": "minimalTimeLeftToMaturity", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:62" }, { - "contract": "ParlayVault", - "label": "usersPerRound", - "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:58" + "contract": "SportsAMM", + "label": "spentOnGame", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:71" }, { - "contract": "ParlayVault", - "label": "userInRound", - "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:59" + "contract": "SportsAMM", + "label": "safeBox", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:74" }, { - "contract": "ParlayVault", - "label": "balancesPerRound", - "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:61" + "contract": "SportsAMM", + "label": "theRundownConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:77" }, { - "contract": "ParlayVault", - "label": "withdrawalRequested", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:62" + "contract": "SportsAMM", + "label": "safeBoxImpact", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:80" }, { - "contract": "ParlayVault", - "label": "depositReceipts", - "type": "t_mapping(t_address,t_struct(DepositReceipt)13959_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:63" + "contract": "SportsAMM", + "label": "stakingThales", + "type": "t_contract(IStakingThales)61177", + "src": "contracts\\SportMarkets\\SportsAMM.sol:83" }, { - "contract": "ParlayVault", - "label": "allocationPerRound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:65" + "contract": "SportsAMM", + "label": "minSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:86" }, { - "contract": "ParlayVault", - "label": "tradingParlayMarketsPerRound", - "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:67" + "contract": "SportsAMM", + "label": "maxSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:89" }, { - "contract": "ParlayVault", - "label": "isTradingParlayMarketInARound", - "type": "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:68" + "contract": "SportsAMM", + "label": "curveSUSD", + "type": "t_contract(ICurveSUSD)59694", + "src": "contracts\\SportMarkets\\SportsAMM.sol:92" }, { - "contract": "ParlayVault", - "label": "profitAndLossPerRound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:70" + "contract": "SportsAMM", + "label": "usdc", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:95" }, { - "contract": "ParlayVault", - "label": "cumulativeProfitAndLoss", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:71" + "contract": "SportsAMM", + "label": "usdt", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:98" }, { - "contract": "ParlayVault", - "label": "maxAllowedDeposit", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:73" + "contract": "SportsAMM", + "label": "dai", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:101" }, { - "contract": "ParlayVault", - "label": "utilizationRate", + "contract": "SportsAMM", + "label": "curveOnrampEnabled", + "type": "t_bool", + "src": "contracts\\SportMarkets\\SportsAMM.sol:104" + }, + { + "contract": "SportsAMM", + "label": "maxAllowedPegSlippagePercentage", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:74" + "src": "contracts\\SportMarkets\\SportsAMM.sol:107" }, { - "contract": "ParlayVault", - "label": "capPerRound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:76" + "contract": "SportsAMM", + "label": "referrals", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:110" }, { - "contract": "ParlayVault", - "label": "minDepositAmount", + "contract": "SportsAMM", + "label": "referrerFee", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:78" + "src": "contracts\\SportMarkets\\SportsAMM.sol:113" }, { - "contract": "ParlayVault", - "label": "maxAllowedUsers", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:80" + "contract": "SportsAMM", + "label": "apexConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:116" }, { - "contract": "ParlayVault", - "label": "usersCurrentlyInVault", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:81" + "contract": "SportsAMM", + "label": "parlayAMM", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:119" }, { - "contract": "ParlayVault", - "label": "priceLowerLimit", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:83" + "contract": "SportsAMM", + "label": "capPerSport", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:122" }, { - "contract": "ParlayVault", - "label": "priceUpperLimit", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:84" + "contract": "SportsAMM", + "label": "sportAmmUtils", + "type": "t_contract(SportsAMMUtils)56033", + "src": "contracts\\SportMarkets\\SportsAMM.sol:124" }, { - "contract": "ParlayVault", - "label": "skewImpactLimit", - "type": "t_int256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:85" + "contract": "SportsAMM", + "label": "capPerMarket", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:127" }, { - "contract": "ParlayVault", - "label": "minTradeAmount", + "contract": "SportsAMM", + "label": "thresholdForOddsUpdate", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:87" + "src": "contracts\\SportMarkets\\SportsAMM.sol:131" }, { - "contract": "ParlayVault", - "label": "stakingThales", - "type": "t_contract(IStakingThales)57307", - "src": "contracts/OvertimeVaults/ParlayVault.sol:90" + "contract": "SportsAMM", + "label": "wrapper", + "type": "t_contract(ITherundownConsumerWrapper)61775", + "src": "contracts\\SportMarkets\\SportsAMM.sol:134" }, { - "contract": "ParlayVault", - "label": "allocationSpentInARound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:92" + "contract": "SportsAMM", + "label": "safeBoxFeePerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:137" + }, + { + "contract": "SportsAMM", + "label": "min_spreadPerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:140" + }, + { + "contract": "SportsAMM", + "label": "capPerSportAndChild", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))", + "src": "contracts\\SportMarkets\\SportsAMM.sol:143" + }, + { + "contract": "SportsAMM", + "label": "liquidityPool", + "type": "t_contract(SportAMMLiquidityPool)30337", + "src": "contracts\\SportMarkets\\SportsAMM.sol:163" } ], "types": { - "t_contract(IParlayMarketsAMM)56314": { - "label": "contract IParlayMarketsAMM" - }, - "t_contract(IERC20Upgradeable)6764": { + "t_contract(IERC20Upgradeable)8234": { "label": "contract IERC20Upgradeable" }, - "t_bool": { - "label": "bool" - }, - "t_uint256": { - "label": "uint256" - }, - "t_mapping(t_uint256,t_uint256)": { - "label": "mapping(uint256 => uint256)" - }, - "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { - "label": "mapping(uint256 => address[])" - }, - "t_array(t_address)dyn_storage": { - "label": "address[]" - }, "t_address": { "label": "address" }, - "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { - "label": "mapping(uint256 => mapping(address => bool))" - }, - "t_mapping(t_address,t_bool)": { - "label": "mapping(address => bool)" - }, - "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { - "label": "mapping(uint256 => mapping(address => uint256))" + "t_uint256": { + "label": "uint256" }, "t_mapping(t_address,t_uint256)": { "label": "mapping(address => uint256)" }, - "t_mapping(t_address,t_struct(DepositReceipt)13959_storage)": { - "label": "mapping(address => struct ParlayVault.DepositReceipt)" + "t_contract(IStakingThales)61177": { + "label": "contract IStakingThales" }, - "t_struct(DepositReceipt)13959_storage": { - "label": "struct ParlayVault.DepositReceipt", - "members": [ - { - "label": "round", - "type": "t_uint256" - }, - { - "label": "amount", - "type": "t_uint256" - } - ] + "t_contract(ICurveSUSD)59694": { + "label": "contract ICurveSUSD" + }, + "t_bool": { + "label": "bool" }, - "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))": { - "label": "mapping(uint256 => mapping(bytes32 => bool))" + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" }, - "t_mapping(t_bytes32,t_bool)": { - "label": "mapping(bytes32 => bool)" + "t_contract(SportsAMMUtils)56033": { + "label": "contract SportsAMMUtils" }, - "t_bytes32": { - "label": "bytes32" + "t_contract(ITherundownConsumerWrapper)61775": { + "label": "contract ITherundownConsumerWrapper" }, - "t_int256": { - "label": "int256" + "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))": { + "label": "mapping(uint256 => mapping(uint256 => uint256))" }, - "t_contract(IStakingThales)57307": { - "label": "contract IStakingThales" + "t_contract(SportAMMLiquidityPool)30337": { + "label": "contract SportAMMLiquidityPool" }, "t_array(t_uint256)49_storage": { "label": "uint256[49]" @@ -34729,257 +34685,239 @@ } } }, - "4efe8288b753615351ffbc9c1243b8e8e9b80764f399645e43205ed789b78ad4": { - "address": "0x7cea40A6569E538D1AC812C0D4Ff37b505466dC0", - "txHash": "0x59dab545cf8f0f551b805e2eb51d1a6c9620678518ed6ec020f644fcb3873801", + "65baecbffbace3ce4a07ae5c83e997b62c1feee4253fdb498dfc70917a98f0d3": { + "address": "0xc33343d3073BCbcF29bBc7b605A5A8172Be698b1", + "txHash": "0xbcd7e59770bc1192e0381fc54d64be94acb5d0176ce40757f3407131bce7cefc", "layout": { "storage": [ { "contract": "Initializable", "label": "_initialized", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" }, { "contract": "Initializable", "label": "_initializing", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" }, { "contract": "ProxyOwned", "label": "owner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" }, { "contract": "ProxyOwned", "label": "nominatedOwner", "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" }, { "contract": "ProxyOwned", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" }, { "contract": "ProxyOwned", "label": "_transferredAtInit", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" }, { "contract": "ContextUpgradeable", "label": "__gap", "type": "t_array(t_uint256)50_storage", - "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:31" + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" }, { "contract": "PausableUpgradeable", "label": "_paused", "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" }, { "contract": "PausableUpgradeable", "label": "__gap", "type": "t_array(t_uint256)49_storage", - "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:97" + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" }, { "contract": "ProxyReentrancyGuard", "label": "_guardCounter", "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" }, { "contract": "ProxyReentrancyGuard", "label": "_initialized", "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" }, { - "contract": "ParlayVault", - "label": "parlayAMM", - "type": "t_contract(IParlayMarketsAMM)59916", - "src": "contracts/OvertimeVaults/ParlayVault.sol:50" + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)3678", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "sUSD", - "type": "t_contract(IERC20Upgradeable)8234", - "src": "contracts/OvertimeVaults/ParlayVault.sol:51" + "type": "t_contract(IERC20Upgradeable)470", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" }, { - "contract": "ParlayVault", - "label": "vaultStarted", + "contract": "SportAMMLiquidityPool", + "label": "started", "type": "t_bool", - "src": "contracts/OvertimeVaults/ParlayVault.sol:53" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "round", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:55" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "roundLength", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:56" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" }, { - "contract": "ParlayVault", - "label": "roundStartTime", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:57" + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", "label": "usersPerRound", "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:59" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "userInRound", "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:60" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "balancesPerRound", "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:62" - }, - { - "contract": "ParlayVault", - "label": "withdrawalRequested", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:63" - }, - { - "contract": "ParlayVault", - "label": "depositReceipts", - "type": "t_mapping(t_address,t_struct(DepositReceipt)15429_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:64" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "allocationPerRound", "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:66" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" }, { - "contract": "ParlayVault", - "label": "tradingParlayMarketsPerRound", + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:68" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" }, { - "contract": "ParlayVault", - "label": "isTradingParlayMarketInARound", - "type": "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))", - "src": "contracts/OvertimeVaults/ParlayVault.sol:69" + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "profitAndLossPerRound", "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:71" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "cumulativeProfitAndLoss", "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:72" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "maxAllowedDeposit", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:74" - }, - { - "contract": "ParlayVault", - "label": "utilizationRate", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:75" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" }, { - "contract": "ParlayVault", - "label": "capPerRound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:77" - }, - { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "minDepositAmount", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:79" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" }, { - "contract": "ParlayVault", + "contract": "SportAMMLiquidityPool", "label": "maxAllowedUsers", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:81" - }, - { - "contract": "ParlayVault", - "label": "usersCurrentlyInVault", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:82" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" }, { - "contract": "ParlayVault", - "label": "priceLowerLimit", + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:84" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" }, { - "contract": "ParlayVault", - "label": "priceUpperLimit", - "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:85" + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" }, { - "contract": "ParlayVault", - "label": "skewImpactLimit", - "type": "t_int256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:86" + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)3755", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:72" }, { - "contract": "ParlayVault", - "label": "minTradeAmount", + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:88" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:74" }, { - "contract": "ParlayVault", - "label": "stakingThales", - "type": "t_contract(IStakingThales)60916", - "src": "contracts/OvertimeVaults/ParlayVault.sol:91" + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:76" }, { - "contract": "ParlayVault", - "label": "allocationSpentInARound", - "type": "t_mapping(t_uint256,t_uint256)", - "src": "contracts/OvertimeVaults/ParlayVault.sol:93" + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:78" }, { - "contract": "ParlayVault", - "label": "maxTradeRate", + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", "type": "t_uint256", - "src": "contracts/OvertimeVaults/ParlayVault.sol:94" + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:80" } ], "types": { - "t_contract(IParlayMarketsAMM)59916": { - "label": "contract IParlayMarketsAMM" + "t_contract(ISportsAMM)3678": { + "label": "contract ISportsAMM" }, - "t_contract(IERC20Upgradeable)8234": { + "t_contract(IERC20Upgradeable)470": { "label": "contract IERC20Upgradeable" }, "t_bool": { @@ -34988,8 +34926,11 @@ "t_uint256": { "label": "uint256" }, - "t_mapping(t_uint256,t_uint256)": { - "label": "mapping(uint256 => uint256)" + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" }, "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { "label": "mapping(uint256 => address[])" @@ -34997,9 +34938,6 @@ "t_array(t_address)dyn_storage": { "label": "address[]" }, - "t_address": { - "label": "address" - }, "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { "label": "mapping(uint256 => mapping(address => bool))" }, @@ -35012,36 +34950,4028 @@ "t_mapping(t_address,t_uint256)": { "label": "mapping(address => uint256)" }, - "t_mapping(t_address,t_struct(DepositReceipt)15429_storage)": { - "label": "mapping(address => struct ParlayVault.DepositReceipt)" + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" }, - "t_struct(DepositReceipt)15429_storage": { - "label": "struct ParlayVault.DepositReceipt", - "members": [ - { - "label": "round", - "type": "t_uint256" - }, - { - "label": "amount", - "type": "t_uint256" - } - ] + "t_contract(IStakingThales)3755": { + "label": "contract IStakingThales" }, - "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))": { - "label": "mapping(uint256 => mapping(bytes32 => bool))" + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" }, - "t_mapping(t_bytes32,t_bool)": { - "label": "mapping(bytes32 => bool)" + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "fbd729d512e8bb399f756286a73c2da8dd03ebb5ce6ca9aa9bde111af96f2efc": { + "address": "0x31D2b97B4bC747294ff744Eb29B32298DC6d4ea0", + "txHash": "0x9baf8bfe702ace07a10312b7378585ee43445a5a92c557238742c31a4c071e47", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "initialized", + "type": "t_bool", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:23" }, - "t_bytes32": { - "label": "bytes32" + { + "contract": "Initializable", + "label": "initializing", + "type": "t_bool", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:28" }, - "t_int256": { - "label": "int256" + { + "contract": "Initializable", + "label": "______gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:63" }, - "t_contract(IStakingThales)60916": { - "label": "contract IStakingThales" + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:10" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "ProxyPausable", + "label": "lastPauseTime", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\ProxyPausable.sol:11" + }, + { + "contract": "ProxyPausable", + "label": "paused", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyPausable.sol:12" + }, + { + "contract": "StakingThales", + "label": "iEscrowThales", + "type": "t_contract(IEscrowThales)6517", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:30" + }, + { + "contract": "StakingThales", + "label": "stakingToken", + "type": "t_contract(IERC20)9079", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:31" + }, + { + "contract": "StakingThales", + "label": "feeToken", + "type": "t_contract(IERC20)9079", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:32" + }, + { + "contract": "StakingThales", + "label": "SNXRewards", + "type": "t_contract(ISNXRewards)6611", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:33" + }, + { + "contract": "StakingThales", + "label": "thalesRoyale", + "type": "t_contract(IThalesRoyale)6757", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:34" + }, + { + "contract": "StakingThales", + "label": "priceFeed", + "type": "t_contract(IPriceFeed)6573", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:35" + }, + { + "contract": "StakingThales", + "label": "periodsOfStaking", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:37" + }, + { + "contract": "StakingThales", + "label": "lastPeriodTimeStamp", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:38" + }, + { + "contract": "StakingThales", + "label": "durationPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:39" + }, + { + "contract": "StakingThales", + "label": "unstakeDurationPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:40" + }, + { + "contract": "StakingThales", + "label": "startTimeStamp", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:41" + }, + { + "contract": "StakingThales", + "label": "currentPeriodRewards", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:42" + }, + { + "contract": "StakingThales", + "label": "currentPeriodFees", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:43" + }, + { + "contract": "StakingThales", + "label": "distributeFeesEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:44" + }, + { + "contract": "StakingThales", + "label": "fixedPeriodReward", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:45" + }, + { + "contract": "StakingThales", + "label": "periodExtraReward", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:46" + }, + { + "contract": "StakingThales", + "label": "totalSNXRewardsInPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:47" + }, + { + "contract": "StakingThales", + "label": "totalSNXFeesInPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:48" + }, + { + "contract": "StakingThales", + "label": "claimEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:49" + }, + { + "contract": "StakingThales", + "label": "stakerLifetimeRewardsClaimed", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:51" + }, + { + "contract": "StakingThales", + "label": "stakerFeesClaimed", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:52" + }, + { + "contract": "StakingThales", + "label": "_totalStakedAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:54" + }, + { + "contract": "StakingThales", + "label": "_totalEscrowedAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:55" + }, + { + "contract": "StakingThales", + "label": "_totalPendingStakeAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:56" + }, + { + "contract": "StakingThales", + "label": "_totalUnclaimedRewards", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:57" + }, + { + "contract": "StakingThales", + "label": "_totalRewardsClaimed", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:58" + }, + { + "contract": "StakingThales", + "label": "_totalRewardFeesClaimed", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:59" + }, + { + "contract": "StakingThales", + "label": "lastUnstakeTime", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:61" + }, + { + "contract": "StakingThales", + "label": "unstaking", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:62" + }, + { + "contract": "StakingThales", + "label": "unstakingAmount", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:63" + }, + { + "contract": "StakingThales", + "label": "_stakedBalances", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:64" + }, + { + "contract": "StakingThales", + "label": "_lastRewardsClaimedPeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:65" + }, + { + "contract": "StakingThales", + "label": "thalesAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:66" + }, + { + "contract": "StakingThales", + "label": "lastAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:75" + }, + { + "contract": "StakingThales", + "label": "stakerAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3104_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:76" + }, + { + "contract": "StakingThales", + "label": "extraRewardsActive", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:78" + }, + { + "contract": "StakingThales", + "label": "ThalesStakingRewardsPool", + "type": "t_contract(IThalesStakingRewardsPool)6767", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:79" + }, + { + "contract": "StakingThales", + "label": "maxSNXRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:81" + }, + { + "contract": "StakingThales", + "label": "maxAMMVolumeRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:82" + }, + { + "contract": "StakingThales", + "label": "AMMVolumeRewardsMultiplier", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:83" + }, + { + "contract": "StakingThales", + "label": "maxThalesRoyaleRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:84" + }, + { + "contract": "StakingThales", + "label": "SNXVolumeRewardsMultiplier", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:89" + }, + { + "contract": "StakingThales", + "label": "_lastStakingPeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:91" + }, + { + "contract": "StakingThales", + "label": "totalStakedLastPeriodEnd", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:93" + }, + { + "contract": "StakingThales", + "label": "totalEscrowedLastPeriodEnd", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:94" + }, + { + "contract": "StakingThales", + "label": "exoticBonds", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:95" + }, + { + "contract": "StakingThales", + "label": "addressResolver", + "type": "t_contract(IAddressResolver)6424", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:97" + }, + { + "contract": "StakingThales", + "label": "thalesRangedAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:99" + }, + { + "contract": "StakingThales", + "label": "sportsAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:100" + }, + { + "contract": "StakingThales", + "label": "lastThalesAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:102" + }, + { + "contract": "StakingThales", + "label": "thalesAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3104_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:103" + }, + { + "contract": "StakingThales", + "label": "lastThalesRangedAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:104" + }, + { + "contract": "StakingThales", + "label": "thalesRangedAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3104_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:105" + }, + { + "contract": "StakingThales", + "label": "lastExoticMarketsUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:106" + }, + { + "contract": "StakingThales", + "label": "exoticMarketsVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3104_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:107" + }, + { + "contract": "StakingThales", + "label": "lastSportsAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:108" + }, + { + "contract": "StakingThales", + "label": "sportsAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3104_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:109" + }, + { + "contract": "StakingThales", + "label": "canClaimOnBehalf", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:111" + }, + { + "contract": "StakingThales", + "label": "mergeAccountEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:113" + }, + { + "contract": "StakingThales", + "label": "delegatedVolume", + "type": "t_mapping(t_address,t_address)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:115" + }, + { + "contract": "StakingThales", + "label": "supportedSportVault", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:116" + }, + { + "contract": "StakingThales", + "label": "supportedAMMVault", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:117" + } + ], + "types": { + "t_contract(IEscrowThales)6517": { + "label": "contract IEscrowThales" + }, + "t_contract(IERC20)9079": { + "label": "contract IERC20" + }, + "t_contract(ISNXRewards)6611": { + "label": "contract ISNXRewards" + }, + "t_contract(IThalesRoyale)6757": { + "label": "contract IThalesRoyale" + }, + "t_contract(IPriceFeed)6573": { + "label": "contract IPriceFeed" + }, + "t_uint256": { + "label": "uint256" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3104_storage)4_storage)": { + "label": "mapping(address => struct StakingThales.AMMVolumeEntry[4])" + }, + "t_array(t_struct(AMMVolumeEntry)3104_storage)4_storage": { + "label": "struct StakingThales.AMMVolumeEntry[4]" + }, + "t_struct(AMMVolumeEntry)3104_storage": { + "label": "struct StakingThales.AMMVolumeEntry", + "members": [ + { + "label": "amount", + "type": "t_uint256" + }, + { + "label": "period", + "type": "t_uint256" + } + ] + }, + "t_contract(IThalesStakingRewardsPool)6767": { + "label": "contract IThalesStakingRewardsPool" + }, + "t_contract(IAddressResolver)6424": { + "label": "contract IAddressResolver" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "label": "mapping(address => mapping(address => bool))" + }, + "t_mapping(t_address,t_address)": { + "label": "mapping(address => address)" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "85e9544a69441f963cf69e0e70fcf5657ee28a61233db4afe2c2d9d84d67cfb9": { + "address": "0xAFa5D48Aa8a72B89fB72570477d9B3a8B61757Cf", + "txHash": "0x42fbaf057e347d33335260b3d01fcf918d6078e43ace3c8a970eb2a3c254061e", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)3780", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)470", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "started", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "round", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundLength", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "userInRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "balancesPerRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "allocationPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "profitAndLossPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "cumulativeProfitAndLoss", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedDeposit", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "minDepositAmount", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedUsers", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)3857", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:72" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:74" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:76" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:78" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:80" + } + ], + "types": { + "t_contract(ISportsAMM)3780": { + "label": "contract ISportsAMM" + }, + "t_contract(IERC20Upgradeable)470": { + "label": "contract IERC20Upgradeable" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { + "label": "mapping(uint256 => address[])" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(IStakingThales)3857": { + "label": "contract IStakingThales" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "6f38075fd4cae210f7c2dc12054fcd0c387694ec0c69189566e4247a11c93ebb": { + "address": "0x14968c4445aC9400ea1A4C990a227c7bC766c608", + "txHash": "0x04076aec8e5a6c4524e83920cea1c8d63adcc7556d74ba2bc524e903d3a73f4f", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)61215", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "started", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "round", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundLength", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "userInRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "balancesPerRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "allocationPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "profitAndLossPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "cumulativeProfitAndLoss", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedDeposit", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "minDepositAmount", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedUsers", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)61292", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:72" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:74" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:76" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:78" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:80" + } + ], + "types": { + "t_contract(ISportsAMM)61215": { + "label": "contract ISportsAMM" + }, + "t_contract(IERC20Upgradeable)8234": { + "label": "contract IERC20Upgradeable" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { + "label": "mapping(uint256 => address[])" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(IStakingThales)61292": { + "label": "contract IStakingThales" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "21bda4d85bedff4448750c84b93dd36758ea26eda579ea7cf15f8c58608cb8d3": { + "address": "0xe1F1EAbCd2491AD9a296FbcA0EA9c9E57FEF856a", + "txHash": "0x8d4a567f05cc5852b310c1d7f5574dc58fabfc4554852f436da0c7591479c44f", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)3829", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)470", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "started", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "round", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundLength", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "userInRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "balancesPerRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "allocationPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "profitAndLossPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "cumulativeProfitAndLoss", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedDeposit", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "minDepositAmount", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedUsers", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)3906", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:72" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:74" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:76" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:78" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:80" + } + ], + "types": { + "t_contract(ISportsAMM)3829": { + "label": "contract ISportsAMM" + }, + "t_contract(IERC20Upgradeable)470": { + "label": "contract IERC20Upgradeable" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { + "label": "mapping(uint256 => address[])" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(IStakingThales)3906": { + "label": "contract IStakingThales" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "b90e29c02582e7d6b48434b30b5276e3ad2d54ce6cc3b64d695dc8d1d7efaea7": { + "address": "0x4bd60Cefd000b5F0bAbde876027771A5e0724B29", + "txHash": "0xf5b68c94d25b5619f33b13955d2c843a7af1cc8066926ea41ee0cc148d68fa46", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)3815", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)470", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "started", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "round", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundLength", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "userInRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "balancesPerRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "allocationPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "profitAndLossPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "cumulativeProfitAndLoss", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedDeposit", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "minDepositAmount", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedUsers", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)3892", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:72" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:74" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:76" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:78" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:80" + } + ], + "types": { + "t_contract(ISportsAMM)3815": { + "label": "contract ISportsAMM" + }, + "t_contract(IERC20Upgradeable)470": { + "label": "contract IERC20Upgradeable" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { + "label": "mapping(uint256 => address[])" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(IStakingThales)3892": { + "label": "contract IStakingThales" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "55b91462f7a086ff851381641f5dfbb412b7934da933cedab85279bfff8c35fd": { + "address": "0x4Dee2bF5df8779ca0531e9B4daC3fBfC786B754d", + "txHash": "0x7d52af77b1b0be4a47961223045b3ba5aba8fb47bd8039ad1b0f7a2a3e239d24", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)61395", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "started", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "round", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundLength", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "userInRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "balancesPerRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "allocationPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "profitAndLossPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "cumulativeProfitAndLoss", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedDeposit", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "minDepositAmount", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedUsers", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)61472", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:72" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:74" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:76" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:78" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:80" + } + ], + "types": { + "t_contract(ISportsAMM)61395": { + "label": "contract ISportsAMM" + }, + "t_contract(IERC20Upgradeable)8234": { + "label": "contract IERC20Upgradeable" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { + "label": "mapping(uint256 => address[])" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(IStakingThales)61472": { + "label": "contract IStakingThales" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "f8ba6f46ba51c54a6f9f896b94d6c3e8f2c12bb49e9ff3e128c1faebc2caf527": { + "address": "0xaC22715FD89BBDD191e5d024528e59f00f77403C", + "txHash": "0xc1ccc6ae623be9bc6f186e196cc2ccbc635d04082f5847e8d24a3338e23416f4", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportsAMM", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)548", + "src": "contracts\\SportMarkets\\SportsAMM.sol:39" + }, + { + "contract": "SportsAMM", + "label": "manager", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:42" + }, + { + "contract": "SportsAMM", + "label": "defaultCapPerGame", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:46" + }, + { + "contract": "SportsAMM", + "label": "min_spread", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:49" + }, + { + "contract": "SportsAMM", + "label": "max_spread", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:52" + }, + { + "contract": "SportsAMM", + "label": "minimalTimeLeftToMaturity", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:56" + }, + { + "contract": "SportsAMM", + "label": "spentOnGame", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:65" + }, + { + "contract": "SportsAMM", + "label": "safeBox", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:68" + }, + { + "contract": "SportsAMM", + "label": "theRundownConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:71" + }, + { + "contract": "SportsAMM", + "label": "safeBoxImpact", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:74" + }, + { + "contract": "SportsAMM", + "label": "stakingThales", + "type": "t_contract(IStakingThales)9187", + "src": "contracts\\SportMarkets\\SportsAMM.sol:77" + }, + { + "contract": "SportsAMM", + "label": "minSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:80" + }, + { + "contract": "SportsAMM", + "label": "maxSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:83" + }, + { + "contract": "SportsAMM", + "label": "curveSUSD", + "type": "t_contract(ICurveSUSD)8228", + "src": "contracts\\SportMarkets\\SportsAMM.sol:86" + }, + { + "contract": "SportsAMM", + "label": "usdc", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:89" + }, + { + "contract": "SportsAMM", + "label": "usdt", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:92" + }, + { + "contract": "SportsAMM", + "label": "dai", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:95" + }, + { + "contract": "SportsAMM", + "label": "curveOnrampEnabled", + "type": "t_bool", + "src": "contracts\\SportMarkets\\SportsAMM.sol:98" + }, + { + "contract": "SportsAMM", + "label": "maxAllowedPegSlippagePercentage", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:101" + }, + { + "contract": "SportsAMM", + "label": "referrals", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:104" + }, + { + "contract": "SportsAMM", + "label": "referrerFee", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:107" + }, + { + "contract": "SportsAMM", + "label": "apexConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:110" + }, + { + "contract": "SportsAMM", + "label": "parlayAMM", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:113" + }, + { + "contract": "SportsAMM", + "label": "capPerSport", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:116" + }, + { + "contract": "SportsAMM", + "label": "sportAmmUtils", + "type": "t_contract(SportsAMMUtils)8201", + "src": "contracts\\SportMarkets\\SportsAMM.sol:118" + }, + { + "contract": "SportsAMM", + "label": "capPerMarket", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:121" + }, + { + "contract": "SportsAMM", + "label": "thresholdForOddsUpdate", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:125" + }, + { + "contract": "SportsAMM", + "label": "wrapper", + "type": "t_contract(ITherundownConsumerWrapper)9441", + "src": "contracts\\SportMarkets\\SportsAMM.sol:128" + }, + { + "contract": "SportsAMM", + "label": "safeBoxFeePerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:131" + }, + { + "contract": "SportsAMM", + "label": "min_spreadPerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:134" + }, + { + "contract": "SportsAMM", + "label": "capPerSportAndChild", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))", + "src": "contracts\\SportMarkets\\SportsAMM.sol:137" + }, + { + "contract": "SportsAMM", + "label": "liquidityPool", + "type": "t_contract(SportAMMLiquidityPool)3121", + "src": "contracts\\SportMarkets\\SportsAMM.sol:157" + } + ], + "types": { + "t_contract(IERC20Upgradeable)548": { + "label": "contract IERC20Upgradeable" + }, + "t_address": { + "label": "address" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_contract(IStakingThales)9187": { + "label": "contract IStakingThales" + }, + "t_contract(ICurveSUSD)8228": { + "label": "contract ICurveSUSD" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(SportsAMMUtils)8201": { + "label": "contract SportsAMMUtils" + }, + "t_contract(ITherundownConsumerWrapper)9441": { + "label": "contract ITherundownConsumerWrapper" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))": { + "label": "mapping(uint256 => mapping(uint256 => uint256))" + }, + "t_contract(SportAMMLiquidityPool)3121": { + "label": "contract SportAMMLiquidityPool" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "00d048b7b847fe0255033349ce7b7fcb61eed2bbc1bd3eee149dac6db22a8014": { + "address": "0x97D6d6bdb457de9EaE2f17f01c4753BC6021b376", + "txHash": "0x68b5132553669142fc2e88184941d89eade92b2c67a77efb65c9c7c7ea798411", + "layout": { + "storage": [ + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "DefaultLiquidityProvider", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\LiquidityPool\\DefaultLiquidityProvider.sol:14" + }, + { + "contract": "DefaultLiquidityProvider", + "label": "liquidityPool", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\DefaultLiquidityProvider.sol:19" + } + ], + "types": { + "t_contract(IERC20Upgradeable)8234": { + "label": "contract IERC20Upgradeable" + }, + "t_address": { + "label": "address" + }, + "t_uint256": { + "label": "uint256" + }, + "t_bool": { + "label": "bool" + } + } + } + }, + "39ec27a5db8e910071ec3ca51ecaaa3d88461aa5143ff80ef1dfc4d640eea2ce": { + "address": "0xf7bcBf53cddfE7fe42d041c72911e00060EaCbfc", + "txHash": "0x169cea623f4afc27bbf0b4572db2578e085cb684c530586b0bb5cb50291fe7be", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)61420", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "started", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "round", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundLength", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "userInRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "balancesPerRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "allocationPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "profitAndLossPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "cumulativeProfitAndLoss", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedDeposit", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "minDepositAmount", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedUsers", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)61497", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:72" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:74" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:76" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:78" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:80" + } + ], + "types": { + "t_contract(ISportsAMM)61420": { + "label": "contract ISportsAMM" + }, + "t_contract(IERC20Upgradeable)8234": { + "label": "contract IERC20Upgradeable" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { + "label": "mapping(uint256 => address[])" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(IStakingThales)61497": { + "label": "contract IStakingThales" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "c6f6b4596e8ce4e5a17feb9256935150f9d11ab47ab64e991dc7b53a029eaa35": { + "address": "0xd2103833656218C6Fb0f5742B48678aB217F4f1F", + "txHash": "0x7f599fc4d5cc083cf6c21d030dbe995753494d12348be18e166f05d6bea2caa5", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportsAMM", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)548", + "src": "contracts\\SportMarkets\\SportsAMM.sol:39" + }, + { + "contract": "SportsAMM", + "label": "manager", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:42" + }, + { + "contract": "SportsAMM", + "label": "defaultCapPerGame", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:46" + }, + { + "contract": "SportsAMM", + "label": "min_spread", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:49" + }, + { + "contract": "SportsAMM", + "label": "max_spread", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:52" + }, + { + "contract": "SportsAMM", + "label": "minimalTimeLeftToMaturity", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:56" + }, + { + "contract": "SportsAMM", + "label": "spentOnGame", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:65" + }, + { + "contract": "SportsAMM", + "label": "safeBox", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:68" + }, + { + "contract": "SportsAMM", + "label": "theRundownConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:71" + }, + { + "contract": "SportsAMM", + "label": "safeBoxImpact", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:74" + }, + { + "contract": "SportsAMM", + "label": "stakingThales", + "type": "t_contract(IStakingThales)9202", + "src": "contracts\\SportMarkets\\SportsAMM.sol:77" + }, + { + "contract": "SportsAMM", + "label": "minSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:80" + }, + { + "contract": "SportsAMM", + "label": "maxSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:83" + }, + { + "contract": "SportsAMM", + "label": "curveSUSD", + "type": "t_contract(ICurveSUSD)8243", + "src": "contracts\\SportMarkets\\SportsAMM.sol:86" + }, + { + "contract": "SportsAMM", + "label": "usdc", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:89" + }, + { + "contract": "SportsAMM", + "label": "usdt", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:92" + }, + { + "contract": "SportsAMM", + "label": "dai", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:95" + }, + { + "contract": "SportsAMM", + "label": "curveOnrampEnabled", + "type": "t_bool", + "src": "contracts\\SportMarkets\\SportsAMM.sol:98" + }, + { + "contract": "SportsAMM", + "label": "maxAllowedPegSlippagePercentage", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:101" + }, + { + "contract": "SportsAMM", + "label": "referrals", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:104" + }, + { + "contract": "SportsAMM", + "label": "referrerFee", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:107" + }, + { + "contract": "SportsAMM", + "label": "apexConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:110" + }, + { + "contract": "SportsAMM", + "label": "parlayAMM", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:113" + }, + { + "contract": "SportsAMM", + "label": "capPerSport", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:117" + }, + { + "contract": "SportsAMM", + "label": "sportAmmUtils", + "type": "t_contract(SportsAMMUtils)8216", + "src": "contracts\\SportMarkets\\SportsAMM.sol:119" + }, + { + "contract": "SportsAMM", + "label": "capPerMarket", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:122" + }, + { + "contract": "SportsAMM", + "label": "thresholdForOddsUpdate", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:126" + }, + { + "contract": "SportsAMM", + "label": "wrapper", + "type": "t_contract(ITherundownConsumerWrapper)9456", + "src": "contracts\\SportMarkets\\SportsAMM.sol:129" + }, + { + "contract": "SportsAMM", + "label": "safeBoxFeePerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:132" + }, + { + "contract": "SportsAMM", + "label": "min_spreadPerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:135" + }, + { + "contract": "SportsAMM", + "label": "capPerSportAndChild", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))", + "src": "contracts\\SportMarkets\\SportsAMM.sol:138" + }, + { + "contract": "SportsAMM", + "label": "liquidityPool", + "type": "t_contract(SportAMMLiquidityPool)3138", + "src": "contracts\\SportMarkets\\SportsAMM.sol:158" + } + ], + "types": { + "t_contract(IERC20Upgradeable)548": { + "label": "contract IERC20Upgradeable" + }, + "t_address": { + "label": "address" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_contract(IStakingThales)9202": { + "label": "contract IStakingThales" + }, + "t_contract(ICurveSUSD)8243": { + "label": "contract ICurveSUSD" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(SportsAMMUtils)8216": { + "label": "contract SportsAMMUtils" + }, + "t_contract(ITherundownConsumerWrapper)9456": { + "label": "contract ITherundownConsumerWrapper" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))": { + "label": "mapping(uint256 => mapping(uint256 => uint256))" + }, + "t_contract(SportAMMLiquidityPool)3138": { + "label": "contract SportAMMLiquidityPool" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "89f9911d5dfbe89db0f5f7fd68bb9ce2d672c5e562e7e6b2ae6d04e72995f3ea": { + "address": "0xAb538aB0A62838DC8C95704fF276952dD229faea", + "txHash": "0x7a6b4d5c39c73c7b04c2e49da94f86d8cfde38c0f136b404ba161365e8b94fa6", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sportsAMM", + "type": "t_contract(ISportsAMM)62014", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:39" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:40" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "started", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:42" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "round", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:44" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundLength", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:45" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "firstRoundStartTime", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:46" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "roundPools", + "type": "t_mapping(t_uint256,t_address)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:48" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:50" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "userInRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:51" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "balancesPerRound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:53" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "allocationPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:54" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "withdrawalRequested", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:56" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "tradingMarketsPerRound", + "type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:58" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "isTradingMarketInARound", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_bool))", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:59" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "profitAndLossPerRound", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:61" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "cumulativeProfitAndLoss", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:62" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedDeposit", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:64" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "minDepositAmount", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:65" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "maxAllowedUsers", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:66" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "usersCurrentlyInPool", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:67" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "defaultLiquidityProvider", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:69" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakingThales", + "type": "t_contract(IStakingThales)62101", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:71" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "stakedThalesMultiplier", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:73" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "poolRoundMastercopy", + "type": "t_address", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:75" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "whitelistedDeposits", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:77" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "totalDeposited", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:79" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "onlyWhitelistedStakersAllowed", + "type": "t_bool", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:81" + }, + { + "contract": "SportAMMLiquidityPool", + "label": "whitelistedStakers", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\SportMarkets\\LiquidityPool\\SportAMMLiquidityPool.sol:83" + } + ], + "types": { + "t_contract(ISportsAMM)62014": { + "label": "contract ISportsAMM" + }, + "t_contract(IERC20Upgradeable)8234": { + "label": "contract IERC20Upgradeable" + }, + "t_bool": { + "label": "bool" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_uint256,t_array(t_address)dyn_storage)": { + "label": "mapping(uint256 => address[])" + }, + "t_array(t_address)dyn_storage": { + "label": "address[]" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_bool))": { + "label": "mapping(uint256 => mapping(address => bool))" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(IStakingThales)62101": { + "label": "contract IStakingThales" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "1724fdf59a19004397ac46691b3a9eff70e782dd4fd73273df107dfe82ffb08f": { + "address": "0x769666FDD20139327603F702C848edb7e4ff9Be4", + "txHash": "0xcb92804b76990a6cf407354247ac0a9dcf725d54e78f4326b32e9338174f08ad", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "initialized", + "type": "t_bool", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:23" + }, + { + "contract": "Initializable", + "label": "initializing", + "type": "t_bool", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:28" + }, + { + "contract": "Initializable", + "label": "______gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\upgrades-core\\contracts\\Initializable.sol:63" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyOwned.sol:10" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "ProxyPausable", + "label": "lastPauseTime", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\ProxyPausable.sol:11" + }, + { + "contract": "ProxyPausable", + "label": "paused", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\ProxyPausable.sol:12" + }, + { + "contract": "StakingThales", + "label": "iEscrowThales", + "type": "t_contract(IEscrowThales)6517", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:33" + }, + { + "contract": "StakingThales", + "label": "stakingToken", + "type": "t_contract(IERC20)9486", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:34" + }, + { + "contract": "StakingThales", + "label": "feeToken", + "type": "t_contract(IERC20)9486", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:35" + }, + { + "contract": "StakingThales", + "label": "SNXRewards", + "type": "t_contract(ISNXRewards)6887", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:36" + }, + { + "contract": "StakingThales", + "label": "thalesRoyale", + "type": "t_contract(IThalesRoyale)7164", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:37" + }, + { + "contract": "StakingThales", + "label": "priceFeed", + "type": "t_contract(IPriceFeed)6849", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:38" + }, + { + "contract": "StakingThales", + "label": "periodsOfStaking", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:40" + }, + { + "contract": "StakingThales", + "label": "lastPeriodTimeStamp", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:41" + }, + { + "contract": "StakingThales", + "label": "durationPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:42" + }, + { + "contract": "StakingThales", + "label": "unstakeDurationPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:43" + }, + { + "contract": "StakingThales", + "label": "startTimeStamp", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:44" + }, + { + "contract": "StakingThales", + "label": "currentPeriodRewards", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:45" + }, + { + "contract": "StakingThales", + "label": "currentPeriodFees", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:46" + }, + { + "contract": "StakingThales", + "label": "distributeFeesEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:47" + }, + { + "contract": "StakingThales", + "label": "fixedPeriodReward", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:48" + }, + { + "contract": "StakingThales", + "label": "periodExtraReward", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:49" + }, + { + "contract": "StakingThales", + "label": "totalSNXRewardsInPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:50" + }, + { + "contract": "StakingThales", + "label": "totalSNXFeesInPeriod", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:51" + }, + { + "contract": "StakingThales", + "label": "claimEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:52" + }, + { + "contract": "StakingThales", + "label": "stakerLifetimeRewardsClaimed", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:54" + }, + { + "contract": "StakingThales", + "label": "stakerFeesClaimed", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:55" + }, + { + "contract": "StakingThales", + "label": "_totalStakedAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:57" + }, + { + "contract": "StakingThales", + "label": "_totalEscrowedAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:58" + }, + { + "contract": "StakingThales", + "label": "_totalPendingStakeAmount", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:59" + }, + { + "contract": "StakingThales", + "label": "_totalUnclaimedRewards", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:60" + }, + { + "contract": "StakingThales", + "label": "_totalRewardsClaimed", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:61" + }, + { + "contract": "StakingThales", + "label": "_totalRewardFeesClaimed", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:62" + }, + { + "contract": "StakingThales", + "label": "lastUnstakeTime", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:64" + }, + { + "contract": "StakingThales", + "label": "unstaking", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:65" + }, + { + "contract": "StakingThales", + "label": "unstakingAmount", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:66" + }, + { + "contract": "StakingThales", + "label": "_stakedBalances", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:67" + }, + { + "contract": "StakingThales", + "label": "_lastRewardsClaimedPeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:68" + }, + { + "contract": "StakingThales", + "label": "thalesAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:69" + }, + { + "contract": "StakingThales", + "label": "lastAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:78" + }, + { + "contract": "StakingThales", + "label": "stakerAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:79" + }, + { + "contract": "StakingThales", + "label": "extraRewardsActive", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:81" + }, + { + "contract": "StakingThales", + "label": "ThalesStakingRewardsPool", + "type": "t_contract(IThalesStakingRewardsPool)7174", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:82" + }, + { + "contract": "StakingThales", + "label": "maxSNXRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:84" + }, + { + "contract": "StakingThales", + "label": "maxAMMVolumeRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:85" + }, + { + "contract": "StakingThales", + "label": "AMMVolumeRewardsMultiplier", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:86" + }, + { + "contract": "StakingThales", + "label": "maxThalesRoyaleRewardsPercentage", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:87" + }, + { + "contract": "StakingThales", + "label": "SNXVolumeRewardsMultiplier", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:92" + }, + { + "contract": "StakingThales", + "label": "_lastStakingPeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:94" + }, + { + "contract": "StakingThales", + "label": "totalStakedLastPeriodEnd", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:96" + }, + { + "contract": "StakingThales", + "label": "totalEscrowedLastPeriodEnd", + "type": "t_uint256", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:97" + }, + { + "contract": "StakingThales", + "label": "exoticBonds", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:98" + }, + { + "contract": "StakingThales", + "label": "addressResolver", + "type": "t_contract(IAddressResolver)6424", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:100" + }, + { + "contract": "StakingThales", + "label": "thalesRangedAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:102" + }, + { + "contract": "StakingThales", + "label": "sportsAMM", + "type": "t_address", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:103" + }, + { + "contract": "StakingThales", + "label": "lastThalesAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:105" + }, + { + "contract": "StakingThales", + "label": "thalesAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:106" + }, + { + "contract": "StakingThales", + "label": "lastThalesRangedAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:107" + }, + { + "contract": "StakingThales", + "label": "thalesRangedAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:108" + }, + { + "contract": "StakingThales", + "label": "lastExoticMarketsUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:109" + }, + { + "contract": "StakingThales", + "label": "exoticMarketsVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:110" + }, + { + "contract": "StakingThales", + "label": "lastSportsAMMUpdatePeriod", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:111" + }, + { + "contract": "StakingThales", + "label": "sportsAMMVolume", + "type": "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:112" + }, + { + "contract": "StakingThales", + "label": "canClaimOnBehalf", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:114" + }, + { + "contract": "StakingThales", + "label": "mergeAccountEnabled", + "type": "t_bool", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:116" + }, + { + "contract": "StakingThales", + "label": "delegatedVolume", + "type": "t_mapping(t_address,t_address)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:118" + }, + { + "contract": "StakingThales", + "label": "supportedSportVault", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:119" + }, + { + "contract": "StakingThales", + "label": "supportedAMMVault", + "type": "t_mapping(t_address,t_bool)", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:120" + }, + { + "contract": "StakingThales", + "label": "sportsAMMLiquidityPool", + "type": "t_contract(ISportsAMMLiquidityPool)6897", + "src": "contracts\\EscrowAndStaking\\StakingThales.sol:122" + } + ], + "types": { + "t_contract(IEscrowThales)6517": { + "label": "contract IEscrowThales" + }, + "t_contract(IERC20)9486": { + "label": "contract IERC20" + }, + "t_contract(ISNXRewards)6887": { + "label": "contract ISNXRewards" + }, + "t_contract(IThalesRoyale)7164": { + "label": "contract IThalesRoyale" + }, + "t_contract(IPriceFeed)6849": { + "label": "contract IPriceFeed" + }, + "t_uint256": { + "label": "uint256" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_address": { + "label": "address" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)" + }, + "t_mapping(t_address,t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage)": { + "label": "mapping(address => struct StakingThales.AMMVolumeEntry[4])" + }, + "t_array(t_struct(AMMVolumeEntry)3107_storage)4_storage": { + "label": "struct StakingThales.AMMVolumeEntry[4]" + }, + "t_struct(AMMVolumeEntry)3107_storage": { + "label": "struct StakingThales.AMMVolumeEntry", + "members": [ + { + "label": "amount", + "type": "t_uint256" + }, + { + "label": "period", + "type": "t_uint256" + } + ] + }, + "t_contract(IThalesStakingRewardsPool)7174": { + "label": "contract IThalesStakingRewardsPool" + }, + "t_contract(IAddressResolver)6424": { + "label": "contract IAddressResolver" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "label": "mapping(address => mapping(address => bool))" + }, + "t_mapping(t_address,t_address)": { + "label": "mapping(address => address)" + }, + "t_contract(ISportsAMMLiquidityPool)6897": { + "label": "contract ISportsAMMLiquidityPool" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]" + } + } + } + }, + "feb45fa214da910081abf951f43d3c738573f902c0d04375865bcd4cae3b5727": { + "address": "0xf5395C7C57E86a92EbBc256C48f9Cea205439561", + "txHash": "0xc3c422b0a2b72aba3d2782ba6b50771c5977c6f2376fe64357b1ecfa4a709cf2", + "layout": { + "storage": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:39" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\proxy\\utils\\Initializable.sol:44" + }, + { + "contract": "ProxyOwned", + "label": "owner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:7" + }, + { + "contract": "ProxyOwned", + "label": "nominatedOwner", + "type": "t_address", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:8" + }, + { + "contract": "ProxyOwned", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:9" + }, + { + "contract": "ProxyOwned", + "label": "_transferredAtInit", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyOwned.sol:10" + }, + { + "contract": "ContextUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)50_storage", + "src": "@openzeppelin\\contracts-upgradeable\\utils\\ContextUpgradeable.sol:31" + }, + { + "contract": "PausableUpgradeable", + "label": "_paused", + "type": "t_bool", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:29" + }, + { + "contract": "PausableUpgradeable", + "label": "__gap", + "type": "t_array(t_uint256)49_storage", + "src": "@openzeppelin\\contracts-upgradeable\\security\\PausableUpgradeable.sol:97" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_guardCounter", + "type": "t_uint256", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:19" + }, + { + "contract": "ProxyReentrancyGuard", + "label": "_initialized", + "type": "t_bool", + "src": "contracts\\utils\\proxy\\solidity-0.8.0\\ProxyReentrancyGuard.sol:20" + }, + { + "contract": "SportsAMM", + "label": "sUSD", + "type": "t_contract(IERC20Upgradeable)8234", + "src": "contracts\\SportMarkets\\SportsAMM.sol:39" + }, + { + "contract": "SportsAMM", + "label": "manager", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:42" + }, + { + "contract": "SportsAMM", + "label": "defaultCapPerGame", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:46" + }, + { + "contract": "SportsAMM", + "label": "min_spread", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:49" + }, + { + "contract": "SportsAMM", + "label": "max_spread", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:52" + }, + { + "contract": "SportsAMM", + "label": "minimalTimeLeftToMaturity", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:56" + }, + { + "contract": "SportsAMM", + "label": "spentOnGame", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:65" + }, + { + "contract": "SportsAMM", + "label": "safeBox", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:68" + }, + { + "contract": "SportsAMM", + "label": "theRundownConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:71" + }, + { + "contract": "SportsAMM", + "label": "safeBoxImpact", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:74" + }, + { + "contract": "SportsAMM", + "label": "stakingThales", + "type": "t_contract(IStakingThales)62067", + "src": "contracts\\SportMarkets\\SportsAMM.sol:77" + }, + { + "contract": "SportsAMM", + "label": "minSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:80" + }, + { + "contract": "SportsAMM", + "label": "maxSupportedOdds", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:83" + }, + { + "contract": "SportsAMM", + "label": "curveSUSD", + "type": "t_contract(ICurveSUSD)60567", + "src": "contracts\\SportMarkets\\SportsAMM.sol:86" + }, + { + "contract": "SportsAMM", + "label": "usdc", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:89" + }, + { + "contract": "SportsAMM", + "label": "usdt", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:92" + }, + { + "contract": "SportsAMM", + "label": "dai", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:95" + }, + { + "contract": "SportsAMM", + "label": "curveOnrampEnabled", + "type": "t_bool", + "src": "contracts\\SportMarkets\\SportsAMM.sol:98" + }, + { + "contract": "SportsAMM", + "label": "maxAllowedPegSlippagePercentage", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:101" + }, + { + "contract": "SportsAMM", + "label": "referrals", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:104" + }, + { + "contract": "SportsAMM", + "label": "referrerFee", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:107" + }, + { + "contract": "SportsAMM", + "label": "apexConsumer", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:110" + }, + { + "contract": "SportsAMM", + "label": "parlayAMM", + "type": "t_address", + "src": "contracts\\SportMarkets\\SportsAMM.sol:113" + }, + { + "contract": "SportsAMM", + "label": "capPerSport", + "type": "t_mapping(t_uint256,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:116" + }, + { + "contract": "SportsAMM", + "label": "sportAmmUtils", + "type": "t_contract(SportsAMMUtils)56906", + "src": "contracts\\SportMarkets\\SportsAMM.sol:118" + }, + { + "contract": "SportsAMM", + "label": "capPerMarket", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:121" + }, + { + "contract": "SportsAMM", + "label": "thresholdForOddsUpdate", + "type": "t_uint256", + "src": "contracts\\SportMarkets\\SportsAMM.sol:125" + }, + { + "contract": "SportsAMM", + "label": "wrapper", + "type": "t_contract(ITherundownConsumerWrapper)62665", + "src": "contracts\\SportMarkets\\SportsAMM.sol:128" + }, + { + "contract": "SportsAMM", + "label": "safeBoxFeePerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:131" + }, + { + "contract": "SportsAMM", + "label": "min_spreadPerAddress", + "type": "t_mapping(t_address,t_uint256)", + "src": "contracts\\SportMarkets\\SportsAMM.sol:134" + }, + { + "contract": "SportsAMM", + "label": "capPerSportAndChild", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))", + "src": "contracts\\SportMarkets\\SportsAMM.sol:137" + }, + { + "contract": "SportsAMM", + "label": "liquidityPool", + "type": "t_contract(SportAMMLiquidityPool)31132", + "src": "contracts\\SportMarkets\\SportsAMM.sol:157" + } + ], + "types": { + "t_contract(IERC20Upgradeable)8234": { + "label": "contract IERC20Upgradeable" + }, + "t_address": { + "label": "address" + }, + "t_uint256": { + "label": "uint256" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)" + }, + "t_contract(IStakingThales)62067": { + "label": "contract IStakingThales" + }, + "t_contract(ICurveSUSD)60567": { + "label": "contract ICurveSUSD" + }, + "t_bool": { + "label": "bool" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)" + }, + "t_contract(SportsAMMUtils)56906": { + "label": "contract SportsAMMUtils" + }, + "t_contract(ITherundownConsumerWrapper)62665": { + "label": "contract ITherundownConsumerWrapper" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_uint256))": { + "label": "mapping(uint256 => mapping(uint256 => uint256))" + }, + "t_contract(SportAMMLiquidityPool)31132": { + "label": "contract SportAMMLiquidityPool" }, "t_array(t_uint256)49_storage": { "label": "uint256[49]" diff --git a/.openzeppelin/unknown-42161.json b/.openzeppelin/unknown-42161.json index b81348242..17454a3be 100644 --- a/.openzeppelin/unknown-42161.json +++ b/.openzeppelin/unknown-42161.json @@ -149,11 +149,6 @@ "address": "0x739d25922010A727B1fc842C483494d4D7a4C90e", "txHash": "0x9387625ab41fe7542b458284124520e75cac37a6e425d354401c29c7689e31b2", "kind": "transparent" - }, - { - "address": "0x0B13071b5f3f860f4D52c836D898A79fE104C9B4", - "txHash": "0x32c66be00c58f4ca48ad4b5ab1376c2556de2f71487bce0b17f6442b3d021bdd", - "kind": "transparent" } ], "impls": { @@ -11517,350 +11512,6 @@ } } } - }, - "1f6237f3cb3c177485233f1a07f1ecf7695a7f5dea4aadb0118a1f3a70d35431": { - "address": "0x3EaA3c6C83856cE307ca651f1fB5A6d981894721", - "txHash": "0x18ade18e3629098392c7c9ea8fe302c4dcfe833fc7d8955c147022c34e54e4e0", - "layout": { - "storage": [ - { - "contract": "Initializable", - "label": "_initialized", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39" - }, - { - "contract": "Initializable", - "label": "_initializing", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44" - }, - { - "contract": "ProxyOwned", - "label": "owner", - "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:7" - }, - { - "contract": "ProxyOwned", - "label": "nominatedOwner", - "type": "t_address", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:8" - }, - { - "contract": "ProxyOwned", - "label": "_initialized", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:9" - }, - { - "contract": "ProxyOwned", - "label": "_transferredAtInit", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyOwned.sol:10" - }, - { - "contract": "ProxyPausable", - "label": "lastPauseTime", - "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:11" - }, - { - "contract": "ProxyPausable", - "label": "paused", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyPausable.sol:12" - }, - { - "contract": "ProxyReentrancyGuard", - "label": "_guardCounter", - "type": "t_uint256", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:19" - }, - { - "contract": "ProxyReentrancyGuard", - "label": "_initialized", - "type": "t_bool", - "src": "contracts/utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol:20" - }, - { - "contract": "ParlayMarketsAMM", - "label": "sportsAmm", - "type": "t_contract(ISportsAMM)13263", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:38" - }, - { - "contract": "ParlayMarketsAMM", - "label": "sportManager", - "type": "t_contract(ISportPositionalMarketManager)13096", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:39" - }, - { - "contract": "ParlayMarketsAMM", - "label": "sUSD", - "type": "t_contract(IERC20Upgradeable)1233", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:40" - }, - { - "contract": "ParlayMarketsAMM", - "label": "stakingThales", - "type": "t_contract(IStakingThales)13340", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:42" - }, - { - "contract": "ParlayMarketsAMM", - "label": "curveSUSD", - "type": "t_contract(ICurveSUSD)11953", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:43" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlayMarketMastercopy", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:45" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlayMarketData", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:46" - }, - { - "contract": "ParlayMarketsAMM", - "label": "safeBox", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:47" - }, - { - "contract": "ParlayMarketsAMM", - "label": "referrals", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:48" - }, - { - "contract": "ParlayMarketsAMM", - "label": "usdc", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:49" - }, - { - "contract": "ParlayMarketsAMM", - "label": "usdt", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:50" - }, - { - "contract": "ParlayMarketsAMM", - "label": "dai", - "type": "t_address", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:51" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlayAmmFee", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:53" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlaySize", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:54" - }, - { - "contract": "ParlayMarketsAMM", - "label": "maxSupportedAmount", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:56" - }, - { - "contract": "ParlayMarketsAMM", - "label": "maxSupportedOdds", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:57" - }, - { - "contract": "ParlayMarketsAMM", - "label": "safeBoxImpact", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:58" - }, - { - "contract": "ParlayMarketsAMM", - "label": "referrerFee", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:59" - }, - { - "contract": "ParlayMarketsAMM", - "label": "curveOnrampEnabled", - "type": "t_bool", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:61" - }, - { - "contract": "ParlayMarketsAMM", - "label": "reducedFeesEnabled", - "type": "t_bool", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:62" - }, - { - "contract": "ParlayMarketsAMM", - "label": "_knownMarkets", - "type": "t_struct(AddressSet)13596_storage", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:64" - }, - { - "contract": "ParlayMarketsAMM", - "label": "resolvedParlay", - "type": "t_mapping(t_address,t_bool)", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:65" - }, - { - "contract": "ParlayMarketsAMM", - "label": "maxAllowedPegSlippagePercentage", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:66" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlayVerifier", - "type": "t_contract(ParlayVerifier)7153", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:67" - }, - { - "contract": "ParlayMarketsAMM", - "label": "minUSDAmount", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:68" - }, - { - "contract": "ParlayMarketsAMM", - "label": "maxAllowedRiskPerCombination", - "type": "t_uint256", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:70" - }, - { - "contract": "ParlayMarketsAMM", - "label": "riskPerCombination", - "type": "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))))))", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:71" - }, - { - "contract": "ParlayMarketsAMM", - "label": "riskPerGameCombination", - "type": "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256))))))))", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:74" - }, - { - "contract": "ParlayMarketsAMM", - "label": "safeBoxFeePerAddress", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:78" - }, - { - "contract": "ParlayMarketsAMM", - "label": "parlayAmmFeePerAddress", - "type": "t_mapping(t_address,t_uint256)", - "src": "contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol:80" - } - ], - "types": { - "t_contract(ISportsAMM)13263": { - "label": "contract ISportsAMM" - }, - "t_contract(ISportPositionalMarketManager)13096": { - "label": "contract ISportPositionalMarketManager" - }, - "t_contract(IERC20Upgradeable)1233": { - "label": "contract IERC20Upgradeable" - }, - "t_contract(IStakingThales)13340": { - "label": "contract IStakingThales" - }, - "t_contract(ICurveSUSD)11953": { - "label": "contract ICurveSUSD" - }, - "t_address": { - "label": "address" - }, - "t_uint256": { - "label": "uint256" - }, - "t_bool": { - "label": "bool" - }, - "t_struct(AddressSet)13596_storage": { - "label": "struct AddressSetLib.AddressSet", - "members": [ - { - "label": "elements", - "type": "t_array(t_address)dyn_storage" - }, - { - "label": "indices", - "type": "t_mapping(t_address,t_uint256)" - } - ] - }, - "t_array(t_address)dyn_storage": { - "label": "address[]" - }, - "t_mapping(t_address,t_uint256)": { - "label": "mapping(address => uint256)" - }, - "t_mapping(t_address,t_bool)": { - "label": "mapping(address => bool)" - }, - "t_contract(ParlayVerifier)7153": { - "label": "contract ParlayVerifier" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))))))": { - "label": "mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256))))))))" - }, - "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256)))))))": { - "label": "mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256)))))))" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))))": { - "label": "mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256))))))" - }, - "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256)))))": { - "label": "mapping(uint256 => mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256)))))" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256))))": { - "label": "mapping(address => mapping(uint256 => mapping(address => mapping(uint256 => uint256))))" - }, - "t_mapping(t_uint256,t_mapping(t_address,t_mapping(t_uint256,t_uint256)))": { - "label": "mapping(uint256 => mapping(address => mapping(uint256 => uint256)))" - }, - "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { - "label": "mapping(address => mapping(uint256 => uint256))" - }, - "t_mapping(t_uint256,t_uint256)": { - "label": "mapping(uint256 => uint256)" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256))))))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint256))))))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256)))))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint256)))))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256))))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint256))))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256)))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint256)))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256))))": { - "label": "mapping(address => mapping(address => mapping(address => mapping(address => uint256))))" - }, - "t_mapping(t_address,t_mapping(t_address,t_mapping(t_address,t_uint256)))": { - "label": "mapping(address => mapping(address => mapping(address => uint256)))" - }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "label": "mapping(address => mapping(address => uint256))" - } - } - } } } } diff --git a/README.md b/README.md index 68ef8b20a..14336dcbe 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ Everything about the [THALES token](https://thalesmarket.io/article/token) ### Audits -- https://iosiro.com/audits/thales-parlay-market-amm-smart-contract-audit - https://iosiro.com/audits/thales-amm-smart-contract-audit - https://www.certik.com/projects/thales - https://iosiro.com/audits/thales-airdrop-and-staking-smart-contract-audit diff --git a/contracts/AMM/SafeBox.sol b/contracts/AMM/SafeBox.sol index 1e4f5e3ec..dd17bddf1 100644 --- a/contracts/AMM/SafeBox.sol +++ b/contracts/AMM/SafeBox.sol @@ -4,7 +4,6 @@ import "@openzeppelin/upgrades-core/contracts/Initializable.sol"; import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/SafeERC20.sol"; import "../utils/proxy/ProxyOwned.sol"; -import "../utils/proxy/ProxyPausable.sol"; contract SafeBox is ProxyOwned, Initializable { using SafeERC20 for IERC20; diff --git a/contracts/EscrowAndStaking/StakingThales.sol b/contracts/EscrowAndStaking/StakingThales.sol index db2c9ef36..1ceb2974f 100644 --- a/contracts/EscrowAndStaking/StakingThales.sol +++ b/contracts/EscrowAndStaking/StakingThales.sol @@ -17,6 +17,7 @@ import "../interfaces/IThalesRoyale.sol"; import "../interfaces/IPriceFeed.sol"; import "../interfaces/IThalesStakingRewardsPool.sol"; import "../interfaces/IAddressResolver.sol"; +import "../interfaces/ISportsAMMLiquidityPool.sol"; import "../interfaces/IThalesAMM.sol"; import "../interfaces/IPositionalMarketManager.sol"; @@ -118,6 +119,8 @@ contract StakingThales is IStakingThales, Initializable, ProxyOwned, ProxyReentr mapping(address => bool) public supportedSportVault; mapping(address => bool) public supportedAMMVault; + ISportsAMMLiquidityPool public sportsAMMLiquidityPool; + /* ========== CONSTRUCTOR ========== */ function initialize( @@ -284,7 +287,8 @@ contract StakingThales is IStakingThales, Initializable, ProxyOwned, ProxyReentr address _sportsAMM, address _priceFeed, address _thalesStakingRewardsPool, - address _addressResolver + address _addressResolver, + address _sportsAMMLiquidityPool ) external onlyOwner { SNXRewards = ISNXRewards(_snxRewards); thalesRoyale = IThalesRoyale(_royale); @@ -295,6 +299,7 @@ contract StakingThales is IStakingThales, Initializable, ProxyOwned, ProxyReentr priceFeed = IPriceFeed(_priceFeed); ThalesStakingRewardsPool = IThalesStakingRewardsPool(_thalesStakingRewardsPool); addressResolver = IAddressResolver(_addressResolver); + sportsAMMLiquidityPool = ISportsAMMLiquidityPool(_sportsAMMLiquidityPool); emit AddressesChanged( _snxRewards, @@ -305,7 +310,8 @@ contract StakingThales is IStakingThales, Initializable, ProxyOwned, ProxyReentr _sportsAMM, _priceFeed, _thalesStakingRewardsPool, - _addressResolver + _addressResolver, + _sportsAMMLiquidityPool ); } @@ -583,6 +589,10 @@ contract StakingThales is IStakingThales, Initializable, ProxyOwned, ProxyReentr require(_stakedBalances[msg.sender] >= amount, "Account doesnt have that much staked"); require(!unstaking[msg.sender], "Account has already triggered unstake cooldown"); + if (address(sportsAMMLiquidityPool) != address(0)) { + require(!sportsAMMLiquidityPool.isUserLPing(msg.sender), "Cannot unstake while LPing"); + } + if (_calculateAvailableRewardsToClaim(msg.sender) > 0) { _claimReward(msg.sender); } @@ -832,7 +842,7 @@ contract StakingThales is IStakingThales, Initializable, ProxyOwned, ProxyReentr ) internal { require(startTimeStamp > 0, "Staking period has not started"); require(amount > 0, "Cannot stake 0"); - require(!unstaking[staker], "Cannot stake, the staker is paused from staking due to unstaking"); + require(!unstaking[staker], "The staker is paused from staking due to unstaking"); // Check if there are not claimable rewards from last period. // Claim them, and add new stake if (_calculateAvailableRewardsToClaim(staker) > 0) { @@ -943,7 +953,8 @@ contract StakingThales is IStakingThales, Initializable, ProxyOwned, ProxyReentr address sportsAMM, address priceFeed, address ThalesStakingRewardsPool, - address addressResolver + address addressResolver, + address sportsAMMLiquidityPool ); event EscrowChanged(address newEscrow); event StakingPeriodStarted(); diff --git a/contracts/OvertimeVaults/ParlayVault.sol b/contracts/OvertimeVaults/ParlayVault.sol deleted file mode 100644 index 105424d6e..000000000 --- a/contracts/OvertimeVaults/ParlayVault.sol +++ /dev/null @@ -1,558 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; -import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; - -import "../utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol"; -import "../utils/proxy/solidity-0.8.0/ProxyOwned.sol"; - -import "../interfaces/ISportsAMM.sol"; -import "../interfaces/IParlayMarketsAMM.sol"; -import "../interfaces/ISportPositionalMarket.sol"; -import "../interfaces/IStakingThales.sol"; - -import "../SportMarkets/Parlay/ParlayMarket.sol"; - -contract ParlayVault is Initializable, ProxyOwned, PausableUpgradeable, ProxyReentrancyGuard { - /* ========== LIBRARIES ========== */ - using SafeERC20Upgradeable for IERC20Upgradeable; - - struct DepositReceipt { - uint round; - uint amount; - } - - struct InitParams { - address _owner; - IParlayMarketsAMM _parlayAMM; - IERC20Upgradeable _sUSD; - uint _roundLength; - uint _priceLowerLimit; - uint _priceUpperLimit; - int _skewImpactLimit; - uint _maxAllowedDeposit; - uint _utilizationRate; - uint _maxTradeRate; - uint _minDepositAmount; - uint _maxAllowedUsers; - uint _minTradeAmount; - uint _maxMarketUsedInRoundCount; - } - - /* ========== CONSTANTS ========== */ - uint private constant HUNDRED = 1e20; - uint private constant ONE = 1e18; - - /* ========== STATE VARIABLES ========== */ - - IParlayMarketsAMM public parlayAMM; - IERC20Upgradeable public sUSD; - - bool public vaultStarted; - - uint public round; - uint public roundLength; - mapping(uint => uint) public roundStartTime; - - mapping(uint => address[]) public usersPerRound; - mapping(uint => mapping(address => bool)) public userInRound; - - mapping(uint => mapping(address => uint)) public balancesPerRound; - mapping(address => bool) public withdrawalRequested; - mapping(address => DepositReceipt) public depositReceipts; - - mapping(uint => uint) public allocationPerRound; - - mapping(uint => address[]) public tradingParlayMarketsPerRound; - mapping(uint => mapping(bytes32 => bool)) public isTradingParlayMarketInARound; - - mapping(uint => uint) public profitAndLossPerRound; - mapping(uint => uint) public cumulativeProfitAndLoss; - - uint public maxAllowedDeposit; - uint public utilizationRate; - uint public maxTradeRate; - - mapping(uint => uint) public capPerRound; - - uint public minDepositAmount; - - uint public maxAllowedUsers; - uint public usersCurrentlyInVault; - - uint public priceLowerLimit; - uint public priceUpperLimit; - int public skewImpactLimit; - - uint public minTradeAmount; - - /// @return The address of the Staking contract - IStakingThales public stakingThales; - - mapping(uint => uint) public allocationSpentInARound; - - mapping(uint => mapping(address => uint)) public marketUsedInRoundCount; - uint public maxMarketUsedInRoundCount; - - /* ========== CONSTRUCTOR ========== */ - - function __BaseSportVault_init( - address _owner, - IParlayMarketsAMM _parlayAMM, - IERC20Upgradeable _sUSD, - uint _roundLength, - uint _maxAllowedDeposit, - uint _utilizationRate, - uint _maxTradeRate, - uint _minDepositAmount, - uint _maxAllowedUsers, - uint _maxMarketUsedInRoundCount - ) internal onlyInitializing { - setOwner(_owner); - initNonReentrant(); - parlayAMM = IParlayMarketsAMM(_parlayAMM); - - sUSD = _sUSD; - roundLength = _roundLength; - maxAllowedDeposit = _maxAllowedDeposit; - utilizationRate = _utilizationRate; - maxTradeRate = _maxTradeRate; - minDepositAmount = _minDepositAmount; - maxAllowedUsers = _maxAllowedUsers; - maxMarketUsedInRoundCount = _maxMarketUsedInRoundCount; - - sUSD.approve(address(parlayAMM), type(uint256).max); - } - - function initialize(InitParams calldata params) external initializer { - __BaseSportVault_init( - params._owner, - params._parlayAMM, - params._sUSD, - params._roundLength, - params._maxAllowedDeposit, - params._utilizationRate, - params._maxTradeRate, - params._minDepositAmount, - params._maxAllowedUsers, - params._maxMarketUsedInRoundCount - ); - priceLowerLimit = params._priceLowerLimit; - priceUpperLimit = params._priceUpperLimit; - skewImpactLimit = params._skewImpactLimit; - minTradeAmount = params._minTradeAmount; - } - - /// @notice Start vault and begin round #1 - function startVault() external onlyOwner { - require(!vaultStarted, "Vault has already started"); - round = 1; - - roundStartTime[round] = block.timestamp; - - vaultStarted = true; - - capPerRound[2] = capPerRound[1]; - - emit VaultStarted(); - } - - /// @notice Close current round and begin next round, - /// excercise options of trading markets and calculate profit and loss - function closeRound() external nonReentrant whenNotPaused { - require(canCloseCurrentRound(), "Can't close current round"); - // excercise market options - _exerciseMarketsReadyToExercised(); - - // balance in next round does not affect PnL in a current round - uint currentVaultBalance = sUSD.balanceOf(address(this)) - allocationPerRound[round + 1]; - // calculate PnL - - // if no allocation for current round - if (allocationPerRound[round] == 0) { - profitAndLossPerRound[round] = 1; - } else { - profitAndLossPerRound[round] = (currentVaultBalance * ONE) / allocationPerRound[round]; - } - - for (uint i = 0; i < usersPerRound[round].length; i++) { - address user = usersPerRound[round][i]; - uint balanceAfterCurRound = (balancesPerRound[round][user] * profitAndLossPerRound[round]) / ONE; - if (userInRound[round][user]) { - if (!withdrawalRequested[user]) { - balancesPerRound[round + 1][user] = balancesPerRound[round + 1][user] + balanceAfterCurRound; - userInRound[round + 1][user] = true; - usersPerRound[round + 1].push(user); - if (address(stakingThales) != address(0)) { - stakingThales.updateVolume(user, balanceAfterCurRound); - } - } else { - balancesPerRound[round + 1][user] = 0; - sUSD.safeTransfer(user, balanceAfterCurRound); - withdrawalRequested[user] = false; - userInRound[round + 1][user] = false; - emit Claimed(user, balanceAfterCurRound); - } - } - } - - if (round == 1) { - cumulativeProfitAndLoss[round] = profitAndLossPerRound[round]; - } else { - cumulativeProfitAndLoss[round] = (cumulativeProfitAndLoss[round - 1] * profitAndLossPerRound[round]) / ONE; - } - - // start next round - round += 1; - - roundStartTime[round] = block.timestamp; - - // allocation for next round doesn't include withdrawal queue share from previous round - allocationPerRound[round] = sUSD.balanceOf(address(this)); - capPerRound[round + 1] = allocationPerRound[round]; - - emit RoundClosed(round - 1, profitAndLossPerRound[round - 1]); - } - - /// @notice Deposit funds from user into vault for the next round - /// @param amount Value to be deposited - function deposit(uint amount) external canDeposit(amount) { - sUSD.safeTransferFrom(msg.sender, address(this), amount); - - uint nextRound = round + 1; - - // new user enters the vault - if (balancesPerRound[round][msg.sender] == 0 && balancesPerRound[nextRound][msg.sender] == 0) { - require(usersCurrentlyInVault < maxAllowedUsers, "Max amount of users reached"); - usersPerRound[nextRound].push(msg.sender); - userInRound[nextRound][msg.sender] = true; - usersCurrentlyInVault = usersCurrentlyInVault + 1; - } - - balancesPerRound[nextRound][msg.sender] += amount; - - // update deposit state of a user - depositReceipts[msg.sender] = DepositReceipt(nextRound, balancesPerRound[nextRound][msg.sender]); - - allocationPerRound[nextRound] += amount; - capPerRound[nextRound] += amount; - - if (address(stakingThales) != address(0)) { - stakingThales.updateVolume(msg.sender, amount); - } - - emit Deposited(msg.sender, amount); - } - - function withdrawalRequest() external { - require(vaultStarted, "Vault has not started"); - require(!withdrawalRequested[msg.sender], "Withdrawal already requested"); - require(balancesPerRound[round][msg.sender] > 0, "Nothing to withdraw"); - require(balancesPerRound[round + 1][msg.sender] == 0, "Can't withdraw as you already deposited for next round"); - - uint nextRound = round + 1; - if (capPerRound[nextRound] > balancesPerRound[round][msg.sender]) { - capPerRound[nextRound] -= balancesPerRound[round][msg.sender]; - } - - usersCurrentlyInVault = usersCurrentlyInVault - 1; - withdrawalRequested[msg.sender] = true; - emit WithdrawalRequested(msg.sender); - } - - /// @notice Buy market options from Thales AMM - /// @param sportMarkets parlay market addresses - /// @param positions to buy options for - /// @param sUSDPaid amount to pay for parlay - function trade( - address[] calldata sportMarkets, - uint[] calldata positions, - uint sUSDPaid - ) external nonReentrant whenNotPaused { - require(vaultStarted, "Vault has not started"); - require(sUSDPaid >= minTradeAmount, "Amount less than minimum"); - require(sUSDPaid < (tradingAllocation() * maxTradeRate) / ONE, "Amount exceeds max value per trade"); - require(sUSDPaid < (tradingAllocation() - allocationSpentInARound[round]), "Amount exceeds available allocation"); - - require(!parlayExistsInARound(round, sportMarkets), "Parlay market already exists in a round"); - - (uint expectedPayout, , , , , uint[] memory finalQuotes, uint[] memory amountsToBuy) = parlayAMM.buyQuoteFromParlay( - sportMarkets, - positions, - sUSDPaid - ); - - for (uint i = 0; i < sportMarkets.length; i++) { - _checkSportMarket(sportMarkets[i], positions[i], finalQuotes[i], amountsToBuy[i]); - } - - require(parlayAMM.canCreateParlayMarket(sportMarkets, positions, sUSDPaid), "Cannot create parlay"); - - _buyFromParlay(sportMarkets, positions, sUSDPaid, expectedPayout); - } - - /// @notice Set length of rounds - /// @param _roundLength Length of a round in miliseconds - function setRoundLength(uint _roundLength) external onlyOwner { - roundLength = _roundLength; - emit RoundLengthChanged(_roundLength); - } - - /// @notice Set ParlayMarketsAMM contract - /// @param _parlayAMM ParlayMarketsAMM address - function setParlayAMM(IParlayMarketsAMM _parlayAMM) external onlyOwner { - parlayAMM = _parlayAMM; - sUSD.approve(address(_parlayAMM), type(uint256).max); - emit ParlayAMMChanged(address(_parlayAMM)); - (address(_parlayAMM)); - } - - /// @notice Set IStakingThales contract - /// @param _stakingThales IStakingThales address - function setStakingThales(IStakingThales _stakingThales) external onlyOwner { - stakingThales = _stakingThales; - emit StakingThalesChanged(address(_stakingThales)); - } - - /// @notice Set utilization rate parameter - /// @param _utilizationRate Value in percents - function setUtilizationRate(uint _utilizationRate) external onlyOwner { - utilizationRate = _utilizationRate; - emit UtilizationRateChanged(_utilizationRate); - } - - /// @notice Set max trade rate parameter - /// @param _maxTradeRate Value in percents - function setMaxTradeRate(uint _maxTradeRate) external onlyOwner { - maxTradeRate = _maxTradeRate; - emit MaxTradeRateChanged(_maxTradeRate); - } - - /// @notice Set max allowed deposit - /// @param _maxAllowedDeposit Deposit value - function setMaxAllowedDeposit(uint _maxAllowedDeposit) external onlyOwner { - maxAllowedDeposit = _maxAllowedDeposit; - emit MaxAllowedDepositChanged(_maxAllowedDeposit); - } - - /// @notice Set min allowed deposit - /// @param _minDepositAmount Deposit value - function setMinAllowedDeposit(uint _minDepositAmount) external onlyOwner { - minDepositAmount = _minDepositAmount; - emit MinAllowedDepositChanged(_minDepositAmount); - } - - /// @notice Set _maxAllowedUsers - /// @param _maxAllowedUsers Deposit value - function setMaxAllowedUsers(uint _maxAllowedUsers) external onlyOwner { - maxAllowedUsers = _maxAllowedUsers; - emit MaxAllowedUsersChanged(_maxAllowedUsers); - } - - /// @notice Set maxMarketUsedInRoundCount - /// @param _maxMarketUsedInRoundCount Deposit value - function setMaxMarketUsedInRoundCount(uint _maxMarketUsedInRoundCount) external onlyOwner { - maxMarketUsedInRoundCount = _maxMarketUsedInRoundCount; - emit MaxMarketUsedInRoundCountChanged(_maxMarketUsedInRoundCount); - } - - /// @notice Set price limit for options to be bought from AMM - /// @param _priceLowerLimit lower limit - /// @param _priceUpperLimit upper limit - function setPriceLimits(uint _priceLowerLimit, uint _priceUpperLimit) external onlyOwner { - require(_priceLowerLimit < _priceUpperLimit, "Invalid price limit values"); - priceLowerLimit = _priceLowerLimit; - priceUpperLimit = _priceUpperLimit; - emit SetPriceLimits(_priceLowerLimit, _priceUpperLimit); - } - - /// @notice Set skew impact limit for sports AMM - /// @param _skewImpactLimit limit in percents - function setSkewImpactLimit(int _skewImpactLimit) external onlyOwner { - skewImpactLimit = _skewImpactLimit; - emit SetSkewImpactLimit(_skewImpactLimit); - } - - /// @notice Set _minTradeAmount - /// @param _minTradeAmount limit in sUSD - function setMinTradeAmount(uint _minTradeAmount) external onlyOwner { - minTradeAmount = _minTradeAmount; - emit SetMinTradeAmount(_minTradeAmount); - } - - /* ========== INTERNAL FUNCTIONS ========== */ - - // @notice Exercises parlay markets in a round - function _exerciseMarketsReadyToExercised() internal { - ParlayMarket parlayMarket; - for (uint i = 0; i < tradingParlayMarketsPerRound[round].length; i++) { - parlayMarket = ParlayMarket(tradingParlayMarketsPerRound[round][i]); - (bool isExercisable, ) = parlayMarket.isParlayExercisable(); - if (isExercisable) { - parlayAMM.exerciseParlay(address(parlayMarket)); - } - } - } - - /// @notice Buys options from AMM - /// @param sportMarkets parlay market addresses - /// @param positions positions to be bought - /// @param sUSDPaid amount to pay - function _buyFromParlay( - address[] calldata sportMarkets, - uint[] calldata positions, - uint sUSDPaid, - uint expectedPayout - ) internal { - parlayAMM.buyFromParlay(sportMarkets, positions, sUSDPaid, 0, expectedPayout, address(0)); - - allocationSpentInARound[round] += sUSDPaid; - - address[] memory parlayMarket = parlayAMM.activeParlayMarkets(parlayAMM.numActiveParlayMarkets() - 1, 1); - - tradingParlayMarketsPerRound[round].push(parlayMarket[0]); - isTradingParlayMarketInARound[round][_calculateCombinationKey(sportMarkets)] = true; - - for (uint i = 0; i < sportMarkets.length; i++) { - marketUsedInRoundCount[round][sportMarkets[i]] += 1; - } - - emit TradeExecuted(parlayMarket[0], sUSDPaid); - } - - /// @notice Check sport markets conditions - /// @param market sport market address - /// @param position option to be bought - /// @param finalQuote price fetched from parlay amm - /// @param amount of positions to be bought - function _checkSportMarket( - address market, - uint position, - uint finalQuote, - uint amount - ) internal { - ISportPositionalMarket marketContract = ISportPositionalMarket(market); - (uint maturity, ) = marketContract.times(); - require(maturity < (roundStartTime[round] + roundLength), "Market time not valid"); - - ISportsAMM.Position ammPosition = (parlayAMM.parlayVerifier()).obtainSportsAMMPosition(position); - - require(finalQuote > 0, "Price not more than 0"); - - require(finalQuote >= priceLowerLimit && finalQuote <= priceUpperLimit, "Market price not valid"); - int pricePositionImpact = ISportsAMM(parlayAMM.sportsAmm()).buyPriceImpact(market, ammPosition, amount); - require(pricePositionImpact < skewImpactLimit, "Skew impact too high"); - - require( - marketUsedInRoundCount[round][market] <= maxMarketUsedInRoundCount, - "Market is at the maximum number of tickets" - ); - } - - /// @notice Calculates parlay combination keys - /// @param _sportMarkets parlay market addresses - function _calculateCombinationKey(address[] memory _sportMarkets) internal view returns (bytes32) { - address[] memory sortedAddresses = new address[](_sportMarkets.length); - sortedAddresses = (parlayAMM.parlayVerifier()).sort(_sportMarkets); - return keccak256(abi.encodePacked(sortedAddresses)); - } - - /* ========== VIEWS ========== */ - - /// @notice Return trading allocation in current round based on utilization rate param - /// @return uint - function tradingAllocation() public view returns (uint) { - return (allocationPerRound[round] * utilizationRate) / ONE; - } - - /// @notice Check if same parlay exists - function parlayExistsInARound(uint _round, address[] calldata _sportMarkets) public view returns (bool) { - bytes32 combinationKey = _calculateCombinationKey(_sportMarkets); - - return isTradingParlayMarketInARound[_round][combinationKey]; - } - - /// @notice Checks if all conditions are met to close the round - /// @return bool - function canCloseCurrentRound() public view returns (bool) { - if (!vaultStarted || block.timestamp < (roundStartTime[round] + roundLength)) { - return false; - } - for (uint i = 0; i < tradingParlayMarketsPerRound[round].length; i++) { - ParlayMarket parlayMarket = ParlayMarket(tradingParlayMarketsPerRound[round][i]); - (bool isResolved, address[] memory resolvableMarkets) = parlayMarket.isAnySportMarketResolved(); - if (!isResolved || parlayMarket.paused()) { - return false; - } - - if (resolvableMarkets.length != parlayMarket.numOfSportMarkets()) { - return false; - } - } - return true; - } - - /// @notice Return user balance in a round - /// @param _round Round number - /// @param user Address of the user - /// @return uint - function getBalancesPerRound(uint _round, address user) external view returns (uint) { - return balancesPerRound[_round][user]; - } - - /// @notice Return available to deposit - /// @return returned how much more users can deposit - function getAvailableToDeposit() external view returns (uint returned) { - if (capPerRound[round + 1] < maxAllowedDeposit) { - returned = maxAllowedDeposit - capPerRound[round + 1]; - } - } - - /// @notice end of current round - /// @return uint - function getCurrentRoundEnd() external view returns (uint) { - return roundStartTime[round] + roundLength; - } - - /// @notice Return multiplied PnLs between rounds - /// @param roundA Round number from - /// @param roundB Round number to - /// @return uint - function cumulativePnLBetweenRounds(uint roundA, uint roundB) public view returns (uint) { - return (cumulativeProfitAndLoss[roundB] * profitAndLossPerRound[roundA]) / cumulativeProfitAndLoss[roundA]; - } - - /* ========== MODIFIERS ========== */ - - modifier canDeposit(uint amount) { - require(!withdrawalRequested[msg.sender], "Withdrawal is requested, cannot deposit"); - require(amount >= minDepositAmount, "Invalid amount"); - require(capPerRound[round + 1] + amount <= maxAllowedDeposit, "Deposit amount exceeds vault cap"); - _; - } - - /* ========== EVENTS ========== */ - - event VaultStarted(); - event RoundClosed(uint round, uint roundPnL); - event RoundLengthChanged(uint roundLength); - event ParlayAMMChanged(address parlayAMM); - event StakingThalesChanged(address stakingThales); - event SetSUSD(address sUSD); - event Deposited(address user, uint amount); - event Claimed(address user, uint amount); - event WithdrawalRequested(address user); - event UtilizationRateChanged(uint utilizationRate); - event MaxTradeRateChanged(uint maxTradeRate); - event MaxAllowedDepositChanged(uint maxAllowedDeposit); - event MinAllowedDepositChanged(uint minAllowedDeposit); - event MaxAllowedUsersChanged(uint maxAllowedUsersChanged); - event MaxMarketUsedInRoundCountChanged(uint maxMarketUsedInRoundCount); - event SetPriceLimits(uint priceLowerLimit, uint priceUpperLimit); - event SetSkewImpactLimit(int skewImpact); - event SetMinTradeAmount(uint SetMinTradeAmount); - event TradeExecuted(address parlayMarket, uint sUSDPaid); -} diff --git a/contracts/OvertimeVaults/SportVault.sol b/contracts/OvertimeVaults/SportVault.sol index ca0565522..4a9fd133e 100644 --- a/contracts/OvertimeVaults/SportVault.sol +++ b/contracts/OvertimeVaults/SportVault.sol @@ -211,7 +211,7 @@ contract SportVault is Initializable, ProxyOwned, PausableUpgradeable, ProxyReen /// @notice Deposit funds from user into vault for the next round /// @param amount Value to be deposited - function deposit(uint amount) external canDeposit(amount) { + function deposit(uint amount) external canDeposit(amount) nonReentrant whenNotPaused { sUSD.safeTransferFrom(msg.sender, address(this), amount); uint nextRound = round + 1; @@ -239,7 +239,7 @@ contract SportVault is Initializable, ProxyOwned, PausableUpgradeable, ProxyReen emit Deposited(msg.sender, amount); } - function withdrawalRequest() external { + function withdrawalRequest() external nonReentrant whenNotPaused { require(vaultStarted, "Vault has not started"); require(!withdrawalRequested[msg.sender], "Withdrawal already requested"); require(balancesPerRound[round][msg.sender] > 0, "Nothing to withdraw"); diff --git a/contracts/SportMarkets/LiquidityPool/DefaultLiquidityProvider.sol b/contracts/SportMarkets/LiquidityPool/DefaultLiquidityProvider.sol new file mode 100644 index 000000000..247e003a9 --- /dev/null +++ b/contracts/SportMarkets/LiquidityPool/DefaultLiquidityProvider.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "../../utils/proxy/solidity-0.8.0/ProxyOwned.sol"; +import "../../utils/proxy/solidity-0.8.0/ProxyPausable.sol"; +import "../../utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol"; + +contract DefaultLiquidityProvider is ProxyOwned, Initializable, ProxyReentrancyGuard { + using SafeERC20Upgradeable for IERC20Upgradeable; + + IERC20Upgradeable public sUSD; + + uint private constant MAX_APPROVAL = type(uint256).max; + + /// @return the adddress of the AMMLP contract + address public liquidityPool; + + function initialize( + address _owner, + IERC20Upgradeable _sUSD, + address _sportAMMLiquidityPool + ) public initializer { + setOwner(_owner); + initNonReentrant(); + sUSD = _sUSD; + liquidityPool = _sportAMMLiquidityPool; + sUSD.approve(liquidityPool, MAX_APPROVAL); + } + + /// @notice Setting the SportAMMLiquidityPool + /// @param _sportAMMLiquidityPool Address of Staking contract + function setSportAMMLiquidityPool(address _sportAMMLiquidityPool) external onlyOwner { + if (liquidityPool != address(0)) { + sUSD.approve(liquidityPool, 0); + } + liquidityPool = _sportAMMLiquidityPool; + sUSD.approve(_sportAMMLiquidityPool, MAX_APPROVAL); + emit SetSportAMMLiquidityPool(_sportAMMLiquidityPool); + } + + function retrieveSUSDAmount(address payable account, uint amount) external onlyOwner nonReentrant { + sUSD.safeTransfer(account, amount); + } + + event SetSportAMMLiquidityPool(address _sportAMMLiquidityPool); +} diff --git a/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPool.sol b/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPool.sol new file mode 100644 index 000000000..e949e5560 --- /dev/null +++ b/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPool.sol @@ -0,0 +1,695 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; + +import "../../utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol"; +import "../../utils/proxy/solidity-0.8.0/ProxyOwned.sol"; +import "@openzeppelin/contracts-4.4.1/proxy/Clones.sol"; + +import "../../interfaces/ISportsAMM.sol"; +import "../../interfaces/ISportPositionalMarket.sol"; +import "../../interfaces/IStakingThales.sol"; + +import "./SportAMMLiquidityPoolRound.sol"; + +contract SportAMMLiquidityPool is Initializable, ProxyOwned, PausableUpgradeable, ProxyReentrancyGuard { + /* ========== LIBRARIES ========== */ + using SafeERC20Upgradeable for IERC20Upgradeable; + + struct InitParams { + address _owner; + ISportsAMM _sportsAmm; + IERC20Upgradeable _sUSD; + uint _roundLength; + uint _maxAllowedDeposit; + uint _minDepositAmount; + uint _maxAllowedUsers; + } + + /* ========== CONSTANTS ========== */ + uint private constant HUNDRED = 1e20; + uint private constant ONE = 1e18; + + /* ========== STATE VARIABLES ========== */ + + ISportsAMM public sportsAMM; + IERC20Upgradeable public sUSD; + + bool public started; + + uint public round; + uint public roundLength; + uint public firstRoundStartTime; + + mapping(uint => address) public roundPools; + + mapping(uint => address[]) public usersPerRound; + mapping(uint => mapping(address => bool)) public userInRound; + + mapping(uint => mapping(address => uint)) public balancesPerRound; + mapping(uint => uint) public allocationPerRound; + + mapping(address => bool) public withdrawalRequested; + + mapping(uint => address[]) public tradingMarketsPerRound; + mapping(uint => mapping(address => bool)) public isTradingMarketInARound; + + mapping(uint => uint) public profitAndLossPerRound; + mapping(uint => uint) public cumulativeProfitAndLoss; + + uint public maxAllowedDeposit; + uint public minDepositAmount; + uint public maxAllowedUsers; + uint public usersCurrentlyInPool; + + address public defaultLiquidityProvider; + + IStakingThales public stakingThales; + + uint public stakedThalesMultiplier; + + address public poolRoundMastercopy; + + mapping(address => bool) public whitelistedDeposits; + + uint public totalDeposited; + + bool public onlyWhitelistedStakersAllowed; + + mapping(address => bool) public whitelistedStakers; + + bool public needsTransformingCollateral; + + /* ========== CONSTRUCTOR ========== */ + + function initialize(InitParams calldata params) external initializer { + setOwner(params._owner); + initNonReentrant(); + sportsAMM = ISportsAMM(params._sportsAmm); + + sUSD = params._sUSD; + roundLength = params._roundLength; + maxAllowedDeposit = params._maxAllowedDeposit; + minDepositAmount = params._minDepositAmount; + maxAllowedUsers = params._maxAllowedUsers; + + sUSD.approve(address(sportsAMM), type(uint256).max); + } + + /// @notice Start pool and begin round #1 + function start() external onlyOwner { + require(!started, "Liquidity pool has already started"); + require(allocationPerRound[1] > 0, "can not start with 0 deposits"); + round = 1; + firstRoundStartTime = block.timestamp; + started = true; + emit PoolStarted(); + } + + /// @notice Deposit funds from user into pool for the next round + /// @param amount Value to be deposited + function deposit(uint amount) external canDeposit(amount) nonReentrant whenNotPaused { + uint nextRound = round + 1; + address roundPool = _getOrCreateRoundPool(nextRound); + sUSD.safeTransferFrom(msg.sender, roundPool, amount); + + if (!whitelistedDeposits[msg.sender]) { + require(!onlyWhitelistedStakersAllowed || whitelistedStakers[msg.sender], "Only whitelisted stakers allowed"); + require( + (balancesPerRound[round][msg.sender] + amount + balancesPerRound[nextRound][msg.sender]) <= + _transformCollateral((stakingThales.stakedBalanceOf(msg.sender) * stakedThalesMultiplier) / ONE), + "Not enough staked THALES" + ); + } + + require(msg.sender != defaultLiquidityProvider, "Can't deposit directly as default liquidity provider"); + + // new user enters the pool + if (balancesPerRound[round][msg.sender] == 0 && balancesPerRound[nextRound][msg.sender] == 0) { + require(usersCurrentlyInPool < maxAllowedUsers, "Max amount of users reached"); + usersPerRound[nextRound].push(msg.sender); + userInRound[nextRound][msg.sender] = true; + usersCurrentlyInPool = usersCurrentlyInPool + 1; + } + + balancesPerRound[nextRound][msg.sender] += amount; + + allocationPerRound[nextRound] += amount; + totalDeposited += amount; + + if (address(stakingThales) != address(0)) { + stakingThales.updateVolume(msg.sender, amount); + } + + emit Deposited(msg.sender, amount, round); + } + + /// @notice get sUSD to mint for buy and store market as trading in the round + /// @param market to trade + /// @param amountToMint amount to get for mint + function commitTrade(address market, uint amountToMint) external nonReentrant whenNotPaused onlyAMM { + require(started, "Pool has not started"); + require(amountToMint > 0, "Can't commit a zero trade"); + + amountToMint = _transformCollateral(amountToMint); + + uint marketRound = getMarketRound(market); + address liquidityPoolRound = _getOrCreateRoundPool(marketRound); + + if (marketRound == round) { + sUSD.safeTransferFrom(liquidityPoolRound, address(sportsAMM), amountToMint); + } else { + uint poolBalance = sUSD.balanceOf(liquidityPoolRound); + if (poolBalance > amountToMint) { + sUSD.safeTransferFrom(liquidityPoolRound, address(sportsAMM), amountToMint); + } else { + uint differenceToLPAsDefault = amountToMint - poolBalance; + _depositAsDefault(differenceToLPAsDefault, liquidityPoolRound, marketRound); + sUSD.safeTransferFrom(liquidityPoolRound, address(sportsAMM), amountToMint); + } + } + + if (!isTradingMarketInARound[marketRound][market]) { + tradingMarketsPerRound[marketRound].push(market); + isTradingMarketInARound[marketRound][market] = true; + } + } + + /// @notice get options that are in the LP into the AMM for the buy tx + /// @param market to get options for + /// @param optionsAmount to get options for + /// @param position to get options for + function getOptionsForBuy( + address market, + uint optionsAmount, + ISportsAMM.Position position + ) external nonReentrant whenNotPaused onlyAMM { + if (optionsAmount > 0) { + require(started, "Pool has not started"); + + uint marketRound = getMarketRound(market); + address liquidityPoolRound = _getOrCreateRoundPool(marketRound); + + (IPosition home, IPosition away, IPosition draw) = ISportPositionalMarket(market).getOptions(); + IPosition target = position == ISportsAMM.Position.Home ? home : away; + if (ISportPositionalMarket(market).optionsCount() > 2 && position != ISportsAMM.Position.Home) { + target = position == ISportsAMM.Position.Away ? away : draw; + } + + SportAMMLiquidityPoolRound(liquidityPoolRound).moveOptions( + IERC20Upgradeable(address(target)), + optionsAmount, + address(sportsAMM) + ); + } + } + + /// @notice get options that are in the LP into the AMM for the buy tx + /// @param market to get options for + /// @param optionsAmount to get options for + /// @param position to get options for + function getOptionsForBuyByAddress( + address market, + uint optionsAmount, + address position + ) external nonReentrant whenNotPaused onlyAMM { + if (optionsAmount > 0) { + require(started, "Pool has not started"); + + uint marketRound = getMarketRound(market); + address liquidityPoolRound = _getOrCreateRoundPool(marketRound); + + SportAMMLiquidityPoolRound(liquidityPoolRound).moveOptions( + IERC20Upgradeable(position), + optionsAmount, + address(sportsAMM) + ); + } + } + + /// @notice request withdrawal from the LP + /// @param market to check + /// @return roundPool the pool for the passed market + function getOrCreateMarketPool(address market) external onlyAMM nonReentrant whenNotPaused returns (address roundPool) { + uint marketRound = getMarketRound(market); + roundPool = _getOrCreateRoundPool(marketRound); + } + + /// @notice request withdrawal from the LP + function withdrawalRequest() external nonReentrant whenNotPaused { + require(started, "Pool has not started"); + require(!withdrawalRequested[msg.sender], "Withdrawal already requested"); + require(balancesPerRound[round][msg.sender] > 0, "Nothing to withdraw"); + require(balancesPerRound[round + 1][msg.sender] == 0, "Can't withdraw as you already deposited for next round"); + + if (!whitelistedDeposits[msg.sender]) { + require( + balancesPerRound[round][msg.sender] < + _transformCollateral(((stakingThales.stakedBalanceOf(msg.sender) * stakedThalesMultiplier) / ONE)), + "Not enough staked THALES" + ); + } + + if (totalDeposited > balancesPerRound[round][msg.sender]) { + totalDeposited -= balancesPerRound[round][msg.sender]; + } else { + totalDeposited = 0; + } + + usersCurrentlyInPool = usersCurrentlyInPool - 1; + withdrawalRequested[msg.sender] = true; + emit WithdrawalRequested(msg.sender); + } + + /// @notice Close current round and begin next round, + /// excercise options of trading markets and calculate profit and loss + function closeRound() external nonReentrant whenNotPaused { + require(canCloseCurrentRound(), "Can't close current round"); + // excercise market options + exerciseMarketsReadyToExercised(); + + address roundPool = roundPools[round]; + // final balance is the final amount of sUSD in the round pool + uint currentBalance = sUSD.balanceOf(roundPool); + // calculate PnL + + // if no allocation for current round + if (allocationPerRound[round] == 0) { + profitAndLossPerRound[round] = 1; + } else { + profitAndLossPerRound[round] = (currentBalance * ONE) / allocationPerRound[round]; + } + + for (uint i = 0; i < usersPerRound[round].length; i++) { + address user = usersPerRound[round][i]; + uint balanceAfterCurRound = (balancesPerRound[round][user] * profitAndLossPerRound[round]) / ONE; + if (userInRound[round][user]) { + if (!withdrawalRequested[user] && (profitAndLossPerRound[round] > 0)) { + balancesPerRound[round + 1][user] = balancesPerRound[round + 1][user] + balanceAfterCurRound; + userInRound[round + 1][user] = true; + usersPerRound[round + 1].push(user); + if (address(stakingThales) != address(0)) { + stakingThales.updateVolume(user, balanceAfterCurRound); + } + } else { + balancesPerRound[round + 1][user] = 0; + sUSD.safeTransferFrom(roundPool, user, balanceAfterCurRound); + withdrawalRequested[user] = false; + userInRound[round + 1][user] = false; + emit Claimed(user, balanceAfterCurRound); + } + } + } + + //always claim for defaultLiquidityProvider + if (balancesPerRound[round][defaultLiquidityProvider] > 0) { + uint balanceAfterCurRound = (balancesPerRound[round][defaultLiquidityProvider] * profitAndLossPerRound[round]) / + ONE; + sUSD.safeTransferFrom(roundPool, defaultLiquidityProvider, balanceAfterCurRound); + emit Claimed(defaultLiquidityProvider, balanceAfterCurRound); + } + + if (round == 1) { + cumulativeProfitAndLoss[round] = profitAndLossPerRound[round]; + } else { + cumulativeProfitAndLoss[round] = (cumulativeProfitAndLoss[round - 1] * profitAndLossPerRound[round]) / ONE; + } + + // start next round + round += 1; + + //add all carried over sUSD + allocationPerRound[round] += sUSD.balanceOf(roundPool); + + totalDeposited = allocationPerRound[round] - balancesPerRound[round][defaultLiquidityProvider]; + + address roundPoolNewRound = _getOrCreateRoundPool(round); + + sUSD.safeTransferFrom(roundPool, roundPoolNewRound, sUSD.balanceOf(roundPool)); + + emit RoundClosed(round - 1, profitAndLossPerRound[round - 1]); + } + + /// @notice Iterate all markets in the current round and exercise those ready to be exercised + function exerciseMarketsReadyToExercised() public { + SportAMMLiquidityPoolRound poolRound = SportAMMLiquidityPoolRound(roundPools[round]); + ISportPositionalMarket market; + for (uint i = 0; i < tradingMarketsPerRound[round].length; i++) { + market = ISportPositionalMarket(tradingMarketsPerRound[round][i]); + poolRound.exerciseMarketReadyToExercised(market); + if (market.isDoubleChance()) { + poolRound.exerciseMarketReadyToExercised(market.parentMarket()); + } + } + } + + /* ========== VIEWS ========== */ + + /// @notice whether the user is currently LPing + /// @param user to check + /// @return isUserInLP whether the user is currently LPing + function isUserLPing(address user) external view returns (bool isUserInLP) { + isUserInLP = + (balancesPerRound[round][user] > 0 || balancesPerRound[round + 1][user] > 0) && + !withdrawalRequested[user]; + } + + /// @notice Return the maximum amount the user can deposit now + /// @param user address to check + /// @return maxDepositForUser the maximum amount the user can deposit in total including already deposited + /// @return availableToDepositForUser the maximum amount the user can deposit now + /// @return stakedThalesForUser how much THALES the user has staked + function getMaxAvailableDepositForUser(address user) + external + view + returns ( + uint maxDepositForUser, + uint availableToDepositForUser, + uint stakedThalesForUser + ) + { + uint nextRound = round + 1; + stakedThalesForUser = stakingThales.stakedBalanceOf(user); + maxDepositForUser = (stakedThalesForUser * stakedThalesMultiplier) / ONE; + availableToDepositForUser = maxDepositForUser > (balancesPerRound[round][user] + balancesPerRound[nextRound][user]) + ? (maxDepositForUser - balancesPerRound[round][user] - balancesPerRound[nextRound][user]) + : 0; + } + + /// @notice Return how much the user needs to have staked to withdraw + /// @param user address to check + /// @return neededStaked how much the user needs to have staked to withdraw + function getNeededStakedThalesToWithdrawForUser(address user) external view returns (uint neededStaked) { + uint nextRound = round + 1; + neededStaked = ((balancesPerRound[round][user] + balancesPerRound[nextRound][user]) * ONE) / stakedThalesMultiplier; + } + + /// @notice get the pool address for the market + /// @param market to check + /// @return roundPool the pool address for the market + function getMarketPool(address market) external view returns (address roundPool) { + roundPool = roundPools[getMarketRound(market)]; + } + + /// @notice Checks if all conditions are met to close the round + /// @return bool + function canCloseCurrentRound() public view returns (bool) { + if (!started || block.timestamp < getRoundEndTime(round)) { + return false; + } + for (uint i = 0; i < tradingMarketsPerRound[round].length; i++) { + IPositionalMarket market = IPositionalMarket(tradingMarketsPerRound[round][i]); + if ((!market.resolved())) { + return false; + } + } + return true; + } + + /// @notice Iterate all markets in the current round and return true if at least one can be exercised + function hasMarketsReadyToBeExercised() public view returns (bool) { + SportAMMLiquidityPoolRound poolRound = SportAMMLiquidityPoolRound(roundPools[round]); + ISportPositionalMarket market; + for (uint i = 0; i < tradingMarketsPerRound[round].length; i++) { + market = ISportPositionalMarket(tradingMarketsPerRound[round][i]); + if (market.resolved()) { + (uint homeBalance, uint awayBalance, uint drawBalance) = market.balancesOf(address(poolRound)); + if (homeBalance > 0 || awayBalance > 0 || drawBalance > 0) { + return true; + } + } + } + return false; + } + + /// @notice Return multiplied PnLs between rounds + /// @param roundA Round number from + /// @param roundB Round number to + /// @return uint + function cumulativePnLBetweenRounds(uint roundA, uint roundB) public view returns (uint) { + return (cumulativeProfitAndLoss[roundB] * profitAndLossPerRound[roundA]) / cumulativeProfitAndLoss[roundA]; + } + + /// @notice Return the start time of the passed round + /// @param _round number + /// @return uint the start time of the given round + function getRoundStartTime(uint _round) public view returns (uint) { + return firstRoundStartTime + (_round - 1) * roundLength; + } + + /// @notice Return the end time of the passed round + /// @param _round number + /// @return uint the end time of the given round + function getRoundEndTime(uint _round) public view returns (uint) { + return firstRoundStartTime + _round * roundLength; + } + + /// @notice Return the round to which a market belongs to + /// @param market to get the round for + /// @return _round the round which the market belongs to + function getMarketRound(address market) public view returns (uint _round) { + ISportPositionalMarket marketContract = ISportPositionalMarket(market); + (uint maturity, ) = marketContract.times(); + if (maturity > firstRoundStartTime) { + _round = (maturity - firstRoundStartTime) / roundLength + 1; + } else { + _round = 1; + } + } + + /* ========== INTERNAL FUNCTIONS ========== */ + + function _transformCollateral(uint value) internal view returns (uint) { + if (needsTransformingCollateral) { + return value / 1e12; + } else { + return value; + } + } + + function _depositAsDefault( + uint amount, + address roundPool, + uint _round + ) internal { + require(defaultLiquidityProvider != address(0), "default liquidity provider not set"); + + sUSD.safeTransferFrom(defaultLiquidityProvider, roundPool, amount); + + balancesPerRound[_round][defaultLiquidityProvider] += amount; + allocationPerRound[_round] += amount; + + emit Deposited(defaultLiquidityProvider, amount, _round); + } + + function _getOrCreateRoundPool(uint _round) internal returns (address roundPool) { + roundPool = roundPools[_round]; + if (roundPool == address(0)) { + require(poolRoundMastercopy != address(0), "Round pool mastercopy not set"); + SportAMMLiquidityPoolRound newRoundPool = SportAMMLiquidityPoolRound(Clones.clone(poolRoundMastercopy)); + newRoundPool.initialize(address(this), sUSD, _round, getRoundEndTime(_round), getRoundEndTime(_round + 1)); + roundPool = address(newRoundPool); + roundPools[_round] = roundPool; + emit RoundPoolCreated(_round, roundPool); + } + } + + /* ========== SETTERS ========== */ + + function setPaused(bool _setPausing) external onlyOwner { + _setPausing ? _pause() : _unpause(); + } + + /// @notice Set onlyWhitelistedStakersAllowed variable + /// @param flagToSet self explanatory + function setOnlyWhitelistedStakersAllowed(bool flagToSet) external onlyOwner { + onlyWhitelistedStakersAllowed = flagToSet; + } + + /// @notice setNeedsTransformingCollateral sets needsTransformingCollateral value + /// @param _needsTransformingCollateral boolen value to be set + function setNeedsTransformingCollateral(bool _needsTransformingCollateral) external onlyOwner { + needsTransformingCollateral = _needsTransformingCollateral; + } + + /// @notice Set _poolRoundMastercopy + /// @param _poolRoundMastercopy to clone round pools from + function setPoolRoundMastercopy(address _poolRoundMastercopy) external onlyOwner { + poolRoundMastercopy = _poolRoundMastercopy; + emit PoolRoundMastercopyChanged(poolRoundMastercopy); + } + + /// @notice Set _stakedThalesMultiplier + /// @param _stakedThalesMultiplier the number of sUSD one can deposit per THALES staked + function setStakedThalesMultiplier(uint _stakedThalesMultiplier) external onlyOwner { + stakedThalesMultiplier = _stakedThalesMultiplier; + emit StakedThalesMultiplierChanged(_stakedThalesMultiplier); + } + + /// @notice Set IStakingThales contract + /// @param _stakingThales IStakingThales address + function setStakingThales(IStakingThales _stakingThales) external onlyOwner { + stakingThales = _stakingThales; + emit StakingThalesChanged(address(_stakingThales)); + } + + /// @notice Set max allowed deposit + /// @param _maxAllowedDeposit Deposit value + function setMaxAllowedDeposit(uint _maxAllowedDeposit) external onlyOwner { + maxAllowedDeposit = _maxAllowedDeposit; + emit MaxAllowedDepositChanged(_maxAllowedDeposit); + } + + /// @notice Set min allowed deposit + /// @param _minDepositAmount Deposit value + function setMinAllowedDeposit(uint _minDepositAmount) external onlyOwner { + minDepositAmount = _minDepositAmount; + emit MinAllowedDepositChanged(_minDepositAmount); + } + + /// @notice Set _maxAllowedUsers + /// @param _maxAllowedUsers Deposit value + function setMaxAllowedUsers(uint _maxAllowedUsers) external onlyOwner { + maxAllowedUsers = _maxAllowedUsers; + emit MaxAllowedUsersChanged(_maxAllowedUsers); + } + + /// @notice Set ThalesAMM contract + /// @param _sportAMM ThalesAMM address + function setSportAmm(ISportsAMM _sportAMM) external onlyOwner { + sportsAMM = _sportAMM; + sUSD.approve(address(sportsAMM), type(uint256).max); + emit SportAMMChanged(address(_sportAMM)); + } + + /// @notice Set defaultLiquidityProvider wallet + /// @param _defaultLiquidityProvider default liquidity provider + function setDefaultLiquidityProvider(address _defaultLiquidityProvider) external onlyOwner { + defaultLiquidityProvider = _defaultLiquidityProvider; + emit DefaultLiquidityProviderChanged(_defaultLiquidityProvider); + } + + /// @notice Set length of rounds + /// @param _roundLength Length of a round in miliseconds + function setRoundLength(uint _roundLength) external onlyOwner { + require(!started, "Can't change round length after start"); + roundLength = _roundLength; + emit RoundLengthChanged(_roundLength); + } + + /// @notice This method only serves as a failsafe to extract tokens from a pool round contract + /// @param tokens to iterate and transfer + /// @param account Address where to send the tokens + /// @param amount Amount of tokens to be sent + /// @param pool where to transfer from + /// @param all ignore amount and send whole balance + function transferTokensFromLiquidityPool( + address[] calldata tokens, + address payable account, + uint amount, + bool all, + address pool + ) external onlyOwner { + require(tokens.length > 0, "tokens array cant be empty"); + for (uint256 index = 0; index < tokens.length; index++) { + if (all) { + IERC20Upgradeable(tokens[index]).safeTransferFrom( + pool, + account, + IERC20Upgradeable(tokens[index]).balanceOf(pool) + ); + } else { + IERC20Upgradeable(tokens[index]).safeTransferFrom(pool, account, amount); + } + } + } + + /// @notice This method only serves as a failsafe to extract tokens from this contract + /// @param tokens to iterate and transfer + /// @param account Address where to send the tokens + /// @param amount Amount of tokens to be sent + /// @param all ignore amount and send whole balance + function transferTokens( + address[] calldata tokens, + address payable account, + uint amount, + bool all + ) external onlyOwner { + require(tokens.length > 0, "Whitelisted addresses cannot be empty"); + for (uint256 index = 0; index < tokens.length; index++) { + if (all) { + IERC20Upgradeable(tokens[index]).safeTransfer( + account, + IERC20Upgradeable(tokens[index]).balanceOf(address(this)) + ); + } else { + IERC20Upgradeable(tokens[index]).safeTransfer(account, amount); + } + } + } + + /// @notice set addresses which can deposit into the AMM bypassing the staking checks + /// @param _whitelistedAddresses Addresses to set the whitelist flag for + /// @param _flag to set + function setWhitelistedAddresses(address[] calldata _whitelistedAddresses, bool _flag) external onlyOwner { + require(_whitelistedAddresses.length > 0, "Whitelisted addresses cannot be empty"); + for (uint256 index = 0; index < _whitelistedAddresses.length; index++) { + // only if current flag is different, if same skip it + if (whitelistedDeposits[_whitelistedAddresses[index]] != _flag) { + whitelistedDeposits[_whitelistedAddresses[index]] = _flag; + emit AddedIntoWhitelist(_whitelistedAddresses[index], _flag); + } + } + } + + /// @notice set addresses which can deposit into the AMM when only whitelisted stakers are allowed + /// @param _whitelistedAddresses Addresses to set the whitelist flag for + /// @param _flag to set + function setWhitelistedStakerAddresses(address[] calldata _whitelistedAddresses, bool _flag) external onlyOwner { + require(_whitelistedAddresses.length > 0, "Whitelisted addresses cannot be empty"); + for (uint256 index = 0; index < _whitelistedAddresses.length; index++) { + // only if current flag is different, if same skip it + if (whitelistedStakers[_whitelistedAddresses[index]] != _flag) { + whitelistedStakers[_whitelistedAddresses[index]] = _flag; + emit AddedIntoWhitelistStaker(_whitelistedAddresses[index], _flag); + } + } + } + + /* ========== MODIFIERS ========== */ + + modifier canDeposit(uint amount) { + require(!withdrawalRequested[msg.sender], "Withdrawal is requested, cannot deposit"); + require(amount >= minDepositAmount, "Amount less than minDepositAmount"); + require(totalDeposited + amount <= maxAllowedDeposit, "Deposit amount exceeds AMM LP cap"); + _; + } + + modifier onlyAMM() { + require(msg.sender == address(sportsAMM), "only the AMM may perform these methods"); + _; + } + + /* ========== EVENTS ========== */ + event PoolStarted(); + event Deposited(address user, uint amount, uint round); + event WithdrawalRequested(address user); + event RoundClosed(uint round, uint roundPnL); + event Claimed(address user, uint amount); + event RoundPoolCreated(uint _round, address roundPool); + event PoolRoundMastercopyChanged(address newMastercopy); + event StakedThalesMultiplierChanged(uint _stakedThalesMultiplier); + event StakingThalesChanged(address stakingThales); + event MaxAllowedDepositChanged(uint maxAllowedDeposit); + event MinAllowedDepositChanged(uint minAllowedDeposit); + event MaxAllowedUsersChanged(uint MaxAllowedUsersChanged); + event SportAMMChanged(address sportAMM); + event DefaultLiquidityProviderChanged(address newProvider); + event AddedIntoWhitelist(address _whitelistAddress, bool _flag); + event AddedIntoWhitelistStaker(address _whitelistAddress, bool _flag); + event RoundLengthChanged(uint roundLength); +} diff --git a/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPoolRound.sol b/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPoolRound.sol new file mode 100644 index 000000000..c05b1915c --- /dev/null +++ b/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPoolRound.sol @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; + +import "../../interfaces/ISportPositionalMarket.sol"; + +import "./SportAMMLiquidityPool.sol"; + +contract SportAMMLiquidityPoolRound { + /* ========== LIBRARIES ========== */ + using SafeERC20Upgradeable for IERC20Upgradeable; + + /* ========== STATE VARIABLES ========== */ + + SportAMMLiquidityPool public liquidityPool; + IERC20Upgradeable public sUSD; + + uint public round; + uint public roundStartTime; + uint public roundEndTime; + + /* ========== CONSTRUCTOR ========== */ + + bool public initialized = false; + + function initialize( + address _liquidityPool, + IERC20Upgradeable _sUSD, + uint _round, + uint _roundStartTime, + uint _roundEndTime + ) external { + require(!initialized, "Already initialized"); + initialized = true; + liquidityPool = SportAMMLiquidityPool(_liquidityPool); + sUSD = _sUSD; + round = _round; + roundStartTime = _roundStartTime; + roundEndTime = _roundEndTime; + sUSD.approve(_liquidityPool, type(uint256).max); + } + + function exerciseMarketReadyToExercised(ISportPositionalMarket market) external onlyLiquidityPool { + if (market.resolved()) { + (uint homeBalance, uint awayBalance, uint drawBalance) = market.balancesOf(address(this)); + if (homeBalance > 0 || awayBalance > 0 || drawBalance > 0) { + market.exerciseOptions(); + } + } + } + + function moveOptions( + IERC20Upgradeable option, + uint optionsAmount, + address destination + ) external onlyLiquidityPool { + option.safeTransfer(destination, optionsAmount); + } + + modifier onlyLiquidityPool() { + require(msg.sender == address(liquidityPool), "only the Pool manager may perform these methods"); + _; + } +} diff --git a/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPoolRoundMastercopy.sol b/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPoolRoundMastercopy.sol new file mode 100644 index 000000000..7e1f2bb50 --- /dev/null +++ b/contracts/SportMarkets/LiquidityPool/SportAMMLiquidityPoolRoundMastercopy.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +// Internal references +import "./SportAMMLiquidityPoolRound.sol"; + +contract SportAMMLiquidityPoolRoundMastercopy is SportAMMLiquidityPoolRound { + constructor() { + // Freeze mastercopy on deployment so it can never be initialized with real arguments + initialized = true; + } +} diff --git a/contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol b/contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol index d57e00381..9fb5357ae 100644 --- a/contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol +++ b/contracts/SportMarkets/Parlay/ParlayMarketsAMM.sol @@ -74,11 +74,6 @@ contract ParlayMarketsAMM is Initializable, ProxyOwned, ProxyPausable, ProxyReen mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => mapping(address => uint)))))))) public riskPerGameCombination; - // @return specific SafeBoxFee per address - mapping(address => uint) public safeBoxFeePerAddress; - // @return specific parlayAmmFee per address - mapping(address => uint) public parlayAmmFeePerAddress; - function initialize( address _owner, ISportsAMM _sportsAmm, @@ -371,7 +366,7 @@ contract ParlayMarketsAMM is Initializable, ProxyOwned, ProxyPausable, ProxyReen _positions, _sUSDPaid ); - uint safeBoxAmount = _getSafeBoxAmount(_sUSDPaid, sUSDAfterFees, _differentRecipient); + uint safeBoxAmount = ((_sUSDPaid - sUSDAfterFees) * safeBoxImpact) / (safeBoxImpact + parlayAmmFee); // apply all checks require(_sUSDPaid >= minUSDAmount, "Low sUSD buy"); require(totalQuote >= maxSupportedOdds, "Can not create parlay market!"); @@ -553,23 +548,6 @@ contract ParlayMarketsAMM is Initializable, ProxyOwned, ProxyPausable, ProxyReen } } - function _getSafeBoxFeePerAddress(address toCheck) internal view returns (uint toReturn) { - return safeBoxFeePerAddress[toCheck] > 0 ? safeBoxFeePerAddress[toCheck] : safeBoxImpact; - } - - function _getParlayAmmFeePerAddress(address toCheck) internal view returns (uint toReturn) { - return parlayAmmFeePerAddress[toCheck] > 0 ? parlayAmmFeePerAddress[toCheck] : parlayAmmFee; - } - - function _getSafeBoxAmount( - uint sUSDPaid, - uint sUSDAfterFees, - address toCheck - ) internal view returns (uint safeBoxAmount) { - uint safeBoxFee = _getSafeBoxFeePerAddress(toCheck); - safeBoxAmount = ((sUSDPaid - sUSDAfterFees) * safeBoxFee) / (safeBoxFee + _getParlayAmmFeePerAddress(toCheck)); - } - /* ========== SETTERS FUNCTIONS ========== */ function setParlayMarketMastercopies(address _parlayMarketMastercopy) external onlyOwner { @@ -652,22 +630,6 @@ contract ParlayMarketsAMM is Initializable, ProxyOwned, ProxyPausable, ProxyReen maxAllowedPegSlippagePercentage = _maxAllowedPegSlippagePercentage; } - /// @notice Updates contract parametars - /// @param _address which has a specific safe box fee - /// @param newFee the fee - function setSafeBoxFeePerAddress(address _address, uint newFee) external onlyOwner { - safeBoxFeePerAddress[_address] = newFee; - emit SafeBoxFeePerAddressChanged(_address, newFee); - } - - /// @notice Updates contract parametars - /// @param _address which has a specific parlay amm fee - /// @param newFee the fee - function setParlayAmmFeePerAddress(address _address, uint newFee) external onlyOwner { - parlayAmmFeePerAddress[_address] = newFee; - emit ParlayAmmFeePerAddressChanged(_address, newFee); - } - /* ========== MODIFIERS ========== */ /* ========== EVENTS ========== */ @@ -703,6 +665,4 @@ contract ParlayMarketsAMM is Initializable, ProxyOwned, ProxyPausable, ProxyReen event ReferrerPaid(address refferer, address trader, uint amount, uint volume); event ExtraAmountTransferredDueToCancellation(address receiver, uint amount); event ParlayResolved(address _parlayMarket, address _parlayOwner, bool _userWon); - event SafeBoxFeePerAddressChanged(address _address, uint newFee); - event ParlayAmmFeePerAddressChanged(address _address, uint newFee); } diff --git a/contracts/SportMarkets/Parlay/ParlayVerifier.sol b/contracts/SportMarkets/Parlay/ParlayVerifier.sol index 9f3194502..b1738a4f9 100644 --- a/contracts/SportMarkets/Parlay/ParlayVerifier.sol +++ b/contracts/SportMarkets/Parlay/ParlayVerifier.sol @@ -11,7 +11,6 @@ import "../../interfaces/ISportPositionalMarketManager.sol"; import "../../interfaces/IStakingThales.sol"; import "../../interfaces/IReferrals.sol"; import "../../interfaces/ICurveSUSD.sol"; -import "../../interfaces/ITherundownConsumer.sol"; contract ParlayVerifier { uint private constant ONE = 1e18; diff --git a/contracts/SportMarkets/Rundown/GamesOddsObtainer.sol b/contracts/SportMarkets/Rundown/GamesOddsObtainer.sol index 4e90fe357..7cb03000d 100644 --- a/contracts/SportMarkets/Rundown/GamesOddsObtainer.sol +++ b/contracts/SportMarkets/Rundown/GamesOddsObtainer.sol @@ -53,6 +53,8 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { mapping(address => address) public currentActiveSpreadChildMarket; mapping(address => bool) public isSpreadChildMarket; mapping(address => bool) public childMarketCreated; + mapping(address => bool) public normalizedOddsForMarketFulfilled; + mapping(address => uint[]) public normalizedOddsForMarket; /* ========== CONSTRUCTOR ========== */ @@ -90,7 +92,7 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { oddsLastPulledForGame[_game.gameId] = block.timestamp; address _main = consumer.marketPerGameId(_game.gameId); - + _setNormalizedOdds(_main, _game.gameId, true); if (doesSportSupportSpreadAndTotal[_sportId]) { _obtainTotalAndSpreadOdds(_game, _main); } @@ -108,7 +110,7 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { !verifier.areOddsArrayInThreshold( _sportId, currentNormalizedOdd, - getNormalizedOdds(_game.gameId), + normalizedOddsForMarket[_main], consumer.isSportTwoPositionsSport(_sportId) ) ) { @@ -116,7 +118,7 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { backupOdds[_game.gameId] = currentOddsBeforeSave; emit OddsCircuitBreaker(_main, _game.gameId); } - emit GameOddsAdded(requestId, _game.gameId, _game, getNormalizedOdds(_game.gameId)); + emit GameOddsAdded(requestId, _game.gameId, _game, normalizedOddsForMarket[_main]); } else { address _main = consumer.marketPerGameId(_game.gameId); if (!sportsManager.isMarketPaused(_main)) { @@ -143,15 +145,24 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { oddsLastPulledForGame[_gameId] = block.timestamp; } + /// @notice set first odds on creation market + /// @param _gameId game id + /// @param _market market + function setFirstNormalizedOdds(bytes32 _gameId, address _market) external onlyConsumer { + _setNormalizedOdds(_market, _gameId, true); + } + /// @notice set backup odds to be main odds /// @param _gameId game id which is using backup odds function setBackupOddsAsMainOddsForGame(bytes32 _gameId) external onlyConsumer { gameOdds[_gameId] = backupOdds[_gameId]; + address _main = consumer.marketPerGameId(_gameId); + _setNormalizedOdds(_main, _gameId, true); emit GameOddsAdded( _gameId, // // no req. from CL (manual cancel) so just put gameID _gameId, gameOdds[_gameId], - getNormalizedOdds(_gameId) + normalizedOddsForMarket[_main] ); } @@ -180,19 +191,14 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { uint8 _homeScore, uint8 _awayScore ) external onlyConsumer { - if (_outcome == CANCELLED) { - for (uint i = 0; i < numberOfChildMarkets[_main]; i++) { - address child = mainMarketChildMarketIndex[_main][i]; + for (uint i = 0; i < numberOfChildMarkets[_main]; i++) { + address child = mainMarketChildMarketIndex[_main][i]; + if (_outcome == CANCELLED) { sportsManager.resolveMarket(child, _outcome); - } - } else { - for (uint i = 0; i < numberOfChildMarkets[_main]; i++) { - address child = mainMarketChildMarketIndex[_main][i]; - if (isSpreadChildMarket[child]) { - _resolveMarketSpread(child, uint16(_homeScore), uint16(_awayScore)); - } else { - _resolveMarketTotal(child, uint24(_homeScore), uint24(_awayScore)); - } + } else if (isSpreadChildMarket[child]) { + _resolveMarketSpread(child, uint16(_homeScore), uint16(_awayScore)); + } else { + _resolveMarketTotal(child, uint24(_homeScore), uint24(_awayScore)); } } } @@ -203,6 +209,33 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { /// @param _gameId game id for which game is looking /// @return uint[] odds array normalized function getNormalizedOdds(bytes32 _gameId) public view returns (uint[] memory) { + address market = consumer.marketPerGameId(_gameId); + return + normalizedOddsForMarketFulfilled[market] + ? normalizedOddsForMarket[market] + : getNormalizedOddsFromGameOddsStruct(_gameId); + } + + /// @notice view function which returns normalized odds (spread or total) up to 100 (Example: 55-45) + /// @param _market market + /// @return uint[] odds array normalized + function getNormalizedChildOdds(address _market) public view returns (uint[] memory) { + return + normalizedOddsForMarketFulfilled[_market] + ? normalizedOddsForMarket[_market] + : getNormalizedChildOddsFromGameOddsStruct(_market); + } + + /// @notice view function which returns normalized odds up to 100 (Example: 50-50) + /// @param _market market + /// @return uint[] odds array normalized + function getNormalizedOddsForMarket(address _market) public view returns (uint[] memory) { + return getNormalizedChildOdds(_market); + } + + /// @param _gameId game id for which game is looking + /// @return uint[] odds array normalized + function getNormalizedOddsFromGameOddsStruct(bytes32 _gameId) public view returns (uint[] memory) { int[] memory odds = new int[](3); odds[0] = gameOdds[_gameId].homeOdds; odds[1] = gameOdds[_gameId].awayOdds; @@ -213,7 +246,7 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { /// @notice view function which returns normalized odds (spread or total) up to 100 (Example: 55-45) /// @param _market market /// @return uint[] odds array normalized - function getNormalizedChildOdds(address _market) public view returns (uint[] memory) { + function getNormalizedChildOddsFromGameOddsStruct(address _market) public view returns (uint[] memory) { bytes32 gameId = gameIdPerChildMarket[_market]; int[] memory odds = new int[](2); odds[0] = isSpreadChildMarket[_market] ? gameOdds[gameId].spreadHomeOdds : gameOdds[gameId].totalOverOdds; @@ -221,13 +254,6 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { return verifier.calculateAndNormalizeOdds(odds); } - /// @notice view function which returns normalized odds up to 100 (Example: 50-50) - /// @param _market market - /// @return uint[] odds array normalized - function getNormalizedOddsForMarket(address _market) public view returns (uint[] memory) { - return getNormalizedChildOdds(_market); - } - /// @notice function which retrievers all markert addresses for given parent market /// @param _parent parent market /// @return address[] child addresses @@ -356,54 +382,60 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { address _main, bool _isSpread ) internal { - if (_isSpread) { - // no child market - if (numberOfChildMarkets[_main] == 0) { - _createMarketSpreadTotalMarket(_game.gameId, _main, true, _game.spreadHome, _game.totalOver); - // new spread no market -> create new pause old - } else if (mainMarketSpreadChildMarket[_main][_game.spreadHome] == address(0)) { - if (currentActiveSpreadChildMarket[_main] != address(0)) { - consumer.pauseOrUnpauseMarket(currentActiveSpreadChildMarket[_main], true); - } - _createMarketSpreadTotalMarket(_game.gameId, _main, true, _game.spreadHome, _game.totalOver); - // new spread arived, market exist -> unpause, pause old - } else if (mainMarketSpreadChildMarket[_main][_game.spreadHome] != currentActiveSpreadChildMarket[_main]) { - consumer.pauseOrUnpauseMarket(mainMarketSpreadChildMarket[_main][_game.spreadHome], false); - consumer.pauseOrUnpauseMarket(currentActiveSpreadChildMarket[_main], true); - _setCurrentChildMarkets(_main, mainMarketSpreadChildMarket[_main][_game.spreadHome], true); - // same spread arived, same market exist -> unpause - } else if (mainMarketSpreadChildMarket[_main][_game.spreadHome] == currentActiveSpreadChildMarket[_main]) { - consumer.pauseOrUnpauseMarket(mainMarketSpreadChildMarket[_main][_game.spreadHome], false); + bool isNewMarket = numberOfChildMarkets[_main] == 0; + + address currentActiveChildMarket = _isSpread + ? currentActiveSpreadChildMarket[_main] + : currentActiveTotalChildMarket[_main]; + + address currentMarket = _isSpread + ? mainMarketSpreadChildMarket[_main][_game.spreadHome] + : mainMarketTotalChildMarket[_main][_game.totalOver]; + + if (isNewMarket || currentMarket == address(0)) { + address newMarket = _createMarketSpreadTotalMarket( + _game.gameId, + _main, + _isSpread, + _game.spreadHome, + _game.totalOver + ); + + _setCurrentChildMarkets(_main, newMarket, _isSpread); + + if (currentActiveChildMarket != address(0)) { + consumer.pauseOrUnpauseMarket(currentActiveChildMarket, true); } + _setNormalizedOdds(newMarket, _game.gameId, false); + } else if (currentMarket != currentActiveChildMarket) { + consumer.pauseOrUnpauseMarket(currentMarket, false); + consumer.pauseOrUnpauseMarket(currentActiveChildMarket, true); + _setCurrentChildMarkets(_main, currentMarket, _isSpread); + _setNormalizedOdds(currentMarket, _game.gameId, false); } else { - // no child market - if (numberOfChildMarkets[_main] == 0) { - _createMarketSpreadTotalMarket(_game.gameId, _main, _isSpread, _game.spreadHome, _game.totalOver); - // new total no market -> create new pause old - } else if (mainMarketTotalChildMarket[_main][_game.totalOver] == address(0)) { - if (currentActiveTotalChildMarket[_main] != address(0)) { - consumer.pauseOrUnpauseMarket(currentActiveTotalChildMarket[_main], true); - } - _createMarketSpreadTotalMarket(_game.gameId, _main, _isSpread, _game.spreadHome, _game.totalOver); - // new total arived, market exist -> unpause, pause old - } else if (mainMarketTotalChildMarket[_main][_game.totalOver] != currentActiveTotalChildMarket[_main]) { - consumer.pauseOrUnpauseMarket(mainMarketTotalChildMarket[_main][_game.totalOver], false); - consumer.pauseOrUnpauseMarket(currentActiveTotalChildMarket[_main], true); - _setCurrentChildMarkets(_main, mainMarketTotalChildMarket[_main][_game.totalOver], false); - // same total arived, same market exist -> unpause - } else if (mainMarketTotalChildMarket[_main][_game.totalOver] == currentActiveTotalChildMarket[_main]) { - consumer.pauseOrUnpauseMarket(mainMarketTotalChildMarket[_main][_game.totalOver], false); - } + consumer.pauseOrUnpauseMarket(currentActiveChildMarket, false); + _setNormalizedOdds(currentActiveChildMarket, _game.gameId, false); } } + function _setNormalizedOdds( + address _market, + bytes32 _gameId, + bool _isParent + ) internal { + normalizedOddsForMarket[_market] = _isParent + ? getNormalizedOddsFromGameOddsStruct(_gameId) + : getNormalizedChildOddsFromGameOddsStruct(_market); + normalizedOddsForMarketFulfilled[_market] = true; + } + function _createMarketSpreadTotalMarket( bytes32 _gameId, address _mainMarket, bool _isSpread, int16 _spreadHome, uint24 _totalOver - ) internal { + ) internal returns (address _childMarket) { // create uint[] memory tags = _calculateTags(consumer.sportsIdPerGame(_gameId), _isSpread); sportsManager.createMarket( @@ -417,7 +449,7 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { _mainMarket ); - address _childMarket = sportsManager.getActiveMarketAddress(sportsManager.numActiveMarkets() - 1); + _childMarket = sportsManager.getActiveMarketAddress(sportsManager.numActiveMarkets() - 1); // adding child markets _setChildMarkets(_gameId, _mainMarket, _childMarket, _isSpread, _spreadHome, _totalOver, tags[1]); @@ -430,35 +462,24 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { return result; } - // "homeTeam(450) vs awayTeam HOME/AWAY" - // "homeTeam vs awayTeam - 20050 OVER/UNDER" function _append( bytes32 _gameId, bool _isSpread, int16 _spreadHome, uint24 _totalOver ) internal view returns (string memory) { - return - _isSpread - ? string( - abi.encodePacked( - consumer.getGameCreatedById(_gameId).homeTeam, - "(", - _parseSpread(_spreadHome), - ")", - " vs ", - consumer.getGameCreatedById(_gameId).awayTeam - ) - ) - : string( - abi.encodePacked( - consumer.getGameCreatedById(_gameId).homeTeam, - " vs ", - consumer.getGameCreatedById(_gameId).awayTeam, - " - ", - Strings.toString(_totalOver) - ) - ); + string memory teamVsTeam = string( + abi.encodePacked( + consumer.getGameCreatedById(_gameId).homeTeam, + " vs ", + consumer.getGameCreatedById(_gameId).awayTeam + ) + ); + if (_isSpread) { + return string(abi.encodePacked(teamVsTeam, "(", _parseSpread(_spreadHome), ")")); + } else { + return string(abi.encodePacked(teamVsTeam, " - ", Strings.toString(_totalOver))); + } } function _parseSpread(int16 _spreadHome) internal pure returns (string memory) { @@ -477,33 +498,43 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { if (_unpauseMain) { consumer.pauseOrUnpauseMarket(_main, _flag); } - // in number of childs more then 0 + if (numberOfChildMarkets[_main] > 0) { - // if pause pause all if (_flag) { for (uint i = 0; i < numberOfChildMarkets[_main]; i++) { consumer.pauseOrUnpauseMarket(mainMarketChildMarketIndex[_main][i], _flag); } - // if unpause check odds } else { if (_areTotalOddsValid(_game)) { - // if not exist create - if (mainMarketTotalChildMarket[_main][_game.totalOver] == address(0)) { - _createMarketSpreadTotalMarket(_game.gameId, _main, false, _game.spreadHome, _game.totalOver); - // if exist unpause + address totalChildMarket = mainMarketTotalChildMarket[_main][_game.totalOver]; + if (totalChildMarket == address(0)) { + address newMarket = _createMarketSpreadTotalMarket( + _game.gameId, + _main, + false, + _game.spreadHome, + _game.totalOver + ); + _setCurrentChildMarkets(_main, newMarket, false); } else { - consumer.pauseOrUnpauseMarket(mainMarketTotalChildMarket[_main][_game.totalOver], _flag); - _setCurrentChildMarkets(_main, mainMarketTotalChildMarket[_main][_game.totalOver], false); + consumer.pauseOrUnpauseMarket(totalChildMarket, _flag); + _setCurrentChildMarkets(_main, totalChildMarket, false); } } if (_areSpreadOddsValid(_game)) { - // if not exist create - if (mainMarketSpreadChildMarket[_main][_game.spreadHome] == address(0)) { - _createMarketSpreadTotalMarket(_game.gameId, _main, true, _game.spreadHome, _game.totalOver); - // if exist unpause + address spreadChildMarket = mainMarketSpreadChildMarket[_main][_game.spreadHome]; + if (spreadChildMarket == address(0)) { + address newMarket = _createMarketSpreadTotalMarket( + _game.gameId, + _main, + true, + _game.spreadHome, + _game.totalOver + ); + _setCurrentChildMarkets(_main, newMarket, true); } else { - consumer.pauseOrUnpauseMarket(mainMarketSpreadChildMarket[_main][_game.spreadHome], _flag); - _setCurrentChildMarkets(_main, mainMarketSpreadChildMarket[_main][_game.spreadHome], true); + consumer.pauseOrUnpauseMarket(spreadChildMarket, _flag); + _setCurrentChildMarkets(_main, spreadChildMarket, true); } } } @@ -571,17 +602,13 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { uint24 _awayScore ) internal { uint24 totalLine = childMarketTotal[_child]; - if ((_homeScore + _awayScore) * 100 > totalLine) { - sportsManager.resolveMarket(_child, HOME_WIN); - emit ResolveChildMarket(_child, HOME_WIN, childMarketMainMarket[_child], _homeScore, _awayScore); - } else if ((_homeScore + _awayScore) * 100 < totalLine) { - sportsManager.resolveMarket(_child, AWAY_WIN); - emit ResolveChildMarket(_child, AWAY_WIN, childMarketMainMarket[_child], _homeScore, _awayScore); - } else { - // total equal - sportsManager.resolveMarket(_child, CANCELLED); - emit ResolveChildMarket(_child, CANCELLED, childMarketMainMarket[_child], 0, 0); - } + + uint outcome = (_homeScore + _awayScore) * 100 > totalLine ? HOME_WIN : (_homeScore + _awayScore) * 100 < totalLine + ? AWAY_WIN + : CANCELLED; + + sportsManager.resolveMarket(_child, outcome); + emit ResolveChildMarket(_child, outcome, childMarketMainMarket[_child], _homeScore, _awayScore); } function _resolveMarketSpread( @@ -592,17 +619,11 @@ contract GamesOddsObtainer is Initializable, ProxyOwned, ProxyPausable { int16 homeScoreWithSpread = int16(_homeScore) * 100 + childMarketSread[_child]; int16 newAwayScore = int16(_awayScore) * 100; - if (homeScoreWithSpread > newAwayScore) { - sportsManager.resolveMarket(_child, HOME_WIN); - emit ResolveChildMarket(_child, HOME_WIN, childMarketMainMarket[_child], uint24(_homeScore), uint24(_awayScore)); - } else if (homeScoreWithSpread < newAwayScore) { - sportsManager.resolveMarket(_child, AWAY_WIN); - emit ResolveChildMarket(_child, AWAY_WIN, childMarketMainMarket[_child], uint24(_homeScore), uint24(_awayScore)); - } else { - // spread equal - sportsManager.resolveMarket(_child, CANCELLED); - emit ResolveChildMarket(_child, CANCELLED, childMarketMainMarket[_child], 0, 0); - } + uint outcome = homeScoreWithSpread > newAwayScore ? HOME_WIN : homeScoreWithSpread < newAwayScore + ? AWAY_WIN + : CANCELLED; + sportsManager.resolveMarket(_child, outcome); + emit ResolveChildMarket(_child, outcome, childMarketMainMarket[_child], uint24(_homeScore), uint24(_awayScore)); } /* ========== CONTRACT MANAGEMENT ========== */ diff --git a/contracts/SportMarkets/Rundown/TherundownConsumer.sol b/contracts/SportMarkets/Rundown/TherundownConsumer.sol index 5285d8dfe..5ea6edb3a 100644 --- a/contracts/SportMarkets/Rundown/TherundownConsumer.sol +++ b/contracts/SportMarkets/Rundown/TherundownConsumer.sol @@ -485,6 +485,8 @@ contract TherundownConsumer is Initializable, ProxyOwned, ProxyPausable { marketCreated[address(market)] = true; canMarketBeUpdated[address(market)] = true; + oddsObtainer.setFirstNormalizedOdds(game.gameId, address(market)); + queues.dequeueGamesCreated(); emit CreateSportsMarket(address(market), game.gameId, game, tags, oddsObtainer.getNormalizedOdds(game.gameId)); diff --git a/contracts/SportMarkets/SportsAMM.sol b/contracts/SportMarkets/SportsAMM.sol index 73458be68..571183b2c 100644 --- a/contracts/SportMarkets/SportsAMM.sol +++ b/contracts/SportMarkets/SportsAMM.sol @@ -21,7 +21,9 @@ import "../interfaces/ICurveSUSD.sol"; import "../interfaces/IReferrals.sol"; import "../interfaces/ISportsAMM.sol"; import "../interfaces/ITherundownConsumerWrapper.sol"; + import "./SportsAMMUtils.sol"; +import "./LiquidityPool/SportAMMLiquidityPool.sol"; /// @title Sports AMM contract /// @author kirilaa @@ -113,7 +115,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent /// @return the cap per sportID. based on the tagID mapping(uint => uint) public capPerSport; - SportsAMMUtils sportAmmUtils; + SportsAMMUtils public sportAmmUtils; /// @return the cap per market. based on the marketId mapping(address => uint) public capPerMarket; @@ -151,6 +153,9 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent address parentMarket; } + /// @return the adddress of the AMMLP contract + SportAMMLiquidityPool public liquidityPool; + /// @notice Initialize the storage in the proxy contract with the parameters. /// @param _owner Owner for using the ownerOnly functions /// @param _sUSD The payment token (sUSD) @@ -273,14 +278,24 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent uint _availableOtherSide = _getAvailableOtherSide(market, position); if (amount <= _available) { int skewImpact = _buyPriceImpact(market, position, amount, _available, _availableOtherSide); - baseOdds = useDefaultMinSpread - ? baseOdds + min_spread - : baseOdds + (min_spreadPerAddress[msg.sender] > 0 ? min_spreadPerAddress[msg.sender] : min_spread); + + baseOdds = baseOdds + _getMinSpreadToUse(useDefaultMinSpread, market); + int tempQuote = sportAmmUtils.calculateTempQuote(skewImpact, baseOdds, useSafeBoxSkewImpact, amount); returnQuote = ISportPositionalMarketManager(manager).transformCollateral(uint(tempQuote)); } } + function _getMinSpreadToUse(bool useDefaultMinSpread, address market) internal view returns (uint min_spreadToUse) { + min_spreadToUse = useDefaultMinSpread + ? min_spread + : (min_spreadPerAddress[msg.sender] > 0 ? min_spreadPerAddress[msg.sender] : min_spread); + bool isTwoPositional = ISportPositionalMarket(market).optionsCount() == 2; + if (isTwoPositional) { + min_spreadToUse = (min_spreadToUse * 3 * ONE) / (2 * ONE); + } + } + function _buyFromAMMQuoteDoubleChance( address market, ISportsAMM.Position position, @@ -290,11 +305,9 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent DoubleChanceStruct memory dcs ) internal view returns (uint returnQuote) { if (position == ISportsAMM.Position.Home) { - (uint baseOdds1, uint baseOdds2) = sportAmmUtils.getBaseOddsForDoubleChance(market); + (uint baseOdds1, uint baseOdds2) = sportAmmUtils.getBaseOddsForDoubleChance(market, minSupportedOdds); if (baseOdds1 > 0 && baseOdds2 > 0) { - baseOdds1 = baseOdds1 < minSupportedOdds ? minSupportedOdds : baseOdds1; - baseOdds2 = baseOdds2 < minSupportedOdds ? minSupportedOdds : baseOdds2; uint firstQuote = _buyFromAmmQuoteWithBaseOddsInternal( dcs.parentMarket, dcs.position1, @@ -353,7 +366,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent (uint balanceFirst, uint balanceSecond) = sportAmmUtils.getBalanceOfPositionsOnMarketByPositions( market, - address(this), + liquidityPool.getMarketPool(market), positionFirst, positionSecond ); @@ -450,12 +463,6 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent } } - /// @notice Read amm utils address - /// @return address return address - function getAmmUtils() external view returns (SportsAMMUtils) { - return sportAmmUtils; - } - /// @notice Obtains the oracle odds for `_position` of a given `_market` game. Odds do not contain price impact /// @param _market The address of the SportPositional market of a game /// @param _position The position (home/away/draw) to get the odds @@ -471,46 +478,23 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent if (ISportPositionalMarketManager(manager).isActiveMarket(market)) { (uint maturity, ) = ISportPositionalMarket(market).times(); if (maturity >= block.timestamp) { - uint timeLeftToMaturity = maturity - block.timestamp; - isTrading = timeLeftToMaturity > minimalTimeLeftToMaturity; + isTrading = (maturity - block.timestamp) > minimalTimeLeftToMaturity; } } } - /// @notice Checks if a `market` options can be excercised. Winners get the full options amount 1 option = 1 sUSD. - /// @param market The address of the SportPositional market of a game - /// @return canExercize true if market can be exercised, returns false market can not be exercised. - function canExerciseMaturedMarket(address market) public view returns (bool canExercize) { - canExercize = sportAmmUtils.getCanExercize(market, address(this)); - } - /// @notice Checks the default odds for a `_market`. These odds take into account the price impact. /// @param _market The address of the SportPositional market of a game /// @return odds Returns the default odds for the `_market` including the price impact. function getMarketDefaultOdds(address _market, bool isSell) public view returns (uint[] memory odds) { odds = new uint[](ISportPositionalMarket(_market).optionsCount()); if (isMarketInAMMTrading(_market)) { - ISportsAMM.Position position; for (uint i = 0; i < odds.length; i++) { - if (i == 0) { - position = ISportsAMM.Position.Home; - } else if (i == 1) { - position = ISportsAMM.Position.Away; - } else { - position = ISportsAMM.Position.Draw; - } - odds[i] = buyFromAmmQuote(_market, position, ONE); + odds[i] = buyFromAmmQuote(_market, ISportsAMM.Position(i), ONE); } } } - /// @notice Get sUSD amount bought from AMM by users for the market - /// @param market address of the market - /// @return uint - function getSpentOnGame(address market) public view returns (uint) { - return spentOnGame[market]; - } - // write methods /// @notice Buy amount of position for market/game from AMM using different collateral @@ -590,11 +574,28 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent _buyFromAMM(BuyFromAMMParams(market, position, amount, expectedPayout, additionalSlippage, true, 0)); } - /// @notice Exercise given market to retrieve sUSD - /// @param market to exercise - function exerciseMaturedMarket(address market) external { - require(canExerciseMaturedMarket(market), "No options to exercise"); - ISportPositionalMarket(market).exerciseOptions(); + /// @notice Send tokens from this contract to the destination address + /// @param tokens to iterate and transfer + /// @param account Address where to send the tokens + /// @param amount Amount of tokens to be sent + /// @param all ignore amount and send whole balance + function transferTokens( + address[] calldata tokens, + address payable account, + uint amount, + bool all + ) external onlyOwner { + require(tokens.length > 0, "tokens array cant be empty"); + for (uint256 index = 0; index < tokens.length; index++) { + if (all) { + IERC20Upgradeable(tokens[index]).safeTransfer( + account, + IERC20Upgradeable(tokens[index]).balanceOf(address(this)) + ); + } else { + IERC20Upgradeable(tokens[index]).safeTransfer(account, amount); + } + } } // setters @@ -615,7 +616,8 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent uint _maxSupportedOdds, uint _defaultCapPerGame, uint _safeBoxImpact, - uint _referrerFee + uint _referrerFee, + uint _threshold ) external onlyOwner { minimalTimeLeftToMaturity = _minimalTimeLeftToMaturity; min_spread = _minSpread; @@ -625,6 +627,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent defaultCapPerGame = _defaultCapPerGame; safeBoxImpact = _safeBoxImpact; referrerFee = _referrerFee; + thresholdForOddsUpdate = _threshold; emit ParametersUpdated( _minimalTimeLeftToMaturity, @@ -634,7 +637,8 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent _maxSupportedOdds, _defaultCapPerGame, _safeBoxImpact, - _referrerFee + _referrerFee, + _threshold ); } @@ -645,6 +649,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent /// @param _stakingThales Address of Staking contract /// @param _referrals contract for referrals storage /// @param _wrapper contract for calling wrapper contract + /// @param _lp contract for managing liquidity pools function setAddresses( address _safeBox, IERC20Upgradeable _sUSD, @@ -652,7 +657,8 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent IStakingThales _stakingThales, address _referrals, address _parlayAMM, - address _wrapper + address _wrapper, + address _lp ) external onlyOwner { safeBox = _safeBox; sUSD = _sUSD; @@ -661,13 +667,14 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent referrals = _referrals; parlayAMM = _parlayAMM; wrapper = ITherundownConsumerWrapper(_wrapper); + liquidityPool = SportAMMLiquidityPool(_lp); - emit AddressesUpdated(_safeBox, _sUSD, _theRundownConsumer, _stakingThales, _referrals, _parlayAMM, _wrapper); + emit AddressesUpdated(_safeBox, _sUSD, _theRundownConsumer, _stakingThales, _referrals, _parlayAMM, _wrapper, _lp); } /// @notice Setting the Sport Positional Manager contract address /// @param _manager Address of Staking contract - function setSportsPositionalMarketManager(address _manager) public onlyOwner { + function setSportsPositionalMarketManager(address _manager) external onlyOwner { if (address(_manager) != address(0)) { sUSD.approve(address(_manager), 0); } @@ -678,16 +685,15 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent /// @notice Updates contract parametars /// @param _address which has a specific safe box fee - /// @param newFee the fee - function setSafeBoxFeePerAddress(address _address, uint newFee) external onlyOwner { - safeBoxFeePerAddress[_address] = newFee; - } - - /// @notice Updates contract parametars - /// @param _address which has a specific min_spread fee - /// @param newFee the fee - function setMinSpreadPerAddress(address _address, uint newFee) external onlyOwner { - min_spreadPerAddress[_address] = newFee; + /// @param newSBFee the SafeBox fee for address + /// @param newMSFee the min_spread fee for address + function setSafeBoxFeeAndMinSpreadPerAddress( + address _address, + uint newSBFee, + uint newMSFee + ) external onlyOwner { + safeBoxFeePerAddress[_address] = newSBFee; + min_spreadPerAddress[_address] = newMSFee; } /// @notice Setting the Curve collateral addresses for all collaterals @@ -719,11 +725,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent } function setPaused(bool _setPausing) external onlyOwner { - if (_setPausing) { - _pause(); - } else { - _unpause(); - } + _setPausing ? _pause() : _unpause(); } /// @notice Setting the Cap per Sport ID @@ -747,13 +749,6 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent emit SetCapPerSportAndChild(_sportID, _childID, _capPerChild); } - /// @notice Setting default odds updater treshold amount for payment - /// @param _threshold amount - function setThresholdForOddsUpdate(uint _threshold) external onlyOwner { - thresholdForOddsUpdate = _threshold; - emit SetThresholdForOddsUpdate(_threshold); - } - /// @notice Setting the Cap per spec. market /// @param _markets market addresses /// @param _capPerMarket The cap amount used for the specific markets @@ -762,7 +757,6 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent msg.sender == owner || ISportPositionalMarketManager(manager).isWhitelistedAddress(msg.sender), "Invalid sender" ); - require(_capPerMarket < defaultCapPerGame * 2, "Must be less then double default"); for (uint i; i < _markets.length; i++) { capPerMarket[_markets[i]] = _capPerMarket; emit SetCapPerMarket(_markets[i], _capPerMarket); @@ -779,13 +773,6 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent } } - /// @notice Retrive all sUSD funds of the SportsAMM contract, in case of destroying - /// @param account Address where to send the funds - /// @param amount Amount of sUSD to be sent - function retrieveSUSDAmount(address payable account, uint amount) external onlyOwner { - sUSD.safeTransfer(account, amount); - } - /// @notice Updates contract parametars /// @param _ammUtils address of AMMUtils function setAmmUtils(SportsAMMUtils _ammUtils) external onlyOwner { @@ -837,10 +824,10 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent require( maxAllowedPegSlippagePercentage > 0 && transformedCollateralForPegCheck >= (susdQuote * (ONE - (maxAllowedPegSlippagePercentage))) / ONE, - "Amount below max allowed peg slippage" + "Max peg slippage" ); - require((collateralQuote * ONE) / (expectedPayout) <= (ONE + additionalSlippage), "Slippage too high!"); + require((collateralQuote * ONE) / (expectedPayout) <= (ONE + additionalSlippage), "High slippage"); IERC20Upgradeable collateralToken = IERC20Upgradeable(collateral); collateralToken.safeTransferFrom(msg.sender, address(this), collateralQuote); @@ -850,19 +837,23 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent } function _buyFromAMM(BuyFromAMMParams memory params) internal { - require(isMarketInAMMTrading(params.market), "Not in Trading"); + require(isMarketInAMMTrading(params.market), "Not trading"); uint optionsCount = ISportPositionalMarket(params.market).optionsCount(); - require(optionsCount > uint(params.position), "Invalid position"); + require(optionsCount > uint(params.position), "Invalid pos"); DoubleChanceStruct memory dcs = _getDoubleChanceStruct(params.market); - require(!dcs.isDoubleChance || params.position == ISportsAMM.Position.Home, "Invalid position"); + require(!dcs.isDoubleChance || params.position == ISportsAMM.Position.Home, "Invalid pos"); uint baseOdds = _obtainOddsWithDC(params.market, params.position, dcs.isDoubleChance); require(baseOdds > 0, "No base odds"); baseOdds = baseOdds < minSupportedOdds ? minSupportedOdds : baseOdds; - uint availableInContract = sportAmmUtils.balanceOfPositionOnMarket(params.market, params.position, address(this)); + uint availableInContract = sportAmmUtils.balanceOfPositionOnMarket( + params.market, + params.position, + liquidityPool.getMarketPool(params.market) + ); uint availableToBuyFromAMMatm = _availableToBuyFromAMMInternal( params.market, params.position, @@ -871,10 +862,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent true, dcs ); - require( - params.amount > ZERO_POINT_ONE && params.amount <= availableToBuyFromAMMatm, - "Low liquidity || 0 params.amount" - ); + require(params.amount > ZERO_POINT_ONE && params.amount <= availableToBuyFromAMMatm, "Low liquidity || 0"); if (params.sendSUSD) { params.sUSDPaid = _buyFromAmmQuoteWithBaseOdds( @@ -888,10 +876,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent false, dcs ); - require( - (params.sUSDPaid * ONE) / params.expectedPayout <= (ONE + params.additionalSlippage), - "Slippage too high" - ); + require((params.sUSDPaid * ONE) / params.expectedPayout <= (ONE + params.additionalSlippage), "High slippage"); sUSD.safeTransferFrom(msg.sender, address(this), params.sUSDPaid); } @@ -903,27 +888,27 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent params.market ); + _getDoubleChanceOptions(params.amount, parentMarketPosition1, params.market); + _getDoubleChanceOptions(params.amount, parentMarketPosition2, params.market); + IERC20Upgradeable(parentMarketPosition1).safeTransfer(params.market, params.amount); IERC20Upgradeable(parentMarketPosition2).safeTransfer(params.market, params.amount); } else { uint toMint = availableInContract < params.amount ? params.amount - availableInContract : 0; if (toMint > 0) { + liquidityPool.commitTrade(params.market, toMint); ISportPositionalMarket(params.market).mint(toMint); spentOnGame[params.market] = spentOnGame[params.market] + toMint; } + liquidityPool.getOptionsForBuy(params.market, params.amount - toMint, params.position); } (IPosition home, IPosition away, IPosition draw) = ISportPositionalMarket(params.market).getOptions(); IPosition target = params.position == ISportsAMM.Position.Home ? home : params.position == ISportsAMM.Position.Away ? away : draw; - IERC20Upgradeable(address(target)).safeTransfer(msg.sender, params.amount); - if (address(stakingThales) != address(0)) { - stakingThales.updateVolume(msg.sender, params.sUSDPaid); - } - if ( !dcs.isDoubleChance && thresholdForOddsUpdate > 0 && (params.amount - params.sUSDPaid) >= thresholdForOddsUpdate ) { @@ -936,6 +921,14 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent msg.sender ); + _sendMintedPositionsAndUSDToLiquidityPool( + dcs.isDoubleChance ? address(ISportPositionalMarket(params.market).parentMarket()) : params.market + ); + + if (address(stakingThales) != address(0)) { + stakingThales.updateVolume(msg.sender, params.sUSDPaid); + } + emit BoughtFromAmm( msg.sender, params.market, @@ -947,6 +940,21 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent ); } + function _getDoubleChanceOptions( + uint amount, + address position, + address market + ) internal { + uint balanceHeld = IERC20Upgradeable(position).balanceOf(address(this)); + if (amount > balanceHeld) { + liquidityPool.getOptionsForBuyByAddress( + address(ISportPositionalMarket(market).parentMarket()), + amount - balanceHeld, + position + ); + } + } + function _availableToBuyFromAMMInternal( address market, ISportsAMM.Position position, @@ -979,7 +987,9 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent ) internal view returns (uint availableAmount) { if (baseOdds > 0 && baseOdds < maxSupportedOdds) { baseOdds = baseOdds + min_spread; - balance = useBalance ? balance : sportAmmUtils.balanceOfPositionOnMarket(market, position, address(this)); + balance = useBalance + ? balance + : sportAmmUtils.balanceOfPositionOnMarket(market, position, liquidityPool.getMarketPool(market)); availableAmount = sportAmmUtils.calculateAvailableToBuy( _calculateCapToBeUsed(market), @@ -994,8 +1004,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent function _obtainOdds(address _market, ISportsAMM.Position _position) internal view returns (uint) { if (ISportPositionalMarketManager(manager).isDoubleChanceMarket(_market)) { if (_position == ISportsAMM.Position.Home) { - (uint oddsPosition1, uint oddsPosition2) = sportAmmUtils.getBaseOddsForDoubleChance(_market); - return oddsPosition1 + oddsPosition2; + return sportAmmUtils.getBaseOddsForDoubleChanceSum(_market, minSupportedOdds); } } return sportAmmUtils.obtainOdds(_market, _position); @@ -1007,8 +1016,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent bool isDoubleChance ) internal view returns (uint) { if (isDoubleChance) { - (uint oddsPosition1, uint oddsPosition2) = sportAmmUtils.getBaseOddsForDoubleChance(_market); - return oddsPosition1 + oddsPosition2; + return sportAmmUtils.getBaseOddsForDoubleChanceSum(_market, minSupportedOdds); } return sportAmmUtils.obtainOdds(_market, _position); } @@ -1019,14 +1027,41 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent } } + function _sendMintedPositionsAndUSDToLiquidityPool(address market) internal { + address _liquidityPool = liquidityPool.getOrCreateMarketPool(market); + + if (sUSD.balanceOf(address(this)) > 0) { + sUSD.safeTransfer(_liquidityPool, sUSD.balanceOf(address(this))); + } + + (IPosition home, IPosition away, IPosition draw) = ISportPositionalMarket(market).getOptions(); + + (uint homeBalance, uint awayBalance, uint drawBalance) = sportAmmUtils.getBalanceOfPositionsOnMarket( + market, + address(this) + ); + + if (homeBalance > 0) { + IERC20Upgradeable(address(home)).safeTransfer(_liquidityPool, homeBalance); + } + + if (awayBalance > 0) { + IERC20Upgradeable(address(away)).safeTransfer(_liquidityPool, awayBalance); + } + if (drawBalance > 0) { + IERC20Upgradeable(address(draw)).safeTransfer(_liquidityPool, drawBalance); + } + } + function _updateSpentOnMarketOnBuy( address market, uint sUSDPaid, address buyer ) internal { uint safeBoxShare; - if (safeBoxImpact > 0 && buyer != parlayAMM) { - safeBoxShare = sUSDPaid - (sUSDPaid * ONE) / (ONE + _getSafeBoxFeePerAddress(buyer)); + uint sbimpact = _getSafeBoxFeePerAddress(buyer); + if (sbimpact > 0) { + safeBoxShare = sUSDPaid - (sUSDPaid * ONE) / (ONE + sbimpact); sUSD.safeTransfer(safeBox, safeBoxShare); } @@ -1037,7 +1072,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent : (spentOnGame[market] = spentOnGame[market] - toSubtract); if (referrerFee > 0 && referrals != address(0)) { - uint referrerShare = sUSDPaid - ((sUSDPaid * ONE) / (ONE + (referrerFee))); + uint referrerShare = sUSDPaid - ((sUSDPaid * ONE) / (ONE + referrerFee)); _handleReferrer(buyer, referrerShare, sUSDPaid); } } @@ -1049,61 +1084,19 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent uint _availableToBuyFromAMM, uint _availableToBuyFromAMMOtherSide ) internal view returns (int priceImpact) { - (uint balancePosition, , uint balanceOtherSide) = sportAmmUtils.balanceOfPositionsOnMarket( - market, - position, - address(this) - ); - bool isTwoPositional = ISportPositionalMarket(market).optionsCount() == 2; - uint balancePositionAfter = balancePosition > amount ? balancePosition - amount : 0; - uint balanceOtherSideAfter = balancePosition > amount - ? balanceOtherSide - : balanceOtherSide + (amount - balancePosition); - if (amount <= balancePosition) { - priceImpact = sportAmmUtils.calculateDiscount( - SportsAMMUtils.DiscountParams( - balancePosition, - balanceOtherSide, + return + sportAmmUtils.getBuyPriceImpact( + SportsAMMUtils.PriceImpactParams( + market, + position, amount, + _availableToBuyFromAMM, _availableToBuyFromAMMOtherSide, - max_spread + liquidityPool, + max_spread, + minSupportedOdds ) ); - } else { - if (balancePosition > 0) { - uint pricePosition = _obtainOdds(market, position); - uint priceOtherPosition = isTwoPositional - ? _obtainOdds( - market, - position == ISportsAMM.Position.Home ? ISportsAMM.Position.Away : ISportsAMM.Position.Home - ) - : ONE - pricePosition; - priceImpact = sportAmmUtils.calculateDiscountFromNegativeToPositive( - SportsAMMUtils.NegativeDiscountsParams( - amount, - balancePosition, - balanceOtherSide, - _availableToBuyFromAMMOtherSide, - _availableToBuyFromAMM, - pricePosition, - priceOtherPosition, - max_spread - ) - ); - } else { - priceImpact = int( - sportAmmUtils.buyPriceImpactImbalancedSkew( - amount, - balanceOtherSide, - balancePosition, - balanceOtherSideAfter, - balancePositionAfter, - _availableToBuyFromAMM, - max_spread - ) - ); - } - } } function _handleReferrer( @@ -1125,7 +1118,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent ) internal { (uint availableInContract1, uint availableInContract2) = sportAmmUtils.getBalanceOfPositionsOnMarketByPositions( dcs.parentMarket, - address(this), + liquidityPool.getMarketPool(market), dcs.position1, dcs.position2 ); @@ -1136,6 +1129,7 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent uint toMint = toMintPosition1 < toMintPosition2 ? toMintPosition2 : toMintPosition1; if (toMint > 0) { + liquidityPool.commitTrade(dcs.parentMarket, toMint); ISportPositionalMarket(dcs.parentMarket).mint(toMint); spentOnGame[dcs.parentMarket] = spentOnGame[dcs.parentMarket] + toMint; } @@ -1151,17 +1145,16 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent } } - function _mapCollateralToCurveIndex(address collateral) internal view returns (int128) { + function _mapCollateralToCurveIndex(address collateral) internal view returns (int128 mappedValue) { if (collateral == dai) { - return 1; + mappedValue = 1; } if (collateral == usdc) { - return 2; + mappedValue = 2; } if (collateral == usdt) { - return 3; + mappedValue = 3; } - return 0; } // events @@ -1183,7 +1176,8 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent uint _maxSupportedOdds, uint _defaultCapPerGame, uint _safeBoxImpact, - uint _referrerFee + uint _referrerFee, + uint threshold ); event AddressesUpdated( address _safeBox, @@ -1192,13 +1186,13 @@ contract SportsAMM is Initializable, ProxyOwned, PausableUpgradeable, ProxyReent IStakingThales _stakingThales, address _referrals, address _parlayAMM, - address _wrapper + address _wrapper, + address _lp ); event SetSportsPositionalMarketManager(address _manager); event ReferrerPaid(address refferer, address trader, uint amount, uint volume); event SetCapPerSport(uint _sport, uint _cap); event SetCapPerMarket(address _market, uint _cap); - event SetThresholdForOddsUpdate(uint _threshold); event SetCapPerSportAndChild(uint _sport, uint _child, uint _cap); } diff --git a/contracts/SportMarkets/SportsAMMUtils.sol b/contracts/SportMarkets/SportsAMMUtils.sol index 8e3f5ee26..d808b491a 100644 --- a/contracts/SportMarkets/SportsAMMUtils.sol +++ b/contracts/SportMarkets/SportsAMMUtils.sol @@ -9,6 +9,8 @@ import "../interfaces/IPosition.sol"; import "../interfaces/ITherundownConsumer.sol"; import "../interfaces/ISportsAMM.sol"; +import "./LiquidityPool/SportAMMLiquidityPool.sol"; + /// @title Sports AMM utils contract SportsAMMUtils { uint private constant ONE = 1e18; @@ -43,6 +45,17 @@ contract SportsAMMUtils { uint max_spread; } + struct PriceImpactParams { + address market; + ISportsAMM.Position position; + uint amount; + uint _availableToBuyFromAMM; + uint _availableToBuyFromAMMOtherSide; + SportAMMLiquidityPool liquidityPool; + uint max_spread; + uint minSupportedOdds; + } + function buyPriceImpactImbalancedSkew( uint amount, uint balanceOtherSide, @@ -355,11 +368,98 @@ contract SportsAMMUtils { parentMarketPosition2 = address(position2); } - function getBaseOddsForDoubleChance(address market) public view returns (uint oddsPosition1, uint oddsPosition2) { + function getBaseOddsForDoubleChance(address market, uint minSupportedOdds) + public + view + returns (uint oddsPosition1, uint oddsPosition2) + { (ISportsAMM.Position position1, ISportsAMM.Position position2, address parentMarket) = getParentMarketPositions( market ); oddsPosition1 = obtainOdds(parentMarket, position1); oddsPosition2 = obtainOdds(parentMarket, position2); + + if (oddsPosition1 > 0 && oddsPosition2 > 0) { + oddsPosition1 = oddsPosition1 < minSupportedOdds ? minSupportedOdds : oddsPosition1; + oddsPosition2 = oddsPosition2 < minSupportedOdds ? minSupportedOdds : oddsPosition2; + } + } + + function getBaseOddsForDoubleChanceSum(address market, uint minSupportedOdds) public view returns (uint sum) { + (uint oddsPosition1, uint oddsPosition2) = getBaseOddsForDoubleChance(market, minSupportedOdds); + + sum = oddsPosition1 + oddsPosition2; + } + + function getBuyPriceImpact(PriceImpactParams memory params) public view returns (int priceImpact) { + (uint balancePosition, , uint balanceOtherSide) = balanceOfPositionsOnMarket( + params.market, + params.position, + params.liquidityPool.getMarketPool(params.market) + ); + bool isTwoPositional = ISportPositionalMarket(params.market).optionsCount() == 2; + uint balancePositionAfter = balancePosition > params.amount ? balancePosition - params.amount : 0; + uint balanceOtherSideAfter = balancePosition > params.amount + ? balanceOtherSide + : balanceOtherSide + (params.amount - balancePosition); + if (params.amount <= balancePosition) { + priceImpact = calculateDiscount( + DiscountParams( + balancePosition, + balanceOtherSide, + params.amount, + params._availableToBuyFromAMMOtherSide, + params.max_spread + ) + ); + } else { + if (balancePosition > 0) { + uint pricePosition = _obtainOdds(params.market, params.position, params.minSupportedOdds); + uint priceOtherPosition = isTwoPositional + ? _obtainOdds( + params.market, + params.position == ISportsAMM.Position.Home ? ISportsAMM.Position.Away : ISportsAMM.Position.Home, + params.minSupportedOdds + ) + : ONE - pricePosition; + priceImpact = calculateDiscountFromNegativeToPositive( + NegativeDiscountsParams( + params.amount, + balancePosition, + balanceOtherSide, + params._availableToBuyFromAMMOtherSide, + params._availableToBuyFromAMM, + pricePosition, + priceOtherPosition, + params.max_spread + ) + ); + } else { + priceImpact = int( + buyPriceImpactImbalancedSkew( + params.amount, + balanceOtherSide, + balancePosition, + balanceOtherSideAfter, + balancePositionAfter, + params._availableToBuyFromAMM, + params.max_spread + ) + ); + } + } + } + + function _obtainOdds( + address _market, + ISportsAMM.Position _position, + uint minSupportedOdds + ) internal view returns (uint) { + if (ISportPositionalMarket(_market).isDoubleChance()) { + if (_position == ISportsAMM.Position.Home) { + return getBaseOddsForDoubleChanceSum(_market, minSupportedOdds); + } + } + return obtainOdds(_market, _position); } } diff --git a/contracts/Vaults/AmmVault.sol b/contracts/Vaults/AmmVault.sol index d5b724eb9..118db0703 100644 --- a/contracts/Vaults/AmmVault.sol +++ b/contracts/Vaults/AmmVault.sol @@ -211,7 +211,7 @@ contract AmmVault is Initializable, ProxyOwned, PausableUpgradeable, ProxyReentr /// @notice Deposit funds from user into vault for the next round /// @param amount Value to be deposited - function deposit(uint amount) external canDeposit(amount) { + function deposit(uint amount) external canDeposit(amount) nonReentrant whenNotPaused { sUSD.safeTransferFrom(msg.sender, address(this), amount); uint nextRound = round + 1; @@ -239,7 +239,7 @@ contract AmmVault is Initializable, ProxyOwned, PausableUpgradeable, ProxyReentr emit Deposited(msg.sender, amount); } - function withdrawalRequest() external { + function withdrawalRequest() external nonReentrant whenNotPaused { require(vaultStarted, "Vault has not started"); require(!withdrawalRequested[msg.sender], "Withdrawal already requested"); require(balancesPerRound[round][msg.sender] > 0, "Nothing to withdraw"); diff --git a/contracts/interfaces/IGamesOddsObtainer.sol b/contracts/interfaces/IGamesOddsObtainer.sol index 8a209342f..50d1252c1 100644 --- a/contracts/interfaces/IGamesOddsObtainer.sol +++ b/contracts/interfaces/IGamesOddsObtainer.sol @@ -84,6 +84,8 @@ interface IGamesOddsObtainer { int24 _drawOdds ) external; + function setFirstNormalizedOdds(bytes32 _gameId, address _market) external; + function setBackupOddsAsMainOddsForGame(bytes32 _gameId) external; function pauseUnpauseChildMarkets(address _main, bool _flag) external; diff --git a/contracts/interfaces/IParlayMarketsAMM.sol b/contracts/interfaces/IParlayMarketsAMM.sol index 403e60018..0ff57e896 100644 --- a/contracts/interfaces/IParlayMarketsAMM.sol +++ b/contracts/interfaces/IParlayMarketsAMM.sol @@ -3,8 +3,6 @@ pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; -import "../SportMarkets/Parlay/ParlayVerifier.sol"; - interface IParlayMarketsAMM { /* ========== VIEWS / VARIABLES ========== */ @@ -14,18 +12,12 @@ interface IParlayMarketsAMM { function sportsAmm() external view returns (address); - function parlayVerifier() external view returns (ParlayVerifier); - function parlayAmmFee() external view returns (uint); function maxAllowedRiskPerCombination() external view returns (uint); function maxSupportedOdds() external view returns (uint); - function numActiveParlayMarkets() external view returns (uint); - - function activeParlayMarkets(uint index, uint pageSize) external view returns (address[] memory); - function riskPerCombination( address _sportMarkets1, uint _position1, @@ -48,12 +40,6 @@ interface IParlayMarketsAMM { address _sportMarkets8 ) external view returns (uint); - function canCreateParlayMarket( - address[] calldata _sportMarkets, - uint[] calldata _positions, - uint _sUSDToPay - ) external view returns (bool canBeCreated); - function isActiveParlay(address _parlayMarket) external view returns (bool isActiveParlayMarket); function exerciseParlay(address _parlayMarket) external; @@ -64,23 +50,6 @@ interface IParlayMarketsAMM { function resolveParlay() external; - function buyQuoteFromParlay( - address[] calldata _sportMarkets, - uint[] calldata _positions, - uint _sUSDPaid - ) - external - view - returns ( - uint sUSDAfterFees, - uint totalBuyAmount, - uint totalQuote, - uint initialQuote, - uint skewImpact, - uint[] memory finalQuotes, - uint[] memory amountsToBuy - ); - function buyFromParlay( address[] calldata _sportMarkets, uint[] calldata _positions, diff --git a/contracts/interfaces/ISportsAMM.sol b/contracts/interfaces/ISportsAMM.sol index 57c569e94..69365b928 100644 --- a/contracts/interfaces/ISportsAMM.sol +++ b/contracts/interfaces/ISportsAMM.sol @@ -45,6 +45,8 @@ interface ISportsAMM { function manager() external view returns (address); + function getLiquidityPool() external view returns (address); + function buyFromAMM( address market, Position position, diff --git a/contracts/interfaces/ISportsAMMLiquidityPool.sol b/contracts/interfaces/ISportsAMMLiquidityPool.sol new file mode 100644 index 000000000..331fe2f3a --- /dev/null +++ b/contracts/interfaces/ISportsAMMLiquidityPool.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.16; + +interface ISportsAMMLiquidityPool { + /* ========== VIEWS / VARIABLES ========== */ + + function isUserLPing(address user) external view returns (bool isUserInLP); +} diff --git a/contracts/test-helpers/MockStakingThales.sol b/contracts/test-helpers/MockStakingThales.sol new file mode 100644 index 000000000..be5b62364 --- /dev/null +++ b/contracts/test-helpers/MockStakingThales.sol @@ -0,0 +1,20 @@ +pragma solidity ^0.5.16; + +contract MockStakingThales { + mapping(address => uint) private _stakedBalances; + mapping(address => uint) public volume; + + constructor() public {} + + function stakedBalanceOf(address account) external view returns (uint) { + return _stakedBalances[account]; + } + + function stake(uint amount) external { + _stakedBalances[msg.sender] = amount; + } + + function updateVolume(address account, uint amount) external { + volume[msg.sender] = amount; + } +} diff --git a/scripts/abi/DefaultLiquidityProvider.json b/scripts/abi/DefaultLiquidityProvider.json new file mode 100644 index 000000000..867e9e37a --- /dev/null +++ b/scripts/abi/DefaultLiquidityProvider.json @@ -0,0 +1,206 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerNominated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_sportAMMLiquidityPool", + "type": "address" + } + ], + "name": "SetSportAMMLiquidityPool", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initNonReentrant", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "contract IERC20Upgradeable", + "name": "_sUSD", + "type": "address" + }, + { + "internalType": "address", + "name": "_sportAMMLiquidityPool", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "nominateNewOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "nominatedOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "retrieveSUSDAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sUSD", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sportAMMLiquidityPool", + "type": "address" + } + ], + "name": "setSportAMMLiquidityPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "proxyAddress", + "type": "address" + } + ], + "name": "transferOwnershipAtInit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/scripts/abi/GamesOddsObtainer.json b/scripts/abi/GamesOddsObtainer.json index b78ee12fe..bfc943c5a 100644 --- a/scripts/abi/GamesOddsObtainer.json +++ b/scripts/abi/GamesOddsObtainer.json @@ -1009,6 +1009,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_market", + "type": "address" + } + ], + "name": "getNormalizedChildOddsFromGameOddsStruct", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1047,6 +1066,25 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_gameId", + "type": "bytes32" + } + ], + "name": "getNormalizedOddsFromGameOddsStruct", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1278,6 +1316,49 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "normalizedOddsForMarket", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "normalizedOddsForMarketFulfilled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1527,6 +1608,24 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_gameId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_market", + "type": "address" + } + ], + "name": "setFirstNormalizedOdds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/scripts/abi/IGamesOddsObtainer.json b/scripts/abi/IGamesOddsObtainer.json index 1c0ab6488..a9e85756f 100644 --- a/scripts/abi/IGamesOddsObtainer.json +++ b/scripts/abi/IGamesOddsObtainer.json @@ -511,6 +511,24 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_gameId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_market", + "type": "address" + } + ], + "name": "setFirstNormalizedOdds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/scripts/abi/IParlayMarketsAMM.json b/scripts/abi/IParlayMarketsAMM.json index aa1d5488f..69fe63953 100644 --- a/scripts/abi/IParlayMarketsAMM.json +++ b/scripts/abi/IParlayMarketsAMM.json @@ -1,28 +1,4 @@ [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "pageSize", - "type": "uint256" - } - ], - "name": "activeParlayMarkets", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -61,94 +37,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_sportMarkets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_positions", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_sUSDPaid", - "type": "uint256" - } - ], - "name": "buyQuoteFromParlay", - "outputs": [ - { - "internalType": "uint256", - "name": "sUSDAfterFees", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBuyAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalQuote", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialQuote", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "skewImpact", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "finalQuotes", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "amountsToBuy", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_sportMarkets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_positions", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_sUSDToPay", - "type": "uint256" - } - ], - "name": "canCreateParlayMarket", - "outputs": [ - { - "internalType": "bool", - "name": "canBeCreated", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -225,19 +113,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "numActiveParlayMarkets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "parlayAmmFee", @@ -264,19 +139,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "parlayVerifier", - "outputs": [ - { - "internalType": "contract ParlayVerifier", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "resolveParlay", diff --git a/scripts/abi/ISportsAMM.json b/scripts/abi/ISportsAMM.json index 42a46b16d..719097890 100644 --- a/scripts/abi/ISportsAMM.json +++ b/scripts/abi/ISportsAMM.json @@ -143,6 +143,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getLiquidityPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/scripts/abi/ISportsAMMLiquidityPool.json b/scripts/abi/ISportsAMMLiquidityPool.json new file mode 100644 index 000000000..e86681a33 --- /dev/null +++ b/scripts/abi/ISportsAMMLiquidityPool.json @@ -0,0 +1,21 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isUserLPing", + "outputs": [ + { + "internalType": "bool", + "name": "isUserInLP", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/scripts/abi/MockStakingThales.json b/scripts/abi/MockStakingThales.json new file mode 100644 index 000000000..ca793021e --- /dev/null +++ b/scripts/abi/MockStakingThales.json @@ -0,0 +1,85 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stakedBalanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "updateVolume", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "volume", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/scripts/abi/ParlayMarketsAMM.json b/scripts/abi/ParlayMarketsAMM.json index b6f415c67..efea0a268 100644 --- a/scripts/abi/ParlayMarketsAMM.json +++ b/scripts/abi/ParlayMarketsAMM.json @@ -124,25 +124,6 @@ "name": "OwnerNominated", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newFee", - "type": "uint256" - } - ], - "name": "ParlayAmmFeePerAddressChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -267,25 +248,6 @@ "name": "ReferrerPaid", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newFee", - "type": "uint256" - } - ], - "name": "SafeBoxFeePerAddressChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -980,25 +942,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "parlayAmmFeePerAddress", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "parlayMarketData", @@ -1305,25 +1248,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "safeBoxFeePerAddress", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "safeBoxImpact", @@ -1477,24 +1401,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "internalType": "uint256", - "name": "newFee", - "type": "uint256" - } - ], - "name": "setParlayAmmFeePerAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1539,24 +1445,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "internalType": "uint256", - "name": "newFee", - "type": "uint256" - } - ], - "name": "setSafeBoxFeePerAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "sportManager", diff --git a/scripts/abi/ParlayVault.json b/scripts/abi/SportAMMLiquidityPool.json similarity index 74% rename from scripts/abi/ParlayVault.json rename to scripts/abi/SportAMMLiquidityPool.json index 3a481a7e4..5c458ae7b 100644 --- a/scripts/abi/ParlayVault.json +++ b/scripts/abi/SportAMMLiquidityPool.json @@ -5,17 +5,36 @@ { "indexed": false, "internalType": "address", - "name": "user", + "name": "_whitelistAddress", "type": "address" }, { "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "internalType": "bool", + "name": "_flag", + "type": "bool" } ], - "name": "Claimed", + "name": "AddedIntoWhitelist", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_whitelistAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_flag", + "type": "bool" + } + ], + "name": "AddedIntoWhitelistStaker", "type": "event" }, { @@ -34,7 +53,7 @@ "type": "uint256" } ], - "name": "Deposited", + "name": "Claimed", "type": "event" }, { @@ -42,25 +61,37 @@ "inputs": [ { "indexed": false, - "internalType": "uint256", - "name": "maxAllowedDeposit", - "type": "uint256" + "internalType": "address", + "name": "newProvider", + "type": "address" } ], - "name": "MaxAllowedDepositChanged", + "name": "DefaultLiquidityProviderChanged", "type": "event" }, { "anonymous": false, "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, { "indexed": false, "internalType": "uint256", - "name": "maxAllowedUsersChanged", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "round", "type": "uint256" } ], - "name": "MaxAllowedUsersChanged", + "name": "Deposited", "type": "event" }, { @@ -69,11 +100,11 @@ { "indexed": false, "internalType": "uint256", - "name": "maxMarketUsedInRoundCount", + "name": "maxAllowedDeposit", "type": "uint256" } ], - "name": "MaxMarketUsedInRoundCountChanged", + "name": "MaxAllowedDepositChanged", "type": "event" }, { @@ -82,11 +113,11 @@ { "indexed": false, "internalType": "uint256", - "name": "maxTradeRate", + "name": "MaxAllowedUsersChanged", "type": "uint256" } ], - "name": "MaxTradeRateChanged", + "name": "MaxAllowedUsersChanged", "type": "event" }, { @@ -140,11 +171,11 @@ { "indexed": false, "internalType": "address", - "name": "parlayAMM", + "name": "account", "type": "address" } ], - "name": "ParlayAMMChanged", + "name": "Paused", "type": "event" }, { @@ -153,11 +184,17 @@ { "indexed": false, "internalType": "address", - "name": "account", + "name": "newMastercopy", "type": "address" } ], - "name": "Paused", + "name": "PoolRoundMastercopyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "PoolStarted", "type": "event" }, { @@ -198,30 +235,17 @@ { "indexed": false, "internalType": "uint256", - "name": "SetMinTradeAmount", - "type": "uint256" - } - ], - "name": "SetMinTradeAmount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "priceLowerLimit", + "name": "_round", "type": "uint256" }, { "indexed": false, - "internalType": "uint256", - "name": "priceUpperLimit", - "type": "uint256" + "internalType": "address", + "name": "roundPool", + "type": "address" } ], - "name": "SetPriceLimits", + "name": "RoundPoolCreated", "type": "event" }, { @@ -230,11 +254,11 @@ { "indexed": false, "internalType": "address", - "name": "sUSD", + "name": "sportAMM", "type": "address" } ], - "name": "SetSUSD", + "name": "SportAMMChanged", "type": "event" }, { @@ -242,12 +266,12 @@ "inputs": [ { "indexed": false, - "internalType": "int256", - "name": "skewImpact", - "type": "int256" + "internalType": "uint256", + "name": "_stakedThalesMultiplier", + "type": "uint256" } ], - "name": "SetSkewImpactLimit", + "name": "StakedThalesMultiplierChanged", "type": "event" }, { @@ -263,25 +287,6 @@ "name": "StakingThalesChanged", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "parlayMarket", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sUSDPaid", - "type": "uint256" - } - ], - "name": "TradeExecuted", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -295,25 +300,6 @@ "name": "Unpaused", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - } - ], - "name": "UtilizationRateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "VaultStarted", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -353,25 +339,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allocationSpentInARound", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -409,28 +376,27 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "closeRound", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "capPerRound", - "outputs": [ + "internalType": "address", + "name": "market", + "type": "address" + }, { "internalType": "uint256", - "name": "", + "name": "amountToMint", "type": "uint256" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "closeRound", + "name": "commitTrade", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -478,6 +444,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "defaultLiquidityProvider", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -491,24 +470,87 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "exerciseMarketsReadyToExercised", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "firstRoundStartTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { "internalType": "address", - "name": "", + "name": "market", + "type": "address" + } + ], + "name": "getMarketPool", + "outputs": [ + { + "internalType": "address", + "name": "roundPool", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", "type": "address" } ], - "name": "depositReceipts", + "name": "getMarketRound", "outputs": [ { "internalType": "uint256", - "name": "round", + "name": "_round", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getMaxAvailableDepositForUser", + "outputs": [ + { + "internalType": "uint256", + "name": "maxDepositForUser", "type": "uint256" }, { "internalType": "uint256", - "name": "amount", + "name": "availableToDepositForUser", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stakedThalesForUser", "type": "uint256" } ], @@ -516,12 +558,18 @@ "type": "function" }, { - "inputs": [], - "name": "getAvailableToDeposit", + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getNeededStakedThalesToWithdrawForUser", "outputs": [ { "internalType": "uint256", - "name": "returned", + "name": "neededStaked", "type": "uint256" } ], @@ -530,18 +578,78 @@ }, { "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, { "internalType": "uint256", - "name": "_round", + "name": "optionsAmount", "type": "uint256" }, + { + "internalType": "enum ISportsAMM.Position", + "name": "position", + "type": "uint8" + } + ], + "name": "getOptionsForBuy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ { "internalType": "address", - "name": "user", + "name": "market", + "type": "address" + }, + { + "internalType": "uint256", + "name": "optionsAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "position", + "type": "address" + } + ], + "name": "getOptionsForBuyByAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", "type": "address" } ], - "name": "getBalancesPerRound", + "name": "getOrCreateMarketPool", + "outputs": [ + { + "internalType": "address", + "name": "roundPool", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + } + ], + "name": "getRoundEndTime", "outputs": [ { "internalType": "uint256", @@ -553,8 +661,14 @@ "type": "function" }, { - "inputs": [], - "name": "getCurrentRoundEnd", + "inputs": [ + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + } + ], + "name": "getRoundStartTime", "outputs": [ { "internalType": "uint256", @@ -565,6 +679,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "hasMarketsReadyToBeExercised", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "initNonReentrant", @@ -582,8 +709,8 @@ "type": "address" }, { - "internalType": "contract IParlayMarketsAMM", - "name": "_parlayAMM", + "internalType": "contract ISportsAMM", + "name": "_sportsAmm", "type": "address" }, { @@ -596,36 +723,11 @@ "name": "_roundLength", "type": "uint256" }, - { - "internalType": "uint256", - "name": "_priceLowerLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_priceUpperLimit", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "_skewImpactLimit", - "type": "int256" - }, { "internalType": "uint256", "name": "_maxAllowedDeposit", "type": "uint256" }, - { - "internalType": "uint256", - "name": "_utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxTradeRate", - "type": "uint256" - }, { "internalType": "uint256", "name": "_minDepositAmount", @@ -635,50 +737,16 @@ "internalType": "uint256", "name": "_maxAllowedUsers", "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minTradeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxMarketUsedInRoundCount", - "type": "uint256" } ], - "internalType": "struct ParlayVault.InitParams", + "internalType": "struct SportAMMLiquidityPool.InitParams", "name": "params", "type": "tuple" } ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "isTradingParlayMarketInARound", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { @@ -694,38 +762,31 @@ "type": "address" } ], - "name": "marketUsedInRoundCount", + "name": "isTradingMarketInARound", "outputs": [ { - "internalType": "uint256", + "internalType": "bool", "name": "", - "type": "uint256" + "type": "bool" } ], "stateMutability": "view", "type": "function" }, { - "inputs": [], - "name": "maxAllowedDeposit", - "outputs": [ + "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "internalType": "address", + "name": "user", + "type": "address" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxAllowedUsers", + "name": "isUserLPing", "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "internalType": "bool", + "name": "isUserInLP", + "type": "bool" } ], "stateMutability": "view", @@ -733,7 +794,7 @@ }, { "inputs": [], - "name": "maxMarketUsedInRoundCount", + "name": "maxAllowedDeposit", "outputs": [ { "internalType": "uint256", @@ -746,7 +807,7 @@ }, { "inputs": [], - "name": "maxTradeRate", + "name": "maxAllowedUsers", "outputs": [ { "internalType": "uint256", @@ -772,12 +833,12 @@ }, { "inputs": [], - "name": "minTradeAmount", + "name": "needsTransformingCollateral", "outputs": [ { - "internalType": "uint256", + "internalType": "bool", "name": "", - "type": "uint256" + "type": "bool" } ], "stateMutability": "view", @@ -811,12 +872,12 @@ }, { "inputs": [], - "name": "owner", + "name": "onlyWhitelistedStakersAllowed", "outputs": [ { - "internalType": "address", + "internalType": "bool", "name": "", - "type": "address" + "type": "bool" } ], "stateMutability": "view", @@ -824,10 +885,10 @@ }, { "inputs": [], - "name": "parlayAMM", + "name": "owner", "outputs": [ { - "internalType": "contract IParlayMarketsAMM", + "internalType": "address", "name": "", "type": "address" } @@ -835,30 +896,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_round", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_sportMarkets", - "type": "address[]" - } - ], - "name": "parlayExistsInARound", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "paused", @@ -874,25 +911,12 @@ }, { "inputs": [], - "name": "priceLowerLimit", + "name": "poolRoundMastercopy", "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "priceUpperLimit", - "outputs": [ - { - "internalType": "uint256", + "internalType": "address", "name": "", - "type": "uint256" + "type": "address" } ], "stateMutability": "view", @@ -951,12 +975,12 @@ "type": "uint256" } ], - "name": "roundStartTime", + "name": "roundPools", "outputs": [ { - "internalType": "uint256", + "internalType": "address", "name": "", - "type": "uint256" + "type": "address" } ], "stateMutability": "view", @@ -978,12 +1002,12 @@ { "inputs": [ { - "internalType": "uint256", - "name": "_maxAllowedDeposit", - "type": "uint256" + "internalType": "address", + "name": "_defaultLiquidityProvider", + "type": "address" } ], - "name": "setMaxAllowedDeposit", + "name": "setDefaultLiquidityProvider", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -992,11 +1016,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_maxAllowedUsers", + "name": "_maxAllowedDeposit", "type": "uint256" } ], - "name": "setMaxAllowedUsers", + "name": "setMaxAllowedDeposit", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1005,11 +1029,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_maxMarketUsedInRoundCount", + "name": "_maxAllowedUsers", "type": "uint256" } ], - "name": "setMaxMarketUsedInRoundCount", + "name": "setMaxAllowedUsers", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1018,11 +1042,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_maxTradeRate", + "name": "_minDepositAmount", "type": "uint256" } ], - "name": "setMaxTradeRate", + "name": "setMinAllowedDeposit", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1030,12 +1054,12 @@ { "inputs": [ { - "internalType": "uint256", - "name": "_minDepositAmount", - "type": "uint256" + "internalType": "bool", + "name": "_needsTransformingCollateral", + "type": "bool" } ], - "name": "setMinAllowedDeposit", + "name": "setNeedsTransformingCollateral", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1043,12 +1067,12 @@ { "inputs": [ { - "internalType": "uint256", - "name": "_minTradeAmount", - "type": "uint256" + "internalType": "bool", + "name": "flagToSet", + "type": "bool" } ], - "name": "setMinTradeAmount", + "name": "setOnlyWhitelistedStakersAllowed", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1069,12 +1093,12 @@ { "inputs": [ { - "internalType": "contract IParlayMarketsAMM", - "name": "_parlayAMM", - "type": "address" + "internalType": "bool", + "name": "_setPausing", + "type": "bool" } ], - "name": "setParlayAMM", + "name": "setPaused", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1082,17 +1106,12 @@ { "inputs": [ { - "internalType": "uint256", - "name": "_priceLowerLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_priceUpperLimit", - "type": "uint256" + "internalType": "address", + "name": "_poolRoundMastercopy", + "type": "address" } ], - "name": "setPriceLimits", + "name": "setPoolRoundMastercopy", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1113,12 +1132,25 @@ { "inputs": [ { - "internalType": "int256", - "name": "_skewImpactLimit", - "type": "int256" + "internalType": "contract ISportsAMM", + "name": "_sportAMM", + "type": "address" + } + ], + "name": "setSportAmm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_stakedThalesMultiplier", + "type": "uint256" } ], - "name": "setSkewImpactLimit", + "name": "setStakedThalesMultiplier", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1139,24 +1171,60 @@ { "inputs": [ { - "internalType": "uint256", - "name": "_utilizationRate", - "type": "uint256" + "internalType": "address[]", + "name": "_whitelistedAddresses", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "_flag", + "type": "bool" + } + ], + "name": "setWhitelistedAddresses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_whitelistedAddresses", + "type": "address[]" + }, + { + "internalType": "bool", + "name": "_flag", + "type": "bool" } ], - "name": "setUtilizationRate", + "name": "setWhitelistedStakerAddresses", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], - "name": "skewImpactLimit", + "name": "sportsAMM", + "outputs": [ + { + "internalType": "contract ISportsAMM", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stakedThalesMultiplier", "outputs": [ { - "internalType": "int256", + "internalType": "uint256", "name": "", - "type": "int256" + "type": "uint256" } ], "stateMutability": "view", @@ -1177,37 +1245,27 @@ }, { "inputs": [], - "name": "startVault", + "name": "start", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [ - { - "internalType": "address[]", - "name": "sportMarkets", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "positions", - "type": "uint256[]" - }, + "inputs": [], + "name": "started", + "outputs": [ { - "internalType": "uint256", - "name": "sUSDPaid", - "type": "uint256" + "internalType": "bool", + "name": "", + "type": "bool" } ], - "name": "trade", - "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { "inputs": [], - "name": "tradingAllocation", + "name": "totalDeposited", "outputs": [ { "internalType": "uint256", @@ -1231,7 +1289,7 @@ "type": "uint256" } ], - "name": "tradingParlayMarketsPerRound", + "name": "tradingMarketsPerRound", "outputs": [ { "internalType": "address", @@ -1255,6 +1313,67 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address payable", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "all", + "type": "bool" + } + ], + "name": "transferTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address payable", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "all", + "type": "bool" + }, + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "transferTokensFromLiquidityPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1281,7 +1400,7 @@ }, { "inputs": [], - "name": "usersCurrentlyInVault", + "name": "usersCurrentlyInPool", "outputs": [ { "internalType": "uint256", @@ -1317,21 +1436,33 @@ "type": "function" }, { - "inputs": [], - "name": "utilizationRate", + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "whitelistedDeposits", "outputs": [ { - "internalType": "uint256", + "internalType": "bool", "name": "", - "type": "uint256" + "type": "bool" } ], "stateMutability": "view", "type": "function" }, { - "inputs": [], - "name": "vaultStarted", + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "whitelistedStakers", "outputs": [ { "internalType": "bool", diff --git a/scripts/abi/SportAMMLiquidityPoolRound.json b/scripts/abi/SportAMMLiquidityPoolRound.json new file mode 100644 index 000000000..ca9235da0 --- /dev/null +++ b/scripts/abi/SportAMMLiquidityPoolRound.json @@ -0,0 +1,149 @@ +[ + { + "inputs": [ + { + "internalType": "contract ISportPositionalMarket", + "name": "market", + "type": "address" + } + ], + "name": "exerciseMarketReadyToExercised", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidityPool", + "type": "address" + }, + { + "internalType": "contract IERC20Upgradeable", + "name": "_sUSD", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_roundStartTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_roundEndTime", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityPool", + "outputs": [ + { + "internalType": "contract SportAMMLiquidityPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "option", + "type": "address" + }, + { + "internalType": "uint256", + "name": "optionsAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "moveOptions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "round", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "roundEndTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "roundStartTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sUSD", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/scripts/abi/SportAMMLiquidityPoolRoundMastercopy.json b/scripts/abi/SportAMMLiquidityPoolRoundMastercopy.json new file mode 100644 index 000000000..3e6920bd5 --- /dev/null +++ b/scripts/abi/SportAMMLiquidityPoolRoundMastercopy.json @@ -0,0 +1,154 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "contract ISportPositionalMarket", + "name": "market", + "type": "address" + } + ], + "name": "exerciseMarketReadyToExercised", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidityPool", + "type": "address" + }, + { + "internalType": "contract IERC20Upgradeable", + "name": "_sUSD", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_round", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_roundStartTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_roundEndTime", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityPool", + "outputs": [ + { + "internalType": "contract SportAMMLiquidityPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "option", + "type": "address" + }, + { + "internalType": "uint256", + "name": "optionsAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "moveOptions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "round", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "roundEndTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "roundStartTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sUSD", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/scripts/abi/SportsAMM.json b/scripts/abi/SportsAMM.json index edb538f42..3656ea11c 100644 --- a/scripts/abi/SportsAMM.json +++ b/scripts/abi/SportsAMM.json @@ -43,6 +43,12 @@ "internalType": "address", "name": "_wrapper", "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_lp", + "type": "address" } ], "name": "AddressesUpdated", @@ -179,6 +185,12 @@ "internalType": "uint256", "name": "_referrerFee", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "threshold", + "type": "uint256" } ], "name": "ParametersUpdated", @@ -304,19 +316,6 @@ "name": "SetSportsPositionalMarketManager", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_threshold", - "type": "uint256" - } - ], - "name": "SetThresholdForOddsUpdate", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -652,25 +651,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "canExerciseMaturedMarket", - "outputs": [ - { - "internalType": "bool", - "name": "canExercize", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -785,32 +765,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "exerciseMaturedMarket", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getAmmUtils", - "outputs": [ - { - "internalType": "contract SportsAMMUtils", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -835,25 +789,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "getSpentOnGame", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "initNonReentrant", @@ -918,6 +853,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "liquidityPool", + "outputs": [ + { + "internalType": "contract SportAMMLiquidityPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "manager", @@ -1143,24 +1091,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address payable", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "retrieveSUSDAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "sUSD", @@ -1255,6 +1185,11 @@ "internalType": "address", "name": "_wrapper", "type": "address" + }, + { + "internalType": "address", + "name": "_lp", + "type": "address" } ], "name": "setAddresses", @@ -1372,24 +1307,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "internalType": "uint256", - "name": "newFee", - "type": "uint256" - } - ], - "name": "setMinSpreadPerAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1444,6 +1361,11 @@ "internalType": "uint256", "name": "_referrerFee", "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_threshold", + "type": "uint256" } ], "name": "setParameters", @@ -1473,11 +1395,16 @@ }, { "internalType": "uint256", - "name": "newFee", + "name": "newSBFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMSFee", "type": "uint256" } ], - "name": "setSafeBoxFeePerAddress", + "name": "setSafeBoxFeeAndMinSpreadPerAddress", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1495,19 +1422,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_threshold", - "type": "uint256" - } - ], - "name": "setThresholdForOddsUpdate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -1527,6 +1441,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "sportAmmUtils", + "outputs": [ + { + "internalType": "contract SportsAMMUtils", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "stakingThales", @@ -1579,6 +1506,34 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address payable", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "all", + "type": "bool" + } + ], + "name": "transferTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/scripts/abi/SportsAMMUtils.json b/scripts/abi/SportsAMMUtils.json index df0fdd7c1..b32bb672d 100644 --- a/scripts/abi/SportsAMMUtils.json +++ b/scripts/abi/SportsAMMUtils.json @@ -415,6 +415,11 @@ "internalType": "address", "name": "market", "type": "address" + }, + { + "internalType": "uint256", + "name": "minSupportedOdds", + "type": "uint256" } ], "name": "getBaseOddsForDoubleChance", @@ -433,6 +438,91 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSupportedOdds", + "type": "uint256" + } + ], + "name": "getBaseOddsForDoubleChanceSum", + "outputs": [ + { + "internalType": "uint256", + "name": "sum", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum ISportsAMM.Position", + "name": "position", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_availableToBuyFromAMM", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_availableToBuyFromAMMOtherSide", + "type": "uint256" + }, + { + "internalType": "contract SportAMMLiquidityPool", + "name": "liquidityPool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "max_spread", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSupportedOdds", + "type": "uint256" + } + ], + "internalType": "struct SportsAMMUtils.PriceImpactParams", + "name": "params", + "type": "tuple" + } + ], + "name": "getBuyPriceImpact", + "outputs": [ + { + "internalType": "int256", + "name": "priceImpact", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/scripts/abi/StakingThales.json b/scripts/abi/StakingThales.json index 2b855a9cd..e8cc1bb2f 100644 --- a/scripts/abi/StakingThales.json +++ b/scripts/abi/StakingThales.json @@ -99,6 +99,12 @@ "internalType": "address", "name": "addressResolver", "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "sportsAMMLiquidityPool", + "type": "address" } ], "name": "AddressesChanged", @@ -1684,6 +1690,11 @@ "internalType": "address", "name": "_addressResolver", "type": "address" + }, + { + "internalType": "address", + "name": "_sportsAMMLiquidityPool", + "type": "address" } ], "name": "setAddresses", @@ -1897,6 +1908,21 @@ "stateMutability": "view", "type": "function" }, + { + "constant": true, + "inputs": [], + "name": "sportsAMMLiquidityPool", + "outputs": [ + { + "internalType": "contract ISportsAMMLiquidityPool", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, { "constant": false, "inputs": [ diff --git a/scripts/deployAMM/deployAMM.js b/scripts/deployAMM/deployAMM.js deleted file mode 100644 index ccacf2516..000000000 --- a/scripts/deployAMM/deployAMM.js +++ /dev/null @@ -1,237 +0,0 @@ -const { ethers, upgrades } = require('hardhat'); -const { getImplementationAddress } = require('@openzeppelin/upgrades-core'); -const snx = require('synthetix-2.50.4-ovm'); -const { artifacts, contract, web3 } = require('hardhat'); -const { getTargetAddress, setTargetAddress } = require('../helpers'); -const { toBytes32 } = require('../../index'); -const w3utils = require('web3-utils'); - -async function main() { - let networkObj = await ethers.provider.getNetwork(); - let network = networkObj.name; - let priceFeedAddress, ProxyERC20sUSDaddress; - - if (network == 'homestead') { - network = 'mainnet'; - } - - if (networkObj.chainId == 69) { - networkObj.name = 'optimisticKovan'; - network = 'optimisticKovan'; - } - - if (networkObj.chainId == 10) { - networkObj.name = 'optimisticEthereum'; - network = 'optimisticEthereum'; - } - - if (networkObj.chainId == 80001) { - networkObj.name = 'polygonMumbai'; - network = 'polygonMumbai'; - } - - if (networkObj.chainId == 137) { - networkObj.name = 'polygon'; - network = 'polygon'; - } - - if (networkObj.chainId == 56) { - networkObj.name = 'bsc'; - network = 'bsc'; - } - - if (networkObj.chainId == 42161) { - networkObj.name = 'arbitrumOne'; - network = 'arbitrumOne'; - } - - if (networkObj.chainId == 10) { - ProxyERC20sUSDaddress = getTargetAddress('ProxysUSD', network); - } else if (networkObj.chainId == 69) { - networkObj.name = 'optimisticKovan'; - ProxyERC20sUSDaddress = getTargetAddress('ProxysUSD', network); - } else if ( - networkObj.chainId == 80001 || - networkObj.chainId == 137 || - networkObj.chainId == 42161 - ) { - ProxyERC20sUSDaddress = getTargetAddress('ProxyUSDC', network); - } else if (networkObj.chainId == 56) { - ProxyERC20sUSDaddress = getTargetAddress('BUSD', network); - } else { - const ProxyERC20sUSD = snx.getTarget({ network, contract: 'ProxyERC20sUSD' }); - ProxyERC20sUSDaddress = ProxyERC20sUSD.address; - } - - const user_key1 = process.env.PRIVATE_KEY; - const owner = new ethers.Wallet(user_key1, ethers.provider); - - console.log('Owner is: ' + owner.address); - console.log('Network:' + network); - console.log('Network id:' + networkObj.chainId); - - priceFeedAddress = getTargetAddress('PriceFeed', network); - console.log('Found PriceFeed at:' + priceFeedAddress); - - const DeciMath = await ethers.getContractFactory('DeciMath'); - const deciMath = await DeciMath.deploy(); - await deciMath.deployed(); - - console.log('DeciMath deployed to:', deciMath.address); - setTargetAddress('DeciMath', network, deciMath.address); - - await delay(5000); - - const hour = 60 * 60; - const ThalesAMM = await ethers.getContractFactory('ThalesAMM'); - let ThalesAMM_deployed = await upgrades.deployProxy(ThalesAMM, [ - owner.address, - priceFeedAddress, - ProxyERC20sUSDaddress, - w3utils.toWei('100'), - deciMath.address, - w3utils.toWei('0.02'), - w3utils.toWei('0.20'), - hour * 24, - ]); - await ThalesAMM_deployed.deployed(); - - console.log('ThalesAMM proxy:', ThalesAMM_deployed.address); - - const ThalesAMMImplementation = await getImplementationAddress( - ethers.provider, - ThalesAMM_deployed.address - ); - - console.log('Implementation ThalesAMM: ', ThalesAMMImplementation); - - setTargetAddress('ThalesAMM', network, ThalesAMM_deployed.address); - setTargetAddress('ThalesAMMImplementation', network, ThalesAMMImplementation); - - let managerAddress = getTargetAddress('PositionalMarketManager', network); - - const PositionalMarketFactory = await ethers.getContractFactory('PositionalMarketFactory'); - let factoryAddress = getTargetAddress('PositionalMarketFactory', network); - const PositionalMarketFactoryInstance = await PositionalMarketFactory.attach(factoryAddress); - - await delay(5000); - - let tx = await ThalesAMM_deployed.setPositionalMarketManager(managerAddress); - await tx.wait().then((e) => { - console.log('ThalesAMM: setPositionalMarketManager'); - }); - - tx = await ThalesAMM_deployed.setImpliedVolatilityPerAsset( - toBytes32('ETH'), - w3utils.toWei('130') - ); - await tx.wait().then((e) => { - console.log('ThalesAMM: setImpliedVolatilityPerAsset(ETH, 130)'); - }); - - await delay(5000); - - tx = await ThalesAMM_deployed.setImpliedVolatilityPerAsset(toBytes32('BTC'), w3utils.toWei('96')); - await tx.wait().then((e) => { - console.log('ThalesAMM: setImpliedVolatilityPerAsset(BTC, 96)'); - }); - - await delay(5000); - - tx = await PositionalMarketFactoryInstance.setThalesAMM(ThalesAMM_deployed.address); - await tx.wait().then((e) => { - console.log('PositionalMarketFactoryInstance: setThalesAMM'); - }); - - await delay(5000); - //setLookupTables - tx = await deciMath.setLUT1(); - await tx.wait().then((e) => { - console.log('deciMath: setLUT1'); - }); - - await delay(5000); - tx = await deciMath.setLUT2(); - await tx.wait().then((e) => { - console.log('deciMath: setLUT2'); - }); - - await delay(5000); - tx = await deciMath.setLUT3_1(); - await tx.wait().then((e) => { - console.log('deciMath: setLUT3_1'); - }); - - await delay(5000); - tx = await deciMath.setLUT3_2(); - await tx.wait().then((e) => { - console.log('deciMath: setLUT3_2'); - }); - - await delay(5000); - tx = await deciMath.setLUT3_3(); - await tx.wait().then((e) => { - console.log('deciMath: setLUT3_3'); - }); - - await delay(5000); - tx = await deciMath.setLUT3_4(); - await tx.wait().then((e) => { - console.log('deciMath: setLUT3_4'); - }); - - await delay(5000); - const stakingThales = getTargetAddress('StakingThales', network); - if (stakingThales) { - tx = await ThalesAMM_deployed.setStakingThales(stakingThales); - await tx.wait().then((e) => { - console.log('ThalesAMM: setStakingThales()'); - }); - } - await delay(5000); - const safeBox = getTargetAddress('SafeBox', network); - tx = await ThalesAMM_deployed.setSafeBox(safeBox); - await tx.wait().then((e) => { - console.log('ThalesAMM: setSafeBox()'); - }); - - await delay(5000); - const safeBoxImpact = w3utils.toWei('0.01'); - tx = await ThalesAMM_deployed.setSafeBoxImpact(safeBoxImpact); - await tx.wait().then((e) => { - console.log('ThalesAMM: setSafeBoxImpact()'); - }); - await delay(5000); - await hre.run('verify:verify', { - address: deciMath.address, - }); - - try { - await hre.run('verify:verify', { - address: ThalesAMMImplementation, - }); - } catch (e) { - console.log(e); - } - - try { - await hre.run('verify:verify', { - address: ThalesAMM_deployed.address, - }); - } catch (e) { - console.log(e); - } -} - -main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); - -function delay(time) { - return new Promise(function (resolve) { - setTimeout(resolve, time); - }); -} diff --git a/scripts/deployEscrowAndStaking/upgrade_staking.js b/scripts/deployEscrowAndStaking/upgrade_staking.js index 888199e67..6bca75c5d 100644 --- a/scripts/deployEscrowAndStaking/upgrade_staking.js +++ b/scripts/deployEscrowAndStaking/upgrade_staking.js @@ -31,11 +31,17 @@ async function main() { if (networkObj.chainId == 69) { network = 'optimisticKovan'; } + if (networkObj.chainId == 420) { + networkObj.name = 'optimisticGoerli'; + network = 'optimisticGoerli'; + proxySUSD = getTargetAddress('ExoticUSD', network); + } + const StakingAddress = getTargetAddress('StakingThales', network); const StakingContract = await ethers.getContractFactory('StakingThales'); console.log('Address of staking: ', StakingAddress); - if (networkObj.chainId == 69) { + if (networkObj.chainId == 69 || networkObj.chainId == 420) { await upgrades.upgradeProxy(StakingAddress, StakingContract); await delay(5000); diff --git a/scripts/deploySportMarkets/deployRundown/deploy_TherundownConsumerVerifier.js b/scripts/deploySportMarkets/deployRundown/deploy_TherundownConsumerVerifier.js index aed35181e..069d0a4f5 100644 --- a/scripts/deploySportMarkets/deployRundown/deploy_TherundownConsumerVerifier.js +++ b/scripts/deploySportMarkets/deployRundown/deploy_TherundownConsumerVerifier.js @@ -67,86 +67,11 @@ async function main() { console.log('TherundownConsumer address: ', consumerAddress); - let invalidNames = [ - 'TBD', - 'TBD TBD', - 'TBD Away', - 'TBD Away TBD Away', - 'TBD Home', - 'TBD Home TBD Home', - 'TBA', - 'TBA TBA', - 'Opponent TBA', - 'Opponent TBA TBA', - '2B', - '2B 2B', - '1A', - '1A 1A', - '2D', - '2D 2D', - '1C', - '1C 1C', - '2C', - '2C 2C', - '1D', - '1D 1D', - '2A', - '2A 2A', - '1B', - '1B 1B', - '2F', - '2F 2F', - '1E', - '1E 1E', - '2H', - '2H 2H', - '1G', - '1G 1G', - '2E', - '2E 2E', - '1F', - '1F 1F', - '2G', - '2G 2G', - '1H', - '1H 1H', - 'Round of 16 6 winner', - 'Round of 16 6 winner Round of 16 6 winner', - 'Round of 16 5 winner', - 'Round of 16 5 winner Round of 16 5 winner', - 'Round of 16 2 winner', - 'Round of 16 2 winner Round of 16 2 winner', - 'Round of 16 1 winner', - 'Round of 16 1 winner Round of 16 1 winner', - 'Round of 16 8 winner', - 'Round of 16 8 winner Round of 16 8 winner', - 'Round of 16 7 winner', - 'Round of 16 7 winner Round of 16 7 winner', - 'Round of 16 4 winner', - 'Round of 16 4 winner Round of 16 4 winner', - 'Round of 16 3 winner', - 'Round of 16 3 winner Round of 16 3 winner', - 'Quarterfinal 2 Winner', - 'Quarterfinal 2 Winner Quarterfinal 2 Winner', - 'Quarterfinal 1 Winner', - 'Quarterfinal 1 Winner Quarterfinal 1 Winner', - 'Quarterfinal 4 Winner', - 'Quarterfinal 4 Winner Quarterfinal 4 Winner', - 'Quarterfinal 3 Winner', - 'Quarterfinal 3 Winner Quarterfinal 3 Winner', - 'semifinal 2 loser', - 'semifinal 2 loser semifinal 2 loser', - 'semifinal 1 loser', - 'semifinal 1 loser semifinal 1 loser', - 'semifinal 2 winner', - 'semifinal 2 winner semifinal 2 winner', - 'semifinal 1 winner', - 'semifinal 1 winner semifinal 1 winner', - ]; + let invalidNames = ['TBD', 'TBD TBD', 'TBA', 'TBA TBA', 'Opponent TBA', 'Opponent TBA TBA']; let supportedMarketTypes = ['create', 'resolve']; - const defaultOddsThreshold = 25; + const defaultOddsThreshold = 20; /* ========== DEPLOY CONTRACT ========== */ diff --git a/scripts/deploySportMarkets/deploySportsLiquidityPool/deployDefaultLP.js b/scripts/deploySportMarkets/deploySportsLiquidityPool/deployDefaultLP.js new file mode 100644 index 000000000..16b8d6e98 --- /dev/null +++ b/scripts/deploySportMarkets/deploySportsLiquidityPool/deployDefaultLP.js @@ -0,0 +1,107 @@ +const { ethers, upgrades } = require('hardhat'); +const { getImplementationAddress } = require('@openzeppelin/upgrades-core'); +const snx = require('synthetix-2.50.4-ovm'); +const { artifacts, contract, web3 } = require('hardhat'); +const { getTargetAddress, setTargetAddress } = require('../../helpers'); +const { toBytes32 } = require('../../../index'); +const w3utils = require('web3-utils'); + +const DAY = 24 * 60 * 60; +const MINUTE = 60; +const rate = w3utils.toWei('1'); + +async function main() { + let networkObj = await ethers.provider.getNetwork(); + let network = networkObj.name; + let thalesAddress, ProxyERC20sUSDaddress; + + let proxySUSD; + + if (network === 'unknown') { + network = 'localhost'; + } + + if (network == 'homestead') { + network = 'mainnet'; + } + + if (networkObj.chainId == 69) { + networkObj.name = 'optimisticKovan'; + network = 'optimisticKovan'; + } + if (networkObj.chainId == 10) { + networkObj.name = 'optimisticEthereum'; + network = 'optimisticEthereum'; + proxySUSD = getTargetAddress('ProxysUSD', network); + } + + if (networkObj.chainId == 80001) { + networkObj.name = 'polygonMumbai'; + network = 'polygonMumbai'; + } + + if (networkObj.chainId == 137) { + networkObj.name = 'polygon'; + network = 'polygon'; + } + + if (networkObj.chainId == 420) { + networkObj.name = 'optimisticGoerli'; + network = 'optimisticGoerli'; + proxySUSD = getTargetAddress('ExoticUSD', network); + } + + let accounts = await ethers.getSigners(); + let owner = accounts[0]; + + console.log('Owner is: ' + owner.address); + console.log('Network:' + network); + console.log('Network id:' + networkObj.chainId); + + const DefaultLiquidityProvider = await ethers.getContractFactory('DefaultLiquidityProvider'); + let DefaultLiquidityProviderDeployed = await upgrades.deployProxy(DefaultLiquidityProvider, [ + owner.address, + proxySUSD, + getTargetAddress('SportAMMLiquidityPool', network), + ]); + await DefaultLiquidityProviderDeployed.deployed(); + + console.log('DefaultLiquidityProvider proxy:', DefaultLiquidityProviderDeployed.address); + + const DefaultLiquidityProviderImplementation = await getImplementationAddress( + ethers.provider, + DefaultLiquidityProviderDeployed.address + ); + + console.log('Implementation DefaultLiquidityProvider: ', DefaultLiquidityProviderImplementation); + + setTargetAddress('DefaultLiquidityProvider', network, DefaultLiquidityProviderDeployed.address); + setTargetAddress( + 'DefaultLiquidityProviderImplementation', + network, + DefaultLiquidityProviderImplementation + ); + + delay(5000); + + try { + await hre.run('verify:verify', { + address: DefaultLiquidityProviderImplementation, + }); + } catch (e) { + console.log(e); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); + +function delay(time) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); +} diff --git a/scripts/deployVaults/ParlayVault/deploy.js b/scripts/deploySportMarkets/deploySportsLiquidityPool/deploy_SportAMMLiquidityPool.js similarity index 52% rename from scripts/deployVaults/ParlayVault/deploy.js rename to scripts/deploySportMarkets/deploySportsLiquidityPool/deploy_SportAMMLiquidityPool.js index 558210cee..7d3de675f 100644 --- a/scripts/deployVaults/ParlayVault/deploy.js +++ b/scripts/deploySportMarkets/deploySportsLiquidityPool/deploy_SportAMMLiquidityPool.js @@ -20,6 +20,10 @@ async function main() { network = 'mainnet'; } + if (networkObj.chainId == 69) { + networkObj.name = 'optimisticKovan'; + network = 'optimisticKovan'; + } if (networkObj.chainId == 10) { networkObj.name = 'optimisticEthereum'; network = 'optimisticEthereum'; @@ -46,41 +50,54 @@ async function main() { console.log('Network:' + network); console.log('Network id:' + networkObj.chainId); - let parlayAMM = getTargetAddress('ParlayAMM', network); + let sportsAMM = getTargetAddress('SportsAMM', network); console.log('Found ProxyERC20sUSD at:' + proxySUSD); - //const week = 7 * 24 * 60 * 60; - const week = 60 * 10; + const week = 7 * 24 * 60 * 60; - const Vault = await ethers.getContractFactory('ParlayVault'); - const vault = await upgrades.deployProxy(Vault, [ + const SportAMMLiquidityPool = await ethers.getContractFactory('SportAMMLiquidityPool'); + const sportAMMLiquidityPool = await upgrades.deployProxy(SportAMMLiquidityPool, [ { _owner: owner.address, - _parlayAMM: parlayAMM, + _sportsAmm: sportsAMM, _sUSD: proxySUSD, _roundLength: week, - _priceLowerLimit: w3utils.toWei('0.3'), - _priceUpperLimit: w3utils.toWei('0.95'), - _skewImpactLimit: w3utils.toWei('-0.2'), // -2% skew impact - _maxAllowedDeposit: w3utils.toWei('10000'), // 10k% max deposit per round - _utilizationRate: w3utils.toWei('0.50'), // 50% utilization rate - _maxTradeRate: w3utils.toWei('0.02'), // 2% max trade rate + _maxAllowedDeposit: w3utils.toWei('20000'), // 10k% max deposit per round _minDepositAmount: w3utils.toWei('20'), // min deposit _maxAllowedUsers: 100, // maximum 100 users allowed at a time in the vault - _minTradeAmount: w3utils.toWei('5'), // minimum trade amount - _maxMarketNumberPerRound: 5, // max market tickets per round }, ]); - await vault.deployed(); + await sportAMMLiquidityPool.deployed(); + + console.log('SportAMMLiquidityPool deployed to:', sportAMMLiquidityPool.address); + setTargetAddress('SportAMMLiquidityPool', network, sportAMMLiquidityPool.address); + + const implementation = await getImplementationAddress( + ethers.provider, + sportAMMLiquidityPool.address + ); + console.log('SportAMMLiquidityPoolImplementation: ', implementation); + setTargetAddress('SportAMMLiquidityPoolImplementation', network, implementation); - console.log('ParlayVault deployed to:', vault.address); - setTargetAddress('ParlayVault', network, vault.address); + const SportAMMLiquidityPoolRoundMastercopy = await ethers.getContractFactory( + 'SportAMMLiquidityPoolRoundMastercopy' + ); + const SportAMMLiquidityPoolRoundMastercopyDeployed = + await SportAMMLiquidityPoolRoundMastercopy.deploy(); + await SportAMMLiquidityPoolRoundMastercopyDeployed.deployed(); - const implementation = await getImplementationAddress(ethers.provider, vault.address); - console.log('ParlayVaultImplementation: ', implementation); - setTargetAddress('ParlayVaultImplementation', network, implementation); + console.log( + 'SportAMMLiquidityPoolRoundMastercopy deployed to:', + SportAMMLiquidityPoolRoundMastercopyDeployed.address + ); + + setTargetAddress( + 'SportAMMLiquidityPoolRoundMastercopy', + network, + SportAMMLiquidityPoolRoundMastercopyDeployed.address + ); try { await hre.run('verify:verify', { @@ -89,6 +106,14 @@ async function main() { } catch (e) { console.log(e); } + + try { + await hre.run('verify:verify', { + address: SportAMMLiquidityPoolRoundMastercopyDeployed.address, + }); + } catch (e) { + console.log(e); + } } main() diff --git a/scripts/deployVaults/ParlayVault/upgrade.js b/scripts/deploySportMarkets/deploySportsLiquidityPool/upgrade_SportAMMLiquidityPool.js similarity index 67% rename from scripts/deployVaults/ParlayVault/upgrade.js rename to scripts/deploySportMarkets/deploySportsLiquidityPool/upgrade_SportAMMLiquidityPool.js index ca0278033..3a6aeb777 100644 --- a/scripts/deployVaults/ParlayVault/upgrade.js +++ b/scripts/deploySportMarkets/deploySportsLiquidityPool/upgrade_SportAMMLiquidityPool.js @@ -46,19 +46,22 @@ async function main() { console.log('Account is: ' + owner.address); console.log('Network:' + network); - const vaultAddress = getTargetAddress('ParlayVault', network); - console.log('Found ParlayVault at:', vaultAddress); + const sportAMMLiquidityPoolAddress = getTargetAddress('SportAMMLiquidityPool', network); + console.log('Found SportAMMLiquidityPool at:', sportAMMLiquidityPoolAddress); - const Vault = await ethers.getContractFactory('ParlayVault'); - const implementation = await upgrades.prepareUpgrade(vaultAddress, Vault); + const SportAMMLiquidityPool = await ethers.getContractFactory('SportAMMLiquidityPool'); + const implementation = await upgrades.prepareUpgrade( + sportAMMLiquidityPoolAddress, + SportAMMLiquidityPool + ); if (networkObj.chainId == 420) { - await upgrades.upgradeProxy(vaultAddress, Vault); - console.log('Vault upgraded'); + await upgrades.upgradeProxy(sportAMMLiquidityPoolAddress, SportAMMLiquidityPool); + console.log('SportAMMLiquidityPool upgraded'); } - console.log('ParlayVaultImplementation: ', implementation); - setTargetAddress('ParlayVaultImplementation', network, implementation); + console.log('SportAMMLiquidityPoolImplementation: ', implementation); + setTargetAddress('SportAMMLiquidityPoolImplementation', network, implementation); await hre.run('verify:verify', { address: implementation, diff --git a/scripts/deployVaults/AmmVault/upgradeset.js b/scripts/deployVaults/AmmVault/upgradeset.js index 0e57b9f0f..ea5bb4585 100644 --- a/scripts/deployVaults/AmmVault/upgradeset.js +++ b/scripts/deployVaults/AmmVault/upgradeset.js @@ -54,7 +54,7 @@ async function main() { const Vaultdeployed = await Vault.attach(vaultAddress); const week = 7 * 24 * 60 * 60; - await Vaultdeployed.setSkewImpactLimit(w3utils.toWei('-0.01'), { from: owner.address }); + await Vaultdeployed.setSkewImpactLimit(w3utils.toWei('0'), { from: owner.address }); } main() .then(() => process.exit(0)) diff --git a/scripts/deployVaults/SportVault/upgradeset.js b/scripts/deployVaults/SportVault/upgradeset.js index c615e586a..056c86f33 100644 --- a/scripts/deployVaults/SportVault/upgradeset.js +++ b/scripts/deployVaults/SportVault/upgradeset.js @@ -47,7 +47,7 @@ async function main() { console.log('Account is: ' + owner.address); console.log('Network:' + network); - const vaultAddress = getTargetAddress('AmmVaultSafu', network); + const vaultAddress = getTargetAddress('SportVaultSafu', network); console.log('Found Vault at:', vaultAddress); const Vault = await ethers.getContractFactory('SportVault'); diff --git a/scripts/deployments.json b/scripts/deployments.json index 4abbd8c72..51239e708 100644 --- a/scripts/deployments.json +++ b/scripts/deployments.json @@ -20,7 +20,7 @@ "SNXIssuer": "0xA2412e0654CdD40F5677Aaad1a0c572e75dF246C", "StakingThales": "0xC392133eEa695603B51a5d5de73655d571c2CE51", "EscrowThales": "0xa25816b9605009aa446d4d597F0AA46FD828f056", - "StakingThalesImplementation": "0x65682E98fb7519220925B3F4f209B83957Da0176", + "StakingThalesImplementation": "0x2113a7d5d203Be717083746Bc6040c3fB8673389", "EscrowThalesImplementation": "0x566d358f3386abAc32CBE750489306C73CAaC9c2", "ThalesStakingRewardsPool": "0xc44DfC6ffaf195E2535fc13D75a79D9238459782", "ThalesStakingRewardsPoolImplementation": "0x0AbC94987F6b98bFE6fD40F749e445a2857a4Ee3", @@ -51,13 +51,13 @@ "SportPositionalMarketFactoryImplementation": "0x9fb1EF2B3cf9B62955ad18FC5e03e47FDCE15a4a", "SportPositionalMarketMastercopy": "0x17D8eb2EA0E9D640b97927BFDEAD5CC83f81a216", "SportPositionMastercopy": "0x4f1f0665Ef05Eb734d2a19eBf9948AAbef898e7d", - "SportsAMMImplementation": "0x08e2c2BA4f48e1dD103c12A38D515BA980F4E5aE", + "SportsAMMImplementation": "0x7aD35a998847fEcf33fb1F23c27D3159a9c59D3C", "SportPositionalMarketData": "0xd8Bc9D6840C701bFAd5E7cf98CAdC2ee637c0701", "SportPositionalMarketDataImplementation": "0xEf9865A2D2dc2322d8B4e6aC84b13d4121EBFf4A", "GamesQueue": "0x5417c847b6ce4163C43116E8D9670395Ba08B503", "GamesQueueImplementation": "0x6BFCac33502F030D6dCCcfda5E810A236aa243f1", "TherundownConsumer": "0x2B91c14Ce9aa828eD124D12541452a017d8a2148", - "TherundownConsumerImplementation": "0x7EdaDd097402aab262B7886640bb020aB0aFDBC6", + "TherundownConsumerImplementation": "0xbC4BBD7Adb2f1dd79e40dD4029bcFf97BE9bb1F7", "TherundownConsumerWrapper": "0x2167af59e68Ea29387EE2EAa60B7663d6158F1fd", "OvertimeVoucher": "0x4393F1470317Da64e277b29D96e5bf203f28eFbE", "ApexConsumer": "0x0a6851C7D112A27019d84DCCb9cE0c0cd8b75325", @@ -65,11 +65,11 @@ "ThalesAMMUtils": "0x6acC550248f0Ef1A99f2B39af530197fcE7c3184", "TherundownConsumerVerifier": "0x56d0A5098AD74F5e635797753644521173be89dB", "TherundownConsumerVerifierImplementation": "0x86089DAaB2444560Fd774307B5D0D854d7e9279d", - "SportsAMMUtils": "0x06011212eC56b65133B13C4Ad3f11F1d40aA2344", + "SportsAMMUtils": "0x565ce8CF5AE8E2Adc6849EECc6c3bA07bA56C4A2", "OvertimeWorldCupZebro": "0x0a47d5F27149270d45D74abD45FA30E567aB9b7D", - "ParlayAMMImplementation": "0x024148079617fe41ADd3FaaDBb9ccb208B78aaC1", + "ParlayAMMImplementation": "0x6Cd8019f6e61aEB99d9170A5FeDb44b23305ECD8", "ParlayMarketMastercopy": "0xFe09453B10D10953c482F6cc6Ab367f57Ce195FD", - "ParlayVerifier": "0xB85fFccF08cCc82D0A3101d78822f293aAb44aDF", + "ParlayVerifier": "0xE6dD36180CB089810D5fE11Bb766CbbC51d7D23b", "ParlayMarketData": "0x3bD77B8FE52242797C29Df251418873Ae34F0641", "ParlayMarketDataImplementation": "0xEa3b0AfDAf4d5B4e64e51C2Af43860831105372E", "ExoticMarketManager": "0x9a51524422DDF1B8AfEc04CBa6451a6c50320998", @@ -106,11 +106,14 @@ "AmmVaultDegen": "0x43318DE9E8f65b591598F17aDD87ae7247649C83", "AmmVaultDegenImplementation": "0x1DC1a62F7F333347B3885fFeef71Cb4D00829fAc", "GamesOddsObtainer": "0x3ff20410003767edE94c06c5Df56968d90ABAe6c", - "GamesOddsObtainerImplementation": "0x4846C5513932923484Cf249a88E2149e8171b84d", + "GamesOddsObtainerImplementation": "0xc647AB2caB7D6da6081703382ECf2814D8b7C03c", "ThalesAMMNewImplementation": "0x9043CF6B9319b07f52D9C8d8964A8B457A64e0Ca", - "ParlayVault": "0x8285047F33c26c1Bf5B387f2b07F21A2aF29Ace2", - "ParlayVaultImplementation": "0xFfC72be6dAF9072664D4bF9b8dD90562CE20ACA5", - "TaleOfThalesNFTs": "0x890b559E10aD1aAE73713f2f1924aab4e60cf505" + "TaleOfThalesNFTs": "0x890b559E10aD1aAE73713f2f1924aab4e60cf505", + "SportAMMLiquidityPool": "0x842e89b7a7eF8Ce099540b3613264C933cE0eBa5", + "SportAMMLiquidityPoolImplementation": "0x6C2e0015b431f8c5F6b40138aF803504E601D91c", + "SportAMMLiquidityPoolRoundMastercopy": "0xAEa1bE15Adb75A49aceeF392A6d37625d993952a", + "DefaultLiquidityProvider": "0x0565B1aB5CEe7075B32C2D6a5B9dA44b708fB898", + "DefaultLiquidityProviderImplementation": "0x0bAc9eC4126cE5b62BEE2e99823c2b2e96c396b5" }, "polygon": { "ProxyUSDC": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", @@ -207,12 +210,14 @@ "TherundownConsumer": "0x0aBdaF0c4cFF91F96F817809d4735929fCA75B80", "TherundownConsumerImplementation": "0x9e7769409E3e5A6821eeDcF33371FCA929fE6A48", "TherundownConsumerWrapper": "0xaC47c388d52C443Fd854848Ef1fA57171679e7B1", + "TherundownConsumerVerifier": "0xAf3335f531B4Dd876EABF611A7E371AD7e84aa7d", + "TherundownConsumerVerifierImplementation": "0x3dD87b5B198798b944853A1f0df4909D065a73d8", "SportsAMMUtils": "0x50B532AdAF5378F59dBD619dFD03E4d4ab3586bC", "OvertimeWorldCupZebro": "", "ParlayAMM": "0x2Bb7D689780e7a34dD365359bD7333ab24903268", - "ParlayAMMImplementation": "0x3EaA3c6C83856cE307ca651f1fB5A6d981894721", + "ParlayAMMImplementation": "0x8AF9a2a03032dF542985A07b15e437c6C42D4329", "ParlayMarketMastercopy": "0x40dEE0d7914FED2749E6b2dBb028Ac67aD453BE0", - "ParlayVerifier": "0xA77CD27C37A3635Be830b6b3448a36967C5c7f9e", + "ParlayVerifier": "0x1947a5F72cA24978b435EC80C3da70fd82d72B45", "ParlayMarketData": "0xff9d1B34f369CAf91c6b69761e2A06f78ed3cd9d", "ParlayMarketDataImplementation": "0x87e81Bb60c3394A3c2425747545916781B49786b", "GamesOddsObtainer": "0xd7C5dF8F490e0eFe8c043F888a39Ea247D4D3e10", @@ -225,9 +230,7 @@ "StakingThalesImplementation": "0xE90e99726548Aa888564D169B2c9686785a04c01", "EscrowThalesImplementation": "0x4c848a4A53954B9A925Cf857248Abf95Ab2A893C", "ThalesStakingRewardsPool": "0x739d25922010A727B1fc842C483494d4D7a4C90e", - "ThalesStakingRewardsPoolImplementation": "0x94B417458AF11c991B413C03e79f76bda330AF77", - "TherundownConsumerVerifier": "0x0B13071b5f3f860f4D52c836D898A79fE104C9B4", - "TherundownConsumerVerifierImplementation": "0x3dD87b5B198798b944853A1f0df4909D065a73d8" + "ThalesStakingRewardsPoolImplementation": "0x94B417458AF11c991B413C03e79f76bda330AF77" }, "mainnet": { "Thales": "0x03E173Ad8d1581A4802d3B532AcE27a62c5B81dc", @@ -468,7 +471,7 @@ "SportPositionalMarketData": "0x202209397e2A26dc3243bD4bF46480C1f6661032", "SportPositionalMarketDataImplementation": "0x947cDF2A9dD730376E65e7648C373dbC581D8c19", "SportsAMM": "0x7465c5d60d3d095443CF9991Da03304A30D42Eae", - "SportsAMMImplementation": "0xa01AD492B19314bEfBcE4891B927A030d660ffA5", + "SportsAMMImplementation": "0xf5395C7C57E86a92EbBc256C48f9Cea205439561", "Referrals": "0xB2947FC03d8Ee002726F4e28C42D513f7B6D6788", "ReferralsImplementation": "0xF9e07A53765aC94d3d0aFfAA58F61551dDcC6bF5", "OvertimeVoucher": "0x9483eFf448042c366a4297dB465FaE108d2e6ea6", @@ -516,11 +519,10 @@ "OpThales_L2": "0xe2aD7187B3b079183a2D16C1d34A255592aC276b", "StakingThales": "0x28D25990f7Dec7c606551c28A7A82B9D116dcb67", "EscrowThales": "0xE7fc1dED638f00E7E20B6d5F024B0F33A7502609", - "StakingThalesImplementation": "0xae23B3b4f13760d7aEc5eb6c847ee043B50792B9", "EscrowThalesImplementation": "0xc6a7a3f049B07CCb260edd1460CA5a6ac9f966a9", "ThalesStakingRewardsPool": "0xA2Ee3a52D06dBAa21eADC395c046aC3707e156EE", "ThalesStakingRewardsPoolImplementation": "0x952E5dA84B230c0E2498268A3CE481E8D2852B50", - "SportsAMMUtils": "0xe7f4088A2F4CfdbFD6c2814e7dB8f88A4eEeF8aC", + "SportsAMMUtils": "0xa47fAf16A799B897fbFFa1176A8311Afcfa2AE24", "SportVault": "0x3051d3a7e619C161B64dCe0B287688012655bA56", "SportVaultImplementation": "0x582FB96EE4ea5b5Eb6f8BFb3ba3fDeAe15d08744", "VaultImplementation": "0x4D3C3D40A6d9f1A0896db3F24DE539858e74543f", @@ -528,8 +530,12 @@ "OvertimeWorldCupZebro": "0xD66eE2D0F8810304402F6bE0E57E7C0a261b54A3", "GamesOddsObtainer": "0x00d23CE013094F7100b681426C046023d1C02858", "GamesOddsObtainerImplementation": "0xeDe874f55B79Fc55Ac8860B6E4C14B04C30AD0bA", - "ParlayVault": "0x7e415D74eb5B01531B2059D1901aCe751c6B26B3", - "ParlayVaultImplementation": "0x7cea40A6569E538D1AC812C0D4Ff37b505466dC0" + "SportAMMLiquidityPool": "0xdd0879AB819287637f33A29d1ee91d5a76c890Af", + "SportAMMLiquidityPoolImplementation": "0xAb538aB0A62838DC8C95704fF276952dD229faea", + "SportAMMLiquidityPoolRoundMastercopy": "0x7FEdfaF6BF9820e280fd5c0DCd0b50AE15a2a7Ee", + "StakingThalesImplementation": "0x769666FDD20139327603F702C848edb7e4ff9Be4", + "DefaultLiquidityProvider": "0x05C191f8Df6bFb72EFfc865550cF23982cafD753", + "DefaultLiquidityProviderImplementation": "0x97D6d6bdb457de9EaE2f17f01c4753BC6021b376" }, "localhost": { "Airdrop": "", diff --git a/test/contracts/SportMarkets/ParlayAMM.js b/test/contracts/SportMarkets/ParlayAMM.js index 5c760a1a7..70d054866 100644 --- a/test/contracts/SportMarkets/ParlayAMM.js +++ b/test/contracts/SportMarkets/ParlayAMM.js @@ -35,12 +35,26 @@ const { const { BN } = require('bn.js'); contract('ParlayAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -161,7 +175,8 @@ contract('ParlayAMM', (accounts) => { testDAI, Referrals, ParlayVerifier, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -257,6 +272,7 @@ contract('ParlayAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('5000000'), { from: owner } ); @@ -289,7 +305,7 @@ contract('ParlayAMM', (accounts) => { second, second, second, - + second, { from: owner } ); @@ -537,6 +553,22 @@ contract('ParlayAMM', (accounts) => { await ParlayAMM.setParameters(5, { from: owner }); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(100000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -545,9 +577,31 @@ contract('ParlayAMM', (accounts) => { Referrals.address, ParlayAMM.address, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('10000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('10000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100000), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('10000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('10000000'), { + from: defaultLiquidityProvider, + }); + await ParlayAMM.setCurveSUSD( curveSUSD.address, testDAI.address, diff --git a/test/contracts/SportMarkets/ParlayAMMSingledOut.js b/test/contracts/SportMarkets/ParlayAMMSingledOut.js index c6d77f21d..b7827462d 100644 --- a/test/contracts/SportMarkets/ParlayAMMSingledOut.js +++ b/test/contracts/SportMarkets/ParlayAMMSingledOut.js @@ -35,12 +35,26 @@ const { const { BN } = require('bn.js'); contract('ParlayAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -161,7 +175,8 @@ contract('ParlayAMM', (accounts) => { testDAI, Referrals, ParlayVerifier, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -218,13 +233,6 @@ contract('ParlayAMM', (accounts) => { await SportPositionalMarketManager.setExpiryDuration(290 * DAY, { from: manager }); - await SportPositionalMarketManager.setSupportedSportForDoubleChance( - [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], - true, - { - from: manager, - } - ); await SportPositionalMarketFactory.setSportPositionalMarketManager( SportPositionalMarketManager.address, { from: manager } @@ -264,6 +272,7 @@ contract('ParlayAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('5000000'), { from: owner } ); @@ -296,7 +305,7 @@ contract('ParlayAMM', (accounts) => { second, second, second, - + second, { from: owner } ); @@ -448,6 +457,13 @@ contract('ParlayAMM', (accounts) => { await SportPositionalMarketManager.setOddsObtainer(GamesOddsObtainerDeployed.address, { from: manager, }); + await SportPositionalMarketManager.setSupportedSportForDoubleChance( + [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], + true, + { + from: manager, + } + ); await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); @@ -537,6 +553,22 @@ contract('ParlayAMM', (accounts) => { await ParlayAMM.setParameters(5, { from: owner }); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(100000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -545,9 +577,31 @@ contract('ParlayAMM', (accounts) => { Referrals.address, ParlayAMM.address, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('10000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('10000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100000), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('10000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('10000000'), { + from: defaultLiquidityProvider, + }); + await ParlayAMM.setCurveSUSD( curveSUSD.address, testDAI.address, diff --git a/test/contracts/SportMarkets/ParlayAMM_Arbi.js b/test/contracts/SportMarkets/ParlayAMM_Arbi.js index f14c7440f..38a236b5f 100644 --- a/test/contracts/SportMarkets/ParlayAMM_Arbi.js +++ b/test/contracts/SportMarkets/ParlayAMM_Arbi.js @@ -35,12 +35,26 @@ const { const { BN } = require('bn.js'); contract('ParlayAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -161,7 +175,8 @@ contract('ParlayAMM', (accounts) => { testDAI, Referrals, ParlayVerifier, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -218,14 +233,6 @@ contract('ParlayAMM', (accounts) => { await SportPositionalMarketManager.setExpiryDuration(290 * DAY, { from: manager }); - await SportPositionalMarketManager.setSupportedSportForDoubleChance( - [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], - true, - { - from: manager, - } - ); - await SportPositionalMarketFactory.setSportPositionalMarketManager( SportPositionalMarketManager.address, { from: manager } @@ -265,6 +272,7 @@ contract('ParlayAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('5000000'), { from: owner } ); @@ -297,7 +305,7 @@ contract('ParlayAMM', (accounts) => { second, second, second, - + second, { from: owner } ); @@ -449,6 +457,13 @@ contract('ParlayAMM', (accounts) => { await SportPositionalMarketManager.setOddsObtainer(GamesOddsObtainerDeployed.address, { from: manager, }); + await SportPositionalMarketManager.setSupportedSportForDoubleChance( + [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], + true, + { + from: manager, + } + ); await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); await SportPositionalMarketManager.setNeedsTransformingCollateral(true, { from: manager }); await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); @@ -539,6 +554,22 @@ contract('ParlayAMM', (accounts) => { await ParlayAMM.setParameters(5, { from: owner }); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(100000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -547,9 +578,31 @@ contract('ParlayAMM', (accounts) => { Referrals.address, ParlayAMM.address, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('10000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('10000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100000), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('10000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('10000000'), { + from: defaultLiquidityProvider, + }); + await ParlayAMM.setCurveSUSD( curveSUSD.address, testDAI.address, diff --git a/test/contracts/SportMarkets/SportsAMM.js b/test/contracts/SportMarkets/SportsAMM.js index 11007030a..218095126 100644 --- a/test/contracts/SportMarkets/SportsAMM.js +++ b/test/contracts/SportMarkets/SportsAMM.js @@ -35,12 +35,26 @@ const { } = require('../../utils/helpers'); contract('SportsAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -133,7 +147,8 @@ contract('SportsAMM', (accounts) => { testUSDT, testDAI, Referrals, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -223,6 +238,7 @@ contract('SportsAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500'), { from: owner } ); @@ -256,6 +272,7 @@ contract('SportsAMM', (accounts) => { second, second, second, + second, { from: owner } ); @@ -420,6 +437,22 @@ contract('SportsAMM', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -428,9 +461,31 @@ contract('SportsAMM', (accounts) => { Referrals.address, ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('100000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('100000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('100000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('100000'), { + from: defaultLiquidityProvider, + }); + await testUSDC.mint(first, toUnit(1000)); await testUSDC.mint(curveSUSD.address, toUnit(1000)); await testUSDC.approve(SportsAMM.address, toUnit(1000), { from: first }); @@ -672,6 +727,7 @@ contract('SportsAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500'), { from: owner } ); }); @@ -959,6 +1015,7 @@ contract('SportsAMM', (accounts) => { console.log('Balance of USDC for sportsAMM: ', fromUnit(sportsAMMBalanceUSDC)); console.log('Balance of sUSD for sportsAMM: ', fromUnit(sportsAMMBalance)); + await Thales.transfer(SportsAMM.address, toUnit('100000'), { from: owner }); await SportsAMM.buyFromAMMWithDifferentCollateral( deployedMarket.address, position, @@ -1512,9 +1569,6 @@ contract('SportsAMM', (accounts) => { console.log('market phase: ', phase.toString()); let known = await SportPositionalMarketManager.isKnownMarket(deployedMarket.address); console.log('known market: ', known.toString()); - let canExcercise = await SportsAMM.canExerciseMaturedMarket(deployedMarket.address); - console.log('Market can be excercised: ', canExcercise.toString()); - await SportsAMM.exerciseMaturedMarket(deployedMarket.address, { from: first }); }); }); @@ -2124,9 +2178,6 @@ contract('SportsAMM', (accounts) => { } ); - answer = await SportsAMM.canExerciseMaturedMarket(deployedMarket.address); - console.log('Can exercise options: ', answer); - let balances = await deployedMarket.balancesOf(first); let payoutOnCancelation = await deployedMarket.calculatePayoutOnCancellation( balances[0], @@ -2148,9 +2199,6 @@ contract('SportsAMM', (accounts) => { answer = await Thales.balanceOf(SportsAMM.address); console.log('Balance before exercise of SportsAMM: ', fromUnit(answer)); - answer = await SportsAMM.exerciseMaturedMarket(deployedMarket.address); - answer = await Thales.balanceOf(SportsAMM.address); - console.log('Balance after exercise of SportsAMM: ', fromUnit(answer)); answer = await Thales.balanceOf(first); console.log('Balance before exercise of first: ', fromUnit(answer)); @@ -2298,6 +2346,7 @@ contract('SportsAMM', (accounts) => { let balanceOfReferrer = await Thales.balanceOf(second); await Referrals.setSportsAMM(SportsAMM.address, ZERO_ADDRESS, { from: owner }); + await Thales.transfer(SportsAMM.address, toUnit('100000'), { from: owner }); await SportsAMM.buyFromAMMWithDifferentCollateralAndReferrer( deployedMarket.address, position, diff --git a/test/contracts/SportMarkets/SportsAMMDiscounts.js b/test/contracts/SportMarkets/SportsAMMDiscounts.js index 5ecc3d6f9..d86b2634d 100644 --- a/test/contracts/SportMarkets/SportsAMMDiscounts.js +++ b/test/contracts/SportMarkets/SportsAMMDiscounts.js @@ -34,12 +34,26 @@ const { } = require('../../utils/helpers'); contract('SportsAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -132,7 +146,8 @@ contract('SportsAMM', (accounts) => { testUSDT, testDAI, Referrals, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -222,6 +237,7 @@ contract('SportsAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500000'), { from: owner } ); @@ -255,6 +271,7 @@ contract('SportsAMM', (accounts) => { second, second, second, + second, { from: owner } ); @@ -409,6 +426,22 @@ contract('SportsAMM', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -417,9 +450,31 @@ contract('SportsAMM', (accounts) => { Referrals.address, ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + await testUSDC.mint(first, toUnit(100000)); await testUSDC.mint(curveSUSD.address, toUnit(100000)); await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); diff --git a/test/contracts/SportMarkets/SportsAMMDiscounts2.js b/test/contracts/SportMarkets/SportsAMMDiscounts2.js index b83911f12..f4e923c49 100644 --- a/test/contracts/SportMarkets/SportsAMMDiscounts2.js +++ b/test/contracts/SportMarkets/SportsAMMDiscounts2.js @@ -34,12 +34,26 @@ const { } = require('../../utils/helpers'); contract('SportsAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -58,7 +72,6 @@ contract('SportsAMM', (accounts) => { const ReferralsContract = artifacts.require('Referrals'); const SportsAMMUtils = artifacts.require('SportsAMMUtils'); - let ThalesOracleCouncil; let Thales; let answer; let verifier; @@ -133,7 +146,8 @@ contract('SportsAMM', (accounts) => { testUSDT, testDAI, Referrals, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -175,6 +189,7 @@ contract('SportsAMM', (accounts) => { await SportPositionalMarketManager.setExpiryDuration(5 * DAY, { from: manager }); // await SportPositionalMarketManager.setCancelTimeout(2 * HOUR, { from: manager }); + await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); await SportPositionalMarketFactory.setSportPositionalMarketManager( SportPositionalMarketManager.address, @@ -222,6 +237,7 @@ contract('SportsAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500000'), { from: owner } ); @@ -255,6 +271,7 @@ contract('SportsAMM', (accounts) => { second, second, second, + second, { from: owner } ); @@ -376,7 +393,7 @@ contract('SportsAMM', (accounts) => { await SportPositionalMarketManager.setTherundownConsumer(TherundownConsumerDeployed.address, { from: manager, }); - //await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); + await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); await SportPositionalMarketData.setSportPositionalMarketManager( @@ -410,6 +427,22 @@ contract('SportsAMM', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -418,9 +451,31 @@ contract('SportsAMM', (accounts) => { Referrals.address, ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + await testUSDC.mint(first, toUnit(100000)); await testUSDC.mint(curveSUSD.address, toUnit(100000)); await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); diff --git a/test/contracts/SportMarkets/SportsAMMDiscounts3.js b/test/contracts/SportMarkets/SportsAMMDiscounts3.js index 58b0be216..9cda8e168 100644 --- a/test/contracts/SportMarkets/SportsAMMDiscounts3.js +++ b/test/contracts/SportMarkets/SportsAMMDiscounts3.js @@ -34,12 +34,26 @@ const { } = require('../../utils/helpers'); contract('SportsAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -115,6 +129,7 @@ contract('SportsAMM', (accounts) => { let game_2_football_resolve; let reqIdResolveFoodball; let gamesResolvedFootball; + let GamesOddsObtainerDeployed; let SportPositionalMarketManager, SportPositionalMarketFactory, @@ -131,8 +146,8 @@ contract('SportsAMM', (accounts) => { testUSDT, testDAI, Referrals, - GamesOddsObtainerDeployed, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -174,6 +189,7 @@ contract('SportsAMM', (accounts) => { await SportPositionalMarketManager.setExpiryDuration(5 * DAY, { from: manager }); // await SportPositionalMarketManager.setCancelTimeout(2 * HOUR, { from: manager }); + // await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); await SportPositionalMarketFactory.setSportPositionalMarketManager( SportPositionalMarketManager.address, @@ -221,6 +237,7 @@ contract('SportsAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500000'), { from: owner } ); @@ -254,6 +271,7 @@ contract('SportsAMM', (accounts) => { second, second, second, + second, { from: owner } ); @@ -375,8 +393,7 @@ contract('SportsAMM', (accounts) => { await SportPositionalMarketManager.setTherundownConsumer(TherundownConsumerDeployed.address, { from: manager, }); - - //await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); + // await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); await SportPositionalMarketData.setSportPositionalMarketManager( @@ -410,6 +427,22 @@ contract('SportsAMM', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -418,9 +451,31 @@ contract('SportsAMM', (accounts) => { Referrals.address, ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + await testUSDC.mint(first, toUnit(100000)); await testUSDC.mint(curveSUSD.address, toUnit(100000)); await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); diff --git a/test/contracts/SportMarkets/SportsAMMDoubleChance.js b/test/contracts/SportMarkets/SportsAMMDoubleChance.js index d86a744c7..629dbfde2 100644 --- a/test/contracts/SportMarkets/SportsAMMDoubleChance.js +++ b/test/contracts/SportMarkets/SportsAMMDoubleChance.js @@ -35,12 +35,27 @@ const { } = require('../../utils/helpers'); contract('SportsAMM DoubleChance', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); + const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -133,7 +148,8 @@ contract('SportsAMM DoubleChance', (accounts) => { testUSDT, testDAI, Referrals, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -230,6 +246,7 @@ contract('SportsAMM DoubleChance', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500000'), { from: owner } ); @@ -263,6 +280,7 @@ contract('SportsAMM DoubleChance', (accounts) => { second, second, second, + second, { from: owner } ); @@ -420,6 +438,22 @@ contract('SportsAMM DoubleChance', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(10000000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -428,9 +462,31 @@ contract('SportsAMM DoubleChance', (accounts) => { Referrals.address, ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(1000000), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + await testUSDC.mint(first, toUnit(1000)); await testUSDC.mint(curveSUSD.address, toUnit(1000)); await testUSDC.approve(SportsAMM.address, toUnit(1000), { from: first }); @@ -760,6 +816,7 @@ contract('SportsAMM DoubleChance', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500'), { from: owner } ); answer = await SportsAMM.availableToBuyFromAMM(homeTeamNotLoseMarket.address, 0); @@ -784,6 +841,7 @@ contract('SportsAMM DoubleChance', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500'), { from: owner } ); @@ -912,13 +970,6 @@ contract('SportsAMM DoubleChance', (accounts) => { answer = await Thales.balanceOf(first); console.log('Balance after buying: ', fromUnit(answer)); - answer = await SportsAMM.canExerciseMaturedMarket(homeTeamNotLoseMarket.address); - console.log('Can exercise options homeTeamNotLoseMarket: ', answer); - answer = await SportsAMM.canExerciseMaturedMarket(awayTeamNotLoseMarket.address); - console.log('Can exercise options awayTeamNotLoseMarket: ', answer); - answer = await SportsAMM.canExerciseMaturedMarket(noDrawMarket.address); - console.log('Can exercise options noDrawMarket: ', answer); - let balancesHomeTeamNotLose = await homeTeamNotLoseMarket.balancesOf(first); let payoutOnCancelationHomeTeamNotLose = @@ -1475,11 +1526,11 @@ contract('SportsAMM DoubleChance', (accounts) => { console.log( 'Spent on game homeTeamNotLose', - (await SportsAMM.getSpentOnGame(homeTeamNotLoseMarket.address)) / 1e18 + (await SportsAMM.spentOnGame(homeTeamNotLoseMarket.address)) / 1e18 ); console.log( 'Spent on game deployedMarket', - (await SportsAMM.getSpentOnGame(deployedMarket.address)) / 1e18 + (await SportsAMM.spentOnGame(deployedMarket.address)) / 1e18 ); // individual buy @@ -1505,7 +1556,7 @@ contract('SportsAMM DoubleChance', (accounts) => { console.log( 'Spent on game deployedMarket', - (await SportsAMM.getSpentOnGame(deployedMarket.address)) / 1e18 + (await SportsAMM.spentOnGame(deployedMarket.address)) / 1e18 ); availableToBuy = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 2); @@ -1530,7 +1581,7 @@ contract('SportsAMM DoubleChance', (accounts) => { console.log( 'Spent on game deployedMarket', - (await SportsAMM.getSpentOnGame(deployedMarket.address)) / 1e18 + (await SportsAMM.spentOnGame(deployedMarket.address)) / 1e18 ); }); @@ -1558,7 +1609,7 @@ contract('SportsAMM DoubleChance', (accounts) => { console.log( 'Spent on game deployedMarket', - (await SportsAMM.getSpentOnGame(deployedMarket.address)) / 1e18 + (await SportsAMM.spentOnGame(deployedMarket.address)) / 1e18 ); availableToBuy = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 2); @@ -1583,7 +1634,7 @@ contract('SportsAMM DoubleChance', (accounts) => { console.log( 'Spent on game deployedMarket', - (await SportsAMM.getSpentOnGame(deployedMarket.address)) / 1e18 + (await SportsAMM.spentOnGame(deployedMarket.address)) / 1e18 ); }); }); diff --git a/test/contracts/SportMarkets/SportsAMMLPing.js b/test/contracts/SportMarkets/SportsAMMLPing.js new file mode 100644 index 000000000..a3630f620 --- /dev/null +++ b/test/contracts/SportMarkets/SportsAMMLPing.js @@ -0,0 +1,869 @@ +'use strict'; + +const { artifacts, contract, web3 } = require('hardhat'); +const { toBN } = web3.utils; + +const { assert, addSnapshotBeforeRestoreAfterEach } = require('../../utils/common'); + +const { toBytes32 } = require('../../../index'); + +var ethers2 = require('ethers'); +var crypto = require('crypto'); + +const SECOND = 1000; +const HOUR = 3600; +const DAY = 86400; +const WEEK = 604800; +const YEAR = 31556926; + +const hour = 60 * 60; +const day = 24 * 60 * 60; +const week = 7 * day; +const month = 30 * day; + +const { + fastForward, + toUnit, + fromUnit, + currentTime, + bytesToString, + multiplyDecimalRound, + divideDecimalRound, +} = require('../../utils')(); + +const { + onlyGivenAddressCanInvoke, + convertToDecimals, + encodeCall, + assertRevert, +} = require('../../utils/helpers'); + +contract('SportsAMM', (accounts) => { + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + defaultLiquidityProvider, + firstLiquidityProvider, + secondLiquidityProvider, + ] = accounts; + + const ZERO_ADDRESS = '0x' + '0'.repeat(40); + const MAX_NUMBER = + '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + + const SportPositionContract = artifacts.require('SportPosition'); + const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); + const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); + const SportPositionalMarketManagerContract = artifacts.require('SportPositionalMarketManager'); + const SportPositionalMarketFactoryContract = artifacts.require('SportPositionalMarketFactory'); + const SportPositionalMarketMasterCopyContract = artifacts.require( + 'SportPositionalMarketMastercopy' + ); + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); + const SportPositionMasterCopyContract = artifacts.require('SportPositionMastercopy'); + const StakingThalesContract = artifacts.require('StakingThales'); + const SportsAMMContract = artifacts.require('SportsAMM'); + const ThalesContract = artifacts.require('contracts/Token/OpThales_L1.sol:OpThales'); + const SNXRewardsContract = artifacts.require('SNXRewards'); + const AddressResolverContract = artifacts.require('AddressResolverHelper'); + const TestOddsContract = artifacts.require('TestOdds'); + const ReferralsContract = artifacts.require('Referrals'); + const SportsAMMUtils = artifacts.require('SportsAMMUtils'); + + let Thales; + let answer; + let verifier; + let sportsAMMUtils; + let minimumPositioningDuration = 0; + let minimumMarketMaturityDuration = 0; + + let marketQuestion, + marketSource, + endOfPositioning, + fixedTicketPrice, + positionAmount1, + positionAmount2, + positionAmount3, + withdrawalAllowed, + tag, + paymentToken, + phrases = [], + deployedMarket, + outcomePosition, + outcomePosition2; + + let consumer; + let TherundownConsumer; + let TherundownConsumerImplementation; + let TherundownConsumerDeployed; + let MockTherundownConsumerWrapper; + let initializeConsumerData; + let gamesQueue; + let game_1_create; + let game_1_resolve; + let gameid1; + let oddsid; + let oddsResult; + let oddsResultArray; + let reqIdOdds; + let gameid2; + let gameid3; + let game_2_create; + let game_2_resolve; + let gamesCreated; + let gamesResolved; + let reqIdCreate; + let reqIdResolve; + let reqIdFootballCreate; + let reqIdFootballCreate2; + let gameFootballid1; + let gameFootballid2; + let gameFootballid3; + let game_1_football_create; + let game_2_football_create; + let game_3_football_create; + let gamesFootballCreated; + let game_1_football_resolve; + let game_2_football_resolve; + let reqIdResolveFoodball; + let gamesResolvedFootball; + let GamesOddsObtainerDeployed; + + let SportPositionalMarketManager, + SportPositionalMarketFactory, + SportPositionalMarketData, + SportPositionalMarket, + SportPositionalMarketMastercopy, + SportPositionMastercopy, + StakingThales, + SNXRewards, + AddressResolver, + TestOdds, + curveSUSD, + testUSDC, + testUSDT, + testDAI, + Referrals, + SportsAMM, + SportAMMLiquidityPool; + + const game1NBATime = 1646958600; + const gameFootballTime = 1649876400; + + const sportId_4 = 4; // NBA + const sportId_16 = 16; // CHL + + const tagID_4 = 9000 + sportId_4; + const tagID_16 = 9000 + sportId_16; + + let gameMarket; + + const usdcQuantity = toBN(10000 * 1e6); //100 USDC + + beforeEach(async () => { + SportPositionalMarketManager = await SportPositionalMarketManagerContract.new({ + from: manager, + }); + SportPositionalMarketFactory = await SportPositionalMarketFactoryContract.new({ + from: manager, + }); + SportPositionalMarketMastercopy = await SportPositionalMarketContract.new({ from: manager }); + SportPositionMastercopy = await SportPositionContract.new({ from: manager }); + SportPositionalMarketData = await SportPositionalMarketDataContract.new({ from: manager }); + StakingThales = await StakingThalesContract.new({ from: manager }); + SportsAMM = await SportsAMMContract.new({ from: manager }); + SNXRewards = await SNXRewardsContract.new({ from: manager }); + AddressResolver = await AddressResolverContract.new(); + // TestOdds = await TestOddsContract.new(); + await AddressResolver.setSNXRewardsAddress(SNXRewards.address); + + Thales = await ThalesContract.new({ from: owner }); + let GamesQueue = artifacts.require('GamesQueue'); + gamesQueue = await GamesQueue.new({ from: owner }); + await gamesQueue.initialize(owner, { from: owner }); + + await SportPositionalMarketManager.initialize(manager, Thales.address, { from: manager }); + await SportPositionalMarketFactory.initialize(manager, { from: manager }); + + await SportPositionalMarketManager.setExpiryDuration(5 * DAY, { from: manager }); + // await SportPositionalMarketManager.setCancelTimeout(2 * HOUR, { from: manager }); + + await SportPositionalMarketFactory.setSportPositionalMarketManager( + SportPositionalMarketManager.address, + { from: manager } + ); + await SportPositionalMarketFactory.setSportPositionalMarketMastercopy( + SportPositionalMarketMastercopy.address, + { from: manager } + ); + await SportPositionalMarketFactory.setSportPositionMastercopy(SportPositionMastercopy.address, { + from: manager, + }); + // await SportPositionalMarketFactory.setLimitOrderProvider(SportsAMM.address, { from: manager }); + await SportPositionalMarketFactory.setSportsAMM(SportsAMM.address, { from: manager }); + await SportPositionalMarketManager.setSportPositionalMarketFactory( + SportPositionalMarketFactory.address, + { from: manager } + ); + await SportPositionalMarketManager.setWhitelistedAddresses([first, third], true, 1, { + from: manager, + }); + await SportPositionalMarketManager.setWhitelistedAddresses([first, second], true, 2, { + from: manager, + }); + + Referrals = await ReferralsContract.new(); + await Referrals.initialize(owner, ZERO_ADDRESS, ZERO_ADDRESS, { from: owner }); + + await SportsAMM.initialize( + owner, + Thales.address, + toUnit('5000'), + toUnit('0.02'), + toUnit('0.2'), + DAY, + { from: owner } + ); + + await SportsAMM.setParameters( + DAY, + toUnit('0.02'), + toUnit('0.2'), + toUnit('0.001'), + toUnit('0.9'), + toUnit('5000'), + toUnit('0.01'), + toUnit('0.005'), + toUnit('500000'), + { from: owner } + ); + + await SportsAMM.setSportsPositionalMarketManager(SportPositionalMarketManager.address, { + from: owner, + }); + + sportsAMMUtils = await SportsAMMUtils.new(SportsAMM.address); + await SportsAMM.setAmmUtils(sportsAMMUtils.address, { + from: owner, + }); + + await SportPositionalMarketData.initialize(owner, { from: owner }); + await StakingThales.initialize( + owner, + Thales.address, + Thales.address, + Thales.address, + WEEK, + WEEK, + SNXRewards.address, + { from: owner } + ); + await StakingThales.setAddresses( + SNXRewards.address, + second, + second, + second, + second, + SportsAMM.address, + second, + second, + second, + second, + { from: owner } + ); + + await Thales.transfer(first, toUnit('100000'), { from: owner }); + await Thales.transfer(second, toUnit('100000'), { from: owner }); + await Thales.transfer(third, toUnit('100000'), { from: owner }); + + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: first }); + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: second }); + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: third }); + + // ids + gameid1 = '0x6536306366613738303834366166363839373862343935373965356366333936'; + gameid2 = '0x3937346533663036386233333764313239656435633133646632376133326662'; + + // await TestOdds.addOddsForGameId(gameid1, [toUnit(0.8), toUnit(0.1899999), toUnit(0)]); + + // create game props + game_1_create = + '0x0000000000000000000000000000000000000000000000000000000000000020653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; + game_2_create = + '0x0000000000000000000000000000000000000000000000000000000000000020393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; + gamesCreated = [game_1_create, game_2_create]; + reqIdCreate = '0x65da2443ccd66b09d4e2693933e8fb9aab9addf46fb93300bd7c1d70c5e21666'; + + // resolve game props + reqIdResolve = '0x30250573c4b099aeaf06273ef9fbdfe32ab2d6b8e33420de988be5d6886c92a7'; + game_1_resolve = + '0x653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000622a9808'; + game_2_resolve = + '0x393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000622a9808'; + gamesResolved = [game_1_resolve, game_2_resolve]; + + // football matches + reqIdFootballCreate = '0x61d7dd698383c58c7217cf366764a1e92a1f059b1b6ea799dce4030a942302f4'; + reqIdFootballCreate2 = '0x47e3535f7d3c146606fa6bcc06d95eb74f0bf8eac7d0d9c352814ee4c726d194'; + gameFootballid1 = '0x3163626162623163303138373465363263313661316462333164363164353333'; + gameFootballid2 = '0x3662646437313731316337393837643336643465333538643937393237356234'; + gameFootballid3 = '0x6535303439326161636538313035666362316531366364373664383963643361'; + // await TestOdds.addOddsForGameId(gameFootballid1, [toUnit(0.55), toUnit(0.1), toUnit(0.35)]); + game_1_football_create = + '0x000000000000000000000000000000000000000000000000000000000000002031636261626231633031383734653632633136613164623331643631643533330000000000000000000000000000000000000000000000000000000062571db00000000000000000000000000000000000000000000000000000000000009c40ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf2c0000000000000000000000000000000000000000000000000000000000006a4000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001f41746c657469636f204d61647269642041746c657469636f204d616472696400000000000000000000000000000000000000000000000000000000000000001f4d616e636865737465722043697479204d616e63686573746572204369747900'; + game_2_football_create = + '0x000000000000000000000000000000000000000000000000000000000000002036626464373137313163373938376433366434653335386439373932373562340000000000000000000000000000000000000000000000000000000062571db0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff76800000000000000000000000000000000000000000000000000000000000018c18000000000000000000000000000000000000000000000000000000000000cb2000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f42656e666963612042656e666963610000000000000000000000000000000000'; + game_3_football_create = + '0x0000000000000000000000000000000000000000000000000000000000000020653530343932616163653831303566636231653136636437366438396364336100000000000000000000000000000000000000000000000000000000629271300000000000000000000000000000000000000000000000000000000000002a3000000000000000000000000000000000000000000000000000000000000064c800000000000000000000000000000000000000000000000000000000000067e800000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000175265616c204d6164726964205265616c204d6164726964000000000000000000'; + gamesFootballCreated = [game_1_football_create, game_2_football_create, game_3_football_create]; + game_1_football_resolve = + '0x316362616262316330313837346536326331366131646233316436316435333300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000062571db0'; + game_2_football_resolve = + '0x366264643731373131633739383764333664346533353864393739323735623400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000062571db0'; + reqIdResolveFoodball = '0xff8887a8535b7a8030962e6f6b1eba61c0f1cb82f706e77d834f15c781e47697'; + gamesResolvedFootball = [game_1_football_resolve, game_2_football_resolve]; + + oddsid = '0x6135363061373861363135353239363137366237393232353866616336613532'; + oddsResult = + '0x6135363061373861363135353239363137366237393232353866616336613532000000000000000000000000000000000000000000000000000000000000283cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd3dc0000000000000000000000000000000000000000000000000000000000000000'; + oddsResultArray = [oddsResult]; + reqIdOdds = '0x5bf0ea636f9515e1e1060e5a21e11ef8a628fa99b1effb8aa18624b02c6f36de'; + // reqIdOdds2 = ''; + + TherundownConsumer = artifacts.require('TherundownConsumer'); + TherundownConsumerDeployed = await TherundownConsumer.new(); + + await TherundownConsumerDeployed.initialize( + owner, + [sportId_4, sportId_16], + SportPositionalMarketManager.address, + [sportId_4], + gamesQueue.address, + [8, 12], // resolved statuses + [1, 2], // cancel statuses + { from: owner } + ); + + let ConsumerVerifier = artifacts.require('TherundownConsumerVerifier'); + verifier = await ConsumerVerifier.new({ from: owner }); + + await verifier.initialize( + owner, + TherundownConsumerDeployed.address, + ['TDB TDB', 'TBA TBA'], + ['create', 'resolve'], + 20, + { + from: owner, + } + ); + + let GamesOddsObtainer = artifacts.require('GamesOddsObtainer'); + GamesOddsObtainerDeployed = await GamesOddsObtainer.new({ from: owner }); + + await GamesOddsObtainerDeployed.initialize( + owner, + TherundownConsumerDeployed.address, + verifier.address, + SportPositionalMarketManager.address, + [4, 16], + { from: owner } + ); + + await Thales.transfer(TherundownConsumerDeployed.address, toUnit('1000'), { from: owner }); + await TherundownConsumerDeployed.setSportContracts( + wrapper, + gamesQueue.address, + SportPositionalMarketManager.address, + verifier.address, + GamesOddsObtainerDeployed.address, + { + from: owner, + } + ); + await TherundownConsumerDeployed.addToWhitelist(third, true, { from: owner }); + await TherundownConsumerDeployed.addToWhitelist(SportPositionalMarketManager.address, true, { + from: owner, + }); + + await SportPositionalMarketManager.setTherundownConsumer(TherundownConsumerDeployed.address, { + from: manager, + }); + await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); + + await SportPositionalMarketData.setSportPositionalMarketManager( + SportPositionalMarketManager.address, + { from: owner } + ); + await SportPositionalMarketData.setSportsAMM(SportsAMM.address, { from: owner }); + + let TestUSDC = artifacts.require('TestUSDC'); + testUSDC = await TestUSDC.new(); + testUSDT = await TestUSDC.new(); + + let ERC20token = artifacts.require('Thales'); + testDAI = await ERC20token.new(); + + let CurveSUSD = artifacts.require('MockCurveSUSD'); + curveSUSD = await CurveSUSD.new( + Thales.address, + testUSDC.address, + testUSDT.address, + testDAI.address + ); + + await SportsAMM.setCurveSUSD( + curveSUSD.address, + testDAI.address, + testUSDC.address, + testUSDT.address, + true, + toUnit(0.02), + { from: owner } + ); + + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: month, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + + await SportsAMM.setAddresses( + owner, + Thales.address, + TherundownConsumerDeployed.address, + StakingThales.address, + Referrals.address, + ZERO_ADDRESS, + wrapper, + SportAMMLiquidityPool.address, + { from: owner } + ); + + await testUSDC.mint(first, toUnit(100000)); + await testUSDC.mint(curveSUSD.address, toUnit(100000)); + await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); + await SportsAMM.setCapPerSport(tagID_4, toUnit('50000'), { from: owner }); + }); + + describe('Test SportsAMM LPing', () => { + let deployedMarket; + let answer; + beforeEach(async () => { + await fastForward(game1NBATime - (await currentTime()) - SECOND); + // req. games + const tx = await TherundownConsumerDeployed.fulfillGamesCreated( + reqIdCreate, + gamesCreated, + sportId_4, + game1NBATime, + { from: wrapper } + ); + + let game = await TherundownConsumerDeployed.gameCreated(gameid1); + let gameTime = game.startTime; + await TherundownConsumerDeployed.createMarketForGame(gameid1); + await TherundownConsumerDeployed.marketPerGameId(gameid1); + answer = await SportPositionalMarketManager.getActiveMarketAddress('0'); + deployedMarket = await SportPositionalMarketContract.at(answer.toString()); + }); + let position = 0; + let value = 100; + + it('Get odds', async () => { + answer = await SportsAMM.obtainOdds(deployedMarket.address, 0); + let sumOfOdds = answer; + console.log('Odds for pos 0: ', fromUnit(answer)); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 1); + sumOfOdds = sumOfOdds.add(answer); + console.log('Odds for pos 1: ', fromUnit(answer)); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 2); + sumOfOdds = sumOfOdds.add(answer); + console.log('Odds for pos 2: ', fromUnit(answer)); + console.log('Total odds: ', fromUnit(sumOfOdds)); + }); + + it('Get american odds', async () => { + answer = await GamesOddsObtainerDeployed.getOddsForGame(gameid1); + let sumOfOdds = answer[0]; + sumOfOdds = sumOfOdds.add(answer[1]); + sumOfOdds = sumOfOdds.add(answer[2]); + }); + + it('Get price', async () => { + answer = await SportsAMM.obtainOdds(deployedMarket.address, 0); + let sumOfPrices = answer; + console.log('Price for pos 0: ', fromUnit(answer)); + sumOfPrices = sumOfPrices.add(answer); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 1); + console.log('Price for pos 1: ', fromUnit(answer)); + sumOfPrices = sumOfPrices.add(answer); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 2); + console.log('Price for pos 2: ', fromUnit(answer)); + console.log('Total price: ', fromUnit(sumOfPrices)); + }); + it('Get Available to buy from SportsAMM, position 1', async () => { + answer = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 1); + console.log('Available to buy: ', fromUnit(answer)); + }); + + it('Get BuyQuote from SportsAMM, position 1, value: 100', async () => { + answer = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 1, toUnit(100)); + console.log('buyAMMQuote: ', fromUnit(answer)); + }); + + it('Buy from SportsAMM, position 1, value: 100', async () => { + let ammBalance = await Thales.balanceOf(SportsAMM.address); + console.log('ammBalance: ' + ammBalance / 1e18); + + let availableToBuy = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 1); + let additionalSlippage = toUnit(0.01); + let buyFromAmmQuote = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 1, toUnit(100)); + answer = await Thales.balanceOf(first); + let before_balance = answer; + console.log('acc balance: ', fromUnit(answer)); + console.log('buyQuote: ', fromUnit(buyFromAmmQuote)); + + await expect( + SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(100), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ) + ).to.be.revertedWith('Pool has not started'); + + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + + await expect( + SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(100), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ) + ).to.be.revertedWith('Pool has not started'); + + await expect(SportAMMLiquidityPool.start({ from: owner })).to.be.revertedWith( + 'can not start with 0 deposits' + ); + + await Thales.transfer(firstLiquidityProvider, toUnit('100'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('100'), { + from: firstLiquidityProvider, + }); + + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + + let isUserLPing = await SportAMMLiquidityPool.isUserLPing(firstLiquidityProvider); + console.log('isUserLPing firstLiquidityProvider: ' + isUserLPing); + + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + + isUserLPing = await SportAMMLiquidityPool.isUserLPing(firstLiquidityProvider); + console.log('isUserLPing firstLiquidityProvider after deposit: ' + isUserLPing); + + await SportAMMLiquidityPool.start({ from: owner }); + + await expect( + SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(100), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ) + ).to.be.revertedWith('default liquidity provider not set'); + + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + + await Thales.transfer(defaultLiquidityProvider, toUnit('100000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('100000'), { + from: defaultLiquidityProvider, + }); + + let maturity = await deployedMarket.times(); + var maturityAfter = maturity[0]; + var expiryAfter = maturity[1]; + console.log('Maturity after' + parseInt(maturityAfter)); + + let now = await currentTime(); + console.log('now' + parseInt(now)); + + let marketRound = await SportAMMLiquidityPool.getMarketRound(deployedMarket.address); + let round = await SportAMMLiquidityPool.round(); + console.log('Market round is ' + marketRound); + console.log('round ' + round); + + let roundPool = await SportAMMLiquidityPool.roundPools(2); + console.log('round pool is ' + roundPool); + + let balanceDefaultLiquidityProviderBefore = await Thales.balanceOf(defaultLiquidityProvider); + console.log( + 'balanceDefaultLiquidityProviderBefore: ' + balanceDefaultLiquidityProviderBefore / 1e18 + ); + + let roundPoolBalanceBefore = await Thales.balanceOf(roundPool); + console.log('roundPoolBalanceBefore: ' + roundPoolBalanceBefore / 1e18); + + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(100), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + buyFromAmmQuote = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 0, toUnit(1)); + console.log('Buy quote for positions 0 is ' + buyFromAmmQuote / 1e18 + ' !!!!!'); + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 0, + toUnit(1), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + let balanceDefaultLiquidityProviderAfter = await Thales.balanceOf(defaultLiquidityProvider); + console.log( + 'balanceDefaultLiquidityProviderAfter: ' + balanceDefaultLiquidityProviderAfter / 1e18 + ); + + let balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound( + 1, + defaultLiquidityProvider + ); + console.log('balancesPerRoundLP 1 ' + balancesPerRoundLP / 1e18); + + balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound( + 2, + defaultLiquidityProvider + ); + console.log('balancesPerRoundLP 2 ' + balancesPerRoundLP / 1e18); + + let roundPoolBalanceAfter = await Thales.balanceOf(roundPool); + console.log('roundPoolBalanceAfter: ' + roundPoolBalanceAfter / 1e18); + + let options = await deployedMarket.options(); + position = artifacts.require('SportPosition'); + let home = await position.at(options.home); + let away = await position.at(options.away); + + let balanceHome = await home.balanceOf(first); + console.log('Balance Home first= ' + balanceHome / 1e18); + + let balanceAway = await away.balanceOf(first); + console.log('Balance Away first= ' + balanceAway / 1e18); + + let balanceHomePool = await home.balanceOf(roundPool); + console.log('Balance Home roundPool= ' + balanceHomePool / 1e18); + + let balanceAwayPool = await away.balanceOf(roundPool); + console.log('Balance Away roundPool= ' + balanceAwayPool / 1e18); + + let canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound ' + canCloseCurrentRound); + + await fastForward(month * 2); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound ' + canCloseCurrentRound); + + await SportAMMLiquidityPool.closeRound(); + + round = await SportAMMLiquidityPool.round(); + console.log('round ' + round); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound ' + canCloseCurrentRound); + + const tx_2 = await TherundownConsumerDeployed.fulfillGamesResolved( + reqIdResolve, + gamesResolved, + sportId_4, + { from: wrapper } + ); + + let gameR = await TherundownConsumerDeployed.gameResolved(gameid1); + assert.equal(100, gameR.homeScore); + assert.equal(129, gameR.awayScore); + + // resolve markets + const tx_resolve = await TherundownConsumerDeployed.resolveMarketForGame(gameid1); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound ' + canCloseCurrentRound); + + await SportAMMLiquidityPool.closeRound(); + + balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound( + 3, + defaultLiquidityProvider + ); + console.log('balancesPerRound 3 defaultLiquidityProvider ' + balancesPerRoundLP / 1e18); + + balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound(3, firstLiquidityProvider); + console.log('balancesPerRound 3 firstLiquidityProvider ' + balancesPerRoundLP / 1e18); + + balanceDefaultLiquidityProviderBefore = await Thales.balanceOf(defaultLiquidityProvider); + console.log( + 'balanceDefaultLiquidityProviderAfter: ' + balanceDefaultLiquidityProviderBefore / 1e18 + ); + + let profitAndLossPerRound = await SportAMMLiquidityPool.profitAndLossPerRound(2); + console.log('profitAndLossPerRound: ' + profitAndLossPerRound / 1e16 + '%'); + + let cumulativeProfitAndLoss = await SportAMMLiquidityPool.cumulativeProfitAndLoss(2); + console.log('cumulativeProfitAndLoss: ' + cumulativeProfitAndLoss / 1e16 + '%'); + + let allocationPerRound = await SportAMMLiquidityPool.allocationPerRound(2); + console.log('allocationPerRound: ' + allocationPerRound / 1e18); + + allocationPerRound = await SportAMMLiquidityPool.allocationPerRound(3); + console.log('allocationPerRound3: ' + allocationPerRound / 1e18); + + round = await SportAMMLiquidityPool.round(); + console.log('round ' + round); + + let totalDeposited = await SportAMMLiquidityPool.totalDeposited(); + console.log('totalDeposited 3 ' + totalDeposited / 1e18); + + await SportAMMLiquidityPool.withdrawalRequest({ from: firstLiquidityProvider }); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound 3 ' + canCloseCurrentRound); + + await fastForward(month * 2); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound 3 ' + canCloseCurrentRound); + + await SportAMMLiquidityPool.closeRound(); + + round = await SportAMMLiquidityPool.round(); + console.log('round ' + round); + + allocationPerRound = await SportAMMLiquidityPool.allocationPerRound(4); + console.log('allocationPerRound3: ' + allocationPerRound / 1e18); + + balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound(4, firstLiquidityProvider); + console.log('balancesPerRound 3 firstLiquidityProvider ' + balancesPerRoundLP / 1e18); + + balanceDefaultLiquidityProviderBefore = await Thales.balanceOf(defaultLiquidityProvider); + console.log( + 'balanceDefaultLiquidityProviderAfter: ' + balanceDefaultLiquidityProviderBefore / 1e18 + ); + + profitAndLossPerRound = await SportAMMLiquidityPool.profitAndLossPerRound(3); + console.log('profitAndLossPerRound 3: ' + profitAndLossPerRound / 1e16 + '%'); + + cumulativeProfitAndLoss = await SportAMMLiquidityPool.cumulativeProfitAndLoss(3); + console.log('cumulativeProfitAndLoss: ' + cumulativeProfitAndLoss / 1e16 + '%'); + + totalDeposited = await SportAMMLiquidityPool.totalDeposited(); + console.log('totalDeposited 4 ' + totalDeposited / 1e18); + + await Thales.transfer(secondLiquidityProvider, toUnit('1000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000'), { + from: secondLiquidityProvider, + }); + + const MockStakingThales = artifacts.require('MockStakingThales'); + let mockStakingThales = await MockStakingThales.new({ from: owner }); + await Thales.approve(mockStakingThales.address, toUnit(1000), { + from: secondLiquidityProvider, + }); + await mockStakingThales.stake(toUnit(100), { from: secondLiquidityProvider }); + + await SportAMMLiquidityPool.setStakedThalesMultiplier(toUnit(1), { + from: owner, + }); + + await SportAMMLiquidityPool.setStakingThales(mockStakingThales.address, { + from: owner, + }); + + await expect( + SportAMMLiquidityPool.deposit(toUnit(1000000), { from: secondLiquidityProvider }) + ).to.be.revertedWith('Deposit amount exceeds AMM LP cap'); + + await expect( + SportAMMLiquidityPool.deposit(toUnit(101), { from: secondLiquidityProvider }) + ).to.be.revertedWith('Not enough staked THALES'); + + await expect( + SportAMMLiquidityPool.deposit(toUnit(1), { from: secondLiquidityProvider }) + ).to.be.revertedWith('Amount less than minDepositAmount'); + + await SportAMMLiquidityPool.setOnlyWhitelistedStakersAllowed(true, { + from: owner, + }); + await expect( + SportAMMLiquidityPool.deposit(toUnit(101), { from: secondLiquidityProvider }) + ).to.be.revertedWith('Only whitelisted stakers allowed'); + + let getMaxAvailableDepositForUser = await SportAMMLiquidityPool.getMaxAvailableDepositForUser( + secondLiquidityProvider + ); + console.log('getMaxAvailableDepositForUser ' + getMaxAvailableDepositForUser[1] / 1e18); + + let getNeededStakedThalesToWithdrawForUser = + await SportAMMLiquidityPool.getNeededStakedThalesToWithdrawForUser(secondLiquidityProvider); + console.log( + 'getNeededStakedThalesToWithdrawForUser ' + getNeededStakedThalesToWithdrawForUser / 1e18 + ); + + await SportAMMLiquidityPool.setWhitelistedStakerAddresses([secondLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: secondLiquidityProvider }); + + getMaxAvailableDepositForUser = await SportAMMLiquidityPool.getMaxAvailableDepositForUser( + secondLiquidityProvider + ); + console.log('getMaxAvailableDepositForUser ' + getMaxAvailableDepositForUser[1] / 1e18); + + getNeededStakedThalesToWithdrawForUser = + await SportAMMLiquidityPool.getNeededStakedThalesToWithdrawForUser(secondLiquidityProvider); + console.log( + 'getNeededStakedThalesToWithdrawForUser ' + getNeededStakedThalesToWithdrawForUser / 1e18 + ); + + ammBalance = await Thales.balanceOf(SportsAMM.address); + console.log('ammBalance: ' + ammBalance / 1e18); + }); + }); +}); diff --git a/test/contracts/SportMarkets/SportsAMMLPingTransformCollateral.js b/test/contracts/SportMarkets/SportsAMMLPingTransformCollateral.js new file mode 100644 index 000000000..23cd2f5a2 --- /dev/null +++ b/test/contracts/SportMarkets/SportsAMMLPingTransformCollateral.js @@ -0,0 +1,885 @@ +'use strict'; + +const { artifacts, contract, web3 } = require('hardhat'); +const { toBN } = web3.utils; + +const { assert, addSnapshotBeforeRestoreAfterEach } = require('../../utils/common'); + +const { toBytes32 } = require('../../../index'); + +var ethers2 = require('ethers'); +var crypto = require('crypto'); + +const SECOND = 1000; +const HOUR = 3600; +const DAY = 86400; +const WEEK = 604800; +const YEAR = 31556926; + +const hour = 60 * 60; +const day = 24 * 60 * 60; +const week = 7 * day; +const month = 30 * day; + +const { toWei } = require('web3-utils'); + +const toUnitSix = (amount) => toBN(toWei(amount.toString(), 'ether') / 1e12); + +const { + fastForward, + toUnit, + fromUnit, + currentTime, + bytesToString, + multiplyDecimalRound, + divideDecimalRound, +} = require('../../utils')(); + +const { + onlyGivenAddressCanInvoke, + convertToDecimals, + encodeCall, + assertRevert, +} = require('../../utils/helpers'); + +contract('SportsAMM', (accounts) => { + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + defaultLiquidityProvider, + firstLiquidityProvider, + secondLiquidityProvider, + ] = accounts; + + const ZERO_ADDRESS = '0x' + '0'.repeat(40); + const MAX_NUMBER = + '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + + const SportPositionContract = artifacts.require('SportPosition'); + const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); + const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); + const SportPositionalMarketManagerContract = artifacts.require('SportPositionalMarketManager'); + const SportPositionalMarketFactoryContract = artifacts.require('SportPositionalMarketFactory'); + const SportPositionalMarketMasterCopyContract = artifacts.require( + 'SportPositionalMarketMastercopy' + ); + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); + const SportPositionMasterCopyContract = artifacts.require('SportPositionMastercopy'); + const StakingThalesContract = artifacts.require('StakingThales'); + const SportsAMMContract = artifacts.require('SportsAMM'); + const ThalesContract = artifacts.require('TestUSDC'); + const ThalesContractForStaking = artifacts.require('contracts/Token/OpThales_L1.sol:OpThales'); + const SNXRewardsContract = artifacts.require('SNXRewards'); + const AddressResolverContract = artifacts.require('AddressResolverHelper'); + const TestOddsContract = artifacts.require('TestOdds'); + const ReferralsContract = artifacts.require('Referrals'); + const SportsAMMUtils = artifacts.require('SportsAMMUtils'); + + let Thales, ThalesForStaking; + let answer; + let verifier; + let sportsAMMUtils; + let minimumPositioningDuration = 0; + let minimumMarketMaturityDuration = 0; + + let marketQuestion, + marketSource, + endOfPositioning, + fixedTicketPrice, + positionAmount1, + positionAmount2, + positionAmount3, + withdrawalAllowed, + tag, + paymentToken, + phrases = [], + deployedMarket, + outcomePosition, + outcomePosition2; + + let consumer; + let TherundownConsumer; + let TherundownConsumerImplementation; + let TherundownConsumerDeployed; + let MockTherundownConsumerWrapper; + let initializeConsumerData; + let gamesQueue; + let game_1_create; + let game_1_resolve; + let gameid1; + let oddsid; + let oddsResult; + let oddsResultArray; + let reqIdOdds; + let gameid2; + let gameid3; + let game_2_create; + let game_2_resolve; + let gamesCreated; + let gamesResolved; + let reqIdCreate; + let reqIdResolve; + let reqIdFootballCreate; + let reqIdFootballCreate2; + let gameFootballid1; + let gameFootballid2; + let gameFootballid3; + let game_1_football_create; + let game_2_football_create; + let game_3_football_create; + let gamesFootballCreated; + let game_1_football_resolve; + let game_2_football_resolve; + let reqIdResolveFoodball; + let gamesResolvedFootball; + let GamesOddsObtainerDeployed; + + let SportPositionalMarketManager, + SportPositionalMarketFactory, + SportPositionalMarketData, + SportPositionalMarket, + SportPositionalMarketMastercopy, + SportPositionMastercopy, + StakingThales, + SNXRewards, + AddressResolver, + TestOdds, + curveSUSD, + testUSDC, + testUSDT, + testDAI, + Referrals, + SportsAMM, + SportAMMLiquidityPool; + + const game1NBATime = 1646958600; + const gameFootballTime = 1649876400; + + const sportId_4 = 4; // NBA + const sportId_16 = 16; // CHL + + const tagID_4 = 9000 + sportId_4; + const tagID_16 = 9000 + sportId_16; + + let gameMarket; + + const usdcQuantity = toBN(10000 * 1e6); //100 USDC + + beforeEach(async () => { + SportPositionalMarketManager = await SportPositionalMarketManagerContract.new({ + from: manager, + }); + SportPositionalMarketFactory = await SportPositionalMarketFactoryContract.new({ + from: manager, + }); + SportPositionalMarketMastercopy = await SportPositionalMarketContract.new({ from: manager }); + SportPositionMastercopy = await SportPositionContract.new({ from: manager }); + SportPositionalMarketData = await SportPositionalMarketDataContract.new({ from: manager }); + StakingThales = await StakingThalesContract.new({ from: manager }); + SportsAMM = await SportsAMMContract.new({ from: manager }); + SNXRewards = await SNXRewardsContract.new({ from: manager }); + AddressResolver = await AddressResolverContract.new(); + // TestOdds = await TestOddsContract.new(); + await AddressResolver.setSNXRewardsAddress(SNXRewards.address); + + Thales = await ThalesContract.new({ from: owner }); + ThalesForStaking = await ThalesContractForStaking.new({ from: owner }); + let GamesQueue = artifacts.require('GamesQueue'); + gamesQueue = await GamesQueue.new({ from: owner }); + await gamesQueue.initialize(owner, { from: owner }); + + await SportPositionalMarketManager.initialize(manager, Thales.address, { from: manager }); + await SportPositionalMarketFactory.initialize(manager, { from: manager }); + + await SportPositionalMarketManager.setNeedsTransformingCollateral(true, { from: manager }); + + await SportPositionalMarketManager.setExpiryDuration(5 * DAY, { from: manager }); + // await SportPositionalMarketManager.setCancelTimeout(2 * HOUR, { from: manager }); + + await SportPositionalMarketFactory.setSportPositionalMarketManager( + SportPositionalMarketManager.address, + { from: manager } + ); + await SportPositionalMarketFactory.setSportPositionalMarketMastercopy( + SportPositionalMarketMastercopy.address, + { from: manager } + ); + await SportPositionalMarketFactory.setSportPositionMastercopy(SportPositionMastercopy.address, { + from: manager, + }); + // await SportPositionalMarketFactory.setLimitOrderProvider(SportsAMM.address, { from: manager }); + await SportPositionalMarketFactory.setSportsAMM(SportsAMM.address, { from: manager }); + await SportPositionalMarketManager.setSportPositionalMarketFactory( + SportPositionalMarketFactory.address, + { from: manager } + ); + await SportPositionalMarketManager.setWhitelistedAddresses([first, third], true, 1, { + from: manager, + }); + await SportPositionalMarketManager.setWhitelistedAddresses([first, second], true, 2, { + from: manager, + }); + + Referrals = await ReferralsContract.new(); + await Referrals.initialize(owner, ZERO_ADDRESS, ZERO_ADDRESS, { from: owner }); + + await SportsAMM.initialize( + owner, + Thales.address, + toUnit('5000'), + toUnit('0.02'), + toUnit('0.2'), + DAY, + { from: owner } + ); + + await SportsAMM.setParameters( + DAY, + toUnit('0.02'), + toUnit('0.2'), + toUnit('0.001'), + toUnit('0.9'), + toUnit('5000'), + toUnit('0.01'), + toUnit('0.005'), + toUnit('500000'), + { from: owner } + ); + + await SportsAMM.setSportsPositionalMarketManager(SportPositionalMarketManager.address, { + from: owner, + }); + + sportsAMMUtils = await SportsAMMUtils.new(SportsAMM.address); + await SportsAMM.setAmmUtils(sportsAMMUtils.address, { + from: owner, + }); + + await SportPositionalMarketData.initialize(owner, { from: owner }); + await StakingThales.initialize( + owner, + Thales.address, + Thales.address, + Thales.address, + WEEK, + WEEK, + SNXRewards.address, + { from: owner } + ); + await StakingThales.setAddresses( + SNXRewards.address, + second, + second, + second, + second, + SportsAMM.address, + second, + second, + second, + second, + { from: owner } + ); + + await Thales.mint(first, toUnitSix('1000')); + await Thales.mint(second, toUnitSix('1000')); + await Thales.mint(third, toUnitSix('1000')); + + await Thales.approve(SportsAMM.address, toUnitSix('1000'), { from: first }); + await Thales.approve(SportsAMM.address, toUnitSix('1000'), { from: second }); + await Thales.approve(SportsAMM.address, toUnitSix('1000'), { from: third }); + + // ids + gameid1 = '0x6536306366613738303834366166363839373862343935373965356366333936'; + gameid2 = '0x3937346533663036386233333764313239656435633133646632376133326662'; + + // await TestOdds.addOddsForGameId(gameid1, [toUnit(0.8), toUnit(0.1899999), toUnit(0)]); + + // create game props + game_1_create = + '0x0000000000000000000000000000000000000000000000000000000000000020653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; + game_2_create = + '0x0000000000000000000000000000000000000000000000000000000000000020393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; + gamesCreated = [game_1_create, game_2_create]; + reqIdCreate = '0x65da2443ccd66b09d4e2693933e8fb9aab9addf46fb93300bd7c1d70c5e21666'; + + // resolve game props + reqIdResolve = '0x30250573c4b099aeaf06273ef9fbdfe32ab2d6b8e33420de988be5d6886c92a7'; + game_1_resolve = + '0x653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000622a9808'; + game_2_resolve = + '0x393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000622a9808'; + gamesResolved = [game_1_resolve, game_2_resolve]; + + // football matches + reqIdFootballCreate = '0x61d7dd698383c58c7217cf366764a1e92a1f059b1b6ea799dce4030a942302f4'; + reqIdFootballCreate2 = '0x47e3535f7d3c146606fa6bcc06d95eb74f0bf8eac7d0d9c352814ee4c726d194'; + gameFootballid1 = '0x3163626162623163303138373465363263313661316462333164363164353333'; + gameFootballid2 = '0x3662646437313731316337393837643336643465333538643937393237356234'; + gameFootballid3 = '0x6535303439326161636538313035666362316531366364373664383963643361'; + // await TestOdds.addOddsForGameId(gameFootballid1, [toUnit(0.55), toUnit(0.1), toUnit(0.35)]); + game_1_football_create = + '0x000000000000000000000000000000000000000000000000000000000000002031636261626231633031383734653632633136613164623331643631643533330000000000000000000000000000000000000000000000000000000062571db00000000000000000000000000000000000000000000000000000000000009c40ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf2c0000000000000000000000000000000000000000000000000000000000006a4000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001f41746c657469636f204d61647269642041746c657469636f204d616472696400000000000000000000000000000000000000000000000000000000000000001f4d616e636865737465722043697479204d616e63686573746572204369747900'; + game_2_football_create = + '0x000000000000000000000000000000000000000000000000000000000000002036626464373137313163373938376433366434653335386439373932373562340000000000000000000000000000000000000000000000000000000062571db0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff76800000000000000000000000000000000000000000000000000000000000018c18000000000000000000000000000000000000000000000000000000000000cb2000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f42656e666963612042656e666963610000000000000000000000000000000000'; + game_3_football_create = + '0x0000000000000000000000000000000000000000000000000000000000000020653530343932616163653831303566636231653136636437366438396364336100000000000000000000000000000000000000000000000000000000629271300000000000000000000000000000000000000000000000000000000000002a3000000000000000000000000000000000000000000000000000000000000064c800000000000000000000000000000000000000000000000000000000000067e800000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000175265616c204d6164726964205265616c204d6164726964000000000000000000'; + gamesFootballCreated = [game_1_football_create, game_2_football_create, game_3_football_create]; + game_1_football_resolve = + '0x316362616262316330313837346536326331366131646233316436316435333300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000062571db0'; + game_2_football_resolve = + '0x366264643731373131633739383764333664346533353864393739323735623400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000062571db0'; + reqIdResolveFoodball = '0xff8887a8535b7a8030962e6f6b1eba61c0f1cb82f706e77d834f15c781e47697'; + gamesResolvedFootball = [game_1_football_resolve, game_2_football_resolve]; + + oddsid = '0x6135363061373861363135353239363137366237393232353866616336613532'; + oddsResult = + '0x6135363061373861363135353239363137366237393232353866616336613532000000000000000000000000000000000000000000000000000000000000283cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd3dc0000000000000000000000000000000000000000000000000000000000000000'; + oddsResultArray = [oddsResult]; + reqIdOdds = '0x5bf0ea636f9515e1e1060e5a21e11ef8a628fa99b1effb8aa18624b02c6f36de'; + // reqIdOdds2 = ''; + + TherundownConsumer = artifacts.require('TherundownConsumer'); + TherundownConsumerDeployed = await TherundownConsumer.new(); + + await TherundownConsumerDeployed.initialize( + owner, + [sportId_4, sportId_16], + SportPositionalMarketManager.address, + [sportId_4], + gamesQueue.address, + [8, 12], // resolved statuses + [1, 2], // cancel statuses + { from: owner } + ); + + let ConsumerVerifier = artifacts.require('TherundownConsumerVerifier'); + verifier = await ConsumerVerifier.new({ from: owner }); + + await verifier.initialize( + owner, + TherundownConsumerDeployed.address, + ['TDB TDB', 'TBA TBA'], + ['create', 'resolve'], + 20, + { + from: owner, + } + ); + + let GamesOddsObtainer = artifacts.require('GamesOddsObtainer'); + GamesOddsObtainerDeployed = await GamesOddsObtainer.new({ from: owner }); + + await GamesOddsObtainerDeployed.initialize( + owner, + TherundownConsumerDeployed.address, + verifier.address, + SportPositionalMarketManager.address, + [4, 16], + { from: owner } + ); + + await Thales.mint(TherundownConsumerDeployed.address, toUnit('1000')); + await TherundownConsumerDeployed.setSportContracts( + wrapper, + gamesQueue.address, + SportPositionalMarketManager.address, + verifier.address, + GamesOddsObtainerDeployed.address, + { + from: owner, + } + ); + await TherundownConsumerDeployed.addToWhitelist(third, true, { from: owner }); + await TherundownConsumerDeployed.addToWhitelist(SportPositionalMarketManager.address, true, { + from: owner, + }); + + await SportPositionalMarketManager.setTherundownConsumer(TherundownConsumerDeployed.address, { + from: manager, + }); + await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); + + await SportPositionalMarketData.setSportPositionalMarketManager( + SportPositionalMarketManager.address, + { from: owner } + ); + await SportPositionalMarketData.setSportsAMM(SportsAMM.address, { from: owner }); + + let TestUSDC = artifacts.require('TestUSDC'); + testUSDC = await TestUSDC.new(); + testUSDT = await TestUSDC.new(); + + let ERC20token = artifacts.require('Thales'); + testDAI = await ERC20token.new(); + + let CurveSUSD = artifacts.require('MockCurveSUSD'); + curveSUSD = await CurveSUSD.new( + Thales.address, + testUSDC.address, + testUSDT.address, + testDAI.address + ); + + await SportsAMM.setCurveSUSD( + curveSUSD.address, + testDAI.address, + testUSDC.address, + testUSDT.address, + true, + toUnit(0.02), + { from: owner } + ); + + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: month, + _maxAllowedDeposit: toUnitSix(1000).toString(), + _minDepositAmount: toUnitSix(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + + await SportsAMM.setAddresses( + owner, + Thales.address, + TherundownConsumerDeployed.address, + StakingThales.address, + Referrals.address, + ZERO_ADDRESS, + wrapper, + SportAMMLiquidityPool.address, + { from: owner } + ); + + await testUSDC.mint(first, toUnit(100000)); + await testUSDC.mint(curveSUSD.address, toUnit(100000)); + await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); + await SportsAMM.setCapPerSport(tagID_4, toUnit('50000'), { from: owner }); + + await SportAMMLiquidityPool.setNeedsTransformingCollateral(true, { + from: owner, + }); + }); + + describe('Test SportsAMM LPing', () => { + let deployedMarket; + let answer; + beforeEach(async () => { + await fastForward(game1NBATime - (await currentTime()) - SECOND); + // req. games + const tx = await TherundownConsumerDeployed.fulfillGamesCreated( + reqIdCreate, + gamesCreated, + sportId_4, + game1NBATime, + { from: wrapper } + ); + + let game = await TherundownConsumerDeployed.gameCreated(gameid1); + let gameTime = game.startTime; + await TherundownConsumerDeployed.createMarketForGame(gameid1); + await TherundownConsumerDeployed.marketPerGameId(gameid1); + answer = await SportPositionalMarketManager.getActiveMarketAddress('0'); + deployedMarket = await SportPositionalMarketContract.at(answer.toString()); + }); + let position = 0; + let value = 100; + + it('Get odds', async () => { + answer = await SportsAMM.obtainOdds(deployedMarket.address, 0); + let sumOfOdds = answer; + console.log('Odds for pos 0: ', fromUnit(answer)); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 1); + sumOfOdds = sumOfOdds.add(answer); + console.log('Odds for pos 1: ', fromUnit(answer)); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 2); + sumOfOdds = sumOfOdds.add(answer); + console.log('Odds for pos 2: ', fromUnit(answer)); + console.log('Total odds: ', fromUnit(sumOfOdds)); + }); + + it('Get american odds', async () => { + answer = await GamesOddsObtainerDeployed.getOddsForGame(gameid1); + let sumOfOdds = answer[0]; + sumOfOdds = sumOfOdds.add(answer[1]); + sumOfOdds = sumOfOdds.add(answer[2]); + }); + + it('Get price', async () => { + answer = await SportsAMM.obtainOdds(deployedMarket.address, 0); + let sumOfPrices = answer; + console.log('Price for pos 0: ', fromUnit(answer)); + sumOfPrices = sumOfPrices.add(answer); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 1); + console.log('Price for pos 1: ', fromUnit(answer)); + sumOfPrices = sumOfPrices.add(answer); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 2); + console.log('Price for pos 2: ', fromUnit(answer)); + console.log('Total price: ', fromUnit(sumOfPrices)); + }); + it('Get Available to buy from SportsAMM, position 1', async () => { + answer = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 1); + console.log('Available to buy: ', fromUnit(answer)); + }); + + it('Get BuyQuote from SportsAMM, position 1, value: 100', async () => { + answer = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 1, toUnit(100)); + console.log('buyAMMQuote: ', fromUnit(answer)); + }); + + it('Buy from SportsAMM, position 1, value: 100', async () => { + let ammBalance = await Thales.balanceOf(SportsAMM.address); + console.log('ammBalance: ' + ammBalance / 1e18); + + let availableToBuy = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 1); + let additionalSlippage = toUnit(0.01); + let buyFromAmmQuote = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 1, toUnit(100)); + answer = await Thales.balanceOf(first); + let before_balance = answer; + console.log('acc balance: ', fromUnit(answer)); + console.log('buyQuote: ', fromUnit(buyFromAmmQuote)); + + await expect( + SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(100), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ) + ).to.be.revertedWith('Pool has not started'); + + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + + await expect( + SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(100), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ) + ).to.be.revertedWith('Pool has not started'); + + await expect(SportAMMLiquidityPool.start({ from: owner })).to.be.revertedWith( + 'can not start with 0 deposits' + ); + + await Thales.mint(firstLiquidityProvider, toUnitSix('100')); + await Thales.approve(SportAMMLiquidityPool.address, toUnitSix('100'), { + from: firstLiquidityProvider, + }); + + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + + let isUserLPing = await SportAMMLiquidityPool.isUserLPing(firstLiquidityProvider); + console.log('isUserLPing firstLiquidityProvider: ' + isUserLPing); + + await SportAMMLiquidityPool.deposit(toUnitSix(100), { from: firstLiquidityProvider }); + + isUserLPing = await SportAMMLiquidityPool.isUserLPing(firstLiquidityProvider); + console.log('isUserLPing firstLiquidityProvider after deposit: ' + isUserLPing); + + await SportAMMLiquidityPool.start({ from: owner }); + + await expect( + SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(100), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ) + ).to.be.revertedWith('default liquidity provider not set'); + + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + + await Thales.mint(defaultLiquidityProvider, toUnitSix('1000')); + await Thales.approve(SportAMMLiquidityPool.address, toUnitSix('1000'), { + from: defaultLiquidityProvider, + }); + + let maturity = await deployedMarket.times(); + var maturityAfter = maturity[0]; + var expiryAfter = maturity[1]; + console.log('Maturity after' + parseInt(maturityAfter)); + + let now = await currentTime(); + console.log('now' + parseInt(now)); + + let marketRound = await SportAMMLiquidityPool.getMarketRound(deployedMarket.address); + let round = await SportAMMLiquidityPool.round(); + console.log('Market round is ' + marketRound); + console.log('round ' + round); + + let roundPool = await SportAMMLiquidityPool.roundPools(2); + console.log('round pool is ' + roundPool); + + let balanceDefaultLiquidityProviderBefore = await Thales.balanceOf(defaultLiquidityProvider); + console.log( + 'balanceDefaultLiquidityProviderBefore: ' + balanceDefaultLiquidityProviderBefore / 1e18 + ); + + let roundPoolBalanceBefore = await Thales.balanceOf(roundPool); + console.log('roundPoolBalanceBefore: ' + roundPoolBalanceBefore / 1e18); + + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(100), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + buyFromAmmQuote = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 0, toUnit(1)); + console.log('Buy quote for positions 0 is ' + buyFromAmmQuote / 1e18 + ' !!!!!'); + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 0, + toUnit(1), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + let balanceDefaultLiquidityProviderAfter = await Thales.balanceOf(defaultLiquidityProvider); + console.log( + 'balanceDefaultLiquidityProviderAfter: ' + balanceDefaultLiquidityProviderAfter / 1e18 + ); + + let balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound( + 1, + defaultLiquidityProvider + ); + console.log('balancesPerRoundLP 1 ' + balancesPerRoundLP / 1e18); + + balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound( + 2, + defaultLiquidityProvider + ); + console.log('balancesPerRoundLP 2 ' + balancesPerRoundLP / 1e18); + + let roundPoolBalanceAfter = await Thales.balanceOf(roundPool); + console.log('roundPoolBalanceAfter: ' + roundPoolBalanceAfter / 1e18); + + let options = await deployedMarket.options(); + position = artifacts.require('SportPosition'); + let home = await position.at(options.home); + let away = await position.at(options.away); + + let balanceHome = await home.balanceOf(first); + console.log('Balance Home first= ' + balanceHome / 1e18); + + let balanceAway = await away.balanceOf(first); + console.log('Balance Away first= ' + balanceAway / 1e18); + + let balanceHomePool = await home.balanceOf(roundPool); + console.log('Balance Home roundPool= ' + balanceHomePool / 1e18); + + let balanceAwayPool = await away.balanceOf(roundPool); + console.log('Balance Away roundPool= ' + balanceAwayPool / 1e18); + + let canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound ' + canCloseCurrentRound); + + await fastForward(month * 2); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound ' + canCloseCurrentRound); + + await SportAMMLiquidityPool.closeRound(); + + round = await SportAMMLiquidityPool.round(); + console.log('round ' + round); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound ' + canCloseCurrentRound); + + const tx_2 = await TherundownConsumerDeployed.fulfillGamesResolved( + reqIdResolve, + gamesResolved, + sportId_4, + { from: wrapper } + ); + + let gameR = await TherundownConsumerDeployed.gameResolved(gameid1); + assert.equal(100, gameR.homeScore); + assert.equal(129, gameR.awayScore); + + // resolve markets + const tx_resolve = await TherundownConsumerDeployed.resolveMarketForGame(gameid1); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound ' + canCloseCurrentRound); + + await SportAMMLiquidityPool.closeRound(); + + balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound( + 3, + defaultLiquidityProvider + ); + console.log('balancesPerRound 3 defaultLiquidityProvider ' + balancesPerRoundLP / 1e18); + + balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound(3, firstLiquidityProvider); + console.log('balancesPerRound 3 firstLiquidityProvider ' + balancesPerRoundLP / 1e18); + + balanceDefaultLiquidityProviderBefore = await Thales.balanceOf(defaultLiquidityProvider); + console.log( + 'balanceDefaultLiquidityProviderAfter: ' + balanceDefaultLiquidityProviderBefore / 1e18 + ); + + let profitAndLossPerRound = await SportAMMLiquidityPool.profitAndLossPerRound(2); + console.log('profitAndLossPerRound: ' + profitAndLossPerRound / 1e16 + '%'); + + let cumulativeProfitAndLoss = await SportAMMLiquidityPool.cumulativeProfitAndLoss(2); + console.log('cumulativeProfitAndLoss: ' + cumulativeProfitAndLoss / 1e16 + '%'); + + let allocationPerRound = await SportAMMLiquidityPool.allocationPerRound(2); + console.log('allocationPerRound: ' + allocationPerRound / 1e18); + + allocationPerRound = await SportAMMLiquidityPool.allocationPerRound(3); + console.log('allocationPerRound3: ' + allocationPerRound / 1e18); + + round = await SportAMMLiquidityPool.round(); + console.log('round ' + round); + + let totalDeposited = await SportAMMLiquidityPool.totalDeposited(); + console.log('totalDeposited 3 ' + totalDeposited / 1e18); + + await SportAMMLiquidityPool.withdrawalRequest({ from: firstLiquidityProvider }); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound 3 ' + canCloseCurrentRound); + + await fastForward(month * 2); + + canCloseCurrentRound = await SportAMMLiquidityPool.canCloseCurrentRound(); + console.log('canCloseCurrentRound 3 ' + canCloseCurrentRound); + + await SportAMMLiquidityPool.closeRound(); + + round = await SportAMMLiquidityPool.round(); + console.log('round ' + round); + + allocationPerRound = await SportAMMLiquidityPool.allocationPerRound(4); + console.log('allocationPerRound3: ' + allocationPerRound / 1e18); + + balancesPerRoundLP = await SportAMMLiquidityPool.balancesPerRound(4, firstLiquidityProvider); + console.log('balancesPerRound 3 firstLiquidityProvider ' + balancesPerRoundLP / 1e18); + + balanceDefaultLiquidityProviderBefore = await Thales.balanceOf(defaultLiquidityProvider); + console.log( + 'balanceDefaultLiquidityProviderAfter: ' + balanceDefaultLiquidityProviderBefore / 1e18 + ); + + profitAndLossPerRound = await SportAMMLiquidityPool.profitAndLossPerRound(3); + console.log('profitAndLossPerRound 3: ' + profitAndLossPerRound / 1e16 + '%'); + + cumulativeProfitAndLoss = await SportAMMLiquidityPool.cumulativeProfitAndLoss(3); + console.log('cumulativeProfitAndLoss: ' + cumulativeProfitAndLoss / 1e16 + '%'); + + totalDeposited = await SportAMMLiquidityPool.totalDeposited(); + console.log('totalDeposited 4 ' + totalDeposited / 1e18); + + await Thales.mint(secondLiquidityProvider, toUnitSix('1000')); + await ThalesForStaking.transfer(secondLiquidityProvider, toUnit('1000'), { + from: owner, + }); + + await Thales.approve(SportAMMLiquidityPool.address, toUnitSix('1000'), { + from: secondLiquidityProvider, + }); + + const MockStakingThales = artifacts.require('MockStakingThales'); + let mockStakingThales = await MockStakingThales.new({ from: owner }); + await ThalesForStaking.approve(mockStakingThales.address, toUnit(1000), { + from: secondLiquidityProvider, + }); + await mockStakingThales.stake(toUnit(100), { from: secondLiquidityProvider }); + + await SportAMMLiquidityPool.setStakedThalesMultiplier(toUnit(1), { + from: owner, + }); + + await SportAMMLiquidityPool.setStakingThales(mockStakingThales.address, { + from: owner, + }); + + await expect( + SportAMMLiquidityPool.deposit(toUnitSix(1000000), { from: secondLiquidityProvider }) + ).to.be.revertedWith('Deposit amount exceeds AMM LP cap'); + + await expect( + SportAMMLiquidityPool.deposit(toUnitSix(101), { from: secondLiquidityProvider }) + ).to.be.revertedWith('Not enough staked THALES'); + + await expect( + SportAMMLiquidityPool.deposit(toUnitSix(1), { from: secondLiquidityProvider }) + ).to.be.revertedWith('Amount less than minDepositAmount'); + + await SportAMMLiquidityPool.setOnlyWhitelistedStakersAllowed(true, { + from: owner, + }); + await expect( + SportAMMLiquidityPool.deposit(toUnitSix(101), { from: secondLiquidityProvider }) + ).to.be.revertedWith('Only whitelisted stakers allowed'); + + let getMaxAvailableDepositForUser = await SportAMMLiquidityPool.getMaxAvailableDepositForUser( + secondLiquidityProvider + ); + console.log('getMaxAvailableDepositForUser ' + getMaxAvailableDepositForUser[1] / 1e18); + + let getNeededStakedThalesToWithdrawForUser = + await SportAMMLiquidityPool.getNeededStakedThalesToWithdrawForUser(secondLiquidityProvider); + console.log( + 'getNeededStakedThalesToWithdrawForUser ' + getNeededStakedThalesToWithdrawForUser / 1e18 + ); + + await SportAMMLiquidityPool.setWhitelistedStakerAddresses([secondLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnitSix(100), { from: secondLiquidityProvider }); + + getMaxAvailableDepositForUser = await SportAMMLiquidityPool.getMaxAvailableDepositForUser( + secondLiquidityProvider + ); + console.log('getMaxAvailableDepositForUser ' + getMaxAvailableDepositForUser[1] / 1e18); + + getNeededStakedThalesToWithdrawForUser = + await SportAMMLiquidityPool.getNeededStakedThalesToWithdrawForUser(secondLiquidityProvider); + console.log( + 'getNeededStakedThalesToWithdrawForUser ' + getNeededStakedThalesToWithdrawForUser / 1e18 + ); + + ammBalance = await Thales.balanceOf(SportsAMM.address); + console.log('ammBalance: ' + ammBalance / 1e18); + }); + }); +}); diff --git a/test/contracts/SportMarkets/SportsAMMSingleBuy.js b/test/contracts/SportMarkets/SportsAMMSingleBuy.js index bd05521ec..c06071c54 100644 --- a/test/contracts/SportMarkets/SportsAMMSingleBuy.js +++ b/test/contracts/SportMarkets/SportsAMMSingleBuy.js @@ -31,15 +31,30 @@ const { convertToDecimals, encodeCall, assertRevert, + getEventByName, } = require('../../utils/helpers'); contract('SportsAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -58,17 +73,17 @@ contract('SportsAMM', (accounts) => { const ReferralsContract = artifacts.require('Referrals'); const SportsAMMUtils = artifacts.require('SportsAMMUtils'); + let ThalesOracleCouncil; let Thales; let answer; let verifier; - let sportsAMMUtils; let minimumPositioningDuration = 0; let minimumMarketMaturityDuration = 0; + let sportsAMMUtils; let marketQuestion, marketSource, endOfPositioning, - fixedTicketPrice, positionAmount1, positionAmount2, positionAmount3, @@ -115,6 +130,7 @@ contract('SportsAMM', (accounts) => { let game_2_football_resolve; let reqIdResolveFoodball; let gamesResolvedFootball; + let GamesOddsObtainerDeployed; let SportPositionalMarketManager, SportPositionalMarketFactory, @@ -131,8 +147,8 @@ contract('SportsAMM', (accounts) => { testUSDT, testDAI, Referrals, - GamesOddsObtainerDeployed, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -174,6 +190,7 @@ contract('SportsAMM', (accounts) => { await SportPositionalMarketManager.setExpiryDuration(5 * DAY, { from: manager }); // await SportPositionalMarketManager.setCancelTimeout(2 * HOUR, { from: manager }); + await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); await SportPositionalMarketFactory.setSportPositionalMarketManager( SportPositionalMarketManager.address, @@ -221,6 +238,7 @@ contract('SportsAMM', (accounts) => { toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500'), { from: owner } ); @@ -254,17 +272,18 @@ contract('SportsAMM', (accounts) => { second, second, second, + second, { from: owner } ); - await Thales.transfer(first, toUnit('100000'), { from: owner }); - await Thales.transfer(second, toUnit('100000'), { from: owner }); - await Thales.transfer(third, toUnit('100000'), { from: owner }); + await Thales.transfer(first, toUnit('1000'), { from: owner }); + await Thales.transfer(second, toUnit('1000'), { from: owner }); + await Thales.transfer(third, toUnit('1000'), { from: owner }); await Thales.transfer(SportsAMM.address, toUnit('100000'), { from: owner }); - await Thales.approve(SportsAMM.address, toUnit('100000'), { from: first }); - await Thales.approve(SportsAMM.address, toUnit('100000'), { from: second }); - await Thales.approve(SportsAMM.address, toUnit('100000'), { from: third }); + await Thales.approve(SportsAMM.address, toUnit('1000'), { from: first }); + await Thales.approve(SportsAMM.address, toUnit('1000'), { from: second }); + await Thales.approve(SportsAMM.address, toUnit('1000'), { from: third }); // ids gameid1 = '0x6536306366613738303834366166363839373862343935373965356366333936'; @@ -375,8 +394,16 @@ contract('SportsAMM', (accounts) => { await SportPositionalMarketManager.setTherundownConsumer(TherundownConsumerDeployed.address, { from: manager, }); - - //await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); + await SportPositionalMarketManager.setOddsObtainer(GamesOddsObtainerDeployed.address, { + from: manager, + }); + await SportPositionalMarketManager.setSupportedSportForDoubleChance( + [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], + true, + { + from: manager, + } + ); await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); await SportPositionalMarketData.setSportPositionalMarketManager( @@ -410,6 +437,22 @@ contract('SportsAMM', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -418,12 +461,34 @@ contract('SportsAMM', (accounts) => { Referrals.address, ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); - await testUSDC.mint(first, toUnit(100000)); - await testUSDC.mint(curveSUSD.address, toUnit(100000)); - await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('100000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('100000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('100000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('100000'), { + from: defaultLiquidityProvider, + }); + + await testUSDC.mint(first, toUnit(1000)); + await testUSDC.mint(curveSUSD.address, toUnit(1000)); + await testUSDC.approve(SportsAMM.address, toUnit(1000), { from: first }); await SportsAMM.setCapPerSport(tagID_4, toUnit('50000'), { from: owner }); }); diff --git a/test/contracts/SportMarkets/SportsAMMSpreadCheck.js b/test/contracts/SportMarkets/SportsAMMSpreadCheck.js new file mode 100644 index 000000000..e5b37087b --- /dev/null +++ b/test/contracts/SportMarkets/SportsAMMSpreadCheck.js @@ -0,0 +1,592 @@ +'use strict'; + +const { artifacts, contract, web3 } = require('hardhat'); +const { toBN } = web3.utils; + +const { assert, addSnapshotBeforeRestoreAfterEach } = require('../../utils/common'); + +const { toBytes32 } = require('../../../index'); + +var ethers2 = require('ethers'); +var crypto = require('crypto'); + +const SECOND = 1000; +const HOUR = 3600; +const DAY = 86400; +const WEEK = 604800; +const YEAR = 31556926; + +const { + fastForward, + toUnit, + fromUnit, + currentTime, + bytesToString, + multiplyDecimalRound, + divideDecimalRound, +} = require('../../utils')(); + +const { + onlyGivenAddressCanInvoke, + convertToDecimals, + encodeCall, + assertRevert, +} = require('../../utils/helpers'); + +contract('SportsAMM', (accounts) => { + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; + + const ZERO_ADDRESS = '0x' + '0'.repeat(40); + const MAX_NUMBER = + '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); + const SportPositionContract = artifacts.require('SportPosition'); + const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); + const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); + const SportPositionalMarketManagerContract = artifacts.require('SportPositionalMarketManager'); + const SportPositionalMarketFactoryContract = artifacts.require('SportPositionalMarketFactory'); + const SportPositionalMarketMasterCopyContract = artifacts.require( + 'SportPositionalMarketMastercopy' + ); + const SportPositionMasterCopyContract = artifacts.require('SportPositionMastercopy'); + const StakingThalesContract = artifacts.require('StakingThales'); + const SportsAMMContract = artifacts.require('SportsAMM'); + const ThalesContract = artifacts.require('contracts/Token/OpThales_L1.sol:OpThales'); + const SNXRewardsContract = artifacts.require('SNXRewards'); + const AddressResolverContract = artifacts.require('AddressResolverHelper'); + const TestOddsContract = artifacts.require('TestOdds'); + const ReferralsContract = artifacts.require('Referrals'); + const SportsAMMUtils = artifacts.require('SportsAMMUtils'); + + let Thales; + let answer; + let verifier; + let sportsAMMUtils; + let minimumPositioningDuration = 0; + let minimumMarketMaturityDuration = 0; + + let marketQuestion, + marketSource, + endOfPositioning, + fixedTicketPrice, + positionAmount1, + positionAmount2, + positionAmount3, + withdrawalAllowed, + tag, + paymentToken, + phrases = [], + deployedMarket, + outcomePosition, + outcomePosition2; + + let consumer; + let TherundownConsumer; + let TherundownConsumerImplementation; + let TherundownConsumerDeployed; + let MockTherundownConsumerWrapper; + let initializeConsumerData; + let gamesQueue; + let game_1_create; + let game_1_resolve; + let gameid1; + let oddsid; + let oddsResult; + let oddsResultArray; + let reqIdOdds; + let gameid2; + let gameid3; + let game_2_create; + let game_2_resolve; + let gamesCreated; + let gamesResolved; + let reqIdCreate; + let reqIdResolve; + let reqIdFootballCreate; + let reqIdFootballCreate2; + let gameFootballid1; + let gameFootballid2; + let gameFootballid3; + let game_1_football_create; + let game_2_football_create; + let game_3_football_create; + let gamesFootballCreated; + let game_1_football_resolve; + let game_2_football_resolve; + let reqIdResolveFoodball; + let gamesResolvedFootball; + let GamesOddsObtainerDeployed; + + let SportPositionalMarketManager, + SportPositionalMarketFactory, + SportPositionalMarketData, + SportPositionalMarket, + SportPositionalMarketMastercopy, + SportPositionMastercopy, + StakingThales, + SNXRewards, + AddressResolver, + TestOdds, + curveSUSD, + testUSDC, + testUSDT, + testDAI, + Referrals, + SportsAMM, + SportAMMLiquidityPool; + + const game1NBATime = 1646958600; + const gameFootballTime = 1649876400; + + const sportId_4 = 4; // NBA + const sportId_16 = 16; // CHL + + const tagID_4 = 9000 + sportId_4; + const tagID_16 = 9000 + sportId_16; + + let gameMarket; + + const usdcQuantity = toBN(10000 * 1e6); //100 USDC + + beforeEach(async () => { + SportPositionalMarketManager = await SportPositionalMarketManagerContract.new({ + from: manager, + }); + SportPositionalMarketFactory = await SportPositionalMarketFactoryContract.new({ + from: manager, + }); + SportPositionalMarketMastercopy = await SportPositionalMarketContract.new({ from: manager }); + SportPositionMastercopy = await SportPositionContract.new({ from: manager }); + SportPositionalMarketData = await SportPositionalMarketDataContract.new({ from: manager }); + StakingThales = await StakingThalesContract.new({ from: manager }); + SportsAMM = await SportsAMMContract.new({ from: manager }); + SNXRewards = await SNXRewardsContract.new({ from: manager }); + AddressResolver = await AddressResolverContract.new(); + // TestOdds = await TestOddsContract.new(); + await AddressResolver.setSNXRewardsAddress(SNXRewards.address); + + Thales = await ThalesContract.new({ from: owner }); + let GamesQueue = artifacts.require('GamesQueue'); + gamesQueue = await GamesQueue.new({ from: owner }); + await gamesQueue.initialize(owner, { from: owner }); + + await SportPositionalMarketManager.initialize(manager, Thales.address, { from: manager }); + await SportPositionalMarketFactory.initialize(manager, { from: manager }); + + await SportPositionalMarketManager.setExpiryDuration(5 * DAY, { from: manager }); + // await SportPositionalMarketManager.setCancelTimeout(2 * HOUR, { from: manager }); + // await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); + + await SportPositionalMarketFactory.setSportPositionalMarketManager( + SportPositionalMarketManager.address, + { from: manager } + ); + await SportPositionalMarketFactory.setSportPositionalMarketMastercopy( + SportPositionalMarketMastercopy.address, + { from: manager } + ); + await SportPositionalMarketFactory.setSportPositionMastercopy(SportPositionMastercopy.address, { + from: manager, + }); + // await SportPositionalMarketFactory.setLimitOrderProvider(SportsAMM.address, { from: manager }); + await SportPositionalMarketFactory.setSportsAMM(SportsAMM.address, { from: manager }); + await SportPositionalMarketManager.setSportPositionalMarketFactory( + SportPositionalMarketFactory.address, + { from: manager } + ); + await SportPositionalMarketManager.setWhitelistedAddresses([first, third], true, 1, { + from: manager, + }); + await SportPositionalMarketManager.setWhitelistedAddresses([first, second], true, 2, { + from: manager, + }); + + Referrals = await ReferralsContract.new(); + await Referrals.initialize(owner, ZERO_ADDRESS, ZERO_ADDRESS, { from: owner }); + + await SportsAMM.initialize( + owner, + Thales.address, + toUnit('5000'), + toUnit('0.02'), + toUnit('0.2'), + DAY, + { from: owner } + ); + + await SportsAMM.setParameters( + DAY, + toUnit('0.01'), //_minSpread + toUnit('0.1'), //_maxSpread + toUnit('0.001'), //_minSupportedOdds + toUnit('0.9'), //_maxSupportedOdds + toUnit('1000'), //_defaultCapPerGame + toUnit('0.02'), //_safeBoxImpact + toUnit('0.005'), //_referrerFee + toUnit('500000'), //_threshold + { from: owner } + ); + + await SportsAMM.setSportsPositionalMarketManager(SportPositionalMarketManager.address, { + from: owner, + }); + + sportsAMMUtils = await SportsAMMUtils.new(SportsAMM.address); + await SportsAMM.setAmmUtils(sportsAMMUtils.address, { + from: owner, + }); + + await SportPositionalMarketData.initialize(owner, { from: owner }); + await StakingThales.initialize( + owner, + Thales.address, + Thales.address, + Thales.address, + WEEK, + WEEK, + SNXRewards.address, + { from: owner } + ); + await StakingThales.setAddresses( + SNXRewards.address, + second, + second, + second, + second, + SportsAMM.address, + second, + second, + second, + second, + { from: owner } + ); + + await Thales.transfer(first, toUnit('100000'), { from: owner }); + await Thales.transfer(second, toUnit('100000'), { from: owner }); + await Thales.transfer(third, toUnit('100000'), { from: owner }); + + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: first }); + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: second }); + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: third }); + + // ids + gameid1 = '0x6536306366613738303834366166363839373862343935373965356366333936'; + gameid2 = '0x3937346533663036386233333764313239656435633133646632376133326662'; + + // await TestOdds.addOddsForGameId(gameid1, [toUnit(0.8), toUnit(0.1899999), toUnit(0)]); + + // create game props + game_1_create = + '0x0000000000000000000000000000000000000000000000000000000000000020653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; + game_2_create = + '0x0000000000000000000000000000000000000000000000000000000000000020393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; + gamesCreated = [game_1_create, game_2_create]; + reqIdCreate = '0x65da2443ccd66b09d4e2693933e8fb9aab9addf46fb93300bd7c1d70c5e21666'; + + // resolve game props + reqIdResolve = '0x30250573c4b099aeaf06273ef9fbdfe32ab2d6b8e33420de988be5d6886c92a7'; + game_1_resolve = + '0x653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000622a9808'; + game_2_resolve = + '0x393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000622a9808'; + gamesResolved = [game_1_resolve, game_2_resolve]; + + // football matches + reqIdFootballCreate = '0x61d7dd698383c58c7217cf366764a1e92a1f059b1b6ea799dce4030a942302f4'; + reqIdFootballCreate2 = '0x47e3535f7d3c146606fa6bcc06d95eb74f0bf8eac7d0d9c352814ee4c726d194'; + gameFootballid1 = '0x3163626162623163303138373465363263313661316462333164363164353333'; + gameFootballid2 = '0x3662646437313731316337393837643336643465333538643937393237356234'; + gameFootballid3 = '0x6535303439326161636538313035666362316531366364373664383963643361'; + // await TestOdds.addOddsForGameId(gameFootballid1, [toUnit(0.55), toUnit(0.1), toUnit(0.35)]); + game_1_football_create = + '0x000000000000000000000000000000000000000000000000000000000000002031636261626231633031383734653632633136613164623331643631643533330000000000000000000000000000000000000000000000000000000062571db00000000000000000000000000000000000000000000000000000000000009c40ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf2c0000000000000000000000000000000000000000000000000000000000006a4000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001f41746c657469636f204d61647269642041746c657469636f204d616472696400000000000000000000000000000000000000000000000000000000000000001f4d616e636865737465722043697479204d616e63686573746572204369747900'; + game_2_football_create = + '0x000000000000000000000000000000000000000000000000000000000000002036626464373137313163373938376433366434653335386439373932373562340000000000000000000000000000000000000000000000000000000062571db0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff76800000000000000000000000000000000000000000000000000000000000018c18000000000000000000000000000000000000000000000000000000000000cb2000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f42656e666963612042656e666963610000000000000000000000000000000000'; + game_3_football_create = + '0x0000000000000000000000000000000000000000000000000000000000000020653530343932616163653831303566636231653136636437366438396364336100000000000000000000000000000000000000000000000000000000629271300000000000000000000000000000000000000000000000000000000000002a3000000000000000000000000000000000000000000000000000000000000064c800000000000000000000000000000000000000000000000000000000000067e800000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000175265616c204d6164726964205265616c204d6164726964000000000000000000'; + gamesFootballCreated = [game_1_football_create, game_2_football_create, game_3_football_create]; + game_1_football_resolve = + '0x316362616262316330313837346536326331366131646233316436316435333300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000062571db0'; + game_2_football_resolve = + '0x366264643731373131633739383764333664346533353864393739323735623400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000062571db0'; + reqIdResolveFoodball = '0xff8887a8535b7a8030962e6f6b1eba61c0f1cb82f706e77d834f15c781e47697'; + gamesResolvedFootball = [game_1_football_resolve, game_2_football_resolve]; + + oddsid = '0x6135363061373861363135353239363137366237393232353866616336613532'; + oddsResult = + '0x6135363061373861363135353239363137366237393232353866616336613532000000000000000000000000000000000000000000000000000000000000283cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd3dc0000000000000000000000000000000000000000000000000000000000000000'; + oddsResultArray = [oddsResult]; + reqIdOdds = '0x5bf0ea636f9515e1e1060e5a21e11ef8a628fa99b1effb8aa18624b02c6f36de'; + // reqIdOdds2 = ''; + + TherundownConsumer = artifacts.require('TherundownConsumer'); + TherundownConsumerDeployed = await TherundownConsumer.new(); + + await TherundownConsumerDeployed.initialize( + owner, + [sportId_4, sportId_16], + SportPositionalMarketManager.address, + [sportId_4], + gamesQueue.address, + [8, 12], // resolved statuses + [1, 2], // cancel statuses + { from: owner } + ); + + let ConsumerVerifier = artifacts.require('TherundownConsumerVerifier'); + verifier = await ConsumerVerifier.new({ from: owner }); + + await verifier.initialize( + owner, + TherundownConsumerDeployed.address, + ['TDB TDB', 'TBA TBA'], + ['create', 'resolve'], + 20, + { + from: owner, + } + ); + + let GamesOddsObtainer = artifacts.require('GamesOddsObtainer'); + GamesOddsObtainerDeployed = await GamesOddsObtainer.new({ from: owner }); + + await GamesOddsObtainerDeployed.initialize( + owner, + TherundownConsumerDeployed.address, + verifier.address, + SportPositionalMarketManager.address, + [4, 16], + { from: owner } + ); + + await Thales.transfer(TherundownConsumerDeployed.address, toUnit('1000'), { from: owner }); + await TherundownConsumerDeployed.setSportContracts( + wrapper, + gamesQueue.address, + SportPositionalMarketManager.address, + verifier.address, + GamesOddsObtainerDeployed.address, + { + from: owner, + } + ); + await TherundownConsumerDeployed.addToWhitelist(third, true, { from: owner }); + await TherundownConsumerDeployed.addToWhitelist(SportPositionalMarketManager.address, true, { + from: owner, + }); + + await SportPositionalMarketManager.setTherundownConsumer(TherundownConsumerDeployed.address, { + from: manager, + }); + // await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); + await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); + + await SportPositionalMarketData.setSportPositionalMarketManager( + SportPositionalMarketManager.address, + { from: owner } + ); + await SportPositionalMarketData.setSportsAMM(SportsAMM.address, { from: owner }); + + let TestUSDC = artifacts.require('TestUSDC'); + testUSDC = await TestUSDC.new(); + testUSDT = await TestUSDC.new(); + + let ERC20token = artifacts.require('Thales'); + testDAI = await ERC20token.new(); + + let CurveSUSD = artifacts.require('MockCurveSUSD'); + curveSUSD = await CurveSUSD.new( + Thales.address, + testUSDC.address, + testUSDT.address, + testDAI.address + ); + + await SportsAMM.setCurveSUSD( + curveSUSD.address, + testDAI.address, + testUSDC.address, + testUSDT.address, + true, + toUnit(0.02), + { from: owner } + ); + + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + + await SportsAMM.setAddresses( + owner, + Thales.address, + TherundownConsumerDeployed.address, + StakingThales.address, + Referrals.address, + ZERO_ADDRESS, + wrapper, + SportAMMLiquidityPool.address, + { from: owner } + ); + + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + + await testUSDC.mint(first, toUnit(100000)); + await testUSDC.mint(curveSUSD.address, toUnit(100000)); + await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); + await SportsAMM.setCapPerSport(tagID_4, toUnit('50000'), { from: owner }); + }); + + describe('Test 3 options game', () => { + let deployedMarket; + let answer; + beforeEach(async () => { + let _currentTime = await currentTime(); + // await fastForward(game1NBATime - (await currentTime()) - SECOND); + // await fastForward(gameFootballTime - (await currentTime()) - SECOND); + await fastForward(game1NBATime - (await currentTime()) - SECOND); + // console.log("Fast forward: ", (gameFootballTime - _currentTime - SECOND).toString()); + + // req. games + const tx = await TherundownConsumerDeployed.fulfillGamesCreated( + reqIdFootballCreate, + gamesFootballCreated, + sportId_16, + game1NBATime, + { from: wrapper } + ); + + let game = await TherundownConsumerDeployed.gameCreated(gameFootballid1); + // console.log("Current time: ", _currentTime.toString()); + // console.log("Start time: ", game.startTime.toString()); + // console.log("Difference: ", (_currentTime - game.startTime).toString()); + + // create markets + const tx_create = await TherundownConsumerDeployed.createMarketForGame(gameFootballid1); + + let marketAdd = await TherundownConsumerDeployed.marketPerGameId(gameFootballid1); + + // check if event is emited + let answer = await SportPositionalMarketManager.getActiveMarketAddress('0'); + // console.log("Active market: ", answer.toString()); + deployedMarket = await SportPositionalMarketContract.at(answer); + }); + + let position = 0; + let value = 100; + + it('Get odds', async () => { + answer = await SportsAMM.obtainOdds(deployedMarket.address, 0); + let sumOfOdds = answer; + console.log('Odds for pos 0: ', fromUnit(answer)); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 1); + sumOfOdds = sumOfOdds.add(answer); + console.log('Odds for pos 1: ', fromUnit(answer)); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 2); + sumOfOdds = sumOfOdds.add(answer); + console.log('Odds for pos 2: ', fromUnit(answer)); + console.log('Total odds: ', fromUnit(sumOfOdds)); + }); + + it('Get Available to buy from SportsAMM, positions', async () => { + answer = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 1); + console.log('Available to buy 1: ', fromUnit(answer)); + answer = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 0); + console.log('Available to buy 0: ', fromUnit(answer)); + answer = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 2); + console.log('Available to buy 2: ', fromUnit(answer)); + }); + + it('Get BuyQuote from SportsAMM, position 1, value: 100', async () => { + answer = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 1, toUnit(100)); + console.log('buyAMMQuote: ', fromUnit(answer)); + }); + + it('Buy from SportsAMM, position 1, value: 100', async () => { + let availableToBuy = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 1); + let additionalSlippage = toUnit(0.01); + + let buyFromAmmQuote = await SportsAMM.buyFromAmmQuote( + deployedMarket.address, + 1, + toUnit(1000) + ); + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(1000), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + buyFromAmmQuote = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 2, toUnit(1000)); + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 2, + toUnit(1000), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + buyFromAmmQuote = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 0, toUnit(1000)); + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 0, + toUnit(1000), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + let roundPool = await SportAMMLiquidityPool.getMarketPool(deployedMarket.address); + let roundPoolBalanceAfter = await Thales.balanceOf(roundPool); + console.log('roundPoolBalanceAfter: ' + roundPoolBalanceAfter / 1e18); + }); + }); +}); diff --git a/test/contracts/SportMarkets/SportsAMMSpreadTwoOptions.js b/test/contracts/SportMarkets/SportsAMMSpreadTwoOptions.js new file mode 100644 index 000000000..1167d8a54 --- /dev/null +++ b/test/contracts/SportMarkets/SportsAMMSpreadTwoOptions.js @@ -0,0 +1,584 @@ +'use strict'; + +const { artifacts, contract, web3 } = require('hardhat'); +const { toBN } = web3.utils; + +const { assert, addSnapshotBeforeRestoreAfterEach } = require('../../utils/common'); + +const { toBytes32 } = require('../../../index'); + +var ethers2 = require('ethers'); +var crypto = require('crypto'); + +const SECOND = 1000; +const HOUR = 3600; +const DAY = 86400; +const WEEK = 604800; +const YEAR = 31556926; + +const { + fastForward, + toUnit, + fromUnit, + currentTime, + bytesToString, + multiplyDecimalRound, + divideDecimalRound, +} = require('../../utils')(); + +const { + onlyGivenAddressCanInvoke, + convertToDecimals, + encodeCall, + assertRevert, +} = require('../../utils/helpers'); + +contract('SportsAMM', (accounts) => { + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; + + const ZERO_ADDRESS = '0x' + '0'.repeat(40); + const MAX_NUMBER = + '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); + const SportPositionContract = artifacts.require('SportPosition'); + const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); + const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); + const SportPositionalMarketManagerContract = artifacts.require('SportPositionalMarketManager'); + const SportPositionalMarketFactoryContract = artifacts.require('SportPositionalMarketFactory'); + const SportPositionalMarketMasterCopyContract = artifacts.require( + 'SportPositionalMarketMastercopy' + ); + const SportPositionMasterCopyContract = artifacts.require('SportPositionMastercopy'); + const StakingThalesContract = artifacts.require('StakingThales'); + const SportsAMMContract = artifacts.require('SportsAMM'); + const ThalesContract = artifacts.require('contracts/Token/OpThales_L1.sol:OpThales'); + const SNXRewardsContract = artifacts.require('SNXRewards'); + const AddressResolverContract = artifacts.require('AddressResolverHelper'); + const TestOddsContract = artifacts.require('TestOdds'); + const ReferralsContract = artifacts.require('Referrals'); + const SportsAMMUtils = artifacts.require('SportsAMMUtils'); + + let Thales; + let answer; + let verifier; + let sportsAMMUtils; + let minimumPositioningDuration = 0; + let minimumMarketMaturityDuration = 0; + + let marketQuestion, + marketSource, + endOfPositioning, + fixedTicketPrice, + positionAmount1, + positionAmount2, + positionAmount3, + withdrawalAllowed, + tag, + paymentToken, + phrases = [], + deployedMarket, + outcomePosition, + outcomePosition2; + + let consumer; + let TherundownConsumer; + let TherundownConsumerImplementation; + let TherundownConsumerDeployed; + let MockTherundownConsumerWrapper; + let initializeConsumerData; + let gamesQueue; + let game_1_create; + let game_1_resolve; + let gameid1; + let oddsid; + let oddsResult; + let oddsResultArray; + let reqIdOdds; + let gameid2; + let gameid3; + let game_2_create; + let game_2_resolve; + let gamesCreated; + let gamesResolved; + let reqIdCreate; + let reqIdResolve; + let reqIdFootballCreate; + let reqIdFootballCreate2; + let gameFootballid1; + let gameFootballid2; + let gameFootballid3; + let game_1_football_create; + let game_2_football_create; + let game_3_football_create; + let gamesFootballCreated; + let game_1_football_resolve; + let game_2_football_resolve; + let reqIdResolveFoodball; + let gamesResolvedFootball; + let GamesOddsObtainerDeployed; + + let SportPositionalMarketManager, + SportPositionalMarketFactory, + SportPositionalMarketData, + SportPositionalMarket, + SportPositionalMarketMastercopy, + SportPositionMastercopy, + StakingThales, + SNXRewards, + AddressResolver, + TestOdds, + curveSUSD, + testUSDC, + testUSDT, + testDAI, + Referrals, + SportsAMM, + SportAMMLiquidityPool; + + const game1NBATime = 1646958600; + const gameFootballTime = 1649876400; + + const sportId_4 = 4; // NBA + const sportId_16 = 16; // CHL + + const tagID_4 = 9000 + sportId_4; + const tagID_16 = 9000 + sportId_16; + + let gameMarket; + + const usdcQuantity = toBN(10000 * 1e6); //100 USDC + + beforeEach(async () => { + SportPositionalMarketManager = await SportPositionalMarketManagerContract.new({ + from: manager, + }); + SportPositionalMarketFactory = await SportPositionalMarketFactoryContract.new({ + from: manager, + }); + SportPositionalMarketMastercopy = await SportPositionalMarketContract.new({ from: manager }); + SportPositionMastercopy = await SportPositionContract.new({ from: manager }); + SportPositionalMarketData = await SportPositionalMarketDataContract.new({ from: manager }); + StakingThales = await StakingThalesContract.new({ from: manager }); + SportsAMM = await SportsAMMContract.new({ from: manager }); + SNXRewards = await SNXRewardsContract.new({ from: manager }); + AddressResolver = await AddressResolverContract.new(); + // TestOdds = await TestOddsContract.new(); + await AddressResolver.setSNXRewardsAddress(SNXRewards.address); + + Thales = await ThalesContract.new({ from: owner }); + let GamesQueue = artifacts.require('GamesQueue'); + gamesQueue = await GamesQueue.new({ from: owner }); + await gamesQueue.initialize(owner, { from: owner }); + + await SportPositionalMarketManager.initialize(manager, Thales.address, { from: manager }); + await SportPositionalMarketFactory.initialize(manager, { from: manager }); + + await SportPositionalMarketManager.setExpiryDuration(5 * DAY, { from: manager }); + // await SportPositionalMarketManager.setCancelTimeout(2 * HOUR, { from: manager }); + //await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); + + await SportPositionalMarketFactory.setSportPositionalMarketManager( + SportPositionalMarketManager.address, + { from: manager } + ); + await SportPositionalMarketFactory.setSportPositionalMarketMastercopy( + SportPositionalMarketMastercopy.address, + { from: manager } + ); + await SportPositionalMarketFactory.setSportPositionMastercopy(SportPositionMastercopy.address, { + from: manager, + }); + // await SportPositionalMarketFactory.setLimitOrderProvider(SportsAMM.address, { from: manager }); + await SportPositionalMarketFactory.setSportsAMM(SportsAMM.address, { from: manager }); + await SportPositionalMarketManager.setSportPositionalMarketFactory( + SportPositionalMarketFactory.address, + { from: manager } + ); + await SportPositionalMarketManager.setWhitelistedAddresses([first, third], true, 1, { + from: manager, + }); + await SportPositionalMarketManager.setWhitelistedAddresses([first, second], true, 2, { + from: manager, + }); + + Referrals = await ReferralsContract.new(); + await Referrals.initialize(owner, ZERO_ADDRESS, ZERO_ADDRESS, { from: owner }); + + await SportsAMM.initialize( + owner, + Thales.address, + toUnit('5000'), + toUnit('0.02'), + toUnit('0.2'), + DAY, + { from: owner } + ); + + await SportsAMM.setParameters( + DAY, + toUnit('0.013'), //_minSpread + toUnit('0.1'), //_maxSpread + toUnit('0.001'), //_minSupportedOdds + toUnit('0.9'), //_maxSupportedOdds + toUnit('1000'), //_defaultCapPerGame + toUnit('0.01'), //_safeBoxImpact + toUnit('0.005'), //_referrerFee + toUnit('500000'), //_threshold + { from: owner } + ); + + await SportsAMM.setSportsPositionalMarketManager(SportPositionalMarketManager.address, { + from: owner, + }); + + sportsAMMUtils = await SportsAMMUtils.new(SportsAMM.address); + await SportsAMM.setAmmUtils(sportsAMMUtils.address, { + from: owner, + }); + + await SportPositionalMarketData.initialize(owner, { from: owner }); + await StakingThales.initialize( + owner, + Thales.address, + Thales.address, + Thales.address, + WEEK, + WEEK, + SNXRewards.address, + { from: owner } + ); + await StakingThales.setAddresses( + SNXRewards.address, + second, + second, + second, + second, + SportsAMM.address, + second, + second, + second, + second, + { from: owner } + ); + + await Thales.transfer(first, toUnit('100000'), { from: owner }); + await Thales.transfer(second, toUnit('100000'), { from: owner }); + await Thales.transfer(third, toUnit('100000'), { from: owner }); + + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: first }); + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: second }); + await Thales.approve(SportsAMM.address, toUnit('100000'), { from: third }); + + // ids + gameid1 = '0x6536306366613738303834366166363839373862343935373965356366333936'; + gameid2 = '0x3937346533663036386233333764313239656435633133646632376133326662'; + + // await TestOdds.addOddsForGameId(gameid1, [toUnit(0.8), toUnit(0.1899999), toUnit(0)]); + + // create game props + game_1_create = + '0x0000000000000000000000000000000000000000000000000000000000000020653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; + game_2_create = + '0x0000000000000000000000000000000000000000000000000000000000000020393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; + gamesCreated = [game_1_create, game_2_create]; + reqIdCreate = '0x65da2443ccd66b09d4e2693933e8fb9aab9addf46fb93300bd7c1d70c5e21666'; + + // resolve game props + reqIdResolve = '0x30250573c4b099aeaf06273ef9fbdfe32ab2d6b8e33420de988be5d6886c92a7'; + game_1_resolve = + '0x653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000081000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000622a9808'; + game_2_resolve = + '0x393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000071000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000622a9808'; + gamesResolved = [game_1_resolve, game_2_resolve]; + + // football matches + reqIdFootballCreate = '0x61d7dd698383c58c7217cf366764a1e92a1f059b1b6ea799dce4030a942302f4'; + reqIdFootballCreate2 = '0x47e3535f7d3c146606fa6bcc06d95eb74f0bf8eac7d0d9c352814ee4c726d194'; + gameFootballid1 = '0x3163626162623163303138373465363263313661316462333164363164353333'; + gameFootballid2 = '0x3662646437313731316337393837643336643465333538643937393237356234'; + gameFootballid3 = '0x6535303439326161636538313035666362316531366364373664383963643361'; + // await TestOdds.addOddsForGameId(gameFootballid1, [toUnit(0.55), toUnit(0.1), toUnit(0.35)]); + game_1_football_create = + '0x000000000000000000000000000000000000000000000000000000000000002031636261626231633031383734653632633136613164623331643631643533330000000000000000000000000000000000000000000000000000000062571db00000000000000000000000000000000000000000000000000000000000009c40ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf2c0000000000000000000000000000000000000000000000000000000000006a4000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001f41746c657469636f204d61647269642041746c657469636f204d616472696400000000000000000000000000000000000000000000000000000000000000001f4d616e636865737465722043697479204d616e63686573746572204369747900'; + game_2_football_create = + '0x000000000000000000000000000000000000000000000000000000000000002036626464373137313163373938376433366434653335386439373932373562340000000000000000000000000000000000000000000000000000000062571db0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff76800000000000000000000000000000000000000000000000000000000000018c18000000000000000000000000000000000000000000000000000000000000cb2000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f42656e666963612042656e666963610000000000000000000000000000000000'; + game_3_football_create = + '0x0000000000000000000000000000000000000000000000000000000000000020653530343932616163653831303566636231653136636437366438396364336100000000000000000000000000000000000000000000000000000000629271300000000000000000000000000000000000000000000000000000000000002a3000000000000000000000000000000000000000000000000000000000000064c800000000000000000000000000000000000000000000000000000000000067e800000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000175265616c204d6164726964205265616c204d6164726964000000000000000000'; + gamesFootballCreated = [game_1_football_create, game_2_football_create, game_3_football_create]; + game_1_football_resolve = + '0x316362616262316330313837346536326331366131646233316436316435333300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000062571db0'; + game_2_football_resolve = + '0x366264643731373131633739383764333664346533353864393739323735623400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000062571db0'; + reqIdResolveFoodball = '0xff8887a8535b7a8030962e6f6b1eba61c0f1cb82f706e77d834f15c781e47697'; + gamesResolvedFootball = [game_1_football_resolve, game_2_football_resolve]; + + oddsid = '0x6536306366613738303834366166363839373862343935373965356366333936'; + oddsResult = + '0x6536306366613738303834366166363839373862343935373965356366333936000000000000000000000000000000000000000000000000000000000000283cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd3dc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd50800000000000000000000000000000000000000000000000000000000000000c8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd508'; + oddsResultArray = [oddsResult]; + reqIdOdds = '0x5bf0ea636f9515e1e1060e5a21e11ef8a628fa99b1effb8aa18624b02c6f36de'; + // reqIdOdds2 = ''; + + TherundownConsumer = artifacts.require('TherundownConsumer'); + TherundownConsumerDeployed = await TherundownConsumer.new(); + + await TherundownConsumerDeployed.initialize( + owner, + [sportId_4, sportId_16], + SportPositionalMarketManager.address, + [sportId_4], + gamesQueue.address, + [8, 12], // resolved statuses + [1, 2], // cancel statuses + { from: owner } + ); + + let ConsumerVerifier = artifacts.require('TherundownConsumerVerifier'); + verifier = await ConsumerVerifier.new({ from: owner }); + + await verifier.initialize( + owner, + TherundownConsumerDeployed.address, + ['TDB TDB', 'TBA TBA'], + ['create', 'resolve'], + 20, + { + from: owner, + } + ); + + let GamesOddsObtainer = artifacts.require('GamesOddsObtainer'); + GamesOddsObtainerDeployed = await GamesOddsObtainer.new({ from: owner }); + + await GamesOddsObtainerDeployed.initialize( + owner, + TherundownConsumerDeployed.address, + verifier.address, + SportPositionalMarketManager.address, + [4, 16], + { from: owner } + ); + + await Thales.transfer(TherundownConsumerDeployed.address, toUnit('1000'), { from: owner }); + await TherundownConsumerDeployed.setSportContracts( + wrapper, + gamesQueue.address, + SportPositionalMarketManager.address, + verifier.address, + GamesOddsObtainerDeployed.address, + { + from: owner, + } + ); + await TherundownConsumerDeployed.addToWhitelist(third, true, { from: owner }); + await TherundownConsumerDeployed.addToWhitelist(SportPositionalMarketManager.address, true, { + from: owner, + }); + + await SportPositionalMarketManager.setTherundownConsumer(TherundownConsumerDeployed.address, { + from: manager, + }); + await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); + + await SportPositionalMarketData.setSportPositionalMarketManager( + SportPositionalMarketManager.address, + { from: owner } + ); + await SportPositionalMarketData.setSportsAMM(SportsAMM.address, { from: owner }); + + let TestUSDC = artifacts.require('TestUSDC'); + testUSDC = await TestUSDC.new(); + testUSDT = await TestUSDC.new(); + + let ERC20token = artifacts.require('Thales'); + testDAI = await ERC20token.new(); + + let CurveSUSD = artifacts.require('MockCurveSUSD'); + curveSUSD = await CurveSUSD.new( + Thales.address, + testUSDC.address, + testUSDT.address, + testDAI.address + ); + + await SportsAMM.setCurveSUSD( + curveSUSD.address, + testDAI.address, + testUSDC.address, + testUSDT.address, + true, + toUnit(0.02), + { from: owner } + ); + + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + + await SportsAMM.setAddresses( + owner, + Thales.address, + TherundownConsumerDeployed.address, + StakingThales.address, + Referrals.address, + ZERO_ADDRESS, + wrapper, + SportAMMLiquidityPool.address, + { from: owner } + ); + + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + + await testUSDC.mint(first, toUnit(100000)); + await testUSDC.mint(curveSUSD.address, toUnit(100000)); + await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); + await SportsAMM.setCapPerSport(tagID_4, toUnit('50000'), { from: owner }); + }); + + describe('Test SportsAMM', () => { + let deployedMarket; + let answer; + beforeEach(async () => { + await fastForward(game1NBATime - (await currentTime()) - SECOND); + // req. games + const tx = await TherundownConsumerDeployed.fulfillGamesCreated( + reqIdCreate, + gamesCreated, + sportId_4, + game1NBATime, + { from: wrapper } + ); + + let game = await TherundownConsumerDeployed.gameCreated(gameid1); + let gameTime = game.startTime; + await TherundownConsumerDeployed.createMarketForGame(gameid1); + await TherundownConsumerDeployed.marketPerGameId(gameid1); + answer = await SportPositionalMarketManager.getActiveMarketAddress('0'); + deployedMarket = await SportPositionalMarketContract.at(answer.toString()); + }); + let position = 0; + let value = 100; + + it('Get odds', async () => { + answer = await SportsAMM.obtainOdds(deployedMarket.address, 0); + let sumOfOdds = answer; + console.log('Odds for pos 0: ', fromUnit(answer)); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 1); + sumOfOdds = sumOfOdds.add(answer); + console.log('Odds for pos 1: ', fromUnit(answer)); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 2); + sumOfOdds = sumOfOdds.add(answer); + console.log('Odds for pos 2: ', fromUnit(answer)); + console.log('Total odds: ', fromUnit(sumOfOdds)); + }); + + it('Get american odds', async () => { + answer = await GamesOddsObtainerDeployed.getOddsForGame(gameid1); + let sumOfOdds = answer[0]; + sumOfOdds = sumOfOdds.add(answer[1]); + sumOfOdds = sumOfOdds.add(answer[2]); + }); + + it('Get price', async () => { + answer = await SportsAMM.obtainOdds(deployedMarket.address, 0); + let sumOfPrices = answer; + console.log('Price for pos 0: ', fromUnit(answer)); + sumOfPrices = sumOfPrices.add(answer); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 1); + console.log('Price for pos 1: ', fromUnit(answer)); + sumOfPrices = sumOfPrices.add(answer); + answer = await SportsAMM.obtainOdds(deployedMarket.address, 2); + console.log('Price for pos 2: ', fromUnit(answer)); + console.log('Total price: ', fromUnit(sumOfPrices)); + }); + it('Get Available to buy from SportsAMM, position 1', async () => { + answer = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 1); + console.log('Available to buy: ', fromUnit(answer)); + }); + + it('Get BuyQuote from SportsAMM, position 1, value: 100', async () => { + answer = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 1, toUnit(100)); + console.log('buyAMMQuote: ', fromUnit(answer)); + }); + + it('Buy from SportsAMM, position 1, value: 100', async () => { + assert.equal(true, await TherundownConsumerDeployed.isSportTwoPositionsSport(sportId_4)); + + let availableToBuy = await SportsAMM.availableToBuyFromAMM(deployedMarket.address, 1); + let additionalSlippage = toUnit(0.01); + + let buyFromAmmQuote = await SportsAMM.buyFromAmmQuote( + deployedMarket.address, + 1, + toUnit(1000) + ); + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 1, + toUnit(1000), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + buyFromAmmQuote = await SportsAMM.buyFromAmmQuote(deployedMarket.address, 0, toUnit(1000)); + answer = await SportsAMM.buyFromAMM( + deployedMarket.address, + 0, + toUnit(1000), + buyFromAmmQuote, + additionalSlippage, + { from: first } + ); + + let roundPool = await SportAMMLiquidityPool.getMarketPool(deployedMarket.address); + let roundPoolBalanceAfter = await Thales.balanceOf(roundPool); + console.log('roundPoolBalanceAfter: ' + roundPoolBalanceAfter / 1e18); + }); + }); +}); diff --git a/test/contracts/SportMarkets/SportsVoucher.js b/test/contracts/SportMarkets/SportsVoucher.js index 20c0b77e8..a56eb7a05 100644 --- a/test/contracts/SportMarkets/SportsVoucher.js +++ b/test/contracts/SportMarkets/SportsVoucher.js @@ -34,12 +34,27 @@ const { } = require('../../utils/helpers'); contract('SportsVauchers', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper, minter] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + minter, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -96,7 +111,7 @@ contract('SportsVauchers', (accounts) => { let game_1_football_resolve; let game_2_football_resolve; let reqIdResolveFoodball; - let gamesResolvedFootball; + let gamesResolvedFootball, SportAMMLiquidityPool; let SportPositionalMarketManager, SportPositionalMarketFactory, @@ -184,13 +199,14 @@ contract('SportsVauchers', (accounts) => { await SportsAMM.setParameters( DAY, - toUnit('0.02'), + toUnit('0.01'), toUnit('0.2'), toUnit('0.001'), toUnit('0.9'), toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500000'), { from: owner } ); @@ -224,6 +240,7 @@ contract('SportsVauchers', (accounts) => { second, second, second, + second, { from: owner } ); @@ -376,6 +393,22 @@ contract('SportsVauchers', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -384,9 +417,31 @@ contract('SportsVauchers', (accounts) => { Referrals.address, ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + await testUSDC.mint(first, toUnit(1000)); await testUSDC.mint(curveSUSD.address, toUnit(1000)); await testUSDC.approve(SportsAMM.address, toUnit(1000), { from: first }); diff --git a/test/contracts/SportMarkets/SportsVoucherWithTransformCollateral.js b/test/contracts/SportMarkets/SportsVoucherWithTransformCollateral.js index 14403deab..a1225731e 100644 --- a/test/contracts/SportMarkets/SportsVoucherWithTransformCollateral.js +++ b/test/contracts/SportMarkets/SportsVoucherWithTransformCollateral.js @@ -32,17 +32,33 @@ const { encodeCall, assertRevert, } = require('../../utils/helpers'); + const { toWei } = require('web3-utils'); const toUnitSix = (amount) => toBN(toWei(amount.toString(), 'ether') / 1e12); contract('SportsVauchers', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper, minter] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + minter, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -54,7 +70,7 @@ contract('SportsVauchers', (accounts) => { const SportPositionMasterCopyContract = artifacts.require('SportPositionMastercopy'); const StakingThalesContract = artifacts.require('StakingThales'); const SportsAMMContract = artifacts.require('SportsAMM'); - const ThalesContract = artifacts.require('TestUSDC'); + const ThalesContract = artifacts.require('contracts/Token/OpThales_L1.sol:OpThales'); const SNXRewardsContract = artifacts.require('SNXRewards'); const AddressResolverContract = artifacts.require('AddressResolverHelper'); const TestOddsContract = artifacts.require('TestOdds'); @@ -99,7 +115,7 @@ contract('SportsVauchers', (accounts) => { let game_1_football_resolve; let game_2_football_resolve; let reqIdResolveFoodball; - let gamesResolvedFootball; + let gamesResolvedFootball, SportAMMLiquidityPool; let SportPositionalMarketManager, SportPositionalMarketFactory, @@ -145,7 +161,7 @@ contract('SportsVauchers', (accounts) => { // TestOdds = await TestOddsContract.new(); await AddressResolver.setSNXRewardsAddress(SNXRewards.address); - Thales = await ThalesContract.new(); + Thales = await ThalesContract.new({ from: owner }); let GamesQueue = artifacts.require('GamesQueue'); gamesQueue = await GamesQueue.new({ from: owner }); await gamesQueue.initialize(owner, { from: owner }); @@ -188,13 +204,14 @@ contract('SportsVauchers', (accounts) => { await SportsAMM.setParameters( DAY, - toUnit('0.02'), + toUnit('0.01'), toUnit('0.2'), toUnit('0.001'), toUnit('0.9'), toUnit('5000'), toUnit('0.01'), toUnit('0.005'), + toUnit('500000'), { from: owner } ); @@ -228,13 +245,14 @@ contract('SportsVauchers', (accounts) => { second, second, second, + second, { from: owner } ); - await Thales.mint(first, toUnitSix('1000')); - await Thales.mint(minter, toUnitSix('1000')); - await Thales.mint(third, toUnitSix('1000')); - await Thales.mint(SportsAMM.address, toUnit('100000'), { from: owner }); + await Thales.transfer(first, toUnitSix('1000'), { from: owner }); + await Thales.transfer(minter, toUnitSix('1000'), { from: owner }); + await Thales.transfer(third, toUnitSix('1000'), { from: owner }); + await Thales.transfer(SportsAMM.address, toUnit('100000'), { from: owner }); await Thales.approve(SportsAMM.address, toUnitSix('1000'), { from: first }); await Thales.approve(SportsAMM.address, toUnitSix('1000'), { from: second }); @@ -330,7 +348,7 @@ contract('SportsVauchers', (accounts) => { { from: owner } ); - await Thales.mint(TherundownConsumerDeployed.address, toUnit('1000')); + await Thales.transfer(TherundownConsumerDeployed.address, toUnit('1000'), { from: owner }); await TherundownConsumerDeployed.setSportContracts( wrapper, gamesQueue.address, @@ -380,6 +398,22 @@ contract('SportsVauchers', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, @@ -388,9 +422,31 @@ contract('SportsVauchers', (accounts) => { Referrals.address, ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let aMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy(aMMLiquidityPoolRoundMastercopy.address, { + from: owner, + }); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + await testUSDC.mint(first, toUnit(1000)); await testUSDC.mint(curveSUSD.address, toUnit(1000)); await testUSDC.approve(SportsAMM.address, toUnit(1000), { from: first }); diff --git a/test/contracts/SportMarkets/TherundownConsumer.js b/test/contracts/SportMarkets/TherundownConsumer.js index 9e77eef3e..bbe1294f2 100644 --- a/test/contracts/SportMarkets/TherundownConsumer.js +++ b/test/contracts/SportMarkets/TherundownConsumer.js @@ -2536,6 +2536,11 @@ contract('TheRundownConsumer', (accounts) => { let marketAdd = await TherundownConsumerDeployed.marketPerGameId(gameFootballid1); + let normalizedFulfiled = await GamesOddsObtainerDeployed.normalizedOddsForMarketFulfilled( + marketAdd + ); + assert.equal(true, normalizedFulfiled); + // check if event is emited assert.eventEqual(tx_create.logs[tx_create.logs.length - 1], 'CreateSportsMarket', { _marketAddress: marketAdd, @@ -2558,6 +2563,18 @@ contract('TheRundownConsumer', (accounts) => { } ); + normalizedFulfiled = await GamesOddsObtainerDeployed.normalizedOddsForMarketFulfilled( + marketAdd + ); + assert.equal(true, normalizedFulfiled); + + let normalizedFirst = await GamesOddsObtainerDeployed.normalizedOddsForMarket(marketAdd, 0); + assert.bnNotEqual(0, normalizedFirst); + let normalizedSecond = await GamesOddsObtainerDeployed.normalizedOddsForMarket(marketAdd, 1); + assert.bnNotEqual(0, normalizedSecond); + let normalizedThird = await GamesOddsObtainerDeployed.normalizedOddsForMarket(marketAdd, 2); + assert.bnNotEqual(0, normalizedThird); + let result_final = await GamesOddsObtainerDeployed.getOddsForGame(gameFootballid1); assert.bnEqual(40000, result_final[0]); assert.bnEqual(-12500, result_final[1]); @@ -3463,6 +3480,22 @@ contract('TheRundownConsumer', (accounts) => { await GamesOddsObtainerDeployed.currentActiveSpreadChildMarket(marketAdd) ); + let normalizedFulfiled = await GamesOddsObtainerDeployed.normalizedOddsForMarketFulfilled( + mainMarketSpreadChildMarket + ); + assert.equal(true, normalizedFulfiled); + + let normalizedFirst = await GamesOddsObtainerDeployed.normalizedOddsForMarket( + mainMarketSpreadChildMarket, + 0 + ); + assert.bnNotEqual(0, normalizedFirst); + let normalizedSecond = await GamesOddsObtainerDeployed.normalizedOddsForMarket( + mainMarketSpreadChildMarket, + 1 + ); + assert.bnNotEqual(0, normalizedSecond); + let childMarket = await SportPositionalMarketContract.at(mainMarketSpreadChildMarket); assert.equal(false, await childMarket.canResolve()); diff --git a/test/contracts/SportVaults/ParlayVault.js b/test/contracts/SportVaults/ParlayVault.js deleted file mode 100644 index 0d20651c8..000000000 --- a/test/contracts/SportVaults/ParlayVault.js +++ /dev/null @@ -1,1262 +0,0 @@ -'use strict'; - -const { artifacts, contract, web3 } = require('hardhat'); -const { toBN } = web3.utils; - -const { assert } = require('../../utils/common'); - -const SECOND = 1000; -const DAY = 86400; -const WEEK = 604800; - -const hour = 60 * 60; -const day = 24 * 60 * 60; - -const { fastForward, toUnit, fromUnit, currentTime } = require('../../utils')(); - -contract('Parlay Vault', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; - - const ZERO_ADDRESS = '0x' + '0'.repeat(40); - - const SportPositionContract = artifacts.require('SportPosition'); - const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); - const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); - const SportPositionalMarketManagerContract = artifacts.require('SportPositionalMarketManager'); - const SportPositionalMarketFactoryContract = artifacts.require('SportPositionalMarketFactory'); - const SportPositionalMarketMasterCopyContract = artifacts.require( - 'SportPositionalMarketMastercopy' - ); - const SportPositionMasterCopyContract = artifacts.require('SportPositionMastercopy'); - const StakingThalesContract = artifacts.require('StakingThales'); - const SportsAMMContract = artifacts.require('SportsAMM'); - const ThalesContract = artifacts.require('contracts/Token/OpThales_L1.sol:OpThales'); - const SNXRewardsContract = artifacts.require('SNXRewards'); - const AddressResolverContract = artifacts.require('AddressResolverHelper'); - const TestOddsContract = artifacts.require('TestOdds'); - const ReferralsContract = artifacts.require('Referrals'); - const ParlayAMMContract = artifacts.require('ParlayMarketsAMM'); - const ParlayMarketContract = artifacts.require('ParlayMarketMastercopy'); - const ParlayMarketDataContract = artifacts.require('ParlayMarketData'); - const ParlayVerifierContract = artifacts.require('ParlayVerifier'); - const SportsAMMUtils = artifacts.require('SportsAMMUtils'); - - let ParlayAMM; - let ParlayMarket; - let ParlayMarketData; - - let Thales; - let answer; - let minimumPositioningDuration = 0; - let minimumMarketMaturityDuration = 0; - - let marketQuestion, - marketSource, - endOfPositioning, - fixedTicketPrice, - positionAmount1, - positionAmount2, - positionAmount3, - withdrawalAllowed, - tag, - paymentToken, - phrases = [], - deployedMarket, - outcomePosition, - outcomePosition2; - - let consumer; - let TherundownConsumer; - let TherundownConsumerImplementation; - let TherundownConsumerDeployed; - let MockTherundownConsumerWrapper; - let initializeConsumerData; - let gamesQueue; - let game_1_create; - let game_1_resolve; - let fightId; - let fight_create; - let fightCreated; - let game_fight_resolve; - let gamesFightResolved; - let game_fight_resolve_draw; - let gamesFightResolvedDraw; - let reqIdFightCreate; - let reqIdFightResolve; - let reqIdFightResolveDraw; - let gameid1; - let oddsid; - let oddsResult; - let oddsResultArray; - let reqIdOdds; - let gameid2; - let gameid3; - let game_2_create; - let game_2_resolve; - let gamesCreated; - let gamesResolved; - let reqIdCreate; - let reqIdResolve; - let reqIdFootballCreate; - let reqIdFootballCreate2; - let gameFootballid1; - let gameFootballid2; - let gameFootballid3; - let game_1_football_create; - let game_2_football_create; - let game_3_football_create; - let gamesFootballCreated; - let game_1_football_resolve; - let game_2_football_resolve; - let reqIdResolveFoodball; - let gamesResolvedFootball; - let GamesOddsObtainerDeployed; - - let oddsid_1; - let oddsResult_1; - let oddsResultArray_1; - let reqIdOdds_1; - let oddsid_2; - let oddsResult_2; - let oddsResultArray_2; - let reqIdOdds_2; - let verifier; - - let SportPositionalMarketManager, - SportPositionalMarketFactory, - SportPositionalMarketData, - SportPositionalMarket, - SportPositionalMarketMastercopy, - SportPositionMastercopy, - ParlayMarketMastercopy, - StakingThales, - SNXRewards, - AddressResolver, - TestOdds, - curveSUSD, - testUSDC, - testUSDT, - testDAI, - Referrals, - ParlayVerifier, - SportsAMM; - - const game1NBATime = 1646958600; - const gameFootballTime = 1649876400; - const fightTime = 1660089600; - - const sportId_4 = 4; // NBA - const sportId_16 = 16; // CHL - const sportId_7 = 7; // UFC - - let gameMarket; - - let parlayAMMfee = toUnit('0.05'); - let safeBoxImpact = toUnit('0.02'); - let minUSDAmount = '10'; - let maxSupportedAmount = '20000'; - let maxSupportedOdd = '0.005'; - - const usdcQuantity = toBN(10000 * 1e6); //100 USDC - let parlayMarkets = []; - let equalParlayMarkets = []; - let parlayPositions = []; - let parlayPositions2 = []; - let parlaySingleMarketAddress; - let parlaySingleMarket; - let voucher; - - let sportsAMMUtils; - - let rewardTokenAddress; - let Vault, vault; - - async function createMarkets() { - await fastForward(game1NBATime - (await currentTime()) - SECOND); - console.log('create markets', await currentTime()); - let answer; - // req. games - const tx = await TherundownConsumerDeployed.fulfillGamesCreated( - reqIdCreate, - gamesCreated, - sportId_4, - game1NBATime, - { from: wrapper } - ); - - assert.equal(gameid1, await gamesQueue.gamesCreateQueue(1)); - assert.equal(gameid2, await gamesQueue.gamesCreateQueue(2)); - - assert.equal(2, await gamesQueue.getLengthUnproccessedGames()); - assert.equal(0, await gamesQueue.unproccessedGamesIndex(gameid1)); - assert.equal(1, await gamesQueue.unproccessedGamesIndex(gameid2)); - - let game = await TherundownConsumerDeployed.gameCreated(gameid1); - let game_2 = await TherundownConsumerDeployed.gameCreated(gameid2); - - // create markets - const tx_create_1 = await TherundownConsumerDeployed.createMarketForGame(gameid1); - const tx_create_2 = await TherundownConsumerDeployed.createMarketForGame(gameid2); - - let marketAdd = await TherundownConsumerDeployed.marketPerGameId(gameid1); - let marketAdd_2 = await TherundownConsumerDeployed.marketPerGameId(gameid2); - - // check if event is emited - assert.eventEqual(tx_create_1.logs[1], 'CreateSportsMarket', { - _marketAddress: marketAdd, - _id: gameid1, - _game: game, - }); - assert.eventEqual(tx_create_2.logs[1], 'CreateSportsMarket', { - _marketAddress: marketAdd_2, - _id: gameid2, - _game: game_2, - }); - - // console.log("1. game:"); - // console.log("==> home: ", game.homeTeam); - // console.log("==> away: ", game.awayTeam); - - // console.log("2. game:"); - // console.log("==> home: ", game_2.homeTeam); - // console.log("==> away: ", game_2.awayTeam); - - answer = await SportPositionalMarketManager.getActiveMarketAddress('0'); - let deployedMarket_1 = await SportPositionalMarketContract.at(answer); - answer = await SportPositionalMarketManager.getActiveMarketAddress('1'); - let deployedMarket_2 = await SportPositionalMarketContract.at(answer); - - assert.equal(deployedMarket_1.address, marketAdd); - assert.equal(deployedMarket_2.address, marketAdd_2); - await fastForward(fightTime - (await currentTime()) - SECOND); - - // req games - const tx_3 = await TherundownConsumerDeployed.fulfillGamesCreated( - reqIdFightCreate, - fightCreated, - sportId_7, - fightTime, - { from: wrapper } - ); - - assert.equal(true, await TherundownConsumerDeployed.isSportTwoPositionsSport(sportId_7)); - assert.equal(true, await TherundownConsumerDeployed.supportedSport(sportId_7)); - - let fight = await TherundownConsumerDeployed.gameCreated(fightId); - assert.equal('Clayton Carpenter', fight.homeTeam); - assert.equal('Edgar Chairez', fight.awayTeam); - - // check if event is emited - assert.eventEqual(tx_3.logs[0], 'GameCreated', { - _requestId: reqIdFightCreate, - _sportId: sportId_7, - _id: fightId, - _game: fight, - }); - - const tx_create_3 = await TherundownConsumerDeployed.createMarketForGame(fightId); - - marketAdd = await TherundownConsumerDeployed.marketPerGameId(fightId); - - // check if event is emited - assert.eventEqual(tx_create_3.logs[1], 'CreateSportsMarket', { - _marketAddress: marketAdd, - _id: fightId, - _game: fight, - }); - - // console.log("3. game:"); - // console.log("==> home: ", fight.homeTeam); - // console.log("==> away: ", fight.awayTeam); - - answer = await SportPositionalMarketManager.getActiveMarketAddress('2'); - let deployedMarket_3 = await SportPositionalMarketContract.at(answer); - - await fastForward(gameFootballTime - (await currentTime()) - SECOND); - - // req. games - const tx_4 = await TherundownConsumerDeployed.fulfillGamesCreated( - reqIdFootballCreate, - gamesFootballCreated, - sportId_16, - gameFootballTime, - { from: wrapper } - ); - - assert.equal(false, await TherundownConsumerDeployed.isSportTwoPositionsSport(sportId_16)); - assert.equal(true, await TherundownConsumerDeployed.supportedSport(sportId_16)); - - let result = await GamesOddsObtainerDeployed.getOddsForGame(gameFootballid1); - assert.bnEqual(40000, result[0]); - assert.bnEqual(-12500, result[1]); - assert.bnEqual(27200, result[2]); - - let game_4 = await TherundownConsumerDeployed.gameCreated(gameFootballid1); - let game_5 = await TherundownConsumerDeployed.gameCreated(gameFootballid2); - assert.equal('Atletico Madrid Atletico Madrid', game_4.homeTeam); - assert.equal('Manchester City Manchester City', game_4.awayTeam); - - // check if event is emited - assert.eventEqual(tx_4.logs[0], 'GameCreated', { - _requestId: reqIdFootballCreate, - _sportId: sportId_16, - _id: gameFootballid1, - _game: game_4, - }); - - // console.log("4. game:"); - // console.log("==> home: ", game_4.homeTeam); - // console.log("==> away: ", game_4.awayTeam); - - // console.log("5. game:"); - // console.log("==> home: ", game_5.homeTeam); - // console.log("==> away: ", game_5.awayTeam); - - // create markets - const tx_create_4 = await TherundownConsumerDeployed.createMarketForGame(gameFootballid1); - await TherundownConsumerDeployed.createMarketForGame(gameFootballid2); - - let marketAdd_4 = await TherundownConsumerDeployed.marketPerGameId(gameFootballid1); - let marketAdd_5 = await TherundownConsumerDeployed.marketPerGameId(gameFootballid2); - - answer = await SportPositionalMarketManager.getActiveMarketAddress('3'); - let deployedMarket_4 = await SportPositionalMarketContract.at(answer); - answer = await SportPositionalMarketManager.getActiveMarketAddress('7'); - let deployedMarket_5 = await SportPositionalMarketContract.at(answer); - - // check if event is emited - - assert.eventEqual(tx_create_4.logs[4], 'CreateSportsMarket', { - _marketAddress: marketAdd_4, - _id: gameFootballid1, - _game: game_4, - }); - - assert.equal(deployedMarket_4.address, marketAdd_4); - assert.equal(deployedMarket_5.address, marketAdd_5); - - answer = await SportPositionalMarketManager.numActiveMarkets(); - assert.equal(answer.toString(), '11'); - // await fastForward(await currentTime()); - - // assert.equal(true, await deployedMarket_1.canResolve()); - // assert.equal(true, await deployedMarket_2.canResolve()); - // assert.equal(true, await deployedMarket_3.canResolve()); - // assert.equal(true, await deployedMarket_4.canResolve()); - // assert.equal(true, await deployedMarket_5.canResolve()); - - // console.log('parlay 1: ', deployedMarket_1.address); - // console.log('parlay 2: ', deployedMarket_2.address); - // console.log('parlay 3: ', deployedMarket_3.address); - // console.log('parlay 4: ', deployedMarket_4.address); - - parlayMarkets = [deployedMarket_1, deployedMarket_5, deployedMarket_4]; - equalParlayMarkets = [deployedMarket_1, deployedMarket_2, deployedMarket_4]; - } - - beforeEach(async () => { - SportPositionalMarketManager = await SportPositionalMarketManagerContract.new({ - from: manager, - }); - SportPositionalMarketFactory = await SportPositionalMarketFactoryContract.new({ - from: manager, - }); - SportPositionalMarketMastercopy = await SportPositionalMarketContract.new({ from: manager }); - SportPositionMastercopy = await SportPositionContract.new({ from: manager }); - ParlayMarketMastercopy = await ParlayMarketContract.new({ from: manager }); - SportPositionalMarketData = await SportPositionalMarketDataContract.new({ from: manager }); - StakingThales = await StakingThalesContract.new({ from: manager }); - SportsAMM = await SportsAMMContract.new({ from: manager }); - SNXRewards = await SNXRewardsContract.new({ from: manager }); - AddressResolver = await AddressResolverContract.new(); - - // TestOdds = await TestOddsContract.new(); - await AddressResolver.setSNXRewardsAddress(SNXRewards.address); - - Thales = await ThalesContract.new({ from: owner }); - let GamesQueue = artifacts.require('GamesQueue'); - gamesQueue = await GamesQueue.new({ from: owner }); - await gamesQueue.initialize(owner, { from: owner }); - - await SportPositionalMarketManager.initialize(manager, Thales.address, { from: manager }); - await SportPositionalMarketFactory.initialize(manager, { from: manager }); - - await SportPositionalMarketManager.setExpiryDuration(30 * DAY, { from: manager }); - - await SportPositionalMarketFactory.setSportPositionalMarketManager( - SportPositionalMarketManager.address, - { from: manager } - ); - await SportPositionalMarketFactory.setSportPositionalMarketMastercopy( - SportPositionalMarketMastercopy.address, - { from: manager } - ); - await SportPositionalMarketFactory.setSportPositionMastercopy(SportPositionMastercopy.address, { - from: manager, - }); - // await SportPositionalMarketFactory.setLimitOrderProvider(SportsAMM.address, { from: manager }); - await SportPositionalMarketFactory.setSportsAMM(SportsAMM.address, { from: manager }); - await SportPositionalMarketManager.setSportPositionalMarketFactory( - SportPositionalMarketFactory.address, - { from: manager } - ); - Referrals = await ReferralsContract.new(); - await Referrals.initialize(owner, ZERO_ADDRESS, ZERO_ADDRESS, { from: owner }); - - await SportsAMM.initialize( - owner, - Thales.address, - toUnit('5000'), - toUnit('0.02'), - toUnit('0.2'), - DAY, - { from: owner } - ); - - await SportsAMM.setParameters( - DAY, - toUnit('0.02'), - toUnit('0.2'), - toUnit('0.001'), - toUnit('0.9'), - toUnit('5000'), - toUnit('0.01'), - toUnit('0.005'), - { from: owner } - ); - - sportsAMMUtils = await SportsAMMUtils.new(SportsAMM.address); - await SportsAMM.setAmmUtils(sportsAMMUtils.address, { - from: owner, - }); - await SportsAMM.setSportsPositionalMarketManager(SportPositionalMarketManager.address, { - from: owner, - }); - - await SportPositionalMarketData.initialize(owner, { from: owner }); - await StakingThales.initialize( - owner, - Thales.address, - Thales.address, - Thales.address, - WEEK, - WEEK, - SNXRewards.address, - { from: owner } - ); - await StakingThales.setAddresses( - SNXRewards.address, - second, - second, - second, - second, - SportsAMM.address, - second, - second, - second, - - { from: owner } - ); - - await Thales.transfer(first, toUnit('1000'), { from: owner }); - await Thales.transfer(second, toUnit('1000'), { from: owner }); - await Thales.transfer(third, toUnit('1000'), { from: owner }); - await Thales.transfer(SportsAMM.address, toUnit('100000'), { from: owner }); - - await Thales.approve(SportsAMM.address, toUnit('1000'), { from: first }); - await Thales.approve(SportsAMM.address, toUnit('1000'), { from: second }); - await Thales.approve(SportsAMM.address, toUnit('1000'), { from: third }); - - // ids - gameid1 = '0x6536306366613738303834366166363839373862343935373965356366333936'; - gameid2 = '0x3937346533663036386233333764313239656435633133646632376133326662'; - fightId = '0x3234376564326334663865313462396538343833353636353361373863393962'; - - // create game props - game_1_create = - '0x0000000000000000000000000000000000000000000000000000000000000020653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; - game_2_create = - '0x0000000000000000000000000000000000000000000000000000000000000020393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; - gamesCreated = [game_1_create, game_2_create]; - reqIdCreate = '0x65da2443ccd66b09d4e2693933e8fb9aab9addf46fb93300bd7c1d70c5e21666'; - - // create fight props - fight_create = - '0x000000000000000000000000000000000000000000000000000000000000002032343765643263346638653134623965383438333536363533613738633939620000000000000000000000000000000000000000000000000000000062f2f500ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f100000000000000000000000000000000000000000000000000000000000007c9c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000011436c6179746f6e2043617270656e746572000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4564676172204368616972657a00000000000000000000000000000000000000'; - fightCreated = [fight_create]; - reqIdFightCreate = '0x1e4ef9996d321a4445068689e63fe393a5860cc98a0df22da1ac877d8cfd37d3'; - - // resolve game props - reqIdFightResolve = '0x6b5d983afa1e2da68d49e1e1e5d963cb7d93e971329e4dac36a9697234584c68'; - game_fight_resolve = - '0x3234376564326334663865313462396538343833353636353361373863393962000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008'; - gamesFightResolved = [game_fight_resolve]; - - reqIdFightResolveDraw = '0x6b5d983afa1e2da68d49e1e1e5d963cb7d93e971329e4dac36a9697234584c68'; - game_fight_resolve_draw = - '0x3234376564326334663865313462396538343833353636353361373863393962000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008'; - gamesFightResolvedDraw = [game_fight_resolve_draw]; - // create game props - game_1_create = - '0x0000000000000000000000000000000000000000000000000000000000000020653630636661373830383436616636383937386234393537396535636633393600000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; - game_2_create = - '0x0000000000000000000000000000000000000000000000000000000000000020393734653366303638623333376431323965643563313364663237613332666200000000000000000000000000000000000000000000000000000000625755f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf240000000000000000000000000000000000000000000000000000000000004524ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaf2400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000d41746c616e7461204861776b73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011436861726c6f74746520486f726e657473000000000000000000000000000000'; - gamesCreated = [game_1_create, game_2_create]; - reqIdCreate = '0x65da2443ccd66b09d4e2693933e8fb9aab9addf46fb93300bd7c1d70c5e21666'; - - // resolve game props - reqIdResolve = '0x30250573c4b099aeaf06273ef9fbdfe32ab2d6b8e33420de988be5d6886c92a7'; - game_1_resolve = - '0x6536306366613738303834366166363839373862343935373965356366333936000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000810000000000000000000000000000000000000000000000000000000000000008'; - game_2_resolve = - '0x3937346533663036386233333764313239656435633133646632376133326662000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000710000000000000000000000000000000000000000000000000000000000000008'; - gamesResolved = [game_1_resolve, game_2_resolve]; - - // football matches - // football matches - reqIdFootballCreate = '0x61d7dd698383c58c7217cf366764a1e92a1f059b1b6ea799dce4030a942302f4'; - gameFootballid1 = '0x3163626162623163303138373465363263313661316462333164363164353333'; - gameFootballid2 = '0x3662646437313731316337393837643336643465333538643937393237356234'; - game_1_football_create = - '0x000000000000000000000000000000000000000000000000000000000000002031636261626231633031383734653632633136613164623331643631643533330000000000000000000000000000000000000000000000000000000062571db00000000000000000000000000000000000000000000000000000000000009c40ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcf2c0000000000000000000000000000000000000000000000000000000000006a4000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001f41746c657469636f204d61647269642041746c657469636f204d616472696400000000000000000000000000000000000000000000000000000000000000001f4d616e636865737465722043697479204d616e63686573746572204369747900'; - game_2_football_create = - '0x000000000000000000000000000000000000000000000000000000000000002036626464373137313163373938376433366434653335386439373932373562340000000000000000000000000000000000000000000000000000000062571db0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff76800000000000000000000000000000000000000000000000000000000000018c18000000000000000000000000000000000000000000000000000000000000cb2000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000134c69766572706f6f6c204c69766572706f6f6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f42656e666963612042656e666963610000000000000000000000000000000000'; - gamesFootballCreated = [game_1_football_create, game_2_football_create]; - game_1_football_resolve = - '0x316362616262316330313837346536326331366131646233316436316435333300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b'; - game_2_football_resolve = - '0x366264643731373131633739383764333664346533353864393739323735623400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b'; - reqIdResolveFoodball = '0xff8887a8535b7a8030962e6f6b1eba61c0f1cb82f706e77d834f15c781e47697'; - gamesResolvedFootball = [game_1_football_resolve, game_2_football_resolve]; - - oddsid = '0x6135363061373861363135353239363137366237393232353866616336613532'; - oddsResult = - '0x6135363061373861363135353239363137366237393232353866616336613532000000000000000000000000000000000000000000000000000000000000283cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd3dc0000000000000000000000000000000000000000000000000000000000000000'; - oddsResultArray = [oddsResult]; - reqIdOdds = '0x5bf0ea636f9515e1e1060e5a21e11ef8a628fa99b1effb8aa18624b02c6f36de'; - - oddsid_1 = '0x3163626162623163303138373465363263313661316462333164363164353333'; - oddsResult_1 = - '0x3163626162623163303138373465363263313661316462333164363164353333000000000000000000000000000000000000000000000000000000000000283cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd3dc0000000000000000000000000000000000000000000000000000000000000000'; - oddsResultArray_1 = [oddsResult_1]; - reqIdOdds_1 = '0x5bf0ea636f9515e1e1060e5a21e11ef8a628fa99b1effb8aa18624b02c6f36de'; - - oddsid_2 = '0x6536306366613738303834366166363839373862343935373965356366333936'; - oddsResult_2 = - '0x6536306366613738303834366166363839373862343935373965356366333936000000000000000000000000000000000000000000000000000000000000283cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd3dc0000000000000000000000000000000000000000000000000000000000000000'; - oddsResultArray_2 = [oddsResult_2]; - reqIdOdds_2 = '0x5bf0ea636f9515e1e1060e5a21e11ef8a628fa99b1effb8aa18624b02c6f36de'; - - TherundownConsumer = artifacts.require('TherundownConsumer'); - TherundownConsumerDeployed = await TherundownConsumer.new(); - - await TherundownConsumerDeployed.initialize( - owner, - [sportId_4, sportId_16, sportId_7], - SportPositionalMarketManager.address, - [sportId_4, sportId_7], - gamesQueue.address, - [8, 12], // resolved statuses - [1, 2], // cancel statuses - { from: owner } - ); - - let ConsumerVerifier = artifacts.require('TherundownConsumerVerifier'); - verifier = await ConsumerVerifier.new({ from: owner }); - - await verifier.initialize( - owner, - TherundownConsumerDeployed.address, - ['TDB TDB', 'TBA TBA'], - ['create', 'resolve'], - 20, - { - from: owner, - } - ); - - let GamesOddsObtainer = artifacts.require('GamesOddsObtainer'); - GamesOddsObtainerDeployed = await GamesOddsObtainer.new({ from: owner }); - - await GamesOddsObtainerDeployed.initialize( - owner, - TherundownConsumerDeployed.address, - verifier.address, - SportPositionalMarketManager.address, - [4, 16], - { from: owner } - ); - - await Thales.transfer(TherundownConsumerDeployed.address, toUnit('1000'), { from: owner }); - await TherundownConsumerDeployed.setSportContracts( - wrapper, - gamesQueue.address, - SportPositionalMarketManager.address, - verifier.address, - GamesOddsObtainerDeployed.address, - { - from: owner, - } - ); - await TherundownConsumerDeployed.addToWhitelist(third, true, { from: owner }); - - await SportPositionalMarketManager.setTherundownConsumer(TherundownConsumerDeployed.address, { - from: manager, - }); - await SportPositionalMarketManager.setOddsObtainer(GamesOddsObtainerDeployed.address, { - from: manager, - }); - await SportPositionalMarketManager.setIsDoubleChanceSupported(true, { from: manager }); - await SportPositionalMarketManager.setSupportedSportForDoubleChance([sportId_16], true, { - from: manager, - }); - await gamesQueue.setConsumerAddress(TherundownConsumerDeployed.address, { from: owner }); - - await SportPositionalMarketData.setSportPositionalMarketManager( - SportPositionalMarketManager.address, - { from: owner } - ); - await SportPositionalMarketData.setSportsAMM(SportsAMM.address, { from: owner }); - - let TestUSDC = artifacts.require('TestUSDC'); - testUSDC = await TestUSDC.new(); - testUSDT = await TestUSDC.new(); - - let ERC20token = artifacts.require('Thales'); - testDAI = await ERC20token.new(); - - let CurveSUSD = artifacts.require('MockCurveSUSD'); - curveSUSD = await CurveSUSD.new( - Thales.address, - testUSDC.address, - testUSDT.address, - testDAI.address - ); - - await SportsAMM.setCurveSUSD( - curveSUSD.address, - testDAI.address, - testUSDC.address, - testUSDT.address, - true, - toUnit(0.02), - { from: owner } - ); - - await testUSDC.mint(first, toUnit(1000)); - await testUSDC.mint(curveSUSD.address, toUnit(1000)); - await testUSDC.approve(SportsAMM.address, toUnit(1000), { from: first }); - - ParlayAMM = await ParlayAMMContract.new({ from: manager }); - - await ParlayAMM.initialize( - owner, - SportsAMM.address, - SportPositionalMarketManager.address, - parlayAMMfee, - toUnit(maxSupportedAmount), - toUnit(maxSupportedOdd), - Thales.address, - safeBox, - safeBoxImpact, - { from: owner } - ); - - await ParlayAMM.setAmounts( - toUnit(minUSDAmount), - toUnit(maxSupportedAmount), - toUnit(maxSupportedOdd), - parlayAMMfee, - safeBoxImpact, - toUnit(0.05), - toUnit(1860), - { - from: owner, - } - ); - - await Thales.approve(ParlayAMM.address, toUnit('1000'), { from: first }); - await Thales.approve(ParlayAMM.address, toUnit('1000'), { from: second }); - await Thales.approve(ParlayAMM.address, toUnit('1000'), { from: third }); - - ParlayMarketData = await ParlayMarketDataContract.new({ from: manager }); - ParlayVerifier = await ParlayVerifierContract.new({ from: manager }); - - await ParlayMarketData.initialize(owner, ParlayAMM.address); - - await ParlayAMM.setAddresses( - SportsAMM.address, - safeBox, - Referrals.address, - ParlayMarketData.address, - ParlayVerifier.address, - { from: owner } - ); - - await ParlayAMM.setParlayMarketMastercopies(ParlayMarketMastercopy.address, { from: owner }); - await Thales.transfer(ParlayAMM.address, toUnit('20000'), { from: owner }); - - await ParlayAMM.setParameters(5, { from: owner }); - - await SportsAMM.setAddresses( - owner, - Thales.address, - TherundownConsumerDeployed.address, - StakingThales.address, - Referrals.address, - ParlayAMM.address, - wrapper, - { from: owner } - ); - - await ParlayAMM.setCurveSUSD( - curveSUSD.address, - testDAI.address, - testUSDC.address, - testUSDT.address, - true, - toUnit(0.02), - { from: owner } - ); - - Referrals.setSportsAMM(SportsAMM.address, ParlayAMM.address, { from: owner }); - - await testUSDC.mint(first, toUnit(1000)); - await testUSDC.mint(curveSUSD.address, toUnit(1000)); - await testUSDC.approve(ParlayAMM.address, toUnit(1000), { from: first }); - - rewardTokenAddress = owner; - - Vault = artifacts.require('ParlayVault'); - vault = await Vault.new(); - - await vault.initialize({ - _owner: owner, - _parlayAMM: ParlayAMM.address, - _sUSD: Thales.address, - _roundLength: day, - _priceLowerLimit: toUnit(0).toString(), - _priceUpperLimit: toUnit(1).toString(), - _skewImpactLimit: toUnit(0.1).toString(), // 10% - _maxAllowedDeposit: toUnit(1000).toString(), // 20% - _utilizationRate: toUnit(0.5).toString(), - _maxTradeRate: toUnit(0.02).toString(), - _minDepositAmount: toUnit(100).toString(), - _maxAllowedUsers: 100, - _minTradeAmount: toUnit(10).toString(), - _maxMarketUsedInRoundCount: 2, - }); - - await vault.setMaxAllowedUsers(100, { from: owner }); - await vault.setMinAllowedDeposit(toUnit(100), { from: owner }); - await vault.setMaxAllowedDeposit(toUnit(1000), { from: owner }); - await vault.setUtilizationRate(toUnit(0.5), { from: owner }); - await vault.setRoundLength(day, { from: owner }); - await vault.setParlayAMM(ParlayAMM.address, { from: owner }); - await vault.setSkewImpactLimit(toUnit(0.3), { from: owner }); - await vault.setMinTradeAmount(toUnit(10), { from: owner }); - await vault.setPriceLimits(toUnit(0), toUnit(1), { from: owner }); - - await Thales.approve(vault.address, toUnit('100000'), { from: first }); - await Thales.approve(vault.address, toUnit('100000'), { from: second }); - await Thales.approve(vault.address, toUnit('100000'), { from: third }); - - await StakingThales.setSupportedSportVault(vault.address, true, { from: owner }); - await StakingThales.startStakingPeriod({ from: owner }); - await vault.setStakingThales(StakingThales.address, { from: owner }); - - await ParlayAMM.setSafeBoxFeePerAddress(vault.address, toUnit('0.005'), { - from: owner, - }); - - await SportsAMM.setMinSpreadPerAddress(vault.address, toUnit('0.005'), { - from: owner, - }); - }); - - describe('Test parlays vault', () => { - it('BuyQuote for Parlay', async () => { - await createMarkets(); - await fastForward(game1NBATime - (await currentTime()) - SECOND); - answer = await SportPositionalMarketManager.numActiveMarkets(); - assert.equal(answer.toString(), '11'); - let totalSUSDToPay = toUnit('10'); - parlayPositions = ['1', '1', '1']; - parlayPositions2 = ['1', '1']; - let parlayMarketsAddress = []; - let parlayMarketsAddress2 = []; - for (let i = 0; i < parlayMarkets.length; i++) { - parlayMarketsAddress[i] = parlayMarkets[i].address; - parlayMarketsAddress2[i] = parlayMarkets[i].address; - } - - parlayMarketsAddress2.pop(); - - let result = await ParlayAMM.buyQuoteFromParlay( - parlayMarketsAddress, - parlayPositions, - totalSUSDToPay - ); - - let result2 = await ParlayAMM.buyQuoteFromParlay( - parlayMarketsAddress2, - parlayPositions2, - totalSUSDToPay - ); - console.log('----------------------THREE PARLAY QUOTE-----------------------------'); - console.log('sUSDAfterFees: ', fromUnit(result.sUSDAfterFees)); - console.log('totalQuote: ', fromUnit(result.totalQuote)); - console.log('totalBuyAmount: ', fromUnit(result.totalBuyAmount)); - console.log('initialQuote: ', fromUnit(result.initialQuote)); - console.log('skewImpact: ', fromUnit(result.skewImpact)); - - for (let i = 0; i < result.finalQuotes.length; i++) { - console.log('finalQuote', i, fromUnit(result.finalQuotes[i])); - console.log('amountToBuy', i, fromUnit(result.amountsToBuy[i])); - } - - console.log('----------------------TWO PARLAY QUOTE-----------------------------'); - - console.log('sUSDAfterFees: ', fromUnit(result2.sUSDAfterFees)); - console.log('totalQuote: ', fromUnit(result2.totalQuote)); - console.log('totalBuyAmount: ', fromUnit(result2.totalBuyAmount)); - console.log('initialQuote: ', fromUnit(result2.initialQuote)); - console.log('skewImpact: ', fromUnit(result2.skewImpact)); - - for (let i = 0; i < result2.finalQuotes.length; i++) { - console.log('finalQuote', i, fromUnit(result2.finalQuotes[i])); - console.log('amountToBuy', i, fromUnit(result2.amountsToBuy[i])); - } - }); - - it('Check init', async () => { - let round = await vault.round(); - console.log('round is:' + round.toString()); - - let maxAllowedUsers = await vault.maxAllowedUsers(); - console.log('maxAllowedUsers is:' + maxAllowedUsers.toString()); - - let minDepositAmount = await vault.minDepositAmount(); - console.log('minDepositAmount is:' + minDepositAmount.toString() / 1e18); - - let utilizationRate = await vault.utilizationRate(); - console.log('utilizationRate is:' + utilizationRate.toString() / 1e18); - - let maxAllowedDeposit = await vault.maxAllowedDeposit(); - console.log('maxAllowedDeposit is:' + maxAllowedDeposit.toString() / 1e18); - - let skewImpactLimit = await vault.skewImpactLimit(); - console.log('skewImpactLimit is:' + skewImpactLimit.toString() / 1e18); - - let priceUpperLimit = await vault.priceUpperLimit(); - console.log('priceUpperLimit is:' + priceUpperLimit.toString() / 1e18); - - let priceLowerLimit = await vault.priceLowerLimit(); - console.log('priceLowerLimit is:' + priceLowerLimit.toString() / 1e18); - - let roundLength = await vault.roundLength(); - console.log('roundLength is:' + roundLength / day + ' days'); - }); - - it('Vault creation', async () => { - let round = await vault.round(); - console.log('round is:' + round.toString()); - - let vaultStarted = await vault.vaultStarted(); - console.log('vaultStarted is:' + vaultStarted); - - await vault.deposit(toUnit(100), { from: first }); - - let volume = await StakingThales.getAMMVolume(first); - console.log('volume first is:' + volume / 1e18); - - volume = await StakingThales.getAMMVolume(second); - console.log('volume second is:' + volume / 1e18); - - round = 1; - assert.bnEqual(await vault.getBalancesPerRound(round, first), toUnit(100)); - - assert.bnEqual(await Thales.balanceOf(vault.address), toUnit(100)); - assert.bnEqual(await vault.allocationPerRound(round), toUnit(100)); - assert.bnEqual(await vault.capPerRound(round), toUnit(100)); - - assert.bnEqual(await vault.allocationPerRound(0), 0); - assert.bnEqual(await vault.allocationPerRound(2), 0); - - let usersCurrentlyInVault = await vault.usersCurrentlyInVault(); - console.log('usersCurrentlyInVault is:' + usersCurrentlyInVault); - - await vault.startVault({ from: owner }); - round = 2; - await vault.deposit(toUnit(200), { from: second }); - assert.bnEqual(await vault.getBalancesPerRound(round, first), 0); - assert.bnEqual(await vault.getBalancesPerRound(round, second), toUnit(200)); - - assert.bnEqual(await Thales.balanceOf(vault.address), toUnit(300)); - assert.bnEqual(await vault.allocationPerRound(round), toUnit(200)); - assert.bnEqual(await vault.capPerRound(round), toUnit(300)); - - await assert.revert( - vault.deposit(toUnit(1000), { from: first }), - 'Deposit amount exceeds vault cap' - ); - await assert.revert(vault.deposit(toUnit(10), { from: first }), 'Invalid amount'); - - usersCurrentlyInVault = await vault.usersCurrentlyInVault(); - console.log('usersCurrentlyInVault is:' + usersCurrentlyInVault); - - await fastForward(day); - // CLOSE ROUND #1 - START ROUND #2 - await vault.closeRound(); - - volume = await StakingThales.getAMMVolume(first); - console.log('volume first round 2 is:' + volume / 1e18); - - volume = await StakingThales.getAMMVolume(second); - console.log('volume second round 2 is:' + volume / 1e18); - - await StakingThales.delegateVolume(second, { from: first }); - - round = 2; - assert.bnEqual(await vault.getBalancesPerRound(round, first), toUnit(100)); - assert.bnEqual(await vault.getBalancesPerRound(round, second), toUnit(200)); - assert.bnEqual(await Thales.balanceOf(vault.address), toUnit(300)); - - await vault.withdrawalRequest({ from: second }); - assert.bnEqual(await vault.capPerRound(3), toUnit(100)); - usersCurrentlyInVault = await vault.usersCurrentlyInVault(); - console.log('usersCurrentlyInVault is:' + usersCurrentlyInVault); - - await fastForward(day); - // CLOSE ROUND #2 - START ROUND #3 - await vault.closeRound(); - - volume = await StakingThales.getAMMVolume(first); - console.log('volume first round 3 is:' + volume / 1e18); - - volume = await StakingThales.getAMMVolume(second); - console.log('volume second round 3 is:' + volume / 1e18); - round = 3; - assert.bnEqual(await vault.getBalancesPerRound(round, first), toUnit(100)); - assert.bnEqual(await vault.getBalancesPerRound(round, second), 0); - assert.bnEqual(await Thales.balanceOf(vault.address), toUnit(100)); - assert.bnEqual(await vault.allocationPerRound(round), toUnit(100)); - - usersCurrentlyInVault = await vault.usersCurrentlyInVault(); - console.log('usersCurrentlyInVault is:' + usersCurrentlyInVault); - - await assert.revert(vault.withdrawalRequest({ from: second }), 'Nothing to withdraw'); - - await vault.withdrawalRequest({ from: first }); - - await fastForward(day); - // CLOSE ROUND #3 - START ROUND #4 - await vault.closeRound(); - round = 4; - assert.bnEqual(await vault.getBalancesPerRound(round, first), 0); - assert.bnEqual(await vault.getBalancesPerRound(round, second), 0); - assert.bnEqual(await Thales.balanceOf(vault.address), 0); - assert.bnEqual(await vault.allocationPerRound(round), 0); - usersCurrentlyInVault = await vault.usersCurrentlyInVault(); - console.log('usersCurrentlyInVault is:' + usersCurrentlyInVault); - - await vault.deposit(toUnit(200), { from: second }); - await vault.deposit(toUnit(300), { from: first }); - - await fastForward(day); - // CLOSE ROUND #4 - START ROUND #5 - await vault.closeRound(); - - await vault.deposit(toUnit(100), { from: second }); - await assert.revert( - vault.withdrawalRequest({ from: second }), - "Can't withdraw as you already deposited for next round" - ); - - await fastForward(day); - // CLOSE ROUND #5 - START ROUND #6 - await vault.closeRound(); - - // await fastForward(game1NBATime - (await currentTime()) - SECOND); - - let roundLength = await vault.roundLength(); - console.log('roundLength is:' + roundLength); - - round = await vault.round(); - console.log('round is:' + round); - - let roundStartTime = await vault.roundStartTime(round); - console.log('roundStartTime is:' + roundStartTime); - - //await createMarkets(); - - await fastForward(day); - // CLOSE ROUND #6 - START ROUND #7 - await vault.closeRound(); - round = await vault.round(); - console.log('round is:' + round); - roundStartTime = await vault.roundStartTime(round); - console.log('roundStartTime is:' + roundStartTime); - - let getCurrentRoundEnd = await vault.getCurrentRoundEnd(); - console.log('getCurrentRoundEnd is:' + getCurrentRoundEnd); - - let allocationSpentInARound = await vault.allocationSpentInARound(round); - console.log('allocationSpentInARound is:' + allocationSpentInARound / 1e18); - - allocationSpentInARound = await vault.allocationSpentInARound(round); - console.log('allocationSpentInARound is:' + allocationSpentInARound / 1e18); - - let canCloseCurrentRound = await vault.canCloseCurrentRound(); - console.log('canCloseCurrentRound is:' + canCloseCurrentRound); - - await fastForward(day); - canCloseCurrentRound = await vault.canCloseCurrentRound(); - console.log('canCloseCurrentRound is:' + canCloseCurrentRound); - - canCloseCurrentRound = await vault.canCloseCurrentRound(); - console.log('canCloseCurrentRound is:' + canCloseCurrentRound); - - let balanceFirst = await vault.getBalancesPerRound(round, first); - console.log('balanceFirst is:' + balanceFirst / 1e18); - - let balanceSecond = await vault.getBalancesPerRound(round, second); - console.log('balanceSecond is:' + balanceSecond / 1e18); - - let balanceVault = await Thales.balanceOf(vault.address); - console.log('balanceVault is:' + balanceVault / 1e18); - - let profitAndLossPerRound = await vault.profitAndLossPerRound(round - 1); - console.log('profitAndLossPerRound is:' + profitAndLossPerRound / 1e18); - - await fastForward(day); - await vault.closeRound(); - - round = await vault.round(); - console.log('round is:' + round); - - balanceFirst = await vault.getBalancesPerRound(round, first); - console.log('balanceFirst is:' + balanceFirst / 1e18); - - balanceSecond = await vault.getBalancesPerRound(round, second); - console.log('balanceSecond is:' + balanceSecond / 1e18); - - balanceVault = await Thales.balanceOf(vault.address); - console.log('balanceVault is:' + balanceVault / 1e18); - - profitAndLossPerRound = await vault.profitAndLossPerRound(round - 1); - console.log('profitAndLossPerRound is:' + profitAndLossPerRound / 1e18); - - volume = await StakingThales.getAMMVolume(first); - console.log('volume first is:' + volume / 1e18); - - volume = await StakingThales.getAMMVolume(second); - console.log('volume second is:' + volume / 1e18); - }); - - it('Vault trade', async () => { - await fastForward(game1NBATime - (await currentTime()) - SECOND); - - let round = await vault.round(); - console.log('round is:' + round.toString()); - - let vaultStarted = await vault.vaultStarted(); - console.log('vaultStarted is:' + vaultStarted); - - await vault.deposit(toUnit(300), { from: first }); - await vault.deposit(toUnit(300), { from: second }); - - await createMarkets(); - - round = 1; - - let usersCurrentlyInVault = await vault.usersCurrentlyInVault(); - console.log('usersCurrentlyInVault is:' + usersCurrentlyInVault); - - await vault.startVault({ from: owner }); - round = await vault.round(); - console.log('round is:' + round.toString()); - - usersCurrentlyInVault = await vault.usersCurrentlyInVault(); - console.log('usersCurrentlyInVault is:' + usersCurrentlyInVault); - - let roundStartTime1 = await vault.roundStartTime(round); - console.log('roundStartTime ROUND 1 is:' + roundStartTime1); - console.log('roundENDTime ROUND 1 is:' + (await vault.getCurrentRoundEnd())); - - assert.bnEqual(await vault.getBalancesPerRound(round, first), toUnit(300)); - assert.bnEqual(await vault.getBalancesPerRound(round, second), toUnit(300)); - assert.bnEqual(await Thales.balanceOf(vault.address), toUnit(600)); - - let balanceVault = await Thales.balanceOf(vault.address); - console.log('balanceVault before trade is:' + balanceVault / 1e18); - - await fastForward(game1NBATime - (await currentTime()) - SECOND); - - let totalSUSDToPay = toUnit('10'); - parlayPositions = ['1', '1', '1']; - parlayPositions2 = ['1', '1']; - let parlayMarketsAddress = []; - let parlayMarketsAddress2 = []; - for (let i = 0; i < parlayMarkets.length; i++) { - parlayMarketsAddress[i] = parlayMarkets[i].address; - parlayMarketsAddress2[i] = parlayMarkets[i].address; - - console.log(parlayMarkets[i].address, (await parlayMarkets[i].times()).maturity / 1); - } - - parlayMarketsAddress2.pop(); - let slippage = toUnit('0.01'); - - let result = await ParlayAMM.buyQuoteFromParlay( - parlayMarketsAddress, - parlayPositions, - totalSUSDToPay - ); - console.log('first', fromUnit(result[0])); - console.log('sUSDAfterFees: ', fromUnit(result.sUSDAfterFees)); - console.log('totalQuote: ', fromUnit(result.totalQuote)); - console.log('totalBuyAmount: ', fromUnit(result.totalBuyAmount)); - console.log('initialQuote: ', fromUnit(result.initialQuote)); - console.log('skewImpact: ', fromUnit(result.skewImpact)); - - for (let i = 0; i < parlayMarkets.length; i++) { - console.log(result.amountsToBuy[i] / 1e18); - let buyFromAmmQuote = await SportsAMM.buyFromAmmQuote( - parlayMarkets[i].address, - 1, - result.amountsToBuy[i] - ); - console.log('buyQuote: ', fromUnit(buyFromAmmQuote)); - - let buyPriceImpactFirst = await SportsAMM.buyPriceImpact( - parlayMarkets[i].address, - 1, - result.amountsToBuy[i] - ); - console.log('buyPriceImpact: ', fromUnit(buyPriceImpactFirst)); - } - - console.log('trading allocation', await vault.tradingAllocation()); - - await assert.revert( - vault.trade(parlayMarketsAddress, parlayPositions, totalSUSDToPay), - 'Amount exceeds max value per trade' - ); - - await vault.setMaxTradeRate(toUnit(0.04).toString(), { from: owner }); - - await vault.trade(parlayMarketsAddress, parlayPositions, totalSUSDToPay); - - await assert.revert( - vault.trade(parlayMarketsAddress, parlayPositions, totalSUSDToPay), - 'Parlay market already exists' - ); - - await vault.trade(parlayMarketsAddress2, parlayPositions2, totalSUSDToPay); - await vault.trade( - [parlayMarketsAddress[1], parlayMarketsAddress[2]], - parlayPositions2, - totalSUSDToPay - ); - - await vault.setMaxMarketUsedInRoundCount(1, { from: owner }); - - await assert.revert( - vault.trade( - [parlayMarketsAddress[0], parlayMarketsAddress[2]], - parlayPositions2, - totalSUSDToPay - ), - 'Market is at the maximum number of tickets' - ); - - balanceVault = await Thales.balanceOf(vault.address); - console.log('balanceVault after trade is:' + balanceVault / 1e18); - - let allocationSpentInARound = await vault.allocationSpentInARound(round); - console.log('allocationSpentInARound is:' + allocationSpentInARound / 1e18); - - let canCloseCurrentRound = await vault.canCloseCurrentRound(); - console.log('canCloseCurrentRound is:' + canCloseCurrentRound); - - await fastForward(day); - canCloseCurrentRound = await vault.canCloseCurrentRound(); - console.log('canCloseCurrentRound is:' + canCloseCurrentRound); - - await fastForward(fightTime - (await currentTime()) + 3 * hour); - let resolveMatrix = ['2', '2', '2']; - let gameId; - let homeResult = '0'; - let awayResult = '0'; - for (let i = 0; i < parlayMarkets.length; i++) { - homeResult = '0'; - awayResult = '0'; - gameId = await TherundownConsumerDeployed.gameIdPerMarket(parlayMarkets[i].address); - if (resolveMatrix[i] == '1') { - homeResult = '1'; - } else if (resolveMatrix[i] == '2') { - awayResult = '1'; - } else if (resolveMatrix[i] == '3') { - homeResult = '1'; - awayResult = '1'; - } - const tx_resolve_4 = await TherundownConsumerDeployed.resolveMarketManually( - parlayMarkets[i].address, - resolveMatrix[i], - homeResult, - awayResult, - { from: owner } - ); - } - let resolved; - for (let i = 0; i < parlayMarkets.length; i++) { - deployedMarket = await SportPositionalMarketContract.at(parlayMarkets[i].address); - resolved = await deployedMarket.resolved(); - assert.equal(true, resolved); - } - - let activeParlays = await ParlayAMM.activeParlayMarkets('0', '100'); - parlaySingleMarketAddress = activeParlays[0]; - parlaySingleMarket = await ParlayMarketContract.at(activeParlays[0].toString()); - - let answer = await parlaySingleMarket.isAnySportMarketResolved(); - result = await ParlayAMM.resolvableSportPositionsInParlay(parlaySingleMarket.address); - assert.equal(answer.isResolved, true); - assert.equal(result.isAnyResolvable, true); - - canCloseCurrentRound = await vault.canCloseCurrentRound(); - console.log('canCloseCurrentRound is:' + canCloseCurrentRound); - - let balanceFirst = await vault.getBalancesPerRound(round, first); - console.log('balanceFirst is:' + balanceFirst / 1e18); - - let balanceSecond = await vault.getBalancesPerRound(round, second); - console.log('balanceSecond is:' + balanceSecond / 1e18); - - balanceVault = await Thales.balanceOf(vault.address); - console.log('balanceVault is:' + balanceVault / 1e18); - - let profitAndLossPerRound = await vault.profitAndLossPerRound(round - 1); - console.log('profitAndLossPerRound is:' + profitAndLossPerRound / 1e18); - - await fastForward(day); - await vault.closeRound(); - - round = await vault.round(); - console.log('round is:' + round); - - balanceFirst = await vault.getBalancesPerRound(round, first); - console.log('balanceFirst is:' + balanceFirst / 1e18); - - balanceSecond = await vault.getBalancesPerRound(round, second); - console.log('balanceSecond is:' + balanceSecond / 1e18); - - balanceVault = await Thales.balanceOf(vault.address); - console.log('balanceVault is:' + balanceVault / 1e18); - - profitAndLossPerRound = await vault.profitAndLossPerRound(round - 1); - console.log('profitAndLossPerRound is:' + profitAndLossPerRound / 1e18); - }); - }); -}); diff --git a/test/contracts/SportVaults/SportVault.js b/test/contracts/SportVaults/SportVault.js index 825c68856..257ae2602 100644 --- a/test/contracts/SportVaults/SportVault.js +++ b/test/contracts/SportVaults/SportVault.js @@ -38,12 +38,26 @@ const { } = require('../../utils/helpers'); contract('SportsAMM', (accounts) => { - const [manager, first, owner, second, third, fourth, safeBox, wrapper] = accounts; + const [ + manager, + first, + owner, + second, + third, + fourth, + safeBox, + wrapper, + firstLiquidityProvider, + defaultLiquidityProvider, + ] = accounts; const ZERO_ADDRESS = '0x' + '0'.repeat(40); const MAX_NUMBER = '115792089237316195423570985008687907853269984665640564039457584007913129639935'; + const SportAMMLiquidityPoolRoundMastercopy = artifacts.require( + 'SportAMMLiquidityPoolRoundMastercopy' + ); const SportPositionContract = artifacts.require('SportPosition'); const SportPositionalMarketContract = artifacts.require('SportPositionalMarket'); const SportPositionalMarketDataContract = artifacts.require('SportPositionalMarketData'); @@ -136,7 +150,8 @@ contract('SportsAMM', (accounts) => { testDAI, Referrals, GamesOddsObtainerDeployed, - SportsAMM; + SportsAMM, + SportAMMLiquidityPool; const game1NBATime = 1646958600; const gameFootballTime = 1649876400; @@ -225,6 +240,7 @@ contract('SportsAMM', (accounts) => { toUnit('100'), toUnit('0.01'), toUnit('0.005'), + toUnit('500'), { from: owner } ); @@ -258,6 +274,7 @@ contract('SportsAMM', (accounts) => { second, second, second, + second, { from: owner } ); @@ -412,17 +429,58 @@ contract('SportsAMM', (accounts) => { { from: owner } ); + let SportAMMLiquidityPoolContract = artifacts.require('SportAMMLiquidityPool'); + SportAMMLiquidityPool = await SportAMMLiquidityPoolContract.new(); + + await SportAMMLiquidityPool.initialize( + { + _owner: owner, + _sportsAmm: SportsAMM.address, + _sUSD: Thales.address, + _roundLength: WEEK, + _maxAllowedDeposit: toUnit(1000).toString(), + _minDepositAmount: toUnit(100).toString(), + _maxAllowedUsers: 100, + }, + { from: owner } + ); + await SportsAMM.setAddresses( owner, Thales.address, TherundownConsumerDeployed.address, StakingThales.address, Referrals.address, - Referrals.address, + ZERO_ADDRESS, wrapper, + SportAMMLiquidityPool.address, { from: owner } ); + let sportAMMLiquidityPoolRoundMastercopy = await SportAMMLiquidityPoolRoundMastercopy.new(); + await SportAMMLiquidityPool.setPoolRoundMastercopy( + sportAMMLiquidityPoolRoundMastercopy.address, + { + from: owner, + } + ); + await Thales.transfer(firstLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: firstLiquidityProvider, + }); + await SportAMMLiquidityPool.setWhitelistedAddresses([firstLiquidityProvider], true, { + from: owner, + }); + await SportAMMLiquidityPool.deposit(toUnit(100), { from: firstLiquidityProvider }); + await SportAMMLiquidityPool.start({ from: owner }); + await SportAMMLiquidityPool.setDefaultLiquidityProvider(defaultLiquidityProvider, { + from: owner, + }); + await Thales.transfer(defaultLiquidityProvider, toUnit('1000000'), { from: owner }); + await Thales.approve(SportAMMLiquidityPool.address, toUnit('1000000'), { + from: defaultLiquidityProvider, + }); + await testUSDC.mint(first, toUnit(100000)); await testUSDC.mint(curveSUSD.address, toUnit(100000)); await testUSDC.approve(SportsAMM.address, toUnit(100000), { from: first }); @@ -473,13 +531,14 @@ contract('SportsAMM', (accounts) => { await StakingThales.startStakingPeriod({ from: owner }); await vault.setStakingThales(StakingThales.address, { from: owner }); - await SportsAMM.setSafeBoxFeePerAddress(vault.address, toUnit('0.005'), { - from: owner, - }); - - await SportsAMM.setMinSpreadPerAddress(vault.address, toUnit('0.005'), { - from: owner, - }); + await SportsAMM.setSafeBoxFeeAndMinSpreadPerAddress( + vault.address, + toUnit('0.005'), + toUnit('0.005'), + { + from: owner, + } + ); }); describe('Test sport vault', () => { diff --git a/test/contracts/Staking/ExtraRewards.js b/test/contracts/Staking/ExtraRewards.js index 7284cc82c..72d89acb0 100644 --- a/test/contracts/Staking/ExtraRewards.js +++ b/test/contracts/Staking/ExtraRewards.js @@ -13,6 +13,8 @@ const { fastForward, toUnit, currentTime } = require('../../utils')(); const { convertToDecimals } = require('../../utils/helpers'); const MockAggregator = artifacts.require('MockAggregatorV2V3'); +const ZERO_ADDRESS = '0x' + '0'.repeat(40); + contract('StakingThales', (accounts) => { const [initialCreator, managerOwner, minter, dummy] = accounts; @@ -138,7 +140,8 @@ contract('StakingThales', (accounts) => { dummy, PriceFeedInstance.address, dummy, - AddressResolverDeployed.address + AddressResolverDeployed.address, + ZERO_ADDRESS ); }); diff --git a/test/contracts/Staking/ProxyStaking.js b/test/contracts/Staking/ProxyStaking.js index de327970e..dd1d1217a 100644 --- a/test/contracts/Staking/ProxyStaking.js +++ b/test/contracts/Staking/ProxyStaking.js @@ -115,7 +115,8 @@ contract('StakingThales', (accounts) => { dummy, dummy, dummy, - AddressResolverDeployed.address + AddressResolverDeployed.address, + ZERO_ADDRESS ); }); diff --git a/test/contracts/Staking/StakingThales.js b/test/contracts/Staking/StakingThales.js index 2d5f16bd2..e4ec01856 100644 --- a/test/contracts/Staking/StakingThales.js +++ b/test/contracts/Staking/StakingThales.js @@ -247,6 +247,7 @@ contract('StakingThales', (accounts) => { PriceFeedInstance.address, ThalesStakingRewardsPoolDeployed.address, AddressResolverDeployed.address, + ZERO_ADDRESS, { from: owner } ); }); diff --git a/test/contracts/Staking/StakingThalesTestAmounts.js b/test/contracts/Staking/StakingThalesTestAmounts.js index fa21adb7c..1f5e57eaf 100644 --- a/test/contracts/Staking/StakingThalesTestAmounts.js +++ b/test/contracts/Staking/StakingThalesTestAmounts.js @@ -13,6 +13,8 @@ const { fastForward, toUnit, currentTime } = require('../../utils')(); const { encodeCall, convertToDecimals } = require('../../utils/helpers'); const MockAggregator = artifacts.require('MockAggregatorV2V3'); +const ZERO_ADDRESS = '0x' + '0'.repeat(40); + contract('StakingThales', (accounts) => { const [first, second, third, owner] = accounts; const [initialCreator, managerOwner, minter, dummy] = accounts; @@ -171,6 +173,7 @@ contract('StakingThales', (accounts) => { PriceFeedInstance.address, ThalesStakingRewardsPoolDeployed.address, AddressResolverDeployed.address, + ZERO_ADDRESS, { from: owner } ); await StakingThalesDeployed.startStakingPeriod({ from: owner }); diff --git a/test/contracts/Staking/UnstakingThalesTest.js b/test/contracts/Staking/UnstakingThalesTest.js index 4ad68a857..4a4bb4520 100644 --- a/test/contracts/Staking/UnstakingThalesTest.js +++ b/test/contracts/Staking/UnstakingThalesTest.js @@ -12,6 +12,8 @@ const { fastForward, toUnit, currentTime } = require('../../utils')(); const { encodeCall, convertToDecimals } = require('../../utils/helpers'); const MockAggregator = artifacts.require('MockAggregatorV2V3'); +const ZERO_ADDRESS = '0x' + '0'.repeat(40); + contract('StakingThales', (accounts) => { const [first, second, third, owner] = accounts; const [initialCreator, managerOwner, minter, dummy] = accounts; @@ -177,6 +179,7 @@ contract('StakingThales', (accounts) => { PriceFeedInstance.address, ThalesStakingRewardsPoolDeployed.address, AddressResolverDeployed.address, + ZERO_ADDRESS, { from: owner } ); });