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

Allow instantiating vault with existing local staking contract #190

Merged

Conversation

JakeHartnell
Copy link
Collaborator

Was playing around with allowing a DAO to have its own mesh vault and realized we needed to be able to instantiate the vault from the local staking contract. Thanks to @ethanfrey for feedback and figuring out how we can clean support the existing interface used in the Mesh Security UI.

Comment on lines +18 to +33
/// Information about the local staking contract used during vault instantiation
/// We use untagged so older clients that just used JSON encoded StakingInitInfo
/// will continue to work with no changes.
#[cw_serde]
pub enum LocalStakingInfo {
#[serde(untagged)]
Existing(ExistingContract),
#[serde(untagged)]
New(StakingInitInfo),
}

#[cw_serde]
pub struct ExistingContract {
/// Address of the local staking contract
pub existing: String,
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's amazing we have such super powers now. Thanks @ethanfrey for pointing this out to me.

Copy link
Collaborator

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

lgtm.

As minor cleanup, you could add impl Into<LocalStakingInfo> for StakingInitInfo but just aesthetics

@ethanfrey ethanfrey merged commit 7c142c2 into main May 30, 2024
2 checks passed
@ethanfrey ethanfrey deleted the instantiate-vault-with-existing-local-staking-contract branch May 30, 2024 09:32
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.

2 participants