hey guys, could you help me please? trying to use function from web3, getting an error: “.sendTransaction is not a function”. But I haven’t any arguments in my function 🙂
return StakingInstance.stake().sendTransaction({ from: account, gas: 300000, value: amount }, function(err, res){});
return StakingInstance.stake({ from: account, gas: 300000, value: amount }, function(err, res){}); - error ‘Invalid number of arguments to Solidity function’
Contract - function stake() external payable {…}
Dec 4, 2020, 12:31 PM
I need to use payable function from web3 -_-
guys I’ve stucked for two days 🙁 help me please
Dec 4, 2020, 12:47 PM
try to use .send() instead of .sendTransaction()
Dec 4, 2020, 12:48 PM
@Pauliax tried, not working (
if i run StakingInstance.stake() it’s working
but i need to send eth. the fucntion is payable
Dec 4, 2020, 12:49 PM
return StakingInstance.stake({ from: account, gas: 300000, value: amount })...
have you tried this?
Dec 4, 2020, 12:50 PM
yes, not woring
‘Invalid number of arguments to Solidity function’
Dec 4, 2020, 12:50 PM
what web3 version do you use? maybe you can try to upgrade
Dec 4, 2020, 12:51 PM
Try removing that gas and let metamask auto estimate
Dec 4, 2020, 12:52 PM
app.js:79 Invalid number of arguments to Solidity function
thanks, i will try. I don’t know, i’m working with TutorialToken from truffle boxes 🙂 there was web3.min.js file...
i’m working with contract using this code
is it ok?
$.getJSON(‘Token.json’, function (data) {
var Artifacts = data;
App.contracts.Token = TruffleContract(Artifacts);
// Set the provider for our contract.
App.contracts.Token.setProvider(App.web3Provider);
return App.getBalances();
});
is it ok?
$.getJSON(‘Token.json’, function (data) {
var Artifacts = data;
App.contracts.Token = TruffleContract(Artifacts);
// Set the provider for our contract.
App.contracts.Token.setProvider(App.web3Provider);
return App.getBalances();
});
Dec 4, 2020, 1:01 PM
require(balances[msg.sender] - _value >= locker[msg.sender]);
seems like a vulnerability
you should use a safemath here
Dec 4, 2020, 2:54 PM
Damn, would've sucked to use that contract in production lol
Can mint unlimited tokens with 1 call 🤷
Why are people not just using OpenZepplin for ERC20, especially beginners
Dec 4, 2020, 3:05 PM
tbh I didn't look through the whole code, don't have time for this now. just went through it for 1-2 mins and found this. so fixing this issue does not mean there are no more lurking.
Dec 4, 2020, 3:10 PM
Yeah I mean if there is such a huge mistake that went unnoticed by the devs I would bet there are more left
Dec 4, 2020, 3:12 PM