Giter Club home page Giter Club logo

golem-crowdfunding's Introduction

Golem Token and Crowdfunding contracts

Contracts

GNT contract is defined in contracts/Token.sol. Crowdfunding allocation of tokens for Golem Factory and developers is in contracts/GNTAllocation.sol. Other contracts are there for testing purposes only.

Testing

Testing requires Python and following packages: pyetherem, py.test

pip install -r requirements.txt

To run tests:

make tests

golem-crowdfunding's People

Contributors

badb avatar banasiakadam60 avatar chfast avatar mfranciszkiewicz avatar paulperegud avatar subtly avatar viggith 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

Watchers

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

golem-crowdfunding's Issues

Implement refunding

In case minimal funding is not reached we need some code to refund users.
Firstly, check how Singularity has done it.
If no better ideas, there must be a function user can trigger what will send him the ethers back. We can reuse function() for user-friendliness.

How to "finalize" funding?

The following action must be performed after the funding has ended:

  • unlock transfer,
  • generate endowment,
  • transfer ethers to Founder.

Variant 1

  1. Auto unlock transfer after the funding has ended.
  2. Allow the Founder to generate the endowment single time.
  3. Allow the Founder to transfer ethers from the Token contract unlimited number of times.

Pros:

  • current implementation,
  • independent actions,

Cons:

  • the endowment is generated when the transfer is already unlocked,
  • implementing crowdfunding logic in a separated contract hard or not possible.

Variant 2

Allow the Founder to perform a single transaction that will unlock transfer and generate the endowment and transfer ethers from the Token.

Pros

  • the endowment is generated when the transfer is locked,

Cons

  • the Founder can delay (or block) the transfer unlocking, however has big incentive not to do it (ethers).

Variant 3

Allow anyone to perform a single transaction that will unlock transfer and generate the endowment and transfer ethers from the Token to the Founder.

Pros

  • the endowment is generated when the transfer is locked,

Cons

  • the Founder must be ready to receive the ethers before the funding ends.

Check gas costs

Check gas costs for every function according to recent hard fork.

Separate contracts used for tests

For external reviewers it must be very misleading to see a lots of contracts in contracts/ directory. We should separate the ones used only for tests.

Maybe use populus for testing?

Someone pointed me at your repository noting that the tests are written in python. I was curious if your team knew about populus which might take some of the overhead out of your testing setup?

Test with EIP160

The EIP160 changes EXP gas costs from 10 + 10 per byte of exponent to 10 + 50 per byte of exponent. As this comes in the next HF we should run our tests with these changed gas costs. Especially .send must be tested carefully as it sends only 2300 units of gas.

I think the simplest way is to hack pyethereum, because these changes are not going to be released on time.

Create precondition table

Write down all preconditions (depending on params and data) for all function to search for patterns and to name them.

Tests ideas

  • Try to send ether to the Crowdfunding contract not through function().
  • Send ether to the Crowdfunding with random data.
  • Send random data to the Crowdfunding.

Measure gas cost of deployment

Looking at allocation of tokens to devs. Gas limit could be problem if attacks persist. Ideally contract is < 500k gas to deploy and execute. (And/or can be executed in stages)

dust spam attack?

Scenario is as following: a lot of small transactions is made from different accounts, blowing up size of balances array. Can this affect other funders?

I see three possibilities.

a) gas cost of creating one more entry in balances is not a constant function of size(balances).
b) gas cost is constant, but work is not constant and this operation can be used to spam network
c) no worries, ETH has withered more complicated attacks

Implement endowment for developers

The distribution is below. Because we will need a lot of static data for that I suggest to implement endowment (including params and for the Factory as well) in a separated function.

25
7.3
7.3
7.3
7.3
7.3
6.3
6.3
6.3
6.3
3.1
1.5
1.5
1
1
1
0.7
0.7
0.7
0.7
0.7
0.4
0.3

Do we need allowance mechanism?

  • Check if Ethereum Wallet requires this part of ERC20 token interface.
  • Check how Raiden / state channels use it and how it should be implemented.

See also #19.

chain replay attack?

Are we susceptible to chain replay attack?

ETH/ETC chain replay does not affect us since contract will be deployed only on one chain.

Can planned hard fork affect us? I think it's perfectly benign and created chain will not have any value whatsoever.

stack exhausion attack?

What will happen if attacker will attempt to bump into stack depth limit while being in our code?

Scenario:
StackLimit = N

def stack_filler(X):
   if X < N:
     stack_filler(X+1)
   else:
     GolemNetworkToken.send(1000)

Will EVM just do what it does when throw or "out of gas" occurs and restore original state?

Separate crowdfunding and migration agents

We need to lock ability to the crowdfunding agent to change its payout address. But we probably want to allow migration agent to change its address in case of the first one is compromised.

Solutions:

  1. Separate addresses.
  2. Lock changeCrowdundingAgent() during funding.

The 1. is better if we want to cleanup funding data after the funding. Do we?

Try populus

Populus does not support solidity 0.4 yet (work in progress). Try to help with that.

Source of contract cannot be verified

When deploying the Crowdfunding contract from Ethereum Wallet:

  • it cannot be done using bytecode,
  • using solidity source code is compiled by builtin solc, but the result contract cannot be verified on etherscan.io.

Test gas bounds

Test insufficient gas and extra gas all calls, especially refund and migration

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.