https://github.com/checkernetwork/spark-rewards
https://github.com/checkernetwork/spark-rewards
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/checkernetwork/spark-rewards
- Owner: CheckerNetwork
- License: other
- Created: 2024-08-27T07:39:42.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-27T07:31:15.000Z (about 1 year ago)
- Last Synced: 2025-05-27T08:41:20.897Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://spark-rewards.fly.dev/
- Size: 944 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# spark-rewards
This implements revision D of [Meridian: Off-chain scheduled rewards](https://spacemeridian.notion.site/Meridian-Off-chain-scheduled-rewards-f9480ef009464ecfaf02a4f752cc4d70).
## Routes
### `GET /scheduled-rewards`
Response:
```js
{
"address": "scheduledRewardsInAttoFIL",
// ...
}
```
### `GET /scheduled-rewards/:address`
Response:
```js
"scheduledRewardsInAttoFIL"
```
### `POST /scores`
Request:
```js
{
"participants": ["address" /* ... */],
"scores": ["score" /* ... */],
"signature": {
"r": "...",
"s": "...",
"v": "..."
}
}
```
Sign over a packed keccak256 with this schema:
```js
['address[]', 'uint256[]']
```
The response includes the resulting scheduled rewards of all affected
participants (excluding the burner address):
```js
{
"address": "scheduledRewardsInAttoFIL",
// ...
}
```
### `POST /paid`
Request:
```js
{
"participants": ["address" /* ... */],
"rewards": ["amountInAttoFIL", /* ... */],
"signature": {
"r": "...",
"s": "...",
"v": "..."
}
}
```
Sign over a packed keccak256 with this schema:
```js
['address[]', 'uint256[]']
```
The response includes the resulting scheduled rewards of all affected
participants:
```js
{
"adddress": "scheduledRewardsInAttoFIL",
// ...
}
```
### `GET /log`
The log endpoint returns an audit trail of all scheduled rewards changes over
time:
```js
[
{
timestamp: "2024-08-28T14:15:08.113Z",
address: "address",
scheduledRewardsDelta: "amountInAttoFIL",
score: "score"
}, {
timestamp: "2024-08-28T14:15:25.441Z",
address: "address",
scheduledRewardsDelta: "negativeAmountInAttoFIL"
// In case of a payout, no `score` is logged
}
// ...
]
```
## Development
```bash
redis-server &
npm start
```