1 - How moneyflow works

What Moneyflow is?

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.

Usually each moneyflow element is a separate smart contract, but you can use MoneyflowTable which can implement any moneyflow scheme, but in a single contract. It effectively reduces gas consumption.

Absolute vs Relative elements

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.

How to group elements?

  1. Usually money flows from the top to the bottom.

  2. 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.

Code example

WeiSplitter root = new WeiSplitter();
WeiSplitter spends = new WeiSplitter();
WeiSplitter salaries = new WeiSplitter();
WeiAbsoluteExpense employee1 = new WeiAbsoluteExpense(1*eth, 1*eth);
WeiAbsoluteExpense employee2 = new WeiAbsoluteExpense(2*eth, 2*eth);
WeiSplitter other = new WeiSplitter();
WeiAbsoluteExpense office = new WeiAbsoluteExpense(1*eth, 1*eth);
WeiSplitter rest = new WeiSplitter();
WeiAbsoluteExpense reserveFund = new WeiAbsoluteExpense(100*eth, 0);
WeiAbsoluteExpense dividendsFund = new WeiAbsoluteExpense(1000000000*eth, 0);
// Connect nodes