Skip to content

Commit 03c23dd

Browse files
committed
Update to recent change in ex_unit_prices cddl definition
1 parent d6619be commit 03c23dd

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

rust/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ impl UnitInterval {
8787
}
8888
}
8989

90+
type SubCoin = UnitInterval;
9091
type Rational = UnitInterval;
9192
type Epoch = u32;
9293
type Slot = u32;

rust/src/plutus.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,23 @@ impl Costmdls {
145145
#[wasm_bindgen]
146146
#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
147147
pub struct ExUnitPrices {
148-
mem_price: Coin,
149-
step_price: Coin,
148+
mem_price: SubCoin,
149+
step_price: SubCoin,
150150
}
151151

152152
to_from_bytes!(ExUnitPrices);
153153

154154
#[wasm_bindgen]
155155
impl ExUnitPrices {
156-
pub fn mem_price(&self) -> Coin {
156+
pub fn mem_price(&self) -> SubCoin {
157157
self.mem_price.clone()
158158
}
159159

160-
pub fn step_price(&self) -> Coin {
160+
pub fn step_price(&self) -> SubCoin {
161161
self.step_price.clone()
162162
}
163163

164-
pub fn new(mem_price: &Coin, step_price: &Coin) -> Self {
164+
pub fn new(mem_price: &SubCoin, step_price: &SubCoin) -> Self {
165165
Self {
166166
mem_price: mem_price.clone(),
167167
step_price: step_price.clone(),
@@ -847,10 +847,10 @@ impl Deserialize for ExUnitPrices {
847847
let mut read_len = CBORReadLen::new(len);
848848
read_len.read_elems(2)?;
849849
let mem_price = (|| -> Result<_, DeserializeError> {
850-
Ok(Coin::deserialize(raw)?)
850+
Ok(SubCoin::deserialize(raw)?)
851851
})().map_err(|e| e.annotate("mem_price"))?;
852852
let step_price = (|| -> Result<_, DeserializeError> {
853-
Ok(Coin::deserialize(raw)?)
853+
Ok(SubCoin::deserialize(raw)?)
854854
})().map_err(|e| e.annotate("step_price"))?;
855855
match len {
856856
cbor_event::Len::Len(_) => (),

0 commit comments

Comments
 (0)