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

Create smart contract for distributions #1

Open
friedger opened this issue Oct 2, 2018 · 1 comment
Open

Create smart contract for distributions #1

friedger opened this issue Oct 2, 2018 · 1 comment

Comments

@friedger
Copy link

friedger commented Oct 2, 2018

The contract should have the following tables

  • board (could be eosio.token with 21 tokens minted)

    • name
    • balance
  • members

    • name
    • balance
    • contribution_ratio
  • config

    • board_ratio (=20)
    • total_shares
    • total_board (=21)
    • payout_ongoing (=false)

There should be the following actions

  • register_board(user, seats)

    boards.put(user,seats)
    
  • register_member(user, ratio)

    members.put(user, ratio,0)
    
  • add_contribution (user, amount_hours)

    assert(!config.payout_ongoing)
    member = members.get(user)
    new_shares = amount_hours * member.contribution_ratio
    config.total_share += new_shares
    member.balance += new_shares
    
  • start_payout

      config.payout_ongoing = true
    
  • payout_amount (amount)

    assert(payout)
    assert(amount <= contract.balance)
    board_distributions = amount * config.board_ratio/100
    member_distributions = amount * (100 - config.board_ratio)/100
    for (member in members) 
       if (member.balance > 0)
         member_amount = member.balance/config.total_shares * member_distributions
         transfer(member, member_amount)
      if (has_board_seat(member))
         board_member = board.get(member)
         board_amount = board_member.balance/config.total_board * board_distributions
         transfer(member, board_amount)
    
  • end_payout

    config.payout_ongoing = false
    
@leordev
Copy link
Member

leordev commented Oct 2, 2018

another thing that I would like to start is... now, that we are growing, our issues should be work proposals... we open an issue, and then we approve/reject the fix of this "work proposal", and also we put hours bounty in this issue/work proposal... upon the delivery the worker can claim more hours if he feels it was not enough.

btw, nice write up @friedger !!! super excited to implement that, I need to dive in before...

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

2 participants