timewave-computer / covenants

Apache License 2.0
17 stars 3 forks source link

covenant durations and deadlines #140

Open bekauz opened 7 months ago

bekauz commented 7 months ago

Currently we treat covenant deadlines as expirations. For context, right now the two party POL covenant gets instantiated with a deposit deadline and a lockup deadline, both provided as timestamps/block heights in the future prior to covenant instantiation.

It may make sense to convert some of them into durations that only start counting from a specific point in the covenant flow, for instance:

Art3miX commented 6 months ago

I think this can be easily done with introducing a wrapper enum:

enum Deadline {
  Expiration(cw_utils::Expiration)
  Duration { 
    start_at: BlockInfo, 
    duration: cw_utils::Duration
  }
}

and then a helper:

impl Deadline { 
  pub fn is_expired(&self, curr_block: &BlockInfo) {
    match self { ... }
  }
}

No even a bad idea to have it on the cw_utils, its a good UX.

Art3miX commented 5 months ago

Whats up with that?

We have the deadline helper in the utils, we just need to use it, 1 thing about it, is that in order to do this nicely, we add the serde(untagged) flag, this allows to "unwrap" the names, the issue with that is that it requires a specific wasmd version, which im not sure is supported on neutron (might be 1,4, or 1.5) cause it requires float support.