Giter VIP home page Giter VIP logo

Comments (2)

kubaplas avatar kubaplas commented on June 24, 2024

Here's the result of the votings structure brainstorm:

1. vote() O(1)
vote: (voting_id, address) -> stake_in_favor, stake_against

voting_result: voting_id -> stake_in_favor, stake_against

voters: voting_id -> OrderedCollection(Address)

votings: voting_id -> Voting(konfiguracja...)

2. finish_voting() O(n)
stake = stake_in_favor + stake_against

if (quorum < voters.len())
    for addresses in voters:
        if (address = creator):
            token.burn(self.address, address.stake_in_favor)
        else:
            token.transfer(address, address.stake_in_favor + address.stake_against)
    return;    

if (stake_in_favor > stake_against)
    for addresss in voters:
        to_transfer := (address.stake_in_favor / stake_in_favor) * stake // czy jakoś tak, to się sprawdzi
        if (to_transfer > 0)
            token.transfer(address,to_transfer)

    do_the_action(voting) // wykonaj akcję przypisaną do głosowania
else
    for addresss in voters:
        to_transfer := (address.stake_against / stake_against) * stake // czy jakoś tak, to się sprawdzi
        if (to_transfer > 0)
            token.transfer(address,to_transfer)

from dao-contracts.

zie1ony avatar zie1ony commented on June 24, 2024

Done.

from dao-contracts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.