API service that provides a sorted leaderboard for incentives/games/Mainnet Sims operating on the Fairground testnet.
The leaderboard is filtered to include ONLY participants that are found on a verified 'allow-list' provided by an external API service. On which each user will verify their public key using Twitter. This service is known internally as Social Media Verification or "Twitter Registration". An optional blacklist can be configured to exclude users from the main public leaderboard, this feature is useful for team members or known bots/scammers.
When running an incentive/game the configuration file for the topgun-service can be configured with the appropriate 'algorithm' to serve up a list of participants on a leaderboard. The choices of algorithm currently includes:
ByPartyAccountGeneralBalance
- Sorted by trading account total general balance of given assetByPartyAccountGeneralBalanceLP
- Sorted by trading account total general balance of given asset and must have submitted LP for configured MarketID
ByPartyAccountGeneralProfit
- Sorted by profit algorithm ((balanceGeneral - depositTotal)/depositTotal) for given assetByPartyAccountGeneralProfitLP
- Sorted by profit algorithm (as above) for given asset and must have submitted LP for configured MarketID
ByPartyAccountGeneralLoser
- Sorted by profit algorithm ((balanceGeneral - depositTotal)/depositTotal) for given asset, however this is ranked descending by greatest non-rekt loser i.e. >0 ByPartyGovernanceVotes
- Sorted by trading account governance votesByLPEquitylikeShare
- Sorted by LP equity like shareByAssetDepositWithdrawal
- Sorted by ERC20 assets deposited and withdrawn (achieved when user deposits and withdraws 2 unique assets) BySocialRegistration
- Sorted by latest Twitter registrations (used to check that a twitter handle is verified/signed up for incentives)The service is written in Go and more recent algorithms use MongoDB as a persistence layer.
Example:
./topgun-service -config custom-config-file.yaml
To build - you can run go build -v -o bin/topgun-service ./cmd/topgun-service
Then to run from the bin directory you can use ./bin/topgun-service -config config.yaml
The application requires a custom configuration file passed in the argument named -config
, an example can be found here. Details of the config variables are detailed below:
Config:
MongoDB:
Optionally, algorithms can make use of persisting and sharing data collections stored in MongoDB, useful to preserve
state of incentives throughout resets and other events like restarts. Currently only the ByAssetDepositWithdrawal
algorithm makes use of mongodb, other algos should set these fields to the value NA
or similar as shown in the example
config file.
Queries:
/status
- useful for health returns 200 if service is up/leaderboard
- returns the leaderboard in json format
?q={social_handle}
- search query to filter for a specific social handle, case insensitive?skip={n}
- skip n
leaderboard results (pagination)?size={n}
- page size n
leaderboard results (pagination)?type={csv|json}
- return type of results, default JSON?blacklisted={true|false}
- Return leaderboard of blacklisted users, default: false
A mapping of public key to social handle (Twitter) is provided by an external service, please see the file verified_example.txt
for an example of the format returned. An attempt to update this list from the 3rd party server happens on each reload of the data from Vega, see vegapoll
time parameter above. This service is operated by Vega and is known internally as Social Media Verification or "Twitter Registration".
Please use the Issues tab in the topgun-service repository in GitHub.