Skip to content

filecoin-station/spark-rewards

Repository files navigation

spark-rewards

This implements revision D of Meridian: Off-chain scheduled rewards.

Routes

GET /scheduled-rewards

Response:

{
  "address": "scheduledRewardsInAttoFIL",
  // ...
}

GET /scheduled-rewards/:address

Response:

"scheduledRewardsInAttoFIL"

POST /scores

Request:

{
  "participants": ["address" /* ... */],
  "scores": ["score" /* ... */],
  "signature": {
    "r": "...",
    "s": "...",
    "v": "..."
  }
}

Sign over a packed keccak256 with this schema:

['address[]', 'uint256[]']

The response includes the resulting scheduled rewards of all affected participants (excluding the burner address):

{
  "address": "scheduledRewardsInAttoFIL",
  // ...
}

POST /paid

Request:

{
  "participants": ["address" /* ... */],
  "rewards": ["amountInAttoFIL", /* ... */],
  "signature": {
    "r": "...",
    "s": "...",
    "v": "..."
  }
}

Sign over a packed keccak256 with this schema:

['address[]', 'uint256[]']

The response includes the resulting scheduled rewards of all affected participants:

{
  "adddress": "scheduledRewardsInAttoFIL",
  // ...
}

GET /log

The log endpoint returns an audit trail of all scheduled rewards changes over time:

[
  {
    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

redis-server &
npm start