contract ZethrBankrollBridge{
    // Must have an interface with the main Zethr token contract 
    ZethrInterface Zethr;
   
    // Store the bankroll addresses 
    // address[0] is main bankroll 
    // address[1] is tier1: 2-5% 
    // address[2] is tier2: 5-10, etc
    address[7] UsedBankrollAddresses; 

    // Mapping for easy checking
    mapping(address => bool) ValidBankrollAddress;
    
    // Set up the tokenbankroll stuff 
    function setupBankrollInterface(address ZethrMainBankrollAddress) internal {
        // Instantiate Zethr
        Zethr = ZethrInterface(0xb9ab8eed48852de901c13543042204c6c569b811);
        // Get the bankroll addresses from the main bankroll
        UsedBankrollAddresses = ZethrMainBankroll(ZethrMainBankrollAddress).gameGetTokenBankrollList();
        for(uint i=0; i<7; i++){
            ValidBankrollAddress[UsedBankrollAddresses[i]] = true;
        }
    }
    
    // Require a function to be called from a *token* bankroll 
    modifier fromBankroll(){
        require(ValidBankrollAddress[msg.sender], "msg.sender should be a valid bankroll");
        _;
    }
    
    // Request a payment in tokens to a user FROM the appropriate tokenBankroll 
    // Figure out the right bankroll via divRate 
    function RequestBankrollPayment(address to, uint tokens, uint userDivRate) internal {
        uint tier = ZethrTierLibrary.getTier(userDivRate);
        address tokenBankrollAddress = UsedBankrollAddresses[tier];
        ZethrTokenBankroll(tokenBankrollAddress).gameRequestTokens(to, tokens);
    }
}
// Contract that contains the functions to interact with the bankroll system
function setupBankrollInterface(address ZethrMainBankrollAddress) internal {
    // Instantiate Zethr
    Zethr = ZethrInterface(0xb9ab8eed48852de901c13543042204c6c569b811);
    // Get the bankroll addresses from the main bankroll
    UsedBankrollAddresses = ZethrMainBankroll(ZethrMainBankrollAddress).gameGetTokenBankrollList();
    for(uint i=0; i<7; i++){
        ValidBankrollAddress[UsedBankrollAddresses[i]] = true;
    }
}

// Set up the tokenbankroll stuff 