Are you referring to the enemies generated for you to attack? It does not seem to be based entirely off of either. It is NOT your base for sure. I left my base at low level while I focused on leveling my dragons. It would not really make sense anyway, you are not going to attack their base with your own base. There MIGHT be a correlation with your dragon power, though. I cannot answer for certain.
One thing to notice though; Your enemies are generally your same level or higher. It seems to be random mostly as long as they are around your character level. Your enemies DO seem to increase over time with the amount of XP, medals, etc. even when you are the same level for a while. I think that is where the system might find pairs based on your own dragon power or number of total/weekly medals.