Skip to content

Commit

Permalink
Merge pull request #14 from svandisproject/transfer-critical-bug
Browse files Browse the repository at this point in the history
transfer bugs fixed
  • Loading branch information
onigiri-x committed May 28, 2018
2 parents bcc1ab1 + 0d59370 commit e64bef3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Sale.sol
Expand Up @@ -124,12 +124,19 @@ contract Sale is Svandis {
uint256 quantity = (msg.value * tierToRates[currentTier])/10^18;

require(quantity <= allowed[this][msg.sender]);
transfer(msg.sender, quantity);


balances[msg.sender] += quantity;
balances[address(this)] -= quantity;

emit Transfer(this, msg.sender, quantity);

withdrawWallet.transfer(msg.value);
}

function takeCompanyTokensOwnership() public {
transfer(msg.sender, companyAllowed[msg.sender]);
balances[msg.sender] += companyAllowed[msg.sender];
balances[address(this)] -= companyAllowed[msg.sender];

emit Transfer(this, msg.sender, companyAllowed[msg.sender]);
}
}
1 change: 1 addition & 0 deletions Svandis.sol
Expand Up @@ -27,6 +27,7 @@ contract Svandis is EIP20Interface {
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
require(_from != address(this));
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT256) {
Expand Down

0 comments on commit e64bef3

Please sign in to comment.