How to split shares fair?


I guess there is an easy solution for this math problem but I just dont get it…

I want to test a Presale-auction… e.g.:

There is an auction of token A - supply 10 ^ 9

To buy with token B…

How can I handle it if lets say the total invest of token B is above 10 ^ 18
How can I split that fair? I was thinking of to just divide token B but I just dont get the correct formula in my head…

Wanted to try it without a for loop, but I don’t see another way… but maybe someone of you?

1 Like

Hi @MToken,

You could look at PaymentSplitter for inspiration: