Questions tagged [remix]

Questions about Remix, an online browser compiler for Solidity, formerly called Browser Solidity.

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

Hardhat console.log doesn't work in VSCode Remix extension

I installed the VSCode Remix Extension and I compiled(successfully) and deployed this contract: // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.6; // tried also with the commented line ...
0
votes
0answers
2 views

Minting NFT using Lazy Minting Method

I am trying to mint NFT using lazy mint method. I am using remix IDE to write contract using solidity. For the front end I'm using react and web3js. I wanted to know if it's possible to implement lazy ...
0
votes
1answer
13 views

Recovering a deployed contract after my computer restarted

I am new to writing contracts so I appreciate any help you can give. I wrote a contract with Remix and then deployed it on the Rinkeby network. I have received a contract address so I know the ...
0
votes
0answers
15 views

looking for some help understanding Solidity interfaces

I have been struggling for a few days now with the solidity interface, have seen 3 ways of implementing it, tried 2 until now and I'm always getting this error message. 1st example: 2nd example: The ...
0
votes
1answer
6 views

DeclarationError : Only constant variables are allowed at file level

i just start learning the solidity and smart contract and i got this error DeclarationError : Only constant variables are allowed at file level this is my code : // SPDX-License-Identifier: MIT ...
0
votes
1answer
11 views

ParserError: Expected ',' but got '}'

I saw similar questions, but my problem is not matching any of those answered questions. I've written a function in a library that also includes in-assembly code but getting an unexpected parser error....
0
votes
0answers
10 views

How to Restrict Withdraw From Solidity Contract

I have a contract that instantiates a different contract - called Project contract. I made it so that I can deposit ETH into the Project contract and also withdraw its balance through functions of the ...
0
votes
1answer
9 views

Javascript testing vs remix

So what would be the benefit of testing the smart contracts using javascript with truffle instead of remix? I just feel is really tedious. I'm guessing there is a reason, but I don't see it, so should ...
0
votes
0answers
22 views

What is the best way to handle ERC20 token payments internally in the another contract?

I'm trying to handle ERC20 token payments, using the instance of the deployed ERC20 smart contract in another smart contract, but getting the following error: contract SimpleSmartContract function ...
0
votes
0answers
31 views

Correct way of randomly selecting token Ids from already minted NFT's

I have an NFT project with 1000 NFTs. As part of my project, users who hold an NFT will be entered into a lottery. The function I want to implement is the following: Select x number of users to ...
0
votes
0answers
39 views

Trying to make our own token: Can not verify contract (can not match byte code) on etherscan.io (mainnet)

We are trying to verify our smart contract code on mainnet to make a token but are unable to do so. We followed this tutorial, although we are using an older version of the code: https://medium.com/...
0
votes
0answers
43 views

Trouble with a lottery contract

The task was to make lottery smart contract where: Entry fee: 25000000000000000 Duration: Every 10 Minutes 50% Winners and 50% Losers Winner Gets 1.8X Losers gets 0X I have come up with the ...
0
votes
0answers
13 views

What to pass for abi encoded arguments

I had cloned usdc contract on polygon test network and deployed it. I want to test deposit method but couldn't able to figure what to pass in depositData( more specifically in which format should i ...
1
vote
1answer
32 views

How to pass array of addresses while testing the contract

I've written a contract... contract TimeLock is TimelockController { uint256 minDelay = block.timestamp + 4 minutes; constructor( address[] memory proposers, address[] ...
0
votes
1answer
21 views

Using payable functions in the remix ide

I created a simple solidity contract in the remix ide. I cannot figure out how to test the payable functions I created. here is an example of a payable function: function pay() payable { } here is a ...
0
votes
1answer
25 views

Recreating a re-entrancy attack but transaction failed/reverted, why?

I tried creating 2 contracts (Victim.sol and Attack.sol) in Remix, to recreate a re-entrancy attack, in particular the recursive function calling. Victim.sol is the contract to be siphoned, I ...
1
vote
1answer
21 views

Unable to withdraw/transfer funds from contract (using Remix)

I wanted to create a contract where wallets can deposit and withdraw funds, to test the re-entrancy attack. However, on deploying this contract in Remix VM (London), I'm unable to withdraw using the ...
0
votes
1answer
34 views

how to write a contract to set a reward for players and they claim the reward?

I want to create a contract to give the players rewards and they claim their rewards. It seems everything is ok! // SPDX-License-Identifier: MIT pragma solidity ^0.8; import "@openzeppelin/...
0
votes
1answer
12 views

Ownable function call from another function

I have two ownable functions (I'm using openzeppelin), when I invoke the second function from the first one, I get: "Ownable: caller is not the owner". function first() external view ...
0
votes
0answers
8 views

Remix price token implementation error

Please help me with the implementation of this contract. Blockquote// //AggregatorV3Interface internal priceFeed; /** * Network: Kovan * Aggregator: ETH/USD * Address: ...
0
votes
0answers
6 views

| ^ (Relevant source part starts here and spans across multiple lines). this error had occured while complining how to correct it help me out [duplicate]

// SPDX-License-Identifier: GPL-3.0 pragma solidity>= 0.5.0 < 0.9.0; contract Identity { string name; uint age; constructor() public { name = "Prem"; age =24; } function getName() view ...
0
votes
2answers
14 views

View function throws an error with block.number

Looking at https://docs.soliditylang.org/en/v0.8.11/contracts.html#view-functions I understood the solidity view function can work with any function unless it mutate states, emit events or perform any ...
1
vote
1answer
23 views

Forwarding Ether from one contract to another

I am currently try to write two smart contracts. Here is the first one: // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract Token { mapping(address => uint) ...
0
votes
1answer
15 views

How to return mapping type in solidity?

I wrote a function that returns mapping type which contains all the tokenID and owner of the tokenID. But I get the following error when compiling. error: TypeError: Data location must be "memory&...
0
votes
1answer
22 views

Error while returning mappings in solidity

How can I return a list of mapping for a specific data? My purpose is to be able to view all the created offers to the users specifically by searching. Here is the code I wrote: contract MyContract { ...
0
votes
0answers
13 views

how can i fix these loop warnings and gas fee warnings. the code is compiled fine just want to update these warnings before launch

Here's the contract code to the token "alex". Below are the warnings from remix. Thanks for any assistance // SPDX-License-Identifier: MIT pragma solidity 0.8.4; contract alex { ...
1
vote
2answers
76 views

Expected Identifier but got '='

Trying to add a struct object to a mapping, however the compiler gives error that expected identifier. Here is my code snippet contract Structs { struct User { string name; ...
0
votes
0answers
49 views

Remix IDE not connecting to Ganache Web3 Provider

I'm trying to deploy my smart contract to Ganache (perferably the Ganache desktop app but this issue is also occurring for ganache-cli). When I select "Web3 Provider" under the "...
1
vote
2answers
60 views

Deploying a simple contract to ETH Mainnet (from remix) costing $500? Am I doing this wrong?

I have a simple contract that I've tested on my ganache network, and now I'd like to push it to the mainnet. So I funded my Metamask with around $100 or 0.025 eth, figured that would be enough to ...
0
votes
2answers
24 views

Solidity fund transfer is redirecting to another address

I am trying to send funds in solidity using the below code / SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract SendEther { function sendAmount() payable public {...
0
votes
0answers
7 views

How to see bytes in bytecode to estime gas cost of deployment

Pretty much title, trying to estimate my gas cost. I know each byte costs 200 gas. When I compile on Remix I see this object property. Is counting the number of characters in that an accurate measure? ...
0
votes
0answers
27 views

Error: Returned error: VM Exception while processing transaction: revert Transaction failed -- Reason given: Transaction failed

I am following a youtube tutorial for coding a smart contract for a MultiSigWallet. The code is working fine in Remix. All the functions, submitTransaction, confirmTransaction and executetTransaction ...
0
votes
1answer
22 views

Is the smart contract receiving funds or is it the address?

//SPDX-License-Identifier: MIT pragma solidity 0.6.12; contract ExceptionExample { mapping(address => uint) public balanceReceived; function receiveMoney() public payable { ...
0
votes
1answer
21 views

Have been having this error, ParserError: Expected ';' but got '}'

// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract will { address owner; uint fortune; bool deceased; constructor() payable public { owner = ...
0
votes
0answers
20 views

solidity ^0.8.0 - receiving payment failed at require(msg.value == ___ ether)

ide: remix injected web3 on ropsten network, issue: I'm new to solidity and reverse engineering a little 3 year old project while learning the breaking change from 0.4+ to 0.8.0 I'm not sure what I'm ...
1
vote
2answers
79 views

Message call to another contract with argument not working

Here I am trying to call contract A's callMe function from contract B using the low level function, call (bool success, )=_b.call(abi.encodeWithSignature("callMe(uint)",val)); But when I do ...
0
votes
0answers
28 views

why does my contract say honeypot?

https://bscscan.com/address/0x4451f5016724867fd00438eb30d5b2f23d3d69bd This is my code source. TokenSniffer does not pick it up and staysafu says its a honeypot, the token is tradeable
0
votes
1answer
29 views

Sending eth to deployed contract between 2 metamask wallets

pragma solidity >=0.7.0 <0.9.0; contract StructMapping { mapping(address => uint) public balanceReceived; function getBalance() public view returns(uint) { return address(...
0
votes
1answer
20 views

Understanding revert with array of contracts

I have the following solidity file: // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; error MustBeOwner(); error BookDoesNotExist(); // book contract contract Book { ...
0
votes
1answer
29 views

Which address is paying the gas fee? And, can the smart contract pay the gas fee by itself?

pragma solidity ^0.8.1; contract SendMoney{ uint public publicBalance; uint public lockedUntil; function receiveMoney() public payable{ publicBalance += msg.value; ...
0
votes
1answer
26 views

How to add separative commas every 3 digits in solidity to an input integer?

Is there a way to add separative commas to large input numbers? let's say the input was 1000, I want the output for this function to be a casted string that has this format "1,000". Note: I'...
0
votes
1answer
21 views

Chain link Aggregator v3 Interface error?

Hello! I am following a tutorial that implements Chain Link's Aggregator V3 Interface, but it seems the code is not interacting properly with its import. Attempting to deploy on Remix brings up the ...
0
votes
1answer
18 views

Contract address balance function returns BN in truffle but actual balance in remix

I am very new to solidity, contracts, and truffle, and I ran across a disconnect between the results of calling the getBalance() function of this basic contract: contract TruffleTutorial { address ...
0
votes
0answers
10 views

Remix - Parser Error on pragma 8.11

I am using the newest version of pragma. 8.11 creating a contract for a token. I am getting a parser error at the bottom line stating expected pragma import directive. Can anyone help I feel like i ...
0
votes
1answer
34 views

Contract charging fees only on sell

The contract below charges fees only on the sale of the token. Nothing is charged on purchase. I can't find which part of the code this is in and how to change it Initially I imagined that there was a ...
0
votes
0answers
14 views

Why ISN'T my GUI interacting with my smart contract?

I successfully deployed an Ethereum smart contract within the Web3 Provider environment, and I am able to successfully interact with the various functions only via the Remix IDE. Find below my ...
0
votes
0answers
15 views

HELP! Accidently Deleted Remix Work Space

I accidently deleted a workspace in remix and cannot figure out how to get it back! my token launches in two weeks!
0
votes
1answer
25 views

What is the meaning of this arguments in this curly brackets

Pls how do i interprete this argument in this curly brackets marked in red. I'm a beginner in solidity programming and I am have a hard time interpreting this arguments and what does the arguments ...
0
votes
0answers
17 views

Solidity error basic programme

I am not able to find the error to this problem Can anyone please help me with it It is showing that hasDeceased function is having some error... Not able to access the function ...
0
votes
1answer
16 views

How do I pay functions in remix?

I am making an NFT vending machine. Here's the code: // SPDX-License-Identifier: MIT pragma solidity ^ 0.8.10; contract VendingMachine { address payable internal vendingAdmin; struct item { ...

1
2 3 4 5
50