问题
Getting BigNumber Error .. tried almost everything
This is the web3js function call
creditPoints: function() {
var self = this;
alert("Credit Coins");
this.setStatus("Initiating transaction... (please wait)");
var meta;
MetaCoin.deployed().then(function(instance) {
meta = instance;
//alert("credit Points");
alert(account);
return meta.creditCoin( account, {from: account,gas: 300000});
}).then(function() {
console.log("Transaction complete");
self.setStatus("Transaction complete!");
// self.refreshBalance();
}).catch(function(e) {
console.log(e);
self.setStatus("Error sending coin; see log.");
});
},
This is the contract function in solidity
function creditCoin(address receiver) returns(bool sufficient) {
uint amount;
amount=100;
if (balances[0xE208914454c16c7a2CD561071519bea9207Dda59] < amount) return false;
balances[0xE208914454c16c7a2CD561071519bea9207Dda59] -= amount;
balances[receiver] += amount;
Transfer(0xE208914454c16c7a2CD561071519bea9207Dda59, receiver, amount);
return true;
}
I am getting the BigNumber error when calling the above function
Error: new BigNumber() not a number: [object Object]
at raise (app.js:17546)
at app.js:17534
at new BigNumber (app.js:16561)
at new BigNumber (app.js:16571)
at toBigNumber (app.js:2719)
at Object.toTwosComplement (app.js:2730)
at SolidityTypeUInt.formatInputInt [as _inputFormatter] (app.js:3888)
at SolidityTypeUInt.SolidityType.encode (app.js:5111)
at app.js:21124
at Array.map (<anonymous>)
来源:https://stackoverflow.com/questions/47906398/error-new-bignumber-not-a-number-object-object