2020-04-23 16:35:58 +00:00
|
|
|
package simulation
|
2020-04-14 01:29:46 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// import (
|
|
|
|
// sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
// )
|
2020-04-14 01:29:46 +00:00
|
|
|
|
2023-04-05 23:21:59 +00:00
|
|
|
// func ShiftDec(x sdk.Dec, places sdkmath.Int) sdk.Dec {
|
2022-01-08 00:39:27 +00:00
|
|
|
// neg := places.IsNegative()
|
|
|
|
// for i := 0; i < int(abs(places.Int64())); i++ {
|
|
|
|
// if neg {
|
|
|
|
// x = x.Mul(sdk.MustNewDecFromStr("0.1"))
|
|
|
|
// } else {
|
2023-04-05 23:21:59 +00:00
|
|
|
// x = x.Mul(sdk.NewDecFromInt(sdkmath.NewInt(10)))
|
2022-01-08 00:39:27 +00:00
|
|
|
// }
|
2020-04-14 01:29:46 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// }
|
|
|
|
// return x
|
|
|
|
// }
|
2020-04-14 01:29:46 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// // abs returns the absolute value of x.
|
|
|
|
// func abs(x int64) int64 {
|
|
|
|
// if x < 0 {
|
|
|
|
// return -x
|
|
|
|
// }
|
|
|
|
// return x
|
|
|
|
// }
|