near-daos / sputnik-dao-contract

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

Add self-destruct functionality to the DAO #63

Open ctindogaru opened 2 years ago

ctindogaru commented 2 years ago

The self-destruct is triggered if the DAO is inactive for too long.

This PR tries to address https://github.com/near-daos/sputnik-dao-contract/issues/39

After this PR gets merged, we should register the following job to croncat: near call cron.in.testnet create_task '{"contract_id": "sputnik_dao_factory.in.testnet","function_id": "check_daos_activity","cadence": "0 0 * * * *","recurring": true,"deposit": 0,"gas": 30000000000000}' --accountId funds_account.testnet --amount 10 We made the assumption that sputnik_dao_factory.in.testnet is the account where the sputnik factory is deployed and funds_account.testnet is the account that pays for the gas fees necessary to run the cron job each time.

This cron job will run each day at 00:00 and it will check for all the inactive DAOs. If inactive DAO is fund, the funds locked in the DAO (except the funds used for storage) are transferred to the dedicated account.

ctindogaru commented 2 years ago

@mikedotexe

ctindogaru commented 2 years ago

@ilblackdragon this is just a draft, but let me know if this is what you want! The TBD in the code needs your attention in particular.

ctindogaru commented 2 years ago

Added unit tests + simulation tests. This PR is ready to be reviewed. @mikedotexe @ilblackdragon

ctindogaru commented 2 years ago

This PR includes the changes in https://github.com/near-daos/sputnik-dao-contract/pull/68