Hi,
apart from Gnosis, is there a solution or industry standard our there to have an address only shareholders can withdraw from? Example
the address 0x001 receives 100 USDT
EOA_A owns 60% and EOA_B owns 40% so they can only withdraw their share
sub accounts are possible to avoid manipulation (e.g. if 100 USDT is received on Monday, EOA_A withdraws its share but when +100 USDT is added, if EOA_B didn't get the time to withdraw then EOA_A can basically steal some money)
so this does what I want thank you, I just have a question as I tested and it works great but for my understanding: how does the SC "remembers" how much each payees should get after some token has already been released?
e.g. my SC has 2 payees, 50/50 shares -> I send 10 USDC -> call release(tokenUSDC, payee1) [USDC SC balance is now 5]
so here if I try to call release(tokenUSDC, payee1) again the SC properly tells me "account has no shares" (payee1 can't still 50% of the 5 USDC remaining)
also if I top up with 10 more USDC [USDC SC balance is now 15] again the SC properly sends me 5 USDC (instead of the potential 7.5 USDC or 50% of the 15 USDC present in the SC)
It uses 2 variables for it, shares to keep track how many shares of the funds are for each account and released, to keep track how much that account already redeemed/received.
last question (thanks a lot for the follow up!): instead of looping through all payees, isn't there a way to release all shares to all payees in 1 tx to save gas?