@@ -121,7 +121,7 @@ def security_token_url() -> str:
121121 return "http://tokenmarket.net/"
122122
123123@pytest .fixture
124- def security_token_initial_supply () -> str :
124+ def security_token_initial_supply () -> int :
125125 return 999999999000000000000000000
126126
127127
@@ -189,18 +189,18 @@ def payout_contract(chain, team_multisig, mock_kyc, security_token, test_token,
189189
190190@pytest .fixture
191191def test_token (chain , team_multisig , token_name , token_symbol , security_token_initial_supply , release_agent , customer ) -> Contract :
192- """Create a Crowdsale token where transfer restrictions have been lifted."""
192+ """Create a Crowdsale token where transfer restrictions have been lifted. Double the security_token_initial_supply"""
193+ """Tokens must be minted in the respective testing functions to test different scenarios"""
193194
194- args = [token_name , token_symbol , security_token_initial_supply , 18 , True ] # Owner set
195+ args = [token_name , token_symbol , 0 , 18 , True ] # Owner set
195196
196197 tx = {
197198 "from" : team_multisig
198199 }
199200
200201 token , hash = chain .provider .deploy_contract ('CrowdsaleToken' , deploy_args = args , deploy_transaction = tx )
201-
202202 token .transact ({"from" : team_multisig }).setReleaseAgent (team_multisig )
203- token .transact ({"from" : team_multisig }).releaseTokenTransfer ( )
203+ token .transact ({"from" : team_multisig }).setMintAgent ( team_multisig , True )
204204
205205 return token
206206
@@ -504,10 +504,12 @@ def test_voting_contract(chain, voting_contract, security_token, team_multisig,
504504 check_gas (chain , voting_contract .transact ({"from" : team_multisig }).transferInvestorTokens (customer , 123 ))
505505 check_gas (chain , voting_contract .transact ({"from" : customer }).importInvestor (customer ))
506506 check_gas (chain , voting_contract .transact ({"from" : customer }).act (123 ))
507- return
508507
509508
510- def test_payout_contract (chain , payout_contract , security_token , test_token , team_multisig , customer ):
509+ def test_payout_contract (chain , payout_contract , security_token , security_token_initial_supply , test_token , team_multisig , customer ):
510+ test_token .transact ({"from" : team_multisig }).mint (team_multisig , security_token_initial_supply * 2 )
511+ test_token .transact ({"from" : team_multisig }).releaseTokenTransfer ()
512+
511513 start_balance = test_token .call ().balanceOf (team_multisig )
512514 assert start_balance > 0
513515 check_gas (chain , test_token .transact ({"from" : team_multisig }).approve (payout_contract .address , start_balance ))
@@ -521,8 +523,27 @@ def test_payout_contract(chain, payout_contract, security_token, test_token, tea
521523 assert test_token .call ().balanceOf (team_multisig ) > initial_balance
522524 # check balance in payout contract
523525 # 0x0000000000000000000000000000000000000064 is default address(100)
524- assert payout_contract .functions .balanceOf ('0x0000000000000000000000000000000000000064' ).call ()
525- return
526+ assert payout_contract .functions .balanceOf ('0x0000000000000000000000000000000000000064' ).call () == 123
527+
528+ remaining_balance = security_token .call ().balanceOf (team_multisig ) - 123
529+ check_gas (chain , payout_contract .transact ({"from" : team_multisig }).act (remaining_balance ))
530+ assert payout_contract .functions .balanceOf ('0x0000000000000000000000000000000000000064' ).call () == remaining_balance + 123
531+
532+ assert test_token .call ().balanceOf (team_multisig ) == start_balance
533+
534+
535+ def test_payout_contract_with_transfer (chain , payout_contract , security_token , security_token_initial_supply , test_token , team_multisig , customer ):
536+ test_token .transact ({"from" : team_multisig }).mint (team_multisig , int (security_token_initial_supply / 2 ))
537+ test_token .transact ({"from" : team_multisig }).releaseTokenTransfer ()
538+
539+ start_balance = test_token .call ().balanceOf (team_multisig )
540+ assert start_balance > 0
541+ check_gas (chain , test_token .transact ({"from" : team_multisig }).approve (payout_contract .address , start_balance ))
542+ check_gas (chain , payout_contract .transact ({"from" : customer }).fetchTokens ())
543+
544+ check_gas (chain , payout_contract .transact ({"from" : team_multisig }).transfer (customer , security_token .call ().balanceOf (team_multisig )))
545+ check_gas (chain , payout_contract .transact ({"from" : customer }).act (security_token .call ().balanceOf (team_multisig )))
546+ assert test_token .call ().balanceOf (customer ) == start_balance
526547
527548
528549def test_erc865 (chain , security_token , team_multisig , customer , private_key , signer_address ):
0 commit comments