get config: https://api.invariant.app/api/config
{
"refreshTime": 1800,
"pointsDecimal": 8,
"promotedPools": [
{
"address": "HRgVv1pyBLXdsAddq4ubSqo8xdQWRrYbvmXqEDtectce",
"pointsPerSecond": "64",
"startCountTimestamp": "6766d8da"
},
{
"address": "86vPh8ctgeQnnn8qPADy5BkzrqoH5XjMCWvkd4tYhhmM",
"pointsPerSecond": "1e",
"startCountTimestamp": "67c03de0"
},
{
"address": "E2B7KUFwjxrsy9cC17hmadPsxWHD1NufZXTyrtuz8YxC",
"pointsPerSecond": "19",
"startCountTimestamp": "67ce0183"
},
{
"address": "FvVsbwsbGVo6PVfimkkPhpcRfBrRitiV946nMNNuz7f9",
"pointsPerSecond": "0a",
"startCountTimestamp": "6772f81b"
}
],
"lastSnapTimestamp": 1743597998,
"pointsPerUsd": "c8",
"swapMultiplier": "01",
"swapPairs": [
{
"tokenX": "AKEWE7Bgh87GPp171b4cJPSSZfmZwQ3KaqYqXoKLNAEE",
"tokenY": "So11111111111111111111111111111111111111112"
},
{
"tokenX": "GU7NS9xCwgNPiAdJ69iusFrRfawjDDPjeMBovhV1d4kn",
"tokenY": "So11111111111111111111111111111111111111112"
},
{
"tokenX": "BeRUj3h7BqkbdfFU7FBNYbodgf8GCHodzKvF9aVjNNfL",
"tokenY": "So11111111111111111111111111111111111111112"
},
{
"tokenX": "AKEWE7Bgh87GPp171b4cJPSSZfmZwQ3KaqYqXoKLNAEE",
"tokenY": "BeRUj3h7BqkbdfFU7FBNYbodgf8GCHodzKvF9aVjNNfL"
}
]
}
Name | Type | Description |
---|---|---|
network | string | Network (currently only eclipse-mainnet) |
address | string / null | User address to query, use null if not specified |
offset | number | Starting position in the leaderboard |
size | number | Number of user records to return. |
get all users without specifying address: https://api.invariant.app/api/eclipse-mainnet/total/null
get all users and specified address: https://api.invariant.app/api/eclipse-mainnet/total/9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE
get all users from range (offset, offset + size) with specified user: https://api.invariant.app/api/eclipse-mainnet/total/9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE?offset=1&size=1
{
"user": {
"address": "9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE",
"points": "f31153ab9f700",
"last24hPoints": "0",
"lpPoints": "f31153ab9f700",
"swapPoints": "0",
"rank": 2
},
"leaderboard": [
{
"address": "9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE",
"points": "f31153ab9f700",
"last24hPoints": "0",
"lpPoints": "f31153ab9f700",
"swapPoints": "0",
"rank": 2
}
],
"totalItems": 144952
}
Name | Type | Description |
---|---|---|
network | string | Network (currently only eclipse-mainnet) |
address | string / null | User address to query, use null if not specified |
offset | number | Starting position in the leaderboard |
size | number | Number of user records to return. |
get all users without specifying address: https://api.invariant.app/api/eclipse-mainnet/lp/null
get all users and specified address: https://api.invariant.app/api/eclipse-mainnet/lp/9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE
get all users from range (offset, offset + size) with specified user: https://api.invariant.app/api/eclipse-mainnet/lp/9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE?offset=1&size=1
{
"user": {
"rank": 2,
"address": "9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE",
"points": "f31153ab9f700",
"last24hPoints": "0",
"positions": 1
},
"leaderboard": [
{
"rank": 2,
"address": "9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE",
"points": "f31153ab9f700",
"last24hPoints": "0",
"positions": 1
}
],
"totalItems": 144957
}
Name | Type | Description |
---|---|---|
network | string | Network (currently only eclipse-mainnet) |
address | string / null | User address to query, use null if not specified |
offset | number | Starting position in the leaderboard |
size | number | Number of user records to return. |
get all users without specifying address: https://api.invariant.app/api/eclipse-mainnet/swaps/null
get all users and specified address: https://api.invariant.app/api/eclipse-mainnet/swaps/9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE
get all users from range (offset, offset + size) with specified user: https://api.invariant.app/api/eclipse-mainnet/swaps/9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE?offset=1&size=1
{
"user": {
"rank": 142307,
"address": "9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE",
"points": "0",
"last24hPoints": "0",
"swaps": 0
},
"leaderboard": [
{
"rank": 2,
"address": "97Qhv1jG8G5M47FvkvaZCu9y4oVfgdTPHFqtpVjRZ2k2",
"points": "f5f0a9600bdd",
"last24hPoints": "0",
"swaps": 1936,
"domain": "btc0w.turbo"
}
],
"totalItems": 144957
}
Name | Type | Description |
---|---|---|
address | string | User address to query |
get user quest state https://api.invariant.app/api/quest/address/9BNu7C9f3cGS4fBS5jKvG2XASHGVVnBxR2XAW4q4ZYUE
{ "totalPoints": "0f31153ab9f700", "completed": true }
get user quest state https://api.invariant.app/api/quest/description
{
"questProvider": "Invariant",
"questProviderUrl": "https://eclipse.invariant.app/"
}
get available price feeds https://api.invariant.app/api/swap/price-feeds
{
"AKEWE7Bgh87GPp171b4cJPSSZfmZwQ3KaqYqXoKLNAEE": {
"pricePublishTime": 1744812314,
"priceDecimals": 8,
"price": "99996853"
},
"So11111111111111111111111111111111111111112": {
"pricePublishTime": 1744812314,
"priceDecimals": 8,
"price": "157263212041"
},
"GU7NS9xCwgNPiAdJ69iusFrRfawjDDPjeMBovhV1d4kn": {
"pricePublishTime": 1744812314,
"priceDecimals": 8,
"price": "159379151733"
},
"BeRUj3h7BqkbdfFU7FBNYbodgf8GCHodzKvF9aVjNNfL": {
"pricePublishTime": 1744812314,
"priceDecimals": 8,
"price": "12514977421"
}
}
Name | Type | Description |
---|---|---|
address | string | User address to query |
get user content program points https://api.invariant.app/api/content-program/37mo4JWDqEQRzn9wHExRGdvAkExJL9J3jTEzeywJipmA
[
{
"startTimestamp": 1734649200,
"endTimestamp": 1738278000,
"points": 100000
},
{ "startTimestamp": 1738368000, "endTimestamp": 1739491200, "points": 50000 },
{ "startTimestamp": 1739491200, "endTimestamp": 1740700800, "points": 50000 },
{
"startTimestamp": 1740787201,
"endTimestamp": 1741910401,
"points": 200000
},
{
"startTimestamp": 1741996800,
"endTimestamp": 1743206400,
"points": 100000
},
{ "startTimestamp": 1743465600, "endTimestamp": 1744588800, "points": 300000 }
]
Name | Type | Description |
---|---|---|
address | string / undefined | one or multiple token addresses to query |
get all available prices https://api.invariant.app/price/eclipse-mainnet
get price for one token https://api.invariant.app/price/eclipse-mainnet?address=64mggk2nXg6vHC1qCdsZdEFzd5QGN4id54Vbho4PswCF
get price for multiple tokens https://api.invariant.app/price/eclipse-mainnet?address=64mggk2nXg6vHC1qCdsZdEFzd5QGN4id54Vbho4PswCF&address=2tGbYEm4nuPFyS6zjDTELzEhvVKizgKewi6xT7AaSKzn
{
"data": {
"2tGbYEm4nuPFyS6zjDTELzEhvVKizgKewi6xT7AaSKzn": { "price": 3.197401 },
"64mggk2nXg6vHC1qCdsZdEFzd5QGN4id54Vbho4PswCF": {
"price": 41.4892796967324
}
},
"lastUpdateTimestamp": 1744812724
}
- Start mongo database from
leaderboard-backend
repo with./setup.sh
script - Migrate data to mognodb from
leaderboard
repo usingts-node scripts/migrate.ts
- Create data backup file with
npm run backup
command inleaderboard-backend
repo - Change the backup file name in the
scripts/insert-backup.ts
to created file in step 3, path:backups/<FILE_NAME>.json
- Copy the files to server using
scp
command (ensure thatnode_modules
are excluded)
-
Install dependencies in main directory and
api
directory -
Start mongo database using
./setup.sh
script -
Insert backup with
npm run insert-backup
-
Start the instances of cron job and api using
screen
command4.1 Create screen for cron
screen -S cron
4.2 Start job with
npm run start
4.3 Detach scren using
CTRL A + D
4.4 Create screen for api
screen -S api
4.5 Start job with
cd api && npm run start
4.6 Detach screen
CTRL A + D
4.7 Create screen for price api
screen -S price
4.8 Start job with
cd price && npm run start
4.9 Detach screen
CTRL A + D
4.10 To reconnect to screen list them using
screen -ls
and then connect to choosen one withscreen -r <SESSION_ID || NAME>
-
Close ssh conenction with
exit
- Enable deploy on cron job run in
leaderboard
repository - Change
LEADERBOARD_API_URL
constant in the webapp repository to start withpoints
prefix instead ofapi
- Change
PRICE_API_URL
constant in the webapp repository fromhttps://api.invariant.app/price
tohttps://price.invariant.app
Highly recomended to test it locally and then update on prod.
Repository: leaderboard-backend
- Create backup
npm run backup
in case of some failures - Copy the backup from hetzner to your local machine using
scp
, insert the backup to mongo database - Put the content program json inside
scripts/content-program/data/<NAME>.json
(ensure that timestamps are correct) - Assign step3 json
<NAME>
toFILE_NAME
variable inscripts/content-program/add-points.ts
- Using HTTP requests check if users have recevied the points
- If everyting is correct repeat steps 3 and 4 on hetzner.
- Change next content program dates in
./api/src/controllers/config.ts
,contentProgramDateStart
andcontentProgramDateEnd
Repository: leaderboard
- Put the content program json inside
scripts/content-program/<NAME>.json
(ensure that timestamps are correct) - Update the import of
POINTS_TO_ADD
to json moved in step1 in filescripts/content-program/add-points.ts
- Check if the content program points are assigned correctly in
data/content-program.json
file - Change next content program dates in
./api/config.ts
,contentProgramDateStart
andcontentProgramDateEnd
Repository: leaderboard-backend
- Change points distribution for specified pool in
consts.ts
and update the pool address inscripts/remove-pool-boost.ts
- Stop cron job updates
- Run script with
npm run remove-pool-boost
- Restart cron job updates & api instance to display recent pool distributions