when I try to run the pickWinner function of my lottery contract, I get such an error. With getPlayers, I can add players and query with players. The address of the manager is visible, but I cannot run the pickWinner function by selecting the address of the manager. What could be the reason?
I did try different values but i did not find solution
You need to post the code so we can figure out the answer, but I can see your pickWinner function has a restricted modifier. If the modifier is preventing the transaction from executing, then the client (remix, metamask, etc) won't be able to estimate the gas.
Related
I am trying to deploy this contract
https://github.com/juustesout/EtherRanger/blob/main/EtherRanger.sol
to BSC Testnet, and I get this error in return :
"revert
The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
Debug the transaction to get more information. "
this is an example of a failed transaction on BSC Testnet
https://testnet.bscscan.com/tx/0x5cbe0adcf6a522d89c974cadf70358dd9d79476988b4fb829fc1cc86c88aff0c
I tried forking multiple contracts from BSC, working tokens, but I always get the same error. I tried adding 'payable' to the constructor function, as other StackOverflow posts suggest, but no go. I have been reading any number of posts through Google Search, but I am getting nowhere.
The contracts compile flawless, no errors, no warnings, but they just won't deploy.
Could someone check if they can deploy this contract on BSC Testnet ? It may be a setting on my Remix or something, I am at a loss, I cannot tell where the error comes from.
I don’t know anything about this contract but I guess the hardcoded addresses for the IBEP20 and others are the problem. You need to deploy these contracts too and then pass their addresses to the interface addresses in your constructor.
But to connect to the BSC test network, you need to find the drop-down menu with a list of networks at the top of the MetaMask
https://domhtml.ru/en/sozdanie-sobstvennyh-tokenov-standarta-bep-20-v-seti-binance-smart-chain-bsc-pri-pomoshhi-remix-ide/
playing aroung with payable following a course tutorial, it's working fine for the instructor but me for me it's throwing away an error. I'm trying to execute a function to send ether to the actual deployed contract.
You should first convert to address and then to payable
payable(address(this)).transfer(msg.value);
also this code doesn't have much sense since you are transferring to the contract the same ether amount the contract is already receiving, you can just leave the function in blank if you only want to receive the ether or use some receive function
After I have deployed a contract, I'm able to interact with the setter functions, as well as with the getter functions. However, after a day goes by, when i try to interact with the same contract again, that is still open and loaded on my remix I get a "pending" message when I try to set and change some variables like a different address. When I try to call a get function also nothing happens. I don't know how to interact with my deployed contract again.
When I reload the contract using the contract address "at address", it properly loads the contract if I select the right smart contract (containing the getter and setter functions) from the dropdown menu in the "deploy and run" page. However, the same problem occurs, that is: when i try to set a variable the transaction is not mined (pending indefinetly), and the call functions also dont read the data.
In order for me to move forward with my project I need to be able to access and interact with the contract if I need to change a variable which currently doesn't work...
Anyone has an idea how to solve this (probably trivial) problem? Thanks!
I am studying how to make BEP-20 tokens. For this I copied the following contract in remix to be able to study it:
Contract in BscScan
If I copy the whole file and compile it in Remix, when I deploy it it doesn't show me any getters. No public view function appears. If I look at the contract displayed on the testnet, it doesn't have any supply of tokens either.
I separated the files and libraries for a better reading. And it is then, when I try to display it, that I get the following error:
VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.
It gives me the feeling that this contract does not generate the tokens ... What am I wrong?
I managed to fix the problem. As I suspected, in order to deploy the contract I have to remove everything related to uniswap and cakeswap. This displays the contract correctly.
If you wanted to deploy the contract with the uniswap interfaces in injected web3, you would need the uniswap testnet.
I found a test address for cake here:
Binance Smart change tesnet
I have one contract with method name as getValues().From Dapp I am invoking contract method as 'contractCAt.getValues.call(function(error,result){...})' this works fine and by using 'contractCAt.getValues(function(error,result){...})' this syntax also works fine.I didn't get any difference between those two ways to invoke contract method.So could anyone help me to give idea about those syntax.
See the web3j documentation:
contractCAt.getValues.call() is run locally and will not alter the state of your contract on the blockchain. Does not consume any ether.
contractCAt.getValues.sendTransaction() does alter the state (assuming the transaction is successfully mined).
contractCAt.getValues() automatically delegates to one of the two above based on the method definition. Constant and pure functions will use call() while the rest will use sendTransaction().