wallet tron transactions
This commit is contained in:
@ -6,6 +6,8 @@ class Math
|
||||
const SCALE = 8;
|
||||
const SCALE_4 = 4;
|
||||
const SCALE_6= 6;
|
||||
const SCALE_8= 8;
|
||||
const DECIMAL_6= 6;
|
||||
static function bcMul($a1,$a2,$scale = self::SCALE): string
|
||||
{
|
||||
return bcmul($a1,$a2,$scale);
|
||||
@ -26,6 +28,17 @@ class Math
|
||||
return bccomp($a1,$a2,$scale);
|
||||
}
|
||||
|
||||
static function valueToAmount($amount,$decimal = self::DECIMAL_6,$scale = self::SCALE_8): string
|
||||
{
|
||||
return (float) bcdiv((string)$amount, '1e'.$decimal, $scale);
|
||||
}
|
||||
|
||||
static function amountToValue($amount,$decimal = self::DECIMAL_6): string
|
||||
{
|
||||
return (float) bcmul((string)$amount, '1e'.$decimal,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user