Lets say I want to create a smart contract that acts as a pool of Algos. Any account can send Algos to the pool account. The catch is that there is an expiration date to the pool, so after a certain number of blocks, no accounts can send Algos to the pool.
So I want to record the percentage contribution to the pool in the local state of each sender. Meaning, if Bob contributed 10 Algos, and at expiration, the pool size is 100 Algos, Bob has 10% of the pool. The problem is that when Bob sends 10 Algos, the pool has not expired yet and can keep growing, so the percentage of contribution cannot be known until the expiration.
How do I calculate this percentage of contribution for each sender?