Millisecond Duration & Expiration Separation
Opened this issue · 0 comments
crnbarr93 commented
Description
The current implementation of `MillisecondsDuration/MillisecondsExpiration` does not generate a different type in our schemas. The intent was to improve UX generated by our schemas but this implementation failed to do so.
We should completely separate these types as two indepdendent structs and change Milliseconds
to be a trait that these two types implement.
Implementation
Instead of using aliases use structs:
pub struct MillisecondsDuration(u64);
pub struct MillisecondsExpiration(u64);
Alter Milliseconds
to be a trait:
pub trait Milliseconds {
fn is_expired(&self, block: &BlockInfo) -> Milliseconds;
//...
}
Implement the new Milliseconds
trait for MillisecondsDuration
and MillisecondsExpiration
.
Acceptance Criteria
- MillisecondsDuration struct
- MillisecondsExpiration struct
- Milliseconds trait
- Updated unit-testing where appropriate