@@ -656,7 +656,7 @@ contract("Colony Funding", (accounts) => {
656656
657657 const receiver = await DomainTokenReceiver . at ( receiverAddress ) ;
658658 await checkErrorRevert ( receiver . approveTokenToColony ( otherToken . address ) , "domain-token-receiver-unauthorized" ) ;
659- await checkErrorRevert ( receiver . transferNativeToColony ( ) , "domain-token-receiver-unauthorized" ) ;
659+ await checkErrorRevert ( receiver . transferChainNativeToColony ( ) , "domain-token-receiver-unauthorized" ) ;
660660 } ) ;
661661
662662 it ( "should not allow even the colonyNetwork to call setColonyAddress once it's set on domainTokenReceiver" , async ( ) => {
@@ -700,6 +700,47 @@ contract("Colony Funding", (accounts) => {
700700 expect ( rootDomainPotBalanceAfter . sub ( rootDomainPotBalanceBefore ) ) . to . eq . BN ( 99 ) ;
701701 } ) ;
702702
703+ it ( `when receiving native (reputation-earning) token, if full approval present for domain,
704+ tokens are received by domain` , async ( ) => {
705+ // Get address for domain 2
706+ await colony . addDomain ( 1 , UINT256_MAX , 1 ) ;
707+ const receiverAddress = await colonyNetwork . getDomainTokenReceiverAddress ( colony . address , 2 ) ;
708+ await colony . mintTokens ( WAD . muln ( 100 ) ) ;
709+ await colony . claimColonyFunds ( token . address ) ;
710+ const domain1 = await colony . getDomain ( 1 ) ;
711+
712+ // Send an arbitrary transaction to mint tokens for receiverAddress
713+ const txData = token . contract . methods [ "mint(address,uint256)" ] ( receiverAddress , 100 ) . encodeABI ( ) ;
714+ await colony . makeArbitraryTransaction ( token . address , txData ) ;
715+
716+ // Approve 250 for the domain
717+ await colony . editAllowedDomainReputationReceipt ( 2 , 250 , true ) ;
718+ let allowedReceipt = await colony . getAllowedDomainReputationReceipt ( 2 ) ;
719+ expect ( allowedReceipt ) . to . eq . BN ( 250 ) ;
720+
721+ // Now test what happens when we claim them
722+
723+ const domain = await colony . getDomain ( 2 ) ;
724+ const domainPotBalanceBefore = await colony . getFundingPotBalance ( domain . fundingPotId , token . address ) ;
725+ const nonRewardPotsTotalBefore = await colony . getNonRewardPotsTotal ( token . address ) ;
726+ const rootDomainPotBalanceBefore = await colony . getFundingPotBalance ( domain1 . fundingPotId , token . address ) ;
727+
728+ // Claim the funds
729+ await colony . claimDomainFunds ( token . address , 2 ) ;
730+
731+ const domainPotBalanceAfter = await colony . getFundingPotBalance ( domain . fundingPotId , token . address ) ;
732+ const nonRewardPotsTotalAfter = await colony . getNonRewardPotsTotal ( token . address ) ;
733+ const rootDomainPotBalanceAfter = await colony . getFundingPotBalance ( domain1 . fundingPotId , token . address ) ;
734+
735+ // Check the balance of the domain
736+ expect ( domainPotBalanceAfter . sub ( domainPotBalanceBefore ) ) . to . eq . BN ( 99 ) ;
737+ expect ( nonRewardPotsTotalAfter . sub ( nonRewardPotsTotalBefore ) ) . to . eq . BN ( 99 ) ;
738+ expect ( rootDomainPotBalanceAfter . sub ( rootDomainPotBalanceBefore ) ) . to . eq . BN ( 0 ) ;
739+
740+ allowedReceipt = await colony . getAllowedDomainReputationReceipt ( 2 ) ;
741+ expect ( allowedReceipt ) . to . eq . BN ( 151 ) ;
742+ } ) ;
743+
703744 it ( `when receiving native (reputation-earning) token, if partial approval present for domain,
704745 tokens are split between intended domain and root` , async ( ) => {
705746 // Get address for domain 2
@@ -769,47 +810,6 @@ contract("Colony Funding", (accounts) => {
769810 await checkErrorRevert ( colony . editAllowedDomainReputationReceipt ( 1 , 70 , true ) , "colony-funding-root-domain" ) ;
770811 } ) ;
771812
772- it ( `when receiving native (reputation-earning) token, if full approval present for domain,
773- tokens are received by domain` , async ( ) => {
774- // Get address for domain 2
775- await colony . addDomain ( 1 , UINT256_MAX , 1 ) ;
776- const receiverAddress = await colonyNetwork . getDomainTokenReceiverAddress ( colony . address , 2 ) ;
777- await colony . mintTokens ( WAD . muln ( 100 ) ) ;
778- await colony . claimColonyFunds ( token . address ) ;
779- const domain1 = await colony . getDomain ( 1 ) ;
780-
781- // Send an arbitrary transaction to mint tokens for receiverAddress
782- const txData = token . contract . methods [ "mint(address,uint256)" ] ( receiverAddress , 100 ) . encodeABI ( ) ;
783- await colony . makeArbitraryTransaction ( token . address , txData ) ;
784-
785- // Approve 250 for the domain
786- await colony . editAllowedDomainReputationReceipt ( 2 , 250 , true ) ;
787- let allowedReceipt = await colony . getAllowedDomainReputationReceipt ( 2 ) ;
788- expect ( allowedReceipt ) . to . eq . BN ( 250 ) ;
789-
790- // Now test what happens when we claim them
791-
792- const domain = await colony . getDomain ( 2 ) ;
793- const domainPotBalanceBefore = await colony . getFundingPotBalance ( domain . fundingPotId , token . address ) ;
794- const nonRewardPotsTotalBefore = await colony . getNonRewardPotsTotal ( token . address ) ;
795- const rootDomainPotBalanceBefore = await colony . getFundingPotBalance ( domain1 . fundingPotId , token . address ) ;
796-
797- // Claim the funds
798- await colony . claimDomainFunds ( token . address , 2 ) ;
799-
800- const domainPotBalanceAfter = await colony . getFundingPotBalance ( domain . fundingPotId , token . address ) ;
801- const nonRewardPotsTotalAfter = await colony . getNonRewardPotsTotal ( token . address ) ;
802- const rootDomainPotBalanceAfter = await colony . getFundingPotBalance ( domain1 . fundingPotId , token . address ) ;
803-
804- // Check the balance of the domain
805- expect ( domainPotBalanceAfter . sub ( domainPotBalanceBefore ) ) . to . eq . BN ( 99 ) ;
806- expect ( nonRewardPotsTotalAfter . sub ( nonRewardPotsTotalBefore ) ) . to . eq . BN ( 99 ) ;
807- expect ( rootDomainPotBalanceAfter . sub ( rootDomainPotBalanceBefore ) ) . to . eq . BN ( 0 ) ;
808-
809- allowedReceipt = await colony . getAllowedDomainReputationReceipt ( 2 ) ;
810- expect ( allowedReceipt ) . to . eq . BN ( 151 ) ;
811- } ) ;
812-
813813 it ( "should not be able to claim funds for a domain that does not exist" , async ( ) => {
814814 await checkErrorRevert ( colony . claimDomainFunds ( ethers . constants . AddressZero , 2 ) , "colony-funding-domain-does-not-exist" ) ;
815815 } ) ;
0 commit comments