There are two possible messages that stats.gallery could send to users right now:
Earned a badge
Advanced to a new level
Earned a badge
Badge acquisition status is determined by the return value of an SQL query to a PostgreSQL indexer server, for example:
select count(*) as result
where exists(
select *
from action_receipt_actions
where action_kind = 'DEPLOY_CONTRACT'
and receipt_predecessor_account_id = 'hatchet.near'
)
Queries will return 0 when a badge is not acquired, and >0 when a badge is acquired. If the badge is a boolean badge (such as the one above), it will return 1 when the badge is awarded. Some badges have multiple levels (example), so instead of the badge being awarded at any return value >0, there are some predetermined levels, which are established here on the frontend.
Badge queries are stored in badge-*.sql.js files here.
Messaging
Congratulations, you've earned the <badge-name> badge on stats.gallery!
TODO: I can ask a designer to work on messaging and email design/template if desired.
@trevorjtclarke
There are two possible messages that stats.gallery could send to users right now:
Earned a badge
Badge acquisition status is determined by the return value of an SQL query to a PostgreSQL indexer server, for example:
Queries will return 0 when a badge is not acquired, and >0 when a badge is acquired. If the badge is a boolean badge (such as the one above), it will return 1 when the badge is awarded. Some badges have multiple levels (example), so instead of the badge being awarded at any return value >0, there are some predetermined levels, which are established here on the frontend.
Badge queries are stored in
badge-*.sql.js
files here.Messaging
TODO: I can ask a designer to work on messaging and email design/template if desired.
Advanced to a new level
Levels are awarded based on an exponentially increasing score requirement. A user's score is calculated by awarding certain types of on-chain actions with different point values. Levels names are determined here (lvl 10+ is "Nearkat").
Messaging