jito-foundation / restaking

https://docs.restaking.jito.network/
Other
54 stars 5 forks source link

Vault: Add per-epoch withdraw caps for each vault #3

Open buffalu opened 2 months ago

buffalu commented 2 months ago

Add per-epoch withdraw caps on a vault basis as a pro-rata share of the vault stake which prevents excess withdraws

aoikurokawa commented 2 months ago

Hi. @buffalu I want to make sure thatI am understanding correctly. So what you means is that adding new those attributes to the Vault like below?

Ex:

#[derive(Debug, Clone, Copy, PartialEq, BorshDeserialize, BorshSerialize)]
pub struct Vault {
    ...

    /// The maximum amount of tokens that can be withdrawn per epoch
    epoch_withdraw_cap: u64,

    /// The current epoch number
    current_epoch: u64,

    /// The amount of tokens withdrawn in the current epoch
    epoch_withdrawn_amount: u64,
}
buffalu commented 2 months ago

Hi. @buffalu I want to make sure thatI am understanding correctly. So what you means is that adding new those attributes to the Vault like below?

Ex:

#[derive(Debug, Clone, Copy, PartialEq, BorshDeserialize, BorshSerialize)]
pub struct Vault {
    ...

    /// The maximum amount of tokens that can be withdrawn per epoch
    epoch_withdraw_cap: u64,

    /// The current epoch number
    current_epoch: u64,

    /// The amount of tokens withdrawn in the current epoch
    epoch_withdrawn_amount: u64,
}

yeah, exactly! i think blocked on #10 but should be done with that in the next 24 hours