Hot answers tagged

1

There is event accountsChanged provided by latest MetaMask version and you can use it like this: if(window.ethereum) { window.ethereum.on('accountsChanged', function () { web3.eth.getAccounts(function(error, accounts) { document.getElementById('account-address').innerHTML = accounts; }); }); }


1

A @Chan-Ho says, there is a transferFrom() in the buy function, and you said you didn't approve() first, so that is the first problem. This looks like the Token contract - AGI: erc20 = TOKEN(address(0x8eb24319393716668d768dcec29356ae9cffe285)); You have to call the approve() function there to "authorize" the snet contract to pull some tokens from your ...


1

Your test uses a beforeEach() to set up new, blank contract to play with. That's an agreeable thing so no test is dependent on any other. The function uses a modulo to pick a row and then forges ahead to work, but if there are players, because enter() wasn't called first, then the modulo will be zero and it will try to access row 0 in players and that ...


1

No no no. The accepted answer above is incorrect, and the fact that you've accepted it means that not many users will even read your question (let alone try to answer it). The integer value of 1000000000000000000 is indeed larger than Number.MAX_SAFE_INTEGER, and you should therefore use "1000000000000000000" or "1e18". But that's not what the error ...


Only top voted, non community-wiki answers of a minimum length are eligible