Git Product home page Git Product logo

thetta-dao-framework's People

Contributors

anthonyakentiev avatar enkogu avatar ken-hoaglan avatar mikelle avatar rostyslavbortman avatar ryzhak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thetta-dao-framework's Issues

Moneyflow scheme - implement + test

Code is here

https://github.com/Thetta/SmartContracts/blob/dev2/contracts/moneyflow/Schemes.sol

Implement all TODOs:

  1. setSalaryForEmployee
  2. setBonusForEmployee
  3. setOtherSpend

Tests should be here:

https://github.com/Thetta/SmartContracts/blob/dev2/test/moneyflow_scheme_test.js

  1. Test each method separately (setSalaryForEmployee, setBonusForEmployee, setOtherSpend)

  2. Each method should be called:
    a) directly
    b) with vote

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

(DON'T DO IT NOW) Optimize moneyflow: send all ETH directly to the terminal items

Currently

Moneyflow send ETH to each item in the heirarchy (splitters). This eats a lot of gas

Improvement

  1. Calculate the current gas usage for the typical moneyflow hierarchy
  2. Make some "getTargets()" method that will return a mapping of address => uint to send ALL money directly just from the 1 source!

This will greately reduce gas cost!

Moneyflow: avoid loops

Think about: How to protect us from the looping?
i.e. when i do A -> B -> A moneyflow scheme!

AutoAction.sol - simplify and make a generic code

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:

  1. make it generic
  2. Voting type should be parametrized

Write tests for setRootWeiReceiverAuto

Method is here

https://github.com/Thetta/Thetta-DAO-Framework/blob/dev2/contracts/moneyflow/Schemes.sol#L82

Auto-wrapper is located here

https://github.com/Thetta/Thetta-DAO-Framework/blob/dev2/contracts/moneyflow/AutoMoneyflowCaller.sol

Tests are located here

https://github.com/Thetta/Thetta-DAO-Framework/blob/dev2/test/moneyflow_scheme_test.js

TODO Tests:

  1. Call 'setRootWeiReceiver directly
  2. Call setRootWeiReceiverAuto that will NOT create new voting. I.e. it will call addNewTask as a result
  3. Call setRootWeiReceiverAuto that will CREATE new voting.

Examples

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

Add https://coveralls.io/ test coverage

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

Create a simple "ICO contract"

Example - https://github.com/airalab/robonomics_contracts/blob/master/airalab-foundation/contracts/Crowdfunding.sol

First idea (issue tokens, then transfer them at purchase)

  1. Client creates new contract with params
  2. Client deposits there tokens
  3. ICO is started
  4. Ether is collected, tokens are transferred
  5. ICO is finished

Second idea (issue token at purchase)

  1. Client creates new "ICO" contract with params
  2. "ICO" contract has permission to issue tokens
  3. ICO is started
  4. Ether is collected, tokens are issues
  5. ICO is finished

WeiAbsoluteExpenseWithPeriod, WeiRelativeExpenseWithPeriod should have option "isCalculateDebt"

How it works now?

Currently WeiAbsoluteExpenseWithPeriod, WeiRelativeExpenseWithPeriod contract ask for X wei in Y days. If 5 * Y days elapsed -> it will still require only X wei.

Should be working like this:

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

Permissions subsystem v.2

Permissions v.1 (now)

  1. Address whitelist
  2. Employee check
  3. Voting with
  4. Denied

Proposal v.1.2 (add different tokens)

  1. Address whitelist
  2. Employee check
  3. Voting with
  4. Denied

Proposal v.1.3 (add ACL groups)

  1. Address whitelist
  2. ACL group check
  3. Voting with
  4. Denied

Update <should be able to upgrade> test.

  1. Add balance checks
// TODO: check employee1 balance
  1. add notifyObserversOnUpgrade() checking
function notifyObserversOnUpgrade(IMicrocompanyBase _new)public onlyOwner {
  for(uint i=0; i<observers.length; ++i){
    IMicrocompanyObserver(observers[i]).onUpgrade(_new);
  }
}

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.