near-daos / sputnik-dao-contract

Smart contracts for https://app.astrodao.com
https://astrodao.com/
MIT License
108 stars 81 forks source link

sputnikdao-factory2 add function to delete the empty DAO (without proposals) #20

Open AngelBlock opened 3 years ago

AngelBlock commented 3 years ago

Re: https://github.com/near-daos/sputnik-dao-contract/tree/main/sputnikdao-factory2

Looking for opinion.

Proposal: to add a factory function call to remove an empty DAO from the state (list), and refund the amount to the creator.

There are few DAOs which created with failed call (our of GAS for instance) or deleted off-contract by using full access key, to avoid clogging of DAO list.

ilblackdragon commented 3 years ago

v2 factory should not be creating DAOs with failed calls anymore. The main problem with this kind of deletion is how to check that DAO is indeed empty. And also who to allow to do this.

Alternative, we can allow Genesis DAO to moderate the list for example, given that list is mostly just for convenience usage anyway.

If DAO needs to be deleted, it can be done now via SelfUpgrade proposal to a contract that would remove things.

mikedotexe commented 3 years ago

Want to point out that you can also add a public key to a DAO, meaning a person can delete that account later.

near call $CONTRACT_ID create '{"name": "genesis", "public_key": "ed25519:CexEjoGcVgb1we3aAwo8o4nZ211p1rnUaoQydHTs9mLo", "args": "$ARGS"}' --accountId $CONTRACT_ID --amount 5 --gas 150000000000000

Perhaps this is something I can explore more later, as we might need to modify the state of the factory, adding a ping function or something to "refresh" them. Not sure of a great way to do this… My first thought would be to send 1 yoctoNEAR to the account we think should still exist and have a callback seeing if that failed.

AngelBlock commented 3 years ago

Want to point out that you can also add a public key to a DAO, meaning a person can delete that account later.

near call $CONTRACT_ID create '{"name": "genesis", "public_key": "ed25519:CexEjoGcVgb1we3aAwo8o4nZ211p1rnUaoQydHTs9mLo", "args": "$ARGS"}' --accountId $CONTRACT_ID --amount 5 --gas 150000000000000

Perhaps this is something I can explore more later, as we might need to modify the state of the factory, adding a ping function or something to "refresh" them. Not sure of a great way to do this… My first thought would be to send 1 yoctoNEAR to the account we think should still exist and have a callback seeing if that failed.

This is one of the cases why I was proposing the DAO deletion mechanism. When DAO is deleted with full access key, it will still remain in the factory state as a reference, and will be returned by getter function, if this is not handled properly on UI it will break it.