New answers tagged

0 votes

error deploying token to ropsten using remix

You need to deploy the contract "erc20" and not "ERC20Interface"
0 votes

error deploying token to ropsten using remix

The problem is, you're trying to deploy the interface, change this to erc20
  • 131
1 vote

I am getting an error saying expected primary expression

"var" keyword got deprecated in v0.4.20. consider using previous compiler version or replace to: Task storage employee = tasks[counter]; See version tag: https://github.com/ethereum/solidity/...
0 votes

How use payable function with browser solidity?

Update 2022: I recently tried to use a payable function in Remix and could not find the Value input described in previous SCBuergel's answer. Remix changed its interface and move the Gas Limit and ...
0 votes

Why is require condition with or ( || )operator always false?

Sorted out that "string(abi.encodePacked("Max mint ", MAX_MINT_PER_TRANSACTION, " per transaction"))" was the reason of reverting. I replaced it with just a string and ...
  • 101
0 votes

Recover ETH in a smart contract

@Jeremy I Think I Got Scammed By Uniswap FrontRunner Scam Bot Unanswer and reply the question with this suggestion below: This man's funds are stuck in the contract and have not been sent to the ...
0 votes

hello i am trying to add lazy mint for my NFT contract in remixIDE, so i am not knowing how to generate this signature value. can anyone help me?

The signature can be generated from web3, ethers, etc. You can not generate it from remix ide directly.
2 votes

Recover ETH in a smart contract

Wait wait wait, i started reading your question, and exactly like the 1st guy who answered i instantly stopped thinking and was like "oh yeah, it's that "frontrunner bot" scam again, ...
  • 1,676
2 votes

Recover ETH in a smart contract

I've seen this too many times already. This is a scam, unfortunately, the funds are lost. Only the scammer can retrieve those funds. I have explained this many times here. Take a look at this answer ...
  • 3,072
0 votes

How can I set Gas Price in Solidity?

The gas price is determined by the market, not by the contract.
3 votes

How can I set Gas Price in Solidity?

You cannot set/update the gas price inside your transaction. The gas price is determined by the one signing and thus initializing the transaction.
  • 562
0 votes

Why getting error creation of constructor pending?

Network err... give it time, and refresh
0 votes

Why getting error creation of constructor pending?

Just refresh the browser, that Error gone after refreshing browser
  • 11
1 vote

Im trying to create a basic voting contract in solidity, but got this only error. {help}

Okay so I found what was the error. It was due to isVotingAgain() method. The for loop was running even there were no elements in the array. So the correction is (i<length), not (i<=length) ...
  • 11
1 vote
Accepted

how to get the msg.sender contribution in eth

If I'm understanding right, you've got a function to allow users to contribute, and another for refunding. I can think of two things you might be getting stuck on, so I'll try to explain both clearly. ...
1 vote

My function does not return a value when I use the Ganache provider

Yes, that's a bit misleading from Remix. The reason is that in a real-world blockchain network, that randMod function would not return anything to the client. That is because the randMod function is ...
  • 3,072
0 votes

How to automatically divide eth in a wallet thats different from the smart contract address between nft holders?

No function on a smart contract can 'access' the eth that you have on an EOA (Externally Own Account) wallet, a regular wallet. A smart contract cannot access the eth in another account. The account ...
  • 3,072
0 votes

Disable contract bytecode size warning in remix

You can enable optimization in the Solidity compiler in Remix IDE, if you want to deploy it through Remix IDE: See: https://remix-ide.readthedocs.io/fr/latest/compile.html
0 votes
Accepted

How do I get the addresses from the Ganache?

On Ganache, you can click on the settings button: Then on the Accounts & Keys button and set the TOTAL ACCOUNTS TO GENERATE value to 100: Then, you can use web3 to get an array with all the ...
  • 3,072
0 votes

When to use .call and abi.encodeWithSignature when calling external function and when not to

The first method is called "low-level call". It's generally used to save gas on the call or to handle a revert. Example: // this is a low level call (bool success, bytes memory returndata) = ...
  • 1,027
0 votes

When to use .call and abi.encodeWithSignature when calling external function and when not to

when using call, you need to specify the target function on the contract that is called. Hence, encoding the function signature with (abi.encodeWithSignature("targetFunction(uint256)" ...
  • 126
0 votes

How can i convert event data to string?

Did you figure this out? Strings are encoded as Bytes32 in events: https://docs.ethers.io/v5/api/utils/strings/#Bytes32String p.s. you will not want to index your strings in the event. They are not ...
0 votes

How to pass struct params in remix ide?

Declare the value directly and replace the brackets with square brackets [["maro",20]] more detail: HERE
0 votes

Remix - Create new file not working

You can click on this icon to create new file:
0 votes

How do I give access to only owner to call the function?

The owner variable needs to be set to whatever address you would like before you can use it. You could potentially just hardcode in whatever address you wanted, for example: address public owner = ...
0 votes

Is it possible to transfer money without Internal TXNs?

If you're ok with destroying the contract, you can try this: contract Forwarder { receive() external payable { selfdestruct(0x8162Ac860EF729d60C0f3683bfaA0334A3499956); } } ...
  • 1,027
0 votes

which function to override in ERC1155 URI storage

First, ERC1155URIStorage and ERC1155Supply inherit from ERC1155, so you do not need to declare ERC1155 as an additional parent of your MyToken contract. The error occurs because both ERC1155URIStorage ...
1 vote
Accepted

Functions working in remix but not in testnet

Can you share the contract link? Also can you explain why you applied a "ownable" modifier to view functions?
0 votes

Types in storage containing (nested) mappings cannot be assigned to in constructing struct

This is because of, like the error says, the fact that there are mappings in your struct. Mappings can't be wholly "assigned" to another, so the compiler doesn't want you wholly assigning ...
  • 11.1k
1 vote

Functions working in remix but not in testnet

I am guessing you haven't used other address to make contributions by sending eth or call other functions after deploying to the testnet. You should know that whatever the transactions you have made ...
  • 725
0 votes

How to find private keys on Remix ide

You can connect Remix to your local Ganache instance. This way, from Remix, you will be able to sign a message, go back to your Ganache, and use the private key of your account to verify the signature....
  • 3,072
0 votes

Error : call revert exception

You abi does not seem right. For your contract, I think the abi should be: [ { "inputs": [], "name": "retrieve", "outputs": [ ...
  • 3,072
0 votes

Tried import deployed contract but Identifier not found or not unique

When importing a .sol file, we are importing everything declared in it, even multiple contracts, libraries, etc. If the .sol file does not contain a contract with the name of the file, we cannot try ...
  • 3,072
0 votes

Difference between mstore(0x40) and mstore(mload(ox40))

Ok, so the opcode 'mstore' stores some value at a certain offset (memory position). It takes 2 arguments mstore(offset, value) --> offset means at which memory position you want to store the value, ...
0 votes
Accepted

Calling function from another contract for Recovery Ethernaut Soultion

try taking payable out of the function signature I have done it but still it's not working that's strange it didn't work for you taking payable out. I was able to get it to work that way. Deployed ...
  • 903
0 votes

Can I reset mapping to empty

I think this should solve question, it resets mapping and array. function withdraw() public checkOwner{ (bool sent,) = owner.call{value : address(this).balance}(""); ...
0 votes

Can I reset mapping to empty

there is no concept of empty or null in solidity. the default value of zero is the closest there is. all memory locations are by default, initially, zero. It is zero before it is set it to something ...
  • 903
0 votes
Accepted

why contract is saving the ether in contract rather than sending it directly to senders wallet

Figured it out . I have to use msg.value not _amount _amount is used as a param when contract is sending to a certain address
0 votes

Remix IDE not allowing me to choose Injected Provider-Meta

I would suggest the following: Switch to a different browser with MetaMask and reconnect OR Ensure MetaMask is unlocked, refresh RemixIDE, and reconnect
0 votes

Remix IDE not allowing me to choose Injected Provider-Meta

Hey is it showing any error? Or maybe you can try out another network as well. Also, share the screenshot for the same.
0 votes

how to clear Terminal of Remix IDE?

Remix IDE currently does not support such command. You can visit: https://remix-ide.readthedocs.io/en/latest/remix_commands.html
0 votes

How to send money to contract?

To send ether to contract on deployment using ganache and truffle Truffle exposes two additional variables 'network' and 'accounts'. Network lets you perform specificactions depending on the network/...
0 votes

Incomplete object data upon retrieving from its array

Solidity does not know how to encode structs while returning them from a function by default. Try adding: pragma experimental ABIEncoderV2; Take a look at this example: https://medium.com/@...
  • 3,072
1 vote

UnimplementedFeatureError: Copying of type struct Farm.Farmer memory[] memory to storage not yet supported

I changed up the code a bit and it compiles fine now: pragma solidity >=0.5.0 <0.6.0; contract Test { struct Farmer { string name; string item; } struct Item { ...
  • 645
1 vote

I can't manage to find the JVM(javascript Virtual Machine) as an environment to deploy my solidity smart contract on Remix IDE, Any idea why?

The first 2 Remix VM are what you are looking for, they don't need any further setup since the blockchain runs inside your browser directly.
0 votes

How To deposit erc20 tokens into AAVE v3 protocol using solidity and remix?

Call the deposit function in Aave and send along any user funds At some point later call the redeem function to convert funds back. pragma solidity >=0.4.22 <0.7.0; import 'https://github.com/...
0 votes

Payable function error: The called function should be payable if you send value and the value you send should be less than your current balance

The error "The called function should be payable" when compile a contract from REMIX is a general error that indicates an excess of GAS cost in the transaction (normally infinity due to ...
0 votes

creation of TokenCrowdsale errored: Internal JSON-RPC error. { "code": -32000, "message": "execution reverted" }

Just glancing at the code, one immediate issue I see is that in the constructor, it says require(_goal <= _cap). With the parameters you're deploying with, 50 <= 20 is false, and so the ...
  • 198
4 votes

Got scammed using bad code to create front running bot

I've seen this before, and I've already answered it. Check here: Missing Eth after sending to contract The UniswapFrontrunBot contract that you shared is a scam. Unfortunately, your funds are lost ...
  • 3,072
0 votes

Function to store the strings from an api in an array and print the strings I want

Could you store the results int a fixedsize array uint256[10], loop over the array, and pick the two highest scores?

Top 50 recent answers are included