Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle proportional payout #59

Open
makoto opened this issue Jun 14, 2020 · 0 comments
Open

Handle proportional payout #59

makoto opened this issue Jun 14, 2020 · 0 comments

Comments

@makoto
Copy link
Collaborator

makoto commented Jun 14, 2020

Background

Currently organiser can only make binary decision about participant and everybody either receives the same payout or 0.

This is achieved by passing bitmap of attendance information at finalise as follows.

function finalize(uint256[] calldata _maps)

By packing all attendance information as a bitmap of uint256, it can handle up to 256 people's attendance information into 1 uint256 slot.

This makes sense in binary result such as meetups, but less flexible for long running challenges.

The proposed change

In addition to pass bitmap where 1 bit represents 1/0 for a participant, allow it to pass bitmap where 8 bit represents 0-255 or 4 bit represents 0-15. By doing so, 8 bit can store up to 32 participant and 4 bit can handle up to 64 participants.

Interface change

function finalize(uint256[] calldata _maps, uint _type)

  • _type is unum of 1/4/8

payoutAmount(address)

  • Change payoutAmount to take address so that it returns unique payout amount per each participant.

Scope of the work.

  • Add functions into smart contract
  • Write smart contract unit tests
  • Make necessary change on js library and tests
  • Write a quick report to compare the gas cost and up to how many participants it can handle within one Ethereum block size.

Evaluation

  • Smaller gas cost is better but prefer not to use optcode so that contract remains simpler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant