Created
June 22, 2018 09:57
-
-
Save AnthonyAkentiev/1856ff8389c60124a2f82972cf147d32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////// | |
// Moneyflow 1 | |
Moneyflow mf; | |
uint idRoot = mf.addSplitter(0); | |
// serial - abs expense | |
uint absExp1 = mf.addAbsExpense(idRoot, 1ETH); | |
uint absExp2 = mf.addAbsExpense(absExp1, 2ETH); | |
uint absExp3 = mf.addAbsExpense(absExp2, 5ETH); | |
uint splitter1 = mf.addSplitter(absExp3); | |
uint relExp1 = mf.addRelativeExpense(splitter2, 10%); | |
uint relExp2 = mf.addRelativeExpense(splitter2, 60%); | |
uint relExp3 = mf.addRelativeExpense(splitter2, 30%); | |
//////////////////////////////////////////////// | |
// Moneyflow 2 | |
Moneyflow mf; | |
uint absExp1 = mf.addAbsExpense(1ETH); | |
uint absExp2 = mf.addAbsExpense(2ETH); | |
uint absExp3 = mf.addAbsExpense(5ETH); | |
absExp2.setParent(absExp1); | |
absExp3.setParent(absExp2); | |
// if 0% -> revert | |
// if >100% -> revert | |
uint rel1 = mf.addRelativeExpense(10%); | |
uint rel2 = mf.addRelativeExpense(60%); | |
uint rel3 = mf.addRelativeExpense(30%); | |
// if not 100% -> revert | |
uint splitter = mf.addSplitter([rel1,rel2,rel3]); | |
rel1.setParent(splitter); | |
rel2.setParent(splitter); | |
rel3.setParent(splitter); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment