Fixed Testing code manages bonus sales and aprove allowance

This commit is contained in:
David E. Perez Negron Rocha 2019-11-26 17:30:21 -08:00
parent 8b63b3c600
commit 1af0f37e30
1 changed files with 8 additions and 12 deletions

View File

@ -110,10 +110,10 @@ contract DECAToken is ERC20Interface, Owned, SafeMath {
uint8 constant public decimals = 18; uint8 constant public decimals = 18;
uint public totalSupply; uint public totalSupply;
//for testing change weeks for hours... //for testing change weeks for hours...
uint public preICOEnds = now + 1 hours; uint public preICOEnds = now + 1 weeks;
uint public bonus1Ends = now + 3 hours; uint public bonus1Ends = now + 3 weeks;
uint public bonus2Ends = now + 6 hours; uint public bonus2Ends = now + 6 weeks;
uint public endDate = now + 11 hours; uint public endDate = now + 11 weeks;
mapping(address => uint) balances; mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed; mapping(address => mapping(address => uint)) allowed;
@ -149,14 +149,10 @@ contract DECAToken is ERC20Interface, Owned, SafeMath {
// from the token owner's account // from the token owner's account
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) { function approve(address spender, uint tokens) public returns (bool success) {
// approve should only be called when setting an initial allowance, // approves to set an allowance
// or when resetting it to zero. To increase and decrease it, use allowed[msg.sender][spender] = tokens;
// 'increaseApproval' and 'decreaseApproval' emit Approval(msg.sender, spender, tokens);
if (allowed[msg.sender][spender] == 0 || tokens == 0){ return true;
emit Approval(msg.sender, spender, tokens);
return true;
}
return false;
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------