pragma solidity 0.6.6;

interface IRealityCards {

    function collectRentAllTokens() external;
    function numberOfTokens() external view returns(uint); 
    function ownerOf(uint) external view returns(address);
    function currentOwnerRemainingDeposit(uint) external view returns(uint);

}

contract rentCollector {
    IRealityCards rc1 = IRealityCards(0x148Bb64E8910422E74f79feF1A2E830BDe0BB938); //election
    IRealityCards rc2 = IRealityCards(0xf30a16DdFDfbA014789E577bC59c6e2E89cEE0f5); //boxing
    IRealityCards rc3 = IRealityCards(0x231C66E7474FC300b000b35E1CF321D2405bb9f0); //curve
    
    function collectRentAllTokensAllMarkets() public 
    {
        bool expired = false;
        
        //rc1:
        expired = false;
        for (uint i = 0; i < rc1.numberOfTokens(); i++) {
            if (rc1.currentOwnerRemainingDeposit(i) == 0) {
                expired = true;
            }
        if (expired) {
            rc1.collectRentAllTokens(); 
            }
        }
        
        // //rc2:
        // expired = false;
        // for (uint i = 0; i < rc2.numberOfTokens(); i++) {
        //     if (rc2.currentOwnerRemainingDeposit(i) == 0) {
        //         expired = true;
        //     }
        // if (expired) {
        //     rc2.collectRentAllTokens(); 
        //     }
        // }
        
        // //rc3:
        // expired = false;
        // for (uint i = 0; i < rc3.numberOfTokens(); i++) {
        //     if (rc3.currentOwnerRemainingDeposit(i) == 0) {
        //         expired = true;
        //     }
        // if (expired) {
        //     rc3.collectRentAllTokens(); 
        //     }
        // }
        
    }
}