Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally require a deposit to make a proposal #11

Merged
merged 1 commit into from
Sep 5, 2021

Conversation

ben2x4
Copy link
Contributor

@ben2x4 ben2x4 commented Sep 5, 2021

This PR closes #1.

The dao can now be configured to require a deposit to make a proposal. The deposit is returned if the proposal passes and becomes property of the dao if the proposal fails.

This change will require future work to prevent the dao from accidentally spending proposal deposit funds. This will most likely be implemented by having a separate contract for managing the deposit funds to make the distinction more clear.

This PR also persists the proposer's address to the proposal state object. This was necessary to return the proposal deposit and seems generally useful.

@ben2x4 ben2x4 requested a review from JakeHartnell September 5, 2021 01:29
.add_messages(prop.msgs)
.add_attribute("action", "execute")
.add_attribute("sender", info.sender)
.add_attribute("proposal_id", proposal_id.to_string()))
}

fn get_proposal_deposit_refund_message(
proposer: &Addr,
config: &ProposalDeposit,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making a comment for later, but feel this variable could be named a bit better... like why not deposit or proposal_deposit? Not a big deal though... good enough for now.

},
}
)
}

#[test]
fn test_proposal_deposit_works() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be a separate ticket, but we should add a test to check the when the proposal deposit is 0, it all works without having to set an allowance. Will make a ticket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the existing tests have the proposal deposit set to zero, so we should be good from a coverage perspective. Thought could make sense to have a explicit test to document the requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optional Proposal Deposit
2 participants