Skip to content

Commit

Permalink
Clean ups.
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Oct 31, 2017
1 parent b7cec24 commit 2c1096e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
7 changes: 6 additions & 1 deletion contracts/AMLToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ import "./BurnableCrowdsaleToken.sol";
*
* This subset of BurnableCrowdsaleToken gives the Owner a possibility to
* reclaim tokens from a participant before the token is released
* (after participant has failed the AML).
* after a participant has failed a prolonged AML process.
*/
contract AMLToken is BurnableCrowdsaleToken {

// An event when the owner has reclaimed non-released tokens
event OwnerReclaim(address fromWhom, uint amount);

function AMLToken(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable) BurnableCrowdsaleToken(_name, _symbol, _initialSupply, _decimals, _mintable) {

}
Expand All @@ -31,5 +35,6 @@ contract AMLToken is BurnableCrowdsaleToken {
balances[fromWhom] = balances[fromWhom].sub(amount);
balances[owner] = balances[owner].add(amount);
Transfer(fromWhom, owner, amount);
OwnerReclaim(fromWhom, amount);
}
}
8 changes: 8 additions & 0 deletions contracts/StandardTokenExt.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ pragma solidity ^0.4.14;

import "zeppelin/contracts/token/StandardToken.sol";


/**
* Standard EIP-20 token with an interface marker.
*
* @notice Interface marker is used by crowdsale contracts to validate that addresses point a good token contract.
*
*/
contract StandardTokenExt is StandardToken {

/* Interface declaration */
function isToken() public constant returns (bool weAre) {
return true;
Expand Down
16 changes: 16 additions & 0 deletions ico/tests/contracts/test_amltoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ethereum.tester import TransactionFailed
from web3.contract import Contract


def test_transfer_to_owner(aml_token: Contract, team_multisig: str, malicious_address: str, empty_address: str):
"""Only owner can move tokens back to him before releasing."""

Expand All @@ -21,6 +22,7 @@ def test_transfer_to_owner(aml_token: Contract, team_multisig: str, malicious_ad

assert starting_amount == aml_token.call().balanceOf(team_multisig)


def test_transfer_to_owner_after_release(aml_token: Contract, team_multisig: str, malicious_address: str, empty_address: str):
"""Only owner can move tokens back to him before releasing."""

Expand All @@ -31,3 +33,17 @@ def test_transfer_to_owner_after_release(aml_token: Contract, team_multisig: str

with pytest.raises(TransactionFailed):
aml_token.transact({"from": team_multisig}).transferToOwner(malicious_address)


def test_transfer_to_owner_only_owner(aml_token: Contract, team_multisig: str, malicious_address: str, empty_address: str):
"""Other parties cannot do AML reclaim."""

starting_amount = aml_token.call().balanceOf(team_multisig)

aml_token.transact({"from": team_multisig}).setTransferAgent(team_multisig, True)
aml_token.transact({"from": team_multisig}).transfer(malicious_address, 1000000)

assert starting_amount != aml_token.call().balanceOf(team_multisig)

with pytest.raises(TransactionFailed):
aml_token.transact({"from": malicious_address}).transferToOwner(malicious_address)
2 changes: 1 addition & 1 deletion zeppelin

0 comments on commit 2c1096e

Please sign in to comment.