STUD.com
← Objectives

Compute · Transform · Analysis & Finance

Compute a proportional token allocation from contribution scores

Each contributor's token allocation = round(contributionScore / sumAllScores * totalPool, 2), and the sum of all allocations equals totalPool within tolerance.

You receive: A pure function allocating a token pool pro rata to contribution scores (2-decimal rounding) with the allocation sum, graded on hidden cases.

Part of Choose Business Model

What's verified: STUD verifies: contribution score proportional allocation formula, rounding to 2 decimal places, sum within rounding tolerance. STUD does NOT verify: whether contribution scores are fairly measured, whether the pool size is appropriate, or whether the token has real-world value.

Opens soon

Cost20 credits
AcceptanceAutomated check against your inputs
ProtectionHeld until verified delivery

This objective is verified and ready. It opens soon, once sign-in and payments are live.

Deliverable interface

The exact vocabulary the automated check enforces: keys, tokens, entry points, and worked examples. Generated from the verification source.

{
 "constants": {},
 "entryName": "allocate",
 "expectNote": "expect is the comparison-space value (your return value goes through normalize first when one is published)",
 "hiddenCaseCount": 13,
 "hiddenCaseNames": [
  "hd_drift_999",
  "hd_decimal_scores",
  "hd_primes",
  "hd_ten_equal",
  "hd_large_pool",
  "gen0",
  "gen1",
  "gen2",
  "gen3",
  "gen4",
  "gen5",
  "gen6",
  "gen7"
 ],
 "inputKeys": [
  "contributionScore",
  "contributorId",
  "contributors",
  "tokenAllocation",
  "totalTokenPool"
 ],
 "normalizeSource": "def _normalize_token_allocation_pro_rata(r):\n    if not isinstance(r, dict):\n        return repr(r)\n    try:\n        return {\"allocations\": [{\"contributorId\": str(x[\"contributorId\"]),\n                                 \"tokenAllocation\": round(float(x[\"tokenAllocation\"]), 2)} for x in r[\"allocations\"]],\n                \"sumAllocations\": round(float(r[\"sumAllocations\"]), 2)}\n    except Exception:\n        return repr(r)\n",
 "returnShapes": [
  [
   "allocations",
   "sumAllocations"
  ]
 ],
 "signature": "def allocate(inp):",
 "submission": "python exposing the entry function; inp is one input object; graded on held-out cases",
 "tier": "calculator",
 "visibleCases": [
  {
   "expect": {
    "allocations": [
     {
      "contributorId": "alice",
      "tokenAllocation": 400
     },
     {
      "contributorId": "bob",
      "tokenAllocation": 400
     },
     {
      "contributorId": "carol",
      "tokenAllocation": 200
     }
    ],
    "sumAllocations": 1000
   },
   "input": {
    "contributors": [
     {
      "contributionScore": 400,
      "contributorId": "alice"
     },
     {
      "contributionScore": 400,
      "contributorId": "bob"
     },
     {
      "contributionScore": 200,
      "contributorId": "carol"
     }
    ],
    "totalTokenPool": 1000
   },
   "name": "proportional_exact"
  },
  {
   "expect": {
    "allocations": [
     {
      "contributorId": "a",
      "tokenAllocation": 16.67
     },
     {
      "contributorId": "b",
      "tokenAllocation": 33.33
     },
     {
      "contributorId": "c",
      "tokenAllocation": 50
     }
    ],
    "sumAllocations": 100
   },
   "input": {
    "contributors": [
     {
      "contributionScore": 1,
      "contributorId": "a"
     },
     {
      "contributionScore": 2,
      "contributorId": "b"
     },
     {
      "contributionScore": 3,
      "contributorId": "c"
     }
    ],
    "totalTokenPool": 100
   },
   "name": "thirds_rounding"
  },
  {
   "expect": {
    "allocations": [
     {
      "contributorId": "a",
      "tokenAllocation": 33.33
     },
     {
      "contributorId": "b",
      "tokenAllocation": 33.33
     },
     {
      "contributorId": "c",
      "tokenAllocation": 33.33
     }
    ],
    "sumAllocations": 99.99
   },
   "input": {
    "contributors": [
     {
      "contributionScore": 1,
      "contributorId": "a"
     },
     {
      "contributionScore": 1,
      "contributorId": "b"
     },
     {
      "contributionScore": 1,
      "contributorId": "c"
     }
    ],
    "totalTokenPool": 100
   },
   "name": "equal_thirds_drift"
  },
  {
   "expect": {
    "allocations": [
     {
      "contributorId": "solo",
      "tokenAllocation": 5000
     }
    ],
    "sumAllocations": 5000
   },
   "input": {
    "contributors": [
     {
      "contributionScore": 7,
      "contributorId": "solo"
     }
    ],
    "totalTokenPool": 5000
   },
   "name": "single_contributor"
  }
 ],
 "vocabulary": [
  "allocations",
  "contributionScore",
  "contributorId",
  "contributors",
  "sumAllocations",
  "tokenAllocation",
  "totalTokenPool"
 ]
}

Get early access to STUD the day it goes live.