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
Conversation
As discussed, following things should be changed:
|
TokenMint(newTokenHolder, tokensAmount); | ||
} | ||
|
||
function () payable donationGuard { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"; | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
In this PR, I propose our first version of crowdfund contract. It's functionalities are as follow:
The directory structure follows
truffle
framework, I don't know if we eventually followtruffle
but I think it's good to start with.