This repository serves as a layer above the v4-cli and stores the result of drawPrize compute command execution.
The CLI is instantiated periodically from the cron workflow. This workflow checks if the most recent drawId
for a network is greater than the last committed drawId
, and if so, runs the v4-cli.
This data serves as the data source for the hosted Netlify API. More information on how to use this API can be found here.
- Add a workflow step to commit prize files if they were created. For example:
- name: Commit files for [newPrizePool]
if: steps.runDrawCalcCLI.outputs.[newPrizePool]CliToolRan == 'true'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
git add ./api/prizes/[newPrizePoolChainId]/
git commit -m "Add draw for [newPrizePool] draw ${{steps.runDrawCalcCLI.outputs.[newPrizePool]DrawId}}"
The generated file structure is:
v4-draw-results
│ README.md
│ package.json
│ ...
└───api
└───prizes
└───1 (chainId for mainnet)
│ └─── 0xb9a179dca5a7bf5f8b9e088437b3a85ebb495efe (Prize Distributor address)
│ └─── draw
│ └─── 1
│ │ 0xa123..json
│ │ 0xa124..json
│ │ ...
│ │ prizes.json
│ │ status.json
|
│ └─── 2
│ ...
└───137 (chainId for polygon)
└─── 0x8141bcfbcee654c5de17c4e2b2af26b67f9b9056 (Prize Distributor address)
│ └─── draw
│ └─── 1
│ │ 0xa123..json
│ │ 0xa124..json
│ │ ...
│ │ prizes.json
│ │ status.json
|
│ └─── 2
│ ...
└───43114 (chainId for avalanche)
└─── 0x83332f908f403ce795d90f677ce3f382fe73f3d1 (Prize Distributor address)
│ └─── draw
│ └─── 67
│ │ 0xa123..json
│ │ 0xa124..json
│ │ ...
│ │ prizes.json
│ │ status.json
|
│ └─── 68
│ ...
File | Description |
---|---|
0xa123..json | Data for a winning address for a draw |
prizes.json | Index file including all winners for draw |
status.json | Metadata about the CLI run (status and time elapsed) |
Where prizes.json
is an index of all the individual address files and status.json
includes .
The file structure is according to Prize Distributor address (not by Ticket) is because a Ticket can mave multiple associated Prize Distributors. NOTE : The use of lower case strings for addresses.
For example:
-
./api/prizes/1/0xb9a179dca5a7bf5f8b9e088437b3a85ebb495efe/draw/1/prizes.json
will display all prizes for chainId = 1 (Ethereum Mainnet) for Prize Distributor (address:0xb9a179dca5a7bf5f8b9e088437b3a85ebb495efe
) for draw 1.This is also viewable at the Netlify API.
-
./api/prizes/137/0x8141bcfbcee654c5de17c4e2b2af26b67f9b9056/draw/12/prizes.json
will display all prizes for chainId = 137 (Polygon/Matic) for Prize Distributor (address:0x8141bcfbcee654c5de17c4e2b2af26b67f9b9056
) for draw 12.This is also viewable at the Netlify API.
-
./api/prizes/43114/0x83332f908f403ce795d90f677ce3f382fe73f3d1/draw/70/prizes.json
will display all prizes for chainId = 43114 (Avalanche) for Prize Distributor (address:0x83332f908f403ce795d90f677ce3f382fe73f3d1
) for draw 70.This is also viewable at the Netlify API.