Giter Site home page Giter Site logo

platform-contracts's People

Contributors

kkx avatar munikes avatar ramarti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

platform-contracts's Issues

Add old contracts test

Lets test that after upgrading a contract, the old one can't interact with the platform.

Separate fund transfer from cap reached

sendFundsToBorrower() should be out of contributeWithAddress() and made external.

Add a check for state === AcceptingContributions in sendFundsToBorrower()

This way the transfer to the exchange will happen when local node and representative are ready and in a room together.

Term refactor

Change borrower by representative wherever present.
Also change defaultDays for delayDays

Allow for multiple early payments

Right now we have 1 payment back with several transactions to repay.

Our borrowers ask to be able to pay fractions of the total amount before the date, with the interest of the time of payment (like in traditional loans).

This implies that there would be several "reclaimContributionWithInterest".

Add integration test

1.- Launch lending contract
2.- Update reputation contract
3.- Try to pay back lending contract using old reputation

Modifier onlyLendingContract

BurnReputation or IncrementReputation. TODO the only Lending Contract modifier and unit tests. We have a branch fix_onlylendingcontract with this code without finish.

Split "borrower" into representative and community

representative should be the exchange account to receive the funds, community should be a wallet that the community controls.

In EthicHubLending, EthicHubReputation and EthicHubUser
We should have "community" and "representative" in the modifiers, registering and such.
Community should be the subject of reputation calculations (like it is know)

Review integration test: calculate reputation

On test/EthicHubIntegration.js
En el contrato EthicHubLending. En el flujo de inversión (The investment flow), calculo la reputación al inicio y al final, para la comunidad está bien, y para el nodo local no cambia.

Automate initial exchange rate

Instead of manual input, use oracles from coinmarketcap to get the peso/ether exchange rate.

Important: Keep the feature of returning surplus ether operational

Expand readme

Explain the system, how to test it and how to contribute.

Reputation algorithm

After Lending payment/default, reputation for the local node and community must be increased or burned.

In this version, reputation for communities is communal. In future version reputations will be set by individual.

Reputation of the local nodes will vary proportionally with the reputation of the communities.

To have a measure of the impact of a project, we are classifying them in 5 tiers (t1 to t5).
Each tier corresponds to the monetary amount lent per person in the project. Each country will have a different monetary amount that makes sense for each tier, and a different fiat currency to grade them, so we will not store that in the blockchain for now.

For our first run in México we have:

  • Tier1: 1000€
  • Tier2: 2000€
  • Tier3: 5000€
  • Tier4: 10000€
  • Tier5: 20000€

Decrement

Community:

Decrement of 1% daily after the set lendingDays, with 100% rep being burned if the money is not returned before maxDefaultDays.

Local node:

Reputation decrement will be a multiplier of the community result.

Increment

Community

R = Reputation
Rp = Previous reputation
Nt = Number of previously succesful projects in that tier
R = Rp + 1/Nt

Local node

Tm = Tier multiplier (1 for t1, 2 for t2..)
C = Number of people on the community
R = Rp + 0.05*(Tm*C)

Fix interest calculations

Change interest to variable and annual, also add 4% local node and 3% EthicHub when returning borrowed amount.

Send partial transfer to exchange.

After the lending period, the initial cap in eth might be too many pesos when going to exchange. We don't want to charge the farmers with more interests than needed.

  1. Allow borrower transfers part of the eth back to the contract when ExchangingToFiat
  2. That amount should be proportionally divided between contributors in a separate ledger. Either via a vault contract (like OpenZeppelin's RefundableCrowdsale or a different mapping.
  3. When setting initial eth2fiat rate, do the calculations with cap - returned
  4. Allow investors to retrieve the returned funds
  5. Emit an event when returning partial transfer.

Add "Exchanging" state to Lending

The exchanged rate must be set after the actual exchange takes place.

We need to add:

  • An state Exchanging after a succesful funding.
  • The inital exchange rate must be set after the actual exchange has taken place.

create EthicHubUser contract

Contract with the API to register investors and local nodes.

Add checks in lending contract for registered investors, valid local nodes creating the contract

Integration tests

Add integration tests for all lending cases, with actual storage, cmc and user contracts , checking that the correct values are set in storage and the balances are right.

Do in a separate testing file that EthicHubLending.js

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.