Open lwazidp opened 2 years ago
My requests are working perfectly but I'm receiving some strange values back.
First of all the function should return a uint256 but i receive an array and second the values are incorrect.
My code:
$web3 = new Web3(new HttpProvider(new HttpRequestManager($provider, 1))); $abi = '[{"inputs":[],"name":"getTotalDividendsDistributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]'; $contract = new Contract($web3->provider, $abi); $contract->at($address)->call("getTotalDividendsDistributed", function ($err, $total) { if ($err !== null) { dd($err); } else { dd($total); } });
Returned value:
{ "value":[ 850193091, 1882330983 ], "is_negative":false, "precision":-1, "bitmask":false, "hex":null }
But checking on Bscscan the value should be: 4042275006966459075
4042275006966459075
Anyone able to explain what's going on?
That's BigInteger from phpseclib, try $total->toString().
$total->toString()
https://github.com/phpseclib/phpseclib/blob/master/phpseclib/Math/BigInteger.php
My requests are working perfectly but I'm receiving some strange values back.
First of all the function should return a uint256 but i receive an array and second the values are incorrect.
My code:
Returned value:
But checking on Bscscan the value should be:
4042275006966459075
Anyone able to explain what's going on?