Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial donation contract for SmartPool #3

Closed
wants to merge 3 commits into from
Closed

Conversation

tranvictor
Copy link
Member

In this PR, I propose our first version of crowdfund contract. It's functionalities are as follow:

  1. It accepts unlimited donation from donors.
  2. Everyone can see their donated amount and their token amount.
  3. Everyone can see total donation amount.
  4. Everyone can see total number of donors.
  5. Donors can have their tokens according to their donation. 1 Ether = T tokens.
  6. After X blocks, donors can still donate, however they would not receive any tokens.
  7. After X blocks, owner can withdraw the donation into their address (account/wallet).
  8. T and X will be specified on contract creation.
  9. After X blocks, owner can turn donation on/off.
  10. Donation data is public for further integrations as Yaron suggested.

The directory structure follows truffle framework, I don't know if we eventually follow truffle but I think it's good to start with.

@tranvictor tranvictor self-assigned this Jan 8, 2017
@tranvictor
Copy link
Member Author

tranvictor commented Jan 8, 2017

As discussed, following things should be changed:

  1. Contract's owner should be able to issue tokens without actually sending ethers. It's for non-ether donations.
  2. Some names should be changed: turnOffDonation -> stopAcceptingDonation, turnOnDonation -> startAcceptingDonation
  3. Token amount should be calculated on ether instead of wei to avoid big num issue
  4. Remove duration constraint, make owner able to change the token rate
  5. Premining once for specific amount of tokens

TokenMint(newTokenHolder, tokensAmount);
}

function () payable donationGuard {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

msg.value is in wei. If does not amount to full ether, then either throw or return reminder.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess its ok to just take it, its just donation anyway. Its kind of bad to ask for donation and then return it.


import "./ERC20.sol";
import "./Lockable.sol";

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are standardtoken.sol implementations. Why not building on top of that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @tranvictor follows the ERC20 template from ethereum/EIPs#20

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following ERC20 is good.
But these days people add another layer of standard token.
See crowdsale token.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏿 you are right, we should use standard token. Its easier.

address public theTeam;
mapping(address => uint) public _tokenBalances;
mapping(address => uint) public _donationBalances;
mapping(uint => address) public _donors;
Copy link
Collaborator

@yaronvel yaronvel Jan 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the role of this field? (_donors)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since _donors maps an index to donor's address, it's a way for us to iterate through donors to get their address, combine with _tokenBalances and _donationBalances we can also get donation and token amount too. I think it would be helpful for us in future?

Change some function names, Token base on Ether instead of Wei, Remove duration constraint, rate is changable, Pre-mined tokens
@tranvictor tranvictor closed this Jan 10, 2017
@tranvictor tranvictor reopened this Jan 10, 2017
@tranvictor tranvictor closed this Jan 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants