Ace the Brackets8
Base Sepolia Contract:
https://sepolia.basescan.org/address/0x9e63ed2acbe3e76e77774f74db51e3c9ff383efa
Base Contract:
https://basescan.org/address/0x28B527CD5Ea34A7a906D005461D54F5e234B4F3B
Events
UpdatePerformed: Emitted when upkeep is performed
lastTimeStamp:uint256
GameCreated: Emitted when a new game is created
gameIndex:uint256
GameActivated: Emitted when a game is activated
gameIndex: uint256
GameAdvanced: Emitted when a game advances to the next round
gameIndex:uint256round:uint8
GameFinished: Emitted when a game finishes
gameIndex:uint256result:bytes32
DaysToClaimPrizeChanged: Emitted when days to claim prize is changed
daysToClaimPrize:uint8
Paused: Emitted when pause state is changed
paused:bool
PriceFeedAdded: Emitted when a new token price feed is added to the contract
tokenIndex:uint256
Constants
MIN_ACTIVE_TOKENS:
uint8 publicMinimum number of active tokens
State Variables
gamesHub:
IGamesHub publicThe games hub contract that manages roles and games
games:
mapping(uint256 => Game) publicMapping from game index to game struct
tokens:
mapping(uint256 => Token) publicMapping from token index to token struct
totalGames:
uint8 publicTotal number of games created
daysToClaimPrize:
uint8 publicNumber of days games remain claimable
updateActivated:
bool publicToggle for enabling/disabling automated updates
createNewGames:
bool publicToggle for enabling/disabling new game creation
lastTimeStamp:
uint256 publicTimestamp of last update
executionAddress:
address publicChainlink Automation compatible forwarder address
paused:
bool publicCheck if contract is paused
minActiveGames:
uint8 publicMinimum number of active games
Structs
Round
tokens:uint256[8]pricesStart:uint256[8]pricesEnd:uint256[8]start:uint256end:uint256
Game
rounds:Round[3]currentRound:uint8winner:uint256finalPrice:uint256activated:boolstart:uint256end:uint256
Modifiers
onlyAdministrator: Restrict access to admin rolesonlyExecutor: Restrict access to Tenderly executor addressgameOutOfIndex(uint256 gameIndex): Check if the gameIndex is out of bounds
Functions
Constructor
Description: Initializes contract parameters
Arguments:
gamesHubAddress:addressminActiveGames:uint8forwarderAddress:address
performGames
Description: Tenderly Automation function to perform updates. If contract is paused, it will not run.
Arguments:
_dataNewGame:bytes calldata_dataUpdate:bytes calldata_lastTimestamp:uint256
setPaused
Description: Function to pause / unpause the contract
Arguments:
paused:bool
Modifiers:
onlyAdministrator: Restrict access
setExecutionAddress
Description: Set Tenderly execution address
Arguments:
_executionAddress:address
Modifiers:
onlyAdministrator: Restrict access
setCreateNewGames
Description: Enable/disable new game creation
Arguments:
_active:bool
Modifiers:
onlyAdministrator: Restrict access
setMinConcurrentGames
Description: Function to set the minimum number of concurrent games.
Arguments:
_minActiveGames:uint8The new minimum number of concurrent games.
Modifiers:
onlyAdministrator: Restrict access to admin roles.
changeDaysToClaimPrize
Description: Change number of days games remain claimable
Arguments:
_daysToClaimPrize:uint8
getFinalResult
Description: Get final bracket result for a game
Arguments:
gameIndex:uint256
Returns:
brackets:uint256[7] memory
getGameStatus
Description: Get current status of a game. 0: not started, 1-3: round numbers, 4: finished
Arguments:
gameIndex:uint256
Returns:
status:uint8
getRoundFullData
Description: Get all data for a round.
Arguments:
gameIndex:uint256
Returns:
gameData:bytes memoryEncoded as:
symbols1:string[8]Token symbolspricesStart1:uint256[8]Token pricesStartpricesEnd1:uint256[8]Token pricesEndstart:uint256Start timestamp in secondsend:uint256End timestamp in seconds
getGameFullData
Description: Get all data for a game. If currentRound is 0 and start prices are 0, the game is not activated
Arguments:
gameIndex:uint256
Returns:
gameData:bytes memoryEncoded as:
round1:bytesRound 1 getRoundFullData bytes encodedround2:bytesRound 2 getRoundFullData bytes encodedround3:bytesRound 3 getRoundFullData bytes encodedwinner:stringWinning token symbolfinalPrice:uint256Final price of winnercurrentRound:uint80-2: rounds 1-3, 3: finishedstart:uint256Start timestamp in secondsend:uint256End timestamp in secondsactivated:boolTrue: Active | False: Inactive
getRoundData
Description: Get token IDs and prices for a specific round
Arguments:
gameIndex:uint256round:uint8
Returns:
tokens:uint256[8] memoryprices:uint256[8] memory
getActiveGames
Description: Get array of active game indexes
Returns:
activeGames:uint256[] memory
getTokenSymbol
Description: Get symbol for a token
Arguments:
tokenIndex:uint256
Returns:
symbol:string memory
getTokenId
Description: Get symbol for a token
Arguments:
symbol:string memory
Returns:
tokenIndex:uint256
getTokensIds
Description: Get the ids for an array of token symbols
Arguments:
_symbols:bytes memoryEncoded string[8] array
Returns:
_tokens:uint256[8] memory
getTokensIds
Description: Get the ids for an array of token symbols
Arguments:
_tokens:bytes memoryEncoded uint256[8] array
Returns:
_symbols:string[8] memory
getActiveGamesActualCoins
Description: Get symbols and start prices for all active games
Returns:
_activeGamesActualCoins:bytes[4] memoryEach array item encoded as:
gameId:uint256symbols:string[8]pricesStart:uint256[8]
Last updated
Was this helpful?