File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
examples/sol-anchor-contract/programs/sol-anchor-contract/src Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ pub mod sol_anchor_contract {
46
46
. checked_mul ( loan_qty)
47
47
. ok_or ( ErrorCode :: Overflow ) ?;
48
48
49
- // Note : f64 should not be used in smart contracts, but we use it here so it gets displayed nicely in the logs.
49
+ // WARNING : f64 SHOULD NOT BE USED IN SMART CONTRACTS, IT IS USED HERE ONLY FOR LOGGING PURPOSES
50
50
// lets get the maximum loan value based on computation
51
51
// i.e {} * 10^({})
52
52
// loan_max_value * 10^(loan_price.expo)
@@ -78,12 +78,12 @@ pub mod sol_anchor_contract {
78
78
. checked_mul ( collateral_qty)
79
79
. ok_or ( ErrorCode :: Overflow ) ?;
80
80
81
- // Note : f64 should not be used in smart contracts, but we use it here so it gets displayed nicely in the logs.
81
+ // WARNING : f64 SHOULD NOT BE USED IN SMART CONTRACTS, IT IS USED HERE ONLY FOR LOGGING PURPOSES
82
82
// lets get the minimum collateral value based on computation
83
83
// i.e {} * 10^({})
84
84
// i.e collateral_min_value * 10^(collateral_price.expo)
85
85
let exponent: i32 = collateral_price. expo ;
86
- let result = ( BASE ) . powi ( exponent. abs ( ) ) ;
86
+ let result = BASE . powi ( exponent. abs ( ) ) ;
87
87
let result: f64 = if exponent < 0 { 1.0 / result } else { result } ;
88
88
let result_collateral_value = collateral_min_value as f64 * result;
89
89
You can’t perform that action at this time.
0 commit comments