Comments (2)
Some notes added to IA (revenue share page):
Allocation workflow
Case of branch stakeholders revenue allocation using deferred transactions:
- When revenue generated and all cuts from it made, its time to allocate it according to branch stakeholders ledger;
- As there could be many stakeholders of the branch, allocation is split into several stages as follows:
- branch id and revenue amount is captured into the contract state with id of revenue event assigned (
tipstakes
table); - deferred transaction can be used to process revenue events, but this approach would not guarantee allocation. The main purpose of this transaction could be to iterate through branch stakeholders ledger and to assign the event id (effectively a receipt number) to each ledger record upon calculation and addition of revenue share according to recorded stake at the moment of transaction;
- stake ledger records can append revenue from each revenue event id only once - contract would not accept request for revenue share from event with id bigger then currently recorded in the ledger for stakeholder;
- obviousely, iterating through big number of stakeholders (even scoped by branch id) to allocate revenue has some performance risks. It would be better to implement the allocation process as a claim for revenue share issued by stake holder from the client side in a batch, iterating over revenue events sorded incrementally and cutting share of each event one by one;
Cases of branch winner and sales channel are safe to implement as deferred transactions, but it is better to register revenue events for them too and to issue deferred transaction for recorded events with resend ability.
from woffler_contract.
Implementation notice
To avoid need to generate detailed "billing" record for each revenue event, generated by levels, current implementation relies on incremental approach: each time branch is tipped by some revenue event (unjail, etc.), its total revenue field appended and tipprocessed
flag set to false. This current 'Branch::allocateRevshare' method does the processing of revenue event and resets the flag back to true upon processing is complete.
Allocation itself relies on values of already processed (allocated) revenue stored in the branch data.
Claim process in its turn relies on values of already claimed revenue stored in the stakeholders ledger (see Stake namespace).
Some minor drawbacks of the implementation:
- if revenue events will occur often, branch state will stay "unprocessed" most of the time.
- to "process" the branch after revenue event, one should call
revshare
action to create deferred processing transaction for unprocessed branches.
Despite of these drawbacks, stakeholders can claim their revenue once per day/week/month, while revshare
action can be called by any account even not registered in the game contract as a player.
from woffler_contract.
Related Issues (20)
- Clear vesting balance upon current game quit HOT 1
- Change result timestamp for TAKE to claim date to simplify operations HOT 1
- Add level generation to show player's progress more intuitively
- Add stake indexing by owner (for GUI)
- Error in next level action - split level existence not taken into account while checking for next level existence
- Remove retries count reset upon `take`/`untake` to prevent "free" retries count reset
- Revisit the whole `splitbet` logic, replace with `buyretries` and new states (SPLIT/NEXT) with stakeholder/winner promotion delayed until unlock HOT 1
- Consider delaying winner/stakeholder promotion until next/split level unlock HOT 1
- Consider adding `NEXT` state as well to prevent `takelvl`/`split` actions HOT 1
- Add `SPLIT`/`NEXT` states to enforce responsible tactics choice
- Rename `claimgreen` to `claimsafe` and enable for `GREEN`, `NEXT` and `SPLIT` states
- Add `bylevel` index to `players` table to enable GUI features
- Consider use `level.generation` as reward/price multiplier in `take`/`unjail`/`buytries` actions HOT 1
- Limit `revshare` action scope to 10-20 branches per call to prevent overtiming
- Add limited branch length preset to allow games with final winner getting all pot value
- Add level generation multiplier for `take`/`unjail`/`buytries` action to increase rewards and motivation
- Add `stkremove` to enable stake removal
- Close branch upon pot emptied. Empty pot if last reward is making pot less than `minpot`
- Move pot from level to branch HOT 1
- Add required checks for `branch.closed` in actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from woffler_contract.