I have a contract and I have ether in it. How can I distribute balance of contract between owner`s tokens base on percentages?
If you still need an answer, try this excellent approach https://medium.com/@weka/dividend-bearing-tokens-on-ethereum-42d01c710657.
The key point here is that it is not you who distributes the ether among holders but holders should withdraw their share themselves.
Contract with ether should watch token transfers and adjust ether sums that are to be paid to those addresses.
The article describes 2 cases: one for fixed token supply and one for variable token supply.
In now day I have solution this task: https://github.com/poperechnyi1/iterable-Mapping-ERC20 I used iterable mapping: https://github.com/szerintedmi/solidity-itMapsLib