Fix wrong $argsLen in contract.
This commit is contained in:
sc0Vu 2019-02-24 16:57:26 +08:00
parent 13f6d3338d
commit 4779c7e710
No known key found for this signature in database
GPG Key ID: A53323E7065B1FA7
2 changed files with 14 additions and 3 deletions

View File

@ -504,7 +504,7 @@ class Contract
if ($argsLen !== count($function['inputs'])) {
continue;
} else {
$paramsLen = $argsLen - 1;
$paramsLen = $argsLen;
}
}
try {
@ -599,7 +599,7 @@ class Contract
if ($argsLen !== count($function['inputs'])) {
continue;
} else {
$paramsLen = $argsLen - 1;
$paramsLen = $argsLen;
}
}
try {
@ -718,7 +718,7 @@ class Contract
if ($argsLen !== count($function['inputs'])) {
continue;
} else {
$paramsLen = $argsLen - 1;
$paramsLen = $argsLen;
}
}
try {

View File

@ -631,6 +631,17 @@ class ContractTest extends TestCase
$this->assertTrue($result !== null);
}
});
// test issue 143
$contract->at($this->contractAddress)->call('balanceOf', $fromAccount, function ($err, $result) use ($contract) {
if ($err !== null) {
return $this->fail($err->getMessage());
}
if (isset($result)) {
// $bn = Utils::toBn($result);
// $this->assertEquals($bn->toString(), '10000', 'Balance should be 10000.');
$this->assertTrue($result !== null);
}
});
}
/**