Smart Contract

Trustless Rewards on Mainnet
The complete code with used Traits

Data Stored On Chain

Error Codes used

Variables used

Lobbies map - keep data about each lobby using their unique id

For a lobby id - have details such as

- owner of lobby, a short description, STX amount accumulated, entry fee

- factor and commission which are used in the calculus formula for rewards

- mapy, length, traffic, curves to display transparently the racing map info

- hours and active for increased security to pay only once the rewards after the lobby is done

Scoreboard to keep the highscore of each address that played in a given lobby and info for rewarding that specific player

Count of lobbies for generating a new id each time one lobby is created

The owner to let only him to pay rewards

Public Functions For Any User

Lobby Creation

Joining a lobby

Admin Functions

Change of Contract Admin

Publish New Highscores On Smart Contract

the new highscores freshly stored on the db are uploaded to the smart contract for full transparency of the data - max 50 per transaction for optimised cost analysis

Finish a lobby

upload the last highscores to sync the smart contract with the database

Disable the lobby after its time is over

Last updated