Skip to content

Support ERC-20 token prizes (DAI) — add currency field #112

@oritwoen

Description

@oritwoen

Context

Arweave puzzle weave9 has a prize of 100 DAI (ERC-20 token on Ethereum), not ETH. The current data model uses Chain enum to imply both the blockchain and the currency, which breaks for ERC-20 tokens — chain: "ethereum" with prize: 100 would be misread as 100 ETH.

Problem

The Chain enum serves double duty:

  1. Blockchain the address lives on (Ethereum)
  2. Currency of the prize (implicitly ETH for Ethereum)

For ERC-20 tokens these diverge — the address is on Ethereum but the prize is in DAI.

Proposal

Add an optional currency field to the puzzle data model:

{
  "name": "weave9",
  "chain": "ethereum",
  "currency": "dai",  // new field, defaults to chain's native token if absent
  "prize": 100,
  // ...
}

Affected files:

  • src/puzzle.rs — add currency: Option<&'static str> field
  • build.rs — codegen for currency field
  • data/schemas/definitions.schema.json — add currency to schema
  • data/arweave.jsonc — add weave9 entry with currency field
  • src/cli.rs — display currency in stats/show output

Blocked puzzle

  • weave9: chain Ethereum, address 0x6f85d220c70abb69a1205b96b566c1ed5d9c3831, prize 100 DAI, status claimed (2020-06-08), source https://arweave.net/1--NRFY3naNwTlxBSRjzDPNUq-Cn1yLG2RmgGHZem9c

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions