Network-Goods / hypercerts-protocol

MIT License
13 stars 5 forks source link

Denominate fractional values in units #73

Closed bitbeckers closed 1 year ago

bitbeckers commented 1 year ago

Goal

Our hypercerts implementation expands on EIP1155 by making the tokens semi-fungible by default. We should both remain compliant with EIP1155 and expose methods for transfering value between tokens representing (a fraction of) the same claim.

Technical

EIP1155

All hypercert tokens are NFTs balanceOf(_owner, tokenID) => for all existing tokens, if owned by _owner should return 1

Hypercert

All hypercert tokens belonging to the same type should be fungible. In this case, fungible means:

Hypercert -> claimID -> typeID -> tokenID (upper 128bits of uint256) HypercertFraction -> tokenID (upper 128 bits + index)

Implementations

bitbeckers commented 1 year ago

74

ryscheng commented 1 year ago

What's the difference between a claimId and a typeId?

In the following?

Hypercert -> claimID -> typeID -> tokenID (upper 128bits of uint256)

We've also used the terminology baseId, which I assume is the same as typeId right?

bitbeckers commented 1 year ago

Yes we should get that more clear. The terminalogy also changes because ClaimID is part of the hypercert spec, where other IDs belong to the SFTs:

@ryscheng what would be the best way to simplify and/or document this?

ryscheng commented 1 year ago

Ah this is super helpful. Thanks for explaining.

Am I reading this right, that TypeID and BaseType are effectively the same thing? If so, I'm cool with combining those into 1 term.

Here's a strawman proposal:

Then there's a question of what the claimID is then. Is the claimId just the TokenType?