How to create an address with shareholders?

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)

thanks a lot for your help!

1 Like

You could check out openzeppelin’s payment splitter contract.

The only downside is that is only works with predefined accounts/percentages . So you aren’t able to make changes to the split.

1 Like

cheers I will give it a shot

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)

thanks a lot for your help!

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.

ha ok so there is indeed no way for one of the payee to get more than what they should normally get, nice!

Yeah that’s exactly what it’s designed for :slight_smile:

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?

The code never loops over the payees except on construction.

Only when a someone redeems is his share checked and updates that persons redeemed amount.

Due to this mechanisme it is really efficient as the tax gas costs is on the pull during redeem and only for that specific account.

1 Like