timewave-computer / valence-services

Other
3 stars 0 forks source link

Should we set a time limit for using a service? #2

Open Art3miX opened 11 months ago

Art3miX commented 11 months ago

The account should be able to specify for how long he wants the account to use the service?

Ex: Use a service for a month, and see how it works for you, or use it without a limit to just run it until you pause/deregister from the service

bekauz commented 11 months ago

I think that makes sense. In covenant-utils I use this:

/// enum based configuration for asserting expiration.
/// works by asserting the current block against enum variants.
#[cw_serde]
pub enum ExpiryConfig {
    /// no expiration configured
    None,
    /// block height based expiry config
    Block(u64),
    /// timestamp based expiry config
    Time(Timestamp),
}
Art3miX commented 11 months ago

You can use cw-utils: https://docs.rs/cw-utils/1.0.2/cw_utils/enum.Expiration.html it is meant exactly for that.

uditvira commented 11 months ago

I can imagine this being useful. For example we may only want the a specific covenant service to be allowed to withdraw funds from a valence account for a fixed amount of time.