-
Notifications
You must be signed in to change notification settings - Fork 14
Description
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)
_typeis unum of 1/4/8
payoutAmount(address)
- Change payoutAmount to take
addressso 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