Permalink
Browse files

improvement in refundTokens

  • Loading branch information...
conejoninja committed Jun 6, 2018
1 parent fae29f1 commit ffc7bcf7f5e68ecedd7dc3bd99a23091ffc6ebcf
Showing with 7 additions and 7 deletions.
  1. +1 −1 contracts/ICO.sol
  2. +6 −6 contracts/Tokens.sol
@@ -264,7 +264,7 @@ contract ICO is HardcodedWallets, Haltable {
// Before transfering the ETHs to the investor, get back the tokens bought on ICO
uint256 tokenAmount = SCRefundVault.getTokensAcquired(msg.sender);
emit GetBackTokensOnRefund(msg.sender, this, tokenAmount); // Event Log
if (!SCTokens.refundTokens(msg.sender, this, tokenAmount)) {
if (!SCTokens.refundTokens(msg.sender, tokenAmount)) {
error('claimRefund: unable to transfer investor tokens to ICO contract before refunding');
return false;
}
@@ -201,14 +201,14 @@ contract Tokens is HardcodedWallets, ERC20, Haltable {
* @notice This is out of ERC20 standard but it is necessary to build market escrow contracts of assets
* @notice Send _amount amount of tokens to from tx.origin to address _to
*/
function refundTokens(address _from, address _to, uint256 _amount) public notTimeLocked stopInEmergency returns (bool success) {
function refundTokens(address _from, uint256 _amount) public notTimeLocked stopInEmergency returns (bool success) {
if (tx.origin != _from) {
error('refundTokens: tx.origin did not request the refund directly');
return false;
}

if (addressSCICO != _to) {
error('refundTokens: _to address is not the current ICO address');
if (addressSCICO != msg.sender) {
error('refundTokens: caller is not the current ICO address');
return false;
}

@@ -217,14 +217,14 @@ contract Tokens is HardcodedWallets, ERC20, Haltable {
return false;
}

if(!SCComplianceService.validate(_from, _to, _amount)) {
if(!SCComplianceService.validate(_from, addressSCICO, _amount)) {
error('transfer: not allowed by the compliance service');
return false;
}

balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount); // Event log
balances[addressSCICO] = balances[addressSCICO].add(_amount);
emit Transfer(_from, addressSCICO, _amount); // Event log

return true;
}

0 comments on commit ffc7bcf

Please sign in to comment.