Losing gold after being raided

So… I have a question.

I have a warehouse, which can keep 1 500 00 gold, and protect just 200k.

 

So now I wanted to ask how much gold can someone rob from raiding me? Is there any math?

Got raided two times for exactly 100k (3 crowns) so that got my attention.

 

 

The reason I am asking, because ppl keep raiding me to get 30-80k, while i can easily raid them back getting 100-200k.

Do i lose less than they get? (i am not talking about alliance bonus)

It depends on the LVL of ur defensive base related to the attacker (the lvl of difficult). The other question u made, ppl keep raiding because of the medals, since u give them in an easy defence.