Moneyflow – is a financial subsystem that can redistribute ETH according to the set of rules which is called "a scheme". This subsystem can be used by any smart contract or a DAO.
Moneyflow can be used:
to receive money from third-party sources (like customers and investors)
to pay salaries, bonuses and regular expenses (like office rent)
to send dividends to token holders
to collect and process funds (roadmap, milestones, etc)
Following diagram represents a typical moneyflow scheme of some organization:
You can think of a moneyflow scheme as a tree, where each node is an instance of WeiReceiver smart contract.
An account or a smart contract that is a source of ETH is called "a source". A source is sending (pushing) ETH to the root node and is not a part of the scheme.
Tree leaves are called "destinations". Destination is where ETH ultimately stored, that's why it has no children.
ETH is flowing from the source to destinations and is processed by internal elements that are called "splitters". A splitter never stores ETH, instead it redistributes ETH to its outputs.
Expenses can be absolute or relative. Relative expense node will consume a fixed part of the total money flow, for example – 2%. Absolute expense node will consume a strictly fixed amount, for example – 5 ETH.
Usually money flows from the top to the bottom.
You can group different elements any way you like. However, it is highly recommended to group items logically. For example: But But not like this:
Although this is absolutely legitimate, it is highly recommended to avoid latter approach.
WeiTopDownSplitter root = new WeiTopDownSplitter('Root');WeiUnsortedSplitter spends = new WeiUnsortedSplitter('Spends');WeiUnsortedSplitter salaries = new WeiUnsortedSplitter('Salaries');WeiAbsoluteExpense employee1 = new WeiAbsoluteExpense(1*eth);WeiAbsoluteExpense employee2 = new WeiAbsoluteExpense(2*eth);WeiUnsortedSplitter other = new WeiUnsortedSplitter('Other');WeiAbsoluteExpense office = new WeiAbsoluteExpense(1*eth);WeiUnsortedSplitter rest = new WeiUnsortedSplitter('Rest');WeiOneTimeFund reserveFund = new WeiOneTimeFund(100*eth);WeiInfiniteFund dividendsFund = new WeiInfiniteFund();// Connect nodesother.addChild(office);salaries.addChild(employee1);salaries.addChild(employee2);spends.addChild(other);spends.addChild(salaries);rest.addChild(reserveFund);rest.addChild(dividendsFund);root.addChild(spends);root.addChild(rest);