thetta / thetta-dao-framework Goto Github PK
View Code? Open in Web Editor NEWThetta - an open-source framework to help you build the DAO of your dreams
Home Page: https://web.thetta.io
License: MIT License
Thetta - an open-source framework to help you build the DAO of your dreams
Home Page: https://web.thetta.io
License: MIT License
https://github.com/Thetta/SmartContracts/blob/dev2/contracts/moneyflow/Schemes.sol
Implement all TODOs:
https://github.com/Thetta/SmartContracts/blob/dev2/test/moneyflow_scheme_test.js
Test each method separately (setSalaryForEmployee, setBonusForEmployee, setOtherSpend)
Each method should be called:
a) directly
b) with vote
Instantiate DefaultMoneyflowScheme and add items just like in the scheme that was manually created here - https://github.com/Thetta/SmartContracts/blob/dev2/test/moneyflow_tests.js#L24
a) add 3 tasks
b) add 3 employees
c) add 3 bonuses
Should allow many persons act as one
https://github.com/Thetta/SmartContracts/blob/dev2/contracts/governance/LiquidDemocracy.sol
https://github.com/Thetta/SmartContracts/blob/dev2/contracts/governance/IVoting.sol#L24
Example:
https://gist.github.com/AnthonyAkentiev/87115598b572693daf0b2abd6471a0af
upgradeMicrocompanyContract() can require voting!
Put "easy to use" code into AutoActionCaller.
See the example with issueTokensAuto.
Add test here - https://github.com/Thetta/SmartContracts/blob/dev2/test/genericcaller_tests.js
Moneyflow send ETH to each item in the heirarchy (splitters). This eats a lot of gas
This will greately reduce gas cost!
These contracts have a lot of common code.
Refactor it -> move common code to base contract
Think about: How to protect us from the looping?
i.e. when i do A -> B -> A moneyflow scheme!
Gate is closed if period not elapsed.
Think about that and implement
See this article - https://medium.com/rocket-pool/upgradable-solidity-contract-design-54789205276d
Zeppelin Proxy approach (delegatecall) is here - https://blog.zeppelinos.org/announcing-zeppelin_os-labs/#more-237
See upgrades here:
https://0xproject.com/wiki#Architecture
Code is very redundant and is very similar:
contract AutoMoneyflowActionCaller {
IMicrocompanyBase mc;
IMoneyflowScheme mfs;
function AutoMoneyflowActionCaller(IMicrocompanyBase _mc, IMoneyflowScheme _mfs){
mc = _mc;
mfs = _mfs;
}
function addNewTask(WeiAbsoluteExpense wt) public returns(address voteOut){
if(mc.isCanDoAction(msg.sender, "addNewTask")){
// 1 - add new task immediately
mfs.addNewTask(wt);
return 0x0;
}else{
ProposalAddNewTask vant = new ProposalAddNewTask(mc, mfs, msg.sender, wt);
// WARNING: should be permitted to add new proposal by the current contract address!!!
mc.addNewProposal(vant);
return vant;
}
}
}
Goals:
https://github.com/Thetta/Thetta-DAO-Framework/blob/dev2/contracts/moneyflow/Schemes.sol#L82
https://github.com/Thetta/Thetta-DAO-Framework/blob/dev2/contracts/moneyflow/AutoMoneyflowCaller.sol
https://github.com/Thetta/Thetta-DAO-Framework/blob/dev2/test/moneyflow_scheme_test.js
Example of #2 test is here - https://github.com/Thetta/Thetta-DAO-Framework/blob/master/test/genericcaller_tests.js#L311
Example of #3 test is here - https://github.com/Thetta/Thetta-DAO-Framework/blob/dev2/test/genericcaller_tests.js#L77
Use solidity-coverage npm package
From Vladimir:
.solcover поправил чтобы работал solodity-cover
В .solcover в skipFiles 3 файла, они пустые, npm run coverage ругается если есть пустые solidity файлы
В данный момент npm run coverage работает только если сначала запустить npm run test, npm run test после прогона всех тестов в корень проекта записывает файл allFiredEvents.json, так вот этот файл нужен для npm run coverage
https://github.com/Thetta/SmartContracts/blob/dev2/contracts/tasks/Tasks.sol
https://github.com/Thetta/SmartContracts/blob/dev2/test/task_tests.js
https://github.com/Thetta/SmartContracts/blob/dev2/test/moneyflow_tests.js
Add 1-2 tasks to moneyflow scheme and test it
solium --dir ./contracts
setRootWeiReceiver https://github.com/Thetta/SmartContracts/blob/dev2/contracts/moneyflow/Moneyflow.sol#L55
withdrawDonationsTo https://github.com/Thetta/SmartContracts/blob/dev2/contracts/moneyflow/Moneyflow.sol#L29
Do not forget to write tests:
Description:
https://docs.google.com/document/d/15UOnXM_iPudD95m-UYBcYns-SeqM2ksDecjYhZrqybQ/edit?usp=sharing
BRANCH is dev2
Stubs are here:
https://github.com/Thetta/SmartContracts/blob/dev2/test/moneyflow_tests.js#L53
I am not sure if logics is correct!
Need all scenarios to be tested (SPLITTERS!!!)
Currently WeiAbsoluteExpenseWithPeriod, WeiRelativeExpenseWithPeriod contract ask for X wei in Y days. If 5 * Y days elapsed -> it will still require only X wei.
Should have option "isCalculateDebt"
If 5* Y days elapsed -> isNeededWei() should be 5 * X;
If 5 * Y days elapsed, but only 3 * X money was received (and PULLED!) -> isNeededWei() should be 2 * X
Current approach requires
uint _currentFlow
to be passed -
See
https://docs.google.com/document/d/15UOnXM_iPudD95m-UYBcYns-SeqM2ksDecjYhZrqybQ/edit?usp=sharing
It would be great if we test another appoach without the 'currentFlow' variable
// TODO: if Microcompany is upgraded -> mc will stop working
https://github.com/Thetta/SmartContracts/blob/dev2/contracts/moneyflow/Moneyflow.sol#L10
https://github.com/Thetta/SmartContracts/blob/dev2/contracts/moneyflow/Schemes.sol#L25
test/bounty_tests.js file
Code is here - https://github.com/Thetta/SmartContracts/blob/dev2/contracts/tasks/Tasks.sol
BRANCH is dev2
// TODO: check employee1 balance
function notifyObserversOnUpgrade(IMicrocompanyBase _new)public onlyOwner {
for(uint i=0; i<observers.length; ++i){
IMicrocompanyObserver(observers[i]).onUpgrade(_new);
}
}
Make a separate ERC20-tokens moneyflow
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.