wallet tron transactions

This commit is contained in:
cano
2024-03-25 06:15:36 +08:00
parent 4b8f205e86
commit 489090382f
83 changed files with 5424 additions and 1343 deletions

View File

@ -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);
}
}