zomglings
Repos
125
Followers
40
Following
22

Building blocks for your blockchain economy

108
31

Moonstream DAO

15
5

codegen for crypto degens and other ethereum smart contract toolkit for python

25
5

Inspector Facet - Inspection utility for EIP2535 Diamond proxies

15
0

"git diff" over abstract syntax trees

43
7

Moonstream game engine for blockchain games. Lootboxes, crafting, dropper, mini games that will enrich your game economy

9
2

Events

closed issue
NFT Dataset v2
Created at 19 hours ago
issue comment
NFT Dataset v2

Superseded by https://github.com/bugout-dev/moonstream/issues/725

Created at 19 hours ago
opened issue
Shadowcorns: Throwing Shade leaderboard frontend
Created at 19 hours ago
issue comment
[Crypto Unicorns] Great Corn Drop - data crawl

Ongoing. CU only needs Sunflower Land and Sandbox this week, which we have provided. We will complete this work next week for the other projects. All data available through Query API. Documentation already delivered.

Created at 19 hours ago
issue comment
NFT Public Dataset v2

Initial order of business:

  • [ ] Check idempotence of crawlers
  • [ ] Crawl full data from Ethereum mainnet for January 1, 2021 to
  • [ ] Set up Polygon crawler
Created at 22 hours ago
opened issue
NFT Public Dataset v2
Created at 22 hours ago
issue comment
Shadowcorns: Throwing Shade Leaderboard

The Throwing Shade leaderboard uses token IDs instead of addresses as representations of players. This leaderboard should always be accessed with the query parameter normalize_addresses=false.

For example:

$ curl -s "https://engineapi.moonstream.to/leaderboard/position?leaderboard_id=863429ad-ea0d-4cbf-b0f9-6e5c3fc83bb2&limit=2000&address=2&normalize_addresses=false" | jq .                                                                                                                                                                           [
  {
    "address": "2369",
    "score": 400,
    "rank": 78,
    "number": 307,
    "points_data": {
      "session_2": 400
    }
  },
  {
    "address": "2",
    "score": 200,
    "rank": 308,
    "number": 308,
    "points_data": {
      "session_2": 200
    }
  },
  {
    "address": "4",
    "score": 200,
    "rank": 308,
    "number": 309,
    "points_data": {
      "session_2": 200
    }
  }
]
Created at 1 day ago
pull request opened
"autocorns judge"

Changes

This PR introduces the autocorns judge command which can be used to push leaderboards to the Moonstream Leaderboard API.

It also introduces the Shadowcorns: Throwing Shade leaderboard.

How to test these changes?

I tested these changes locally and against the production APIs with the Throwing Shade leaderboard.

Related issues

Resolves https://github.com/bugout-dev/autocorns/issues/19

Created at 1 day ago

Got Shadowcorns: Throwing Shade leaderboard crawler working

Created at 1 day ago
create branch
zomglings create branch judge
Created at 1 day ago

Bumped Moonstream client version to 0.1.2

Created at 1 day ago
pull request opened
Added "moonstream" CLI with "create-query" command

Changes

To create queries for Moonstream Query API.

How to test these changes?

I tested by creating a query.

Related issues

Created at 1 day ago

Update README.md

The site is now available only with www prefix

init state.

add reports.

Add terminus.

cu dashboard generator.

Tokenonomics systemd services and changed on boot start timers

Add fixes in create queries logic.

Merge branch 'add-cu-reports-crawler' of github.com:bugout-dev/moonstream into add-cu-reports-crawler

Merge branch 'main' into add-cu-reports-crawler

Fix mypy.

Black formating.

contact form background

streams filter form text color

sidebar cursor pointer

Merge pull request #698 from bugout-dev/fix-text-color

Fix text color

subscriptions bgcolor when w < 530px

streams page align

ok in desktops and mobile app views

change desktop landing dropdown menu

change desktop app dropdown menu

Created at 1 day ago
create branch
zomglings create branch client-cli
Created at 1 day ago
delete branch
zomglings delete branch leaderboard-token-ids
Created at 1 day ago
closed issue
Moonstream Leaderboard API - support leaderboards for token ids (in addition to web3 addresses)

Currently, the LeaderboardScores model has an address column which is a VARCHAR(256). The assumption is that players are represented by an Ethereum address and only by an Ethereum address.

I propose replacing address with player, and adding a player_type column which can be address or string. This will allow us to create leaderboards not only for web3 addresses but also for NFT token IDs (characters in a game).

Created at 1 day ago

Made normalization of addresses optional on leaderboards

When pushing scores, and when reading scores.

add_scores database commit in try-except block

If there is an exception, it rolls back the database transaction.

Merge pull request #216 from bugout-dev/leaderboard-token-ids

Made normalization of addresses optional on leaderboards

Created at 1 day ago
pull request closed
Made normalization of addresses optional on leaderboards

Changes

Made normalization of addresses optional on leaderboards (using Web3.toChecksumAddress) when pushing scores, and when reading scores.

How to test these changes?

Tested against local API instance. This is how it was tested:

Testing

Created two files:

regular-scores.json:

[
  {
    "address": "0x0000000000000000000000000000000000000001",
    "score": 200000000,
    "points_data": {
      "something": 100000000,
      "something_else": 100000000
    }
  }
]

token-id-scores.json:

[
  {
    "address": "1",
    "score": 200000000,
    "points_data": {
      "something": 100000000,
      "something_else": 100000000
    }
  }
]

Regular scores (address)

To add regular scores:

curl -X PUT http://localhost:7191/leaderboard/$LEADERBOARD_ID/scores \
    -H "Authorization: Bearer $MOONSTREAM_ADMIN_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d @regular-scores.json

To view:

curl -s "http://localhost:7191/leaderboard/position?leaderboard_id=$LEADERBOARD_ID&address=0x0000000000000000000000000000000000000001&window_size=0" | jq .

Output:

[
  {
    "address": "0x0000000000000000000000000000000000000001",
    "score": 200000000,
    "rank": 1,
    "number": 1,
    "points_data": {
      "something": 100000000,
      "something_else": 100000000
    }
  }
]

Token ID scores

To add token id scores:

curl -X PUT http://localhost:7191/leaderboard/$LEADERBOARD_ID/scores \
    -H "Authorization: Bearer $MOONSTREAM_ADMIN_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d @token-id-scores.json

On main, this resulted in an Internal Server Error.

Logs from server:

... (huge stack trace)
ValueError: Unknown format 1, attempted to normalize to 0x1

Even in the head of the PR, the command above results in an Internal Server Error. However, if we add the normalize_addresses=0 query parameter:

curl -X PUT "http://localhost:7191/leaderboard/$LEADERBOARD_ID/scores?normalize_addresses=0" \
    -H "Authorization: Bearer $MOONSTREAM_ADMIN_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d @token-id-scores.json

Then no Internal Server Error!

To retrieve the position:

curl -s "http://localhost:7191/leaderboard/position?leaderboard_id=$LEADERBOARD_ID&address=1"

Results in Internal Server Error.

But:

curl -s "http://localhost:7191/leaderboard/position?leaderboard_id=$LEADERBOARD_ID&address=1&normalize_addresses=false&window_size=0" | jq .

Output:

[
  {
    "address": "1",
    "score": 200000000,
    "rank": 1,
    "number": 2,
    "points_data": {
      "something": 100000000,
      "something_else": 100000000
    }
  }
]

Related issues

Resolves https://github.com/bugout-dev/engine/issues/215

Created at 1 day ago
opened issue
Moonstream Metadata service design document
Created at 1 day ago
opened issue
Entity API client
Created at 2 days ago

add_scores database commit in try-except block

If there is an exception, it rolls back the database transaction.

Created at 2 days ago
pull request opened
Made normalization of addresses optional on leaderboards

Changes

Made normalization of addresses optional on leaderboards (using Web3.toChecksumAddress) when pushing scores, and when reading scores.

How to test these changes?

Tested against local API instance.

Related issues

Resolves https://github.com/bugout-dev/engine/issues/215

Created at 2 days ago
create branch
zomglings create branch leaderboard-token-ids
Created at 2 days ago
issue comment
Moonstream Leaderboard API - support leaderboards for general strings (in addition to web3 addresses)

All commands were run against local instances of Brood, Spire, Engine APIs.

Initial commit: c0bc0c4dedbaa917a4490b85ca5b1cec190d5db5

Test leaderboard setup

Following this document, created by Andrey: https://www.notion.so/Create-test-leaderboard-8be6ebbf104a49049c39cb72bd4c021a

Create leaderboard

$ engineapi engine-db leaderboard create-leaderboard -t "Leaderboard by token id" -d "Test leaderboard in which players are represented by token ids and not by addresses"
13c08004-bc45-4552-af11-81ded309e65e

To export LEADERBOARD_ID: export LEADERBOARD_ID="13c08004-bc45-4552-af11-81ded309e65e".

Create leaderboard resource

engineapi engine-db leaderboard permissions assign  --leaderboard-id $LEADERBOARD_ID

Output:

INFO:engineapi.cli:leaderboard:13c08004-bc45-4552-af11-81ded309e65e assign resource_id:a07d4ca7-4eb3-4b31-afd3-c77565684e4f

This is needed for access control to work with the leaderboard.

TODO: This should be done automatically when creating leaderboards.

Where do we normalize addresses?

  • [x] When scores are added to leaderboard?
  • [x] When scores are read from leaderboard?
$ git grep  -l -i toChecksumAddress
engineapi/actions.py
engineapi/auth.py
engineapi/contracts/web3_util.py
engineapi/middleware.py
engineapi/routes/admin.py
engineapi/routes/dropper.py
engineapi/routes/leaderboard.py
engineapi/routes/play.py

Relevant files for leaderboard:

engineapi/actions.py

Relevant methods:

engineapi/routes/leaderboard.py

Relevant methods:

How should we proceed?

I propose to:

  • Add an option to add_scores which specifies if the address should be normalized or not.
  • Remove normalization when we read addresses on GET /position

Why use this hack and not implement this the correct way?

As mentioned in the GitHub issue, the correct way to handle token IDs as player representations would be to:

  1. Rename address to player in the leaderboard_scores table.
  2. Add a player_type column whose values could come from an enumeration including address, raw_string, etc.

This change would require our clients to also change their leaderboard implementations, which is something that we should broadcast ahead of time and potentially offer backwards compatibility for for some intermediate period.

This is all very complicated in production, and we need to support token IDs urgently.

Created at 2 days ago
issue comment
Moonstream Leaderboard API - support leaderboards for general strings (in addition to web3 addresses)

My proposal of modifying the tables is a complex way (although perhaps the mathematically correct way) of fixing the problem.

An alternative approach is to just pump token IDs into the address field and create a bypass mechanism for the web3 checksum normalization on addresses.

Created at 3 days ago