Skip to content

Commit a91ad84

Browse files
guidiazaesedepece
authored andcommitted
fix(json_rpc): collateral_ratio as integer on getDataRequest's etheral report
1 parent 7b6fb22 commit a91ad84

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

  • node/src/actors/json_rpc

node/src/actors/json_rpc/api.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,7 +2689,7 @@ pub struct DataRequestQueryParams {
26892689
dro_hash: Hash,
26902690
rad_hash: Hash,
26912691
rad_bytecode: String,
2692-
collateral_ratio: f32,
2692+
collateral_ratio: u16,
26932693
unitary_reward: u64,
26942694
witnesses: u16,
26952695
}
@@ -2836,9 +2836,7 @@ async fn get_drt_query_params(dr_tx_hash: Hash) -> Result<DataRequestQueryParams
28362836
.unwrap_or_default();
28372837

28382838
Ok(DataRequestQueryParams {
2839-
collateral_ratio: (dr_tx.body.dr_output.collateral as f64)
2840-
.div(dr_tx.body.dr_output.witness_reward as f64)
2841-
as f32,
2839+
collateral_ratio: dr_tx.body.dr_output.collateral.div_ceil(dr_tx.body.dr_output.witness_reward) as u16,
28422840
dro_hash: dr_tx.body.dr_output.hash(),
28432841
rad_hash: calculate_sha256(&bytecode).into(),
28442842
rad_bytecode: hex::encode(&bytecode),
@@ -2865,9 +2863,7 @@ async fn get_drt_query_params(dr_tx_hash: Hash) -> Result<DataRequestQueryParams
28652863
.unwrap_or_default();
28662864

28672865
Ok(DataRequestQueryParams {
2868-
collateral_ratio: (dr_tx.body.dr_output.collateral as f64)
2869-
.div(dr_tx.body.dr_output.witness_reward as f64)
2870-
as f32,
2866+
collateral_ratio: dr_tx.body.dr_output.collateral.div_ceil(dr_tx.body.dr_output.witness_reward) as u16,
28712867
dro_hash: dr_tx.body.dr_output.hash(),
28722868
rad_hash: calculate_sha256(&bytecode).into(),
28732869
rad_bytecode: hex::encode(&bytecode),

0 commit comments

Comments
 (0)