near-cli-rs icon indicating copy to clipboard operation
near-cli-rs copied to clipboard

feat: Add support for submitting DAO proposals

Open frol opened this issue 1 year ago • 0 comments

Currently, commands like near tokens xxx.near send-near prepare a transaction with native actions such as TRANSFER or FUNCTION_CALL to FT contract. I tried to integrate DAO commands right into the existing commands, but with DAO we have two different accounts (DAO contract account id, and signer account id) in addition to a receiver account id (if applicable).

Here is the current command to send NEAR:

near tokens sender.near send-near receiver.near 10N network-config mainnet

If I just try to "send tokens from DAO", there is no way to specify who will be signing the transaction:

near tokens dao.near send-near receiver.near 10N network-config mainnet

So my natural first attempt was:

near dao devdao.near tokens send-near receiver.near 10N sign-as signer.near network-config mainnet

Though, it might mislead users that this command will actually send the tokens while it is only intended to submit a new proposal to the DAO with a TRANSFER action, which will only be executed when the proposal is confirmed. So second thought is to introduce submit-proposal and confirm-proposal commands:

near dao devdao.near submit-proposal send-near receiver.near 10n sign-as signer.near network-config mainnet

The problem I hate to admit is that we won't be able to reuse existing commands, so send-near, send-ft, send-nft, function-call as-transaction, deploy, account manage-storage-deposit deposit / withdraw commands will need to be re-implemented, and it is even more painful if we take extensions into account, e.g. bos CLI components deployment, permissions and prepaid storage management would need to be re-implemented for DAO as well.

At least DAO proposal confirmation seems to be quite straightforward:

near dao devdao.near confirm-proposal 123 gas-attached 200TGAS sign-as signer.near network-config mainnet

I would love to spend more time thinking about how to avoid code duplication, so this issue is just a placeholder for now.

frol avatar May 21 '23 20:05 frol