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

Sudo refactoring #161

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/consumer/virtual-staking/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ pub fn sudo(
msg: SudoMsg,
) -> Result<Response<VirtualStakeCustomMsg>, ContractError> {
match msg {
SudoMsg::Rebalance {} => VirtualStakingContract::new().handle_epoch(deps, env),
SudoMsg::HandleEpoch {} => VirtualStakingContract::new().handle_epoch(deps, env),
SudoMsg::ValsetUpdate {
additions,
removals,
Expand Down
6 changes: 3 additions & 3 deletions packages/apis/src/virtual_staking_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub trait VirtualStakingApi {
) -> Result<Response, Self::Error>;

/// Burns stake. This is called when the user's collateral is slashed and, as part of slashing
/// propagation, the native staking contract needs to burn / discount the indicated slashing amount.
/// propagation, the virtual staking contract needs to burn / discount the indicated slashing amount.
/// Undelegates evenly from all `validators`.
#[msg(exec)]
fn burn(
Expand All @@ -41,12 +41,12 @@ pub trait VirtualStakingApi {

#[cw_serde]
pub enum SudoMsg {
/// SudoMsg::Rebalance{} should be called once per epoch by the sdk (in EndBlock).
/// SudoMsg::HandleEpoch{} should be called once per epoch by the sdk (in EndBlock).
/// It allows the virtual staking contract to bond or unbond any pending requests, as well
/// as to perform a rebalance if needed (over the max cap).
///
/// It should also withdraw all pending rewards here, and send them to the converter contract.
Rebalance {},
HandleEpoch {},
/// SudoMsg::ValsetUpdate{} should be called every time there's a validator set update:
/// - Addition of a new validator to the active validator set.
/// - Temporary removal of a validator from the active set. (i.e. `unbonded` state).
Expand Down
2 changes: 0 additions & 2 deletions packages/bindings/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
mod msg;
mod query;
mod sudo;

pub use msg::{VirtualStakeCustomMsg, VirtualStakeMsg};
pub use query::{
BondStatusResponse, SlashRatioResponse, TokenQuerier, VirtualStakeCustomQuery,
VirtualStakeQuery,
};
pub use sudo::SudoMsg;

// This is a signal, such that any contract that imports these helpers
// will only run on blockchains that support virtual_staking feature
Expand Down
6 changes: 0 additions & 6 deletions packages/bindings/src/sudo.rs

This file was deleted.

Loading