1a1a19da7d
* deleted transfer_output added asset type and transaction result to core * removed writing 0x00 when buffer length is 0 * Refactored emit into VM package + moved tx to own package. * implemented transaction along with claimTransaction. * refactored naming of transaction + added decode address for uint160 types * removed unnecessary folder and files. * transaction/smartcontract logic * bumped version 0.24.0
31 lines
566 B
Go
31 lines
566 B
Go
package util
|
|
|
|
import (
|
|
"bytes"
|
|
"strconv"
|
|
)
|
|
|
|
// Fixed8 represents a fixed-point number with precision 10^-8.
|
|
type Fixed8 int64
|
|
|
|
// String implements the Stringer interface.
|
|
func (f Fixed8) String() string {
|
|
buf := new(bytes.Buffer)
|
|
val := int64(f)
|
|
if val < 0 {
|
|
buf.WriteRune('-')
|
|
val = -val
|
|
}
|
|
str := strconv.FormatInt(val/100000000, 10)
|
|
buf.WriteString(str)
|
|
val %= 100000000
|
|
if val > 0 {
|
|
buf.WriteRune('.')
|
|
str = strconv.FormatInt(val, 10)
|
|
for i := len(str); i < 8; i++ {
|
|
buf.WriteRune('0')
|
|
}
|
|
buf.WriteString(str)
|
|
}
|
|
return buf.String()
|
|
}
|